hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
98 values
lang
stringclasses
21 values
max_stars_repo_path
stringlengths
3
945
max_stars_repo_name
stringlengths
4
118
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
368k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
945
max_issues_repo_name
stringlengths
4
118
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
945
max_forks_repo_name
stringlengths
4
135
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
1.05M
avg_line_length
float64
1
1.03M
max_line_length
int64
2
1.03M
alphanum_fraction
float64
0
1
2f5e5b82f3fb01dfd47bc81f619525f4f9f21e9e
181
cs
C#
KnightsOfCSharpia/KnnightsOfCSharpiaLib/Items/ItemType.cs
webdude21/Caipirinha
0742b4ce3b6f6df324ca9680743cd5a20f1baa15
[ "Unlicense" ]
1
2016-10-19T18:04:35.000Z
2016-10-19T18:04:35.000Z
KnightsOfCSharpia/KnnightsOfCSharpiaLib/Items/ItemType.cs
webdude21/Caipirinha
0742b4ce3b6f6df324ca9680743cd5a20f1baa15
[ "Unlicense" ]
null
null
null
KnightsOfCSharpia/KnnightsOfCSharpiaLib/Items/ItemType.cs
webdude21/Caipirinha
0742b4ce3b6f6df324ca9680743cd5a20f1baa15
[ "Unlicense" ]
null
null
null
namespace KnightsOfCSharpiaLib.Items { public enum ItemType { Weapon, Arms, Chest, Head, Shield, Belt, Feet, } }
13.923077
37
0.469613
60e1f9517792164bca976aec8c84a403fd644313
8,498
cc
C++
Code/Components/CP/simager/current/distributedimager/CubeBuilder.cc
rtobar/askapsoft
6bae06071d7d24f41abe3f2b7f9ee06cb0a9445e
[ "BSL-1.0", "Apache-2.0", "OpenSSL" ]
1
2020-06-18T08:37:43.000Z
2020-06-18T08:37:43.000Z
Code/Components/CP/simager/current/distributedimager/CubeBuilder.cc
ATNF/askapsoft
d839c052d5c62ad8a511e58cd4b6548491a6006f
[ "BSL-1.0", "Apache-2.0", "OpenSSL" ]
null
null
null
Code/Components/CP/simager/current/distributedimager/CubeBuilder.cc
ATNF/askapsoft
d839c052d5c62ad8a511e58cd4b6548491a6006f
[ "BSL-1.0", "Apache-2.0", "OpenSSL" ]
null
null
null
/// @file CubeBuilder.cc /// /// @copyright (c) 2013 CSIRO /// Australia Telescope National Facility (ATNF) /// Commonwealth Scientific and Industrial Research Organisation (CSIRO) /// PO Box 76, Epping NSW 1710, Australia /// atnf-enquiries@csiro.au /// /// This file is part of the ASKAP software distribution. /// /// The ASKAP software distribution is free software: you can redistribute it /// and/or modify it under the terms of the GNU General Public License as /// published by the Free Software Foundation; either version 2 of the License, /// or (at your option) any later version. /// /// This program is distributed in the hope that it will be useful, /// but WITHOUT ANY WARRANTY; without even the implied warranty of /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /// GNU General Public License for more details. /// /// You should have received a copy of the GNU General Public License /// along with this program; if not, write to the Free Software /// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /// /// @author Ben Humphreys <ben.humphreys@csiro.au> // Include own header file first #include <distributedimager/CubeBuilder.h> // Include package level header file #include <askap_simager.h> // System includes #include <iostream> #include <iomanip> #include <string> #include <vector> // ASKAPsoft includes #include <askap/AskapError.h> #include <askap/AskapLogging.h> #include <measurementequation/SynthesisParamsHelper.h> #include <Common/ParameterSet.h> #include <utils/PolConverter.h> #include <casacore/casa/Arrays/IPosition.h> #include <casacore/coordinates/Coordinates/SpectralCoordinate.h> #include <casacore/coordinates/Coordinates/DirectionCoordinate.h> #include <casacore/coordinates/Coordinates/StokesCoordinate.h> #include <casacore/coordinates/Coordinates/CoordinateSystem.h> #include <casacore/measures/Measures/Stokes.h> #include <casacore/images/Images/PagedImage.h> #include <casacore/casa/Quanta/Unit.h> #include <casacore/casa/Quanta/QC.h> ASKAP_LOGGER(logger, ".CubeBuilder"); using namespace askap::cp; using namespace casa; using namespace std; using namespace askap::synthesis; CubeBuilder::CubeBuilder(const LOFAR::ParameterSet& parset, const casa::uInt nchan, const casa::Quantity& f0, const casa::Quantity& inc, const std::string& name) { itsFilename = parset.getString("Images.name"); ASKAPCHECK(itsFilename.substr(0,5)=="image", "Simager.Images.name must start with 'image'"); // If necessary, replace "image" with _name_ (e.g. "psf", "weights") // unless name='restored', in which case we append ".restored" if (!name.empty()) { if (name == "restored") { itsFilename = itsFilename + ".restored"; } else { const string orig = "image"; const size_t f = itsFilename.find(orig); itsFilename.replace(f, orig.length(), name); } } const std::string restFreqString = parset.getString("Images.restFrequency", "-1."); if (restFreqString == "HI") { itsRestFrequency = casa::QC::HI; } else { itsRestFrequency = SynthesisParamsHelper::convertQuantity(restFreqString, "Hz"); } // Polarisation const std::vector<std::string> stokesVec = parset.getStringVector("Images.polarisation", std::vector<std::string>(1,"I")); // there could be many ways to define stokes, e.g. ["XX YY"] or ["XX","YY"] or "XX,YY" // to allow some flexibility we have to concatenate all elements first and then // allow the parser from PolConverter to take care of extracting the products. std::string stokesStr; for (size_t i=0; i<stokesVec.size(); ++i) { stokesStr += stokesVec[i]; } itsStokes = scimath::PolConverter::fromString(stokesStr); const casa::uInt npol=itsStokes.size(); // Get the image shape const vector<casa::uInt> imageShapeVector = parset.getUintVector("Images.shape"); const casa::uInt nx = imageShapeVector[0]; const casa::uInt ny = imageShapeVector[1]; const casa::IPosition cubeShape(4, nx, ny, npol, nchan); // Use a tile shape appropriate for plane-by-plane access casa::IPosition tileShape(cubeShape.nelements(), 1); tileShape(0) = 256; tileShape(1) = 256; const casa::CoordinateSystem csys = createCoordinateSystem(parset, nx, ny, f0, inc); ASKAPLOG_DEBUG_STR(logger, "Creating Cube " << itsFilename << " with shape [xsize:" << nx << " ysize:" << ny << " npol:" << npol << " nchan:" << nchan << "], f0: " << f0.getValue("MHz") << " MHz, finc: " << inc.getValue("kHz") << " kHz"); itsCube.reset(new casa::PagedImage<float>(casa::TiledShape(cubeShape, tileShape), csys, itsFilename)); // default flux units are Jy/pixel. If we set the restoring beam // later on, can set to Jy/beam setUnits("Jy/pixel"); } CubeBuilder::~CubeBuilder() { } void CubeBuilder::writeSlice(const casa::Array<float>& arr, const casa::uInt chan) { casa::IPosition where(4, 0, 0, 0, chan); itsCube->putSlice(arr, where); } casa::CoordinateSystem CubeBuilder::createCoordinateSystem(const LOFAR::ParameterSet& parset, const casa::uInt nx, const casa::uInt ny, const casa::Quantity& f0, const casa::Quantity& inc) { CoordinateSystem coordsys; const vector<string> dirVector = parset.getStringVector("Images.direction"); const vector<string> cellSizeVector = parset.getStringVector("Images.cellsize"); // Direction Coordinate { Matrix<Double> xform(2, 2); xform = 0.0; xform.diagonal() = 1.0; const Quantum<Double> ra = asQuantity(dirVector.at(0), "deg"); const Quantum<Double> dec = asQuantity(dirVector.at(1), "deg"); ASKAPLOG_DEBUG_STR(logger, "Direction: " << ra.getValue() << " degrees, " << dec.getValue() << " degrees"); const Quantum<Double> xcellsize = asQuantity(cellSizeVector.at(0), "arcsec") * -1.0; const Quantum<Double> ycellsize = asQuantity(cellSizeVector.at(1), "arcsec"); ASKAPLOG_DEBUG_STR(logger, "Cellsize: " << xcellsize.getValue() << " arcsec, " << ycellsize.getValue() << " arcsec"); casa::MDirection::Types type; casa::MDirection::getType(type, dirVector.at(2)); const DirectionCoordinate radec(type, Projection(Projection::SIN), ra, dec, xcellsize, ycellsize, xform, nx / 2, ny / 2); coordsys.addCoordinate(radec); } // Stokes Coordinate { // To make a StokesCoordinate, need to convert the StokesTypes // into integers explicitly casa::Vector<casa::Int> stokes(itsStokes.size()); for(unsigned int i=0;i<stokes.size();i++){ stokes[i] = itsStokes[i]; } const StokesCoordinate stokescoord(stokes); coordsys.addCoordinate(stokescoord); } // Spectral Coordinate { const Double refPix = 0.0; // is the reference pixel SpectralCoordinate sc(MFrequency::TOPO, f0, inc, refPix); // add rest frequency, but only if requested, and only for // image.blah, residual.blah, image.blah.restored if (itsRestFrequency.getValue("Hz") > 0.) { if ((itsFilename.find("image.") != string::npos) || (itsFilename.find("residual.") != string::npos)) { if (!sc.setRestFrequency(itsRestFrequency.getValue("Hz"))) { ASKAPLOG_ERROR_STR(logger, "Could not set the rest frequency to " << itsRestFrequency.getValue("Hz") << "Hz"); } } } coordsys.addCoordinate(sc); } return coordsys; } void CubeBuilder::addBeam(casa::Vector<casa::Quantum<double> > &beam) { casa::ImageInfo ii = itsCube->imageInfo(); ii.setRestoringBeam(beam); itsCube->setImageInfo(ii); setUnits("Jy/beam"); } void CubeBuilder::setUnits(const std::string &units) { itsCube->setUnits(casa::Unit(units)); }
37.60177
126
0.624618
418772c0e07206dc329d8ac1be71374c98685278
118
h
C
Pod/Classes/playball/UIFont+Playball.h
parakeety/GoogleFontsiOS
46a0d144b32b14f06f3605568ab210ad390c8e96
[ "MIT" ]
10
2015-08-07T19:43:38.000Z
2019-03-06T10:40:11.000Z
Pod/Classes/playball/UIFont+Playball.h
Maxatma/GoogleFontsiOS
46a0d144b32b14f06f3605568ab210ad390c8e96
[ "MIT" ]
3
2016-03-01T10:29:45.000Z
2017-03-30T12:23:06.000Z
Pod/Classes/playball/UIFont+Playball.h
Maxatma/GoogleFontsiOS
46a0d144b32b14f06f3605568ab210ad390c8e96
[ "MIT" ]
4
2016-02-10T12:34:29.000Z
2020-04-08T07:18:23.000Z
#import <UIKit/UIKit.h> @interface UIFont (Playball) + (instancetype)playballRegularFontOfSize:(CGFloat)size; @end
14.75
56
0.771186
5dd2c517dfb9a9cb27260e2f81a324a98d21e1d5
2,740
go
Go
pingdom/user_types.go
signal-ai/go-pingdom
7054da7bc1be4a4f8e2bf6d02b195aa01f680f97
[ "MIT" ]
5
2019-02-11T23:39:02.000Z
2021-09-24T12:03:51.000Z
pingdom/user_types.go
signal-ai/go-pingdom
7054da7bc1be4a4f8e2bf6d02b195aa01f680f97
[ "MIT" ]
null
null
null
pingdom/user_types.go
signal-ai/go-pingdom
7054da7bc1be4a4f8e2bf6d02b195aa01f680f97
[ "MIT" ]
1
2021-12-06T09:54:16.000Z
2021-12-06T09:54:16.000Z
package pingdom import ( "fmt" ) // User email represents the sms contact object in a user in // GET /users type UserSms struct { Severity string `json:"severity"` CountryCode string `json:"country_code"` Number string `json:"number"` Provider string `json:"provider"` } // User email represents the email contact object in a user in // GET /users type UserEmail struct { Severity string `json:"severity"` Address string `json:"address"` } // Contact represents a Pingdom contact target type Contact struct { Severity string `json:"severitylevel"` CountryCode string `json:"countrycode"` Number string `json:"number"` Provider string `json:"provider"` Email string `json:"email"` } // User represents a Pingdom User or Contact. type User struct { Paused string `json:"paused,omitempty"` Username string `json:"name,omitempty"` Primary string `json:"primary,omitempty"` Sms []UserSmsResponse `json:"sms,omitempty"` Email []UserEmailResponse `json:"email,omitempty"` } func (u *User) ValidUser() error { if u.Username == "" { return fmt.Errorf("Invalid value for `Username`. Must contain non-empty string") } return nil } // For simplicity I am enforcing these rules for both PUT and POST // of contact targets. However in practice they are slightly different func (c *Contact) ValidContact() error { if c.Email == "" && c.Number == "" { return fmt.Errorf("you must provide either an Email or a Phone Number to create a contact target") } if c.Number != "" && c.CountryCode == "" { return fmt.Errorf("you must provide a Country Code if providing a phone number") } if c.Provider != "" && (c.Number == "" || c.CountryCode == "") { return fmt.Errorf("you must provide CountryCode and Number if Provider is provided") } return nil } func (u *User) PostParams() map[string]string { m := map[string]string{ "name": u.Username, } return m } func (c *Contact) PostContactParams() map[string]string { m := map[string]string{} // Ignore if not defined if c.Email != "" { m["email"] = c.Email } if c.Number != "" { m["number"] = c.Number } if c.CountryCode != "" { m["countrycode"] = c.CountryCode } if c.Severity != "" { m["severitylevel"] = c.Severity } if c.Provider != "" { m["provider"] = c.Provider } return m } func (u *User) PutParams() map[string]string { m := map[string]string{ "name": u.Username, } if u.Primary != "" { m["primary"] = u.Primary } if u.Paused != "" { m["paused"] = u.Paused } return m } // Currently the Creates and Updates for Contacts are the same func (c *Contact) PutContactParams() map[string]string { return c.PostContactParams() }
22.459016
100
0.655474
75130e7f3ad7ce271e0fedef5c6b913be746fc89
420
cs
C#
tests/Cuture.Extensions.Modularity.Test/Modules/Chaos/Standard/ChaosDependsModuleStandard1.cs
cuture/Cuture.Extensions.Modularity
20b4c1af49b77efd729fe7bb718142b68309e899
[ "MIT" ]
1
2021-10-18T09:55:53.000Z
2021-10-18T09:55:53.000Z
tests/Cuture.Extensions.Modularity.Test/Modules/Chaos/Standard/ChaosDependsModuleStandard1.cs
cuture/Cuture.Extensions.Modularity
20b4c1af49b77efd729fe7bb718142b68309e899
[ "MIT" ]
null
null
null
tests/Cuture.Extensions.Modularity.Test/Modules/Chaos/Standard/ChaosDependsModuleStandard1.cs
cuture/Cuture.Extensions.Modularity
20b4c1af49b77efd729fe7bb718142b68309e899
[ "MIT" ]
null
null
null
 using Cuture.Extensions.Modularity; namespace DependencyInjection.Modularity.Test { [DependsOn(typeof(ChaosDependsModuleStandard2))] public class ChaosDependsModuleStandard1 : CountableModuleBase { } } namespace DependencyInjection.Modularity.Test { [DependsOn(typeof(ChaosDependsModuleStandard2Async))] public class ChaosDependsModuleStandard1Async : AsyncCountableModuleBase { } }
21
76
0.780952
8e2d340fe1e36c351df257b938fe92868814b553
2,196
asm
Assembly
src/bootsect/bootsect.asm
LukeUsher/ProjectCD
9230a7d2ab47d3bdfd3791b31bdf9446a608d723
[ "BSD-2-Clause" ]
14
2017-03-20T02:18:34.000Z
2022-03-18T23:25:03.000Z
src/bootsect/bootsect.asm
LukeUsher/ProjectCD
9230a7d2ab47d3bdfd3791b31bdf9446a608d723
[ "BSD-2-Clause" ]
null
null
null
src/bootsect/bootsect.asm
LukeUsher/ProjectCD
9230a7d2ab47d3bdfd3791b31bdf9446a608d723
[ "BSD-2-Clause" ]
1
2017-04-02T14:04:19.000Z
2017-04-02T14:04:19.000Z
align macro cnop 0,\1 endm ; ======================================================================================= ; Sega CD Header (Based on Sonic CD's header) ; ======================================================================================= DiscType: dc.b 'SEGADISCSYSTEM ' ; Disc Type (Must be SEGADISCSYSTEM) VolumeName: dc.b 'SEGACDGAME ',0 ; Disc ID VolumeSystem: dc.w $100, $1 ; System ID, Type SystemName: dc.b 'SEGACDGAME ',0 ; System Name SystemVersion: dc.w 0,0 ; System Version, Type IP_Addr: dc.l $800 ; IP Start Address (Must be $800) IP_Size: dc.l $800 ; IP End Address (Must be $800) IP_Entry: dc.l 0 IP_WorkRAM: dc.l 0 SP_Addr: dc.l $1000 ; SP Start Address (Must be $1000) SP_Size: dc.l $7000 ; SP End Address (Must be $7000) SP_Entry: dc.l 0 SP_WorkRAM: dc.l 0 align $100 ; Pad to $100 ; ======================================================================================= ; Game Header ; ======================================================================================= HardwareType: dc.b 'SEGA MEGA DRIVE ' Copyright: dc.b '(C)LUKE 2010.OCT' NativeName: dc.b 'SEGA CD TEST GAME ' OverseasName: dc.b 'SEGA CD TEST GAME ' DiscID: dc.b 'GM 00-0000-00 ' IO: dc.b 'J ' ; Modem information, notes, and padding, left undefined as it is not used ; Padded to $1F0 instead (Start of Region Code) align $1F0 Region: dc.b 'E ' ; ======================================================================================== ; IP (Includes security sector) ; ======================================================================================== incbin "ip.bin"; ; ======================================================================================= ; Sub CPU Program (SP) ; ======================================================================================= align $1000 incbin "sp.bin" ; ======================================================================================= ; Padding, to $8000 (Size of boot area of iso) ; ======================================================================================= align $8000
45.75
91
0.369763
2987873b94a18f6b12906f3d66d8ab5b1ac536a1
8,918
swift
Swift
test/SPI/private_swiftinterface.swift
jmgc/swift
01c3c48674f72e76b093a2a894b94abbdb606c81
[ "Apache-2.0" ]
1
2020-12-03T09:58:06.000Z
2020-12-03T09:58:06.000Z
test/SPI/private_swiftinterface.swift
jmgc/swift
01c3c48674f72e76b093a2a894b94abbdb606c81
[ "Apache-2.0" ]
null
null
null
test/SPI/private_swiftinterface.swift
jmgc/swift
01c3c48674f72e76b093a2a894b94abbdb606c81
[ "Apache-2.0" ]
1
2021-09-11T08:43:53.000Z
2021-09-11T08:43:53.000Z
/// Test the generated private textual module interfaces and that the public /// one doesn't leak SPI decls and info. // RUN: %empty-directory(%t) // RUN: %target-swift-frontend -enable-experimental-prespecialization -emit-module %S/Inputs/spi_helper.swift -module-name SPIHelper -emit-module-path %t/SPIHelper.swiftmodule -swift-version 5 -enable-library-evolution -emit-module-interface-path %t/SPIHelper.swiftinterface -emit-private-module-interface-path %t/SPIHelper.private.swiftinterface // RUN: %target-swift-frontend -enable-experimental-prespecialization -emit-module %S/Inputs/ioi_helper.swift -module-name IOIHelper -emit-module-path %t/IOIHelper.swiftmodule -swift-version 5 -enable-library-evolution -emit-module-interface-path %t/IOIHelper.swiftinterface -emit-private-module-interface-path %t/IOIHelper.private.swiftinterface /// Make sure that the public swiftinterface of spi_helper doesn't leak SPI. // RUN: %FileCheck -check-prefix=CHECK-HELPER %s < %t/SPIHelper.swiftinterface // CHECK-HELPER-NOT: HelperSPI // CHECK-HELPER-NOT: @_spi // CHECK-HELPER-NOT: @_specialize // Test the spi parameter of the _specialize attribute in the private interface. // RUN: %FileCheck -check-prefix=CHECK-HELPER-PRIVATE %s < %t/SPIHelper.private.swiftinterface // CHECK-HELPER-PRIVATE: @_specialize(exported: true, spi: HelperSPI, kind: full, where T == Swift.Int) // CHECK-HELPER-PRIVATE-NEXT: public func genericFunc<T>(_ t: T) // CHECK-HELPER-PRIVATE: @_specialize(exported: true, spi: HelperSPI, kind: full, where T == Swift.Int) // CHECK-HELPER-PRIVATE-NEXT: public func genericFunc2<T>(_ t: T) // CHECK-HELPER-PRIVATE: @_specialize(exported: true, spi: HelperSPI, kind: full, where T == Swift.Int) // CHECK-HELPER-PRIVATE-NEXT: public func genericFunc3<T>(_ t: T) // CHECK-HELPER-PRIVATE: @_specialize(exported: true, spi: HelperSPI, kind: full, where T == Swift.Int) // CHECK-HELPER-PRIVATE-NEXT: public func genericFunc4<T>(_ t: T) // CHECK-HELPER-PRIVATE: @_specialize(exported: true, spi: HelperSPI, kind: full, where T == Swift.Int) // CHECK-HELPER-PRIVATE-NEXT: public func prespecializedMethod<T>(_ t: T) // RUN: %target-swift-frontend -emit-module %t/SPIHelper.swiftinterface -emit-module-path %t/SPIHelper-from-public-swiftinterface.swiftmodule -swift-version 5 -module-name SPIHelper -enable-library-evolution /// Test the textual interfaces generated from this test. // RUN: %target-swift-frontend -typecheck %s -emit-module-interface-path %t/Main.swiftinterface -emit-private-module-interface-path %t/Main.private.swiftinterface -enable-library-evolution -swift-version 5 -I %t -module-name Main // RUN: %FileCheck -check-prefix=CHECK-PUBLIC %s < %t/Main.swiftinterface // RUN: %FileCheck -check-prefix=CHECK-PRIVATE %s < %t/Main.private.swiftinterface // RUN: %target-swift-frontend -typecheck-module-from-interface -I %t %t/Main.swiftinterface // RUN: %target-swift-frontend -typecheck-module-from-interface -I %t %t/Main.private.swiftinterface -module-name Main /// Serialize and deserialize this module, then print. // RUN: %target-swift-frontend -emit-module %s -emit-module-path %t/Merged-partial.swiftmodule -swift-version 5 -I %t -module-name Merged -enable-library-evolution // RUN: %target-swift-frontend -merge-modules %t/Merged-partial.swiftmodule -module-name Merged -emit-module -emit-module-path %t/Merged.swiftmodule -I %t -emit-module-interface-path %t/Merged.swiftinterface -emit-private-module-interface-path %t/Merged.private.swiftinterface -enable-library-evolution -swift-version 5 -I %t // RUN: %FileCheck -check-prefix=CHECK-PUBLIC %s < %t/Merged.swiftinterface // RUN: %FileCheck -check-prefix=CHECK-PRIVATE %s < %t/Merged.private.swiftinterface // RUN: %target-swift-frontend -typecheck-module-from-interface -I %t %t/Merged.swiftinterface // RUN: %target-swift-frontend -typecheck-module-from-interface -I %t %t/Merged.private.swiftinterface -module-name Merged @_spi(HelperSPI) @_spi(OtherSPI) @_spi(OtherSPI) import SPIHelper // CHECK-PUBLIC: import SPIHelper // CHECK-PRIVATE: @_spi(OtherSPI) @_spi(HelperSPI) import SPIHelper @_implementationOnly import IOIHelper public func foo() {} // CHECK-PUBLIC: foo() // CHECK-PRIVATE: foo() @_spi(MySPI) @_spi(MyOtherSPI) public func localSPIFunc() {} // CHECK-PRIVATE: @_spi(MySPI) // CHECK-PRIVATE: localSPIFunc() // CHECK-PUBLIC-NOT: localSPIFunc() // SPI declarations @_spi(MySPI) public class SPIClassLocal { // CHECK-PRIVATE: @_spi(MySPI) public class SPIClassLocal // CHECK-PUBLIC-NOT: class SPIClassLocal public init() {} } @_spi(MySPI) public extension SPIClassLocal { // CHECK-PRIVATE: @_spi(MySPI) extension SPIClassLocal // CHECK-PUBLIC-NOT: extension SPIClassLocal @_spi(MySPI) func extensionMethod() {} // CHECK-PRIVATE: @_spi(MySPI) public func extensionMethod // CHECK-PUBLIC-NOT: func extensionMethod internal func internalExtensionMethod() {} // CHECK-PRIVATE-NOT: internalExtensionMethod // CHECK-PUBLIC-NOT: internalExtensionMethod func inheritedSPIExtensionMethod() {} // CHECK-PRIVATE: inheritedSPIExtensionMethod // CHECK-PUBLIC-NOT: inheritedSPIExtensionMethod } public extension SPIClassLocal { internal func internalExtensionMethode1() {} // CHECK-PRIVATE-NOT: internalExtensionMethod1 // CHECK-PUBLIC-NOT: internalExtensionMethod1 } class InternalClassLocal {} // CHECK-PRIVATE-NOT: InternalClassLocal // CHECK-PUBLIC-NOT: InternalClassLocal private class PrivateClassLocal {} // CHECK-PRIVATE-NOT: PrivateClassLocal // CHECK-PUBLIC-NOT: PrivateClassLocal @_spi(LocalSPI) public func useOfSPITypeOk(_ p: SPIClassLocal) -> SPIClassLocal { fatalError() } // CHECK-PRIVATE: @_spi(LocalSPI) public func useOfSPITypeOk // CHECK-PUBLIC-NOT: useOfSPITypeOk @_spi(LocalSPI) extension SPIClass { // CHECK-PRIVATE: @_spi(LocalSPI) extension SPIClass // CHECK-PUBLIC-NOT: SPIClass @_spi(LocalSPI) public func extensionSPIMethod() {} // CHECK-PRIVATE: @_spi(LocalSPI) public func extensionSPIMethod() // CHECK-PUBLIC-NOT: extensionSPIMethod } @propertyWrapper public struct Wrapper<T> { public var value: T public var wrappedValue: T { get { value } set { value = newValue } } } @propertyWrapper public struct WrapperWithInitialValue<T> { private var value: T public var wrappedValue: T { get { value } set { value = newValue } } public var projectedValue: Wrapper<T> { get { Wrapper(value: value) } set { value = newValue.value } } } public class SomeClass { } public struct PublicStruct { @_spi(S) @Wrapper public var spiWrappedSimple: SomeClass // CHECK-PRIVATE: @_spi(S) @{{.*}}.Wrapper public var spiWrappedSimple: {{.*}}.SomeClass // CHECK-PUBLIC-NOT: spiWrappedSimple @_spi(S) @WrapperWithInitialValue public var spiWrappedDefault: SomeClass // CHECK-PRIVATE: @_spi(S) @{{.*}}.WrapperWithInitialValue @_projectedValueProperty($spiWrappedDefault) public var spiWrappedDefault: {{.*}}.SomeClass // CHECK-PRIVATE: @_spi(S) public var $spiWrappedDefault: {{.*}}.Wrapper<{{.*}}.SomeClass> // CHECK-PUBLIC-NOT: spiWrappedDefault } @_spi(LocalSPI) public protocol SPIProto3 { // CHECK-PRIVATE: @_spi(LocalSPI) public protocol SPIProto3 // CHECK-PUBLIC-NOT: SPIProto3 associatedtype AssociatedType // CHECK-PRIVATE: {{^}} associatedtype AssociatedType // CHECK-PUBLIC-NOT: AssociatedType func implicitSPIMethod() // CHECK-PRIVATE: @_spi(LocalSPI) func implicitSPIMethod() // CHECK-PUBLIC-NOT: implicitSPIMethod } // Test the dummy conformance printed to replace private types used in // conditional conformances. rdar://problem/63352700 // Conditional conformances using SPI types should appear in full in the // private swiftinterface. public struct PublicType<T> {} @_spi(LocalSPI) public protocol SPIProto {} private protocol PrivateConstraint {} @_spi(LocalSPI) public protocol SPIProto2 {} @_spi(LocalSPI) extension PublicType: SPIProto2 where T: SPIProto2 {} // CHECK-PRIVATE: extension PublicType : {{.*}}.SPIProto2 where T : {{.*}}.SPIProto2 // CHECK-PUBLIC-NOT: _ConstraintThatIsNotPartOfTheAPIOfThisLibrary public protocol LocalPublicProto {} extension IOIPublicStruct : LocalPublicProto {} // CHECK-PRIVATE-NOT: IOIPublicStruct // CHECK-PUBLIC-NOT: IOIPublicStruct @_spi(S) @frozen public struct SPIFrozenStruct { // CHECK-PRIVATE: struct SPIFrozenStruct // CHECK-PUBLIC-NOT: SPIFrozenStruct var spiTypeInFrozen = SPIStruct() // CHECK-PRIVATE: @_spi(S) internal var spiTypeInFrozen private var spiTypeInFrozen1: SPIClass // CHECK-PRIVATE: @_spi(S) private var spiTypeInFrozen1 } // The dummy conformance should be only in the private swiftinterface for // SPI extensions. @_spi(LocalSPI) extension PublicType: SPIProto where T: PrivateConstraint {} // CHECK-PRIVATE: extension {{.*}}.PublicType : {{.*}}.SPIProto where T : _ConstraintThatIsNotPartOfTheAPIOfThisLibrary // CHECK-PUBLIC-NOT: _ConstraintThatIsNotPartOfTheAPIOfThisLibrary
43.931034
346
0.757905
c5b3dffb1257eed32163c120d3cf6e4518b800b2
987
cpp
C++
aws-cpp-sdk-workspaces-web/source/model/CreateTrustStoreResult.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2022-02-12T08:09:30.000Z
2022-02-12T08:09:30.000Z
aws-cpp-sdk-workspaces-web/source/model/CreateTrustStoreResult.cpp
perfectrecall/aws-sdk-cpp
fb8cbebf2fd62720b65aeff841ad2950e73d8ebd
[ "Apache-2.0" ]
1
2021-10-14T16:57:00.000Z
2021-10-18T10:47:24.000Z
aws-cpp-sdk-workspaces-web/source/model/CreateTrustStoreResult.cpp
ravindra-wagh/aws-sdk-cpp
7d5ff01b3c3b872f31ca98fb4ce868cd01e97696
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/workspaces-web/model/CreateTrustStoreResult.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/core/AmazonWebServiceResult.h> #include <aws/core/utils/StringUtils.h> #include <aws/core/utils/UnreferencedParam.h> #include <utility> using namespace Aws::WorkSpacesWeb::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; CreateTrustStoreResult::CreateTrustStoreResult() { } CreateTrustStoreResult::CreateTrustStoreResult(const Aws::AmazonWebServiceResult<JsonValue>& result) { *this = result; } CreateTrustStoreResult& CreateTrustStoreResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("trustStoreArn")) { m_trustStoreArn = jsonValue.GetString("trustStoreArn"); } return *this; }
24.073171
112
0.767984
1e7a42661da31e91bdfa76ae42bbcf97f47965cc
2,138
kt
Kotlin
src/main/java/dev/blachut/svelte/lang/psi/SvelteJSEmbeddedContentImpl.kt
pfz/svelte-intellij
7cd33b737bac9de4dccefd088f676bf16997cde3
[ "MIT" ]
432
2019-05-04T01:42:56.000Z
2022-03-30T19:39:13.000Z
src/main/java/dev/blachut/svelte/lang/psi/SvelteJSEmbeddedContentImpl.kt
pfz/svelte-intellij
7cd33b737bac9de4dccefd088f676bf16997cde3
[ "MIT" ]
215
2019-05-05T15:54:03.000Z
2022-03-31T09:33:31.000Z
src/main/java/dev/blachut/svelte/lang/psi/SvelteJSEmbeddedContentImpl.kt
pfz/svelte-intellij
7cd33b737bac9de4dccefd088f676bf16997cde3
[ "MIT" ]
38
2019-06-21T19:30:15.000Z
2022-03-08T17:51:53.000Z
package dev.blachut.svelte.lang.psi import com.intellij.lang.ASTNode import com.intellij.lang.javascript.JSStubElementTypes import com.intellij.lang.javascript.psi.JSDefinitionExpression import com.intellij.lang.javascript.psi.JSElementVisitor import com.intellij.lang.javascript.psi.JSExpressionStatement import com.intellij.lang.javascript.psi.JSLabeledStatement import com.intellij.lang.javascript.psi.impl.JSEmbeddedContentImpl import com.intellij.psi.PsiElement import com.intellij.psi.ResolveState import com.intellij.psi.scope.PsiScopeProcessor import dev.blachut.svelte.lang.codeInsight.SvelteReactiveDeclarationsUtil class SvelteJSEmbeddedContentImpl(node: ASTNode) : JSEmbeddedContentImpl(node) { override fun processDeclarations( processor: PsiScopeProcessor, state: ResolveState, lastParent: PsiElement?, place: PsiElement ): Boolean { return super.processDeclarations(processor, state, lastParent, place) && processReactiveStatements(processor, state, lastParent, place) } @Suppress("UNUSED_PARAMETER") private fun processReactiveStatements( processor: PsiScopeProcessor, state: ResolveState, lastParent: PsiElement?, place: PsiElement ): Boolean { var result = true acceptChildren(object : JSElementVisitor() { override fun visitJSLabeledStatement(labeledStatement: JSLabeledStatement) { if (result && labeledStatement.label == SvelteReactiveDeclarationsUtil.REACTIVE_LABEL && labeledStatement.statement is JSExpressionStatement) { val expression = (labeledStatement.statement as JSExpressionStatement).expression ?: return val definition = expression.node.findChildByType(JSStubElementTypes.DEFINITION_EXPRESSION)?.psi as JSDefinitionExpression? ?: return if (!processor.execute(definition, ResolveState.initial())) { result = false } } } }) return result } }
39.592593
159
0.696445
b84eaed22616a18326b1a54d6428d62a79ed8599
294
sql
SQL
data/druid/custom_granularity/query.sql
nbuesing/druid_rollup_tutorial
ece07e125ab1bb24fac30ac35e616c00ebb2e1c4
[ "Apache-2.0" ]
null
null
null
data/druid/custom_granularity/query.sql
nbuesing/druid_rollup_tutorial
ece07e125ab1bb24fac30ac35e616c00ebb2e1c4
[ "Apache-2.0" ]
null
null
null
data/druid/custom_granularity/query.sql
nbuesing/druid_rollup_tutorial
ece07e125ab1bb24fac30ac35e616c00ebb2e1c4
[ "Apache-2.0" ]
null
null
null
select 'orders_custom_granularity' "Datasource", __time, USER_REWARD, sum("COUNT") "Logical_Count", count("COUNT") "Physical_Count" from orders_custom_granularity where __time >= CURRENT_TIMESTAMP - INTERVAL '5' MINUTE group by 1,2,3
32.666667
56
0.629252
18fcbf7fbf2a7c624a4ef4a6f61b9bbb03c7d3c7
56,539
rb
Ruby
spec/defines/instance_spec.rb
pixelpark/puppet-ds_389
2e1861e216e02255d9863b831ee2ca9c7cd48395
[ "Apache-2.0" ]
null
null
null
spec/defines/instance_spec.rb
pixelpark/puppet-ds_389
2e1861e216e02255d9863b831ee2ca9c7cd48395
[ "Apache-2.0" ]
2
2020-11-25T05:42:18.000Z
2021-04-05T23:09:38.000Z
spec/defines/instance_spec.rb
pixelpark/puppet-ds_389
2e1861e216e02255d9863b831ee2ca9c7cd48395
[ "Apache-2.0" ]
2
2021-01-28T12:20:13.000Z
2021-04-09T18:57:19.000Z
require 'spec_helper' describe 'ds_389::instance' do let(:pre_condition) do 'class {"::ds_389": }' end let(:title) { 'specdirectory' } on_supported_os(facterversion: '2.4').each do |os, os_facts| context "on #{os}" do let(:facts) do os_facts.merge( networking: { fqdn: 'foo.example.com' }, ) end context 'with required params' do let(:params) do { root_dn: 'cn=Directory Manager', suffix: 'dc=example,dc=com', cert_db_pass: 'secret', root_dn_pass: 'supersecure', server_id: 'specdirectory', } end it { is_expected.to compile } it { is_expected.to contain_file('/etc/dirsrv/slapd-specdirectory/pin.txt').with( ensure: 'file', mode: '0440', owner: 'dirsrv', group: 'dirsrv', content: "Internal (Software) Token:supersecure\n", ).that_requires('Exec[setup ds: specdirectory]').that_notifies( 'Exec[restart specdirectory to pick up new token]', ) } # rubocop:disable RepeatedExample case os_facts[:osfamily] when 'Debian' it { is_expected.to contain_exec('setup ds: specdirectory').with( command: 'dscreate from-file /etc/dirsrv/template-specdirectory.inf', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-specdirectory', ) } it { is_expected.to contain_exec('Rehash cacertdir: specdirectory').with( command: 'openssl rehash /etc/openldap/cacerts', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } case os_facts[:operatingsystemmajrelease] when '10', '20.04' it { is_expected.to contain_exec('stop specdirectory to create new token').with( command: 'systemctl stop dirsrv@specdirectory ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_comes_before('File[/etc/dirsrv/slapd-specdirectory/pin.txt]') } it { is_expected.to contain_exec('restart specdirectory to pick up new token').with( command: 'systemctl restart dirsrv@specdirectory ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } else it { is_expected.to contain_exec('stop specdirectory to create new token').with( command: 'service dirsrv stop specdirectory ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_comes_before('File[/etc/dirsrv/slapd-specdirectory/pin.txt]') } it { is_expected.to contain_exec('restart specdirectory to pick up new token').with( command: 'service dirsrv restart specdirectory ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } end when 'RedHat' it { is_expected.to contain_exec('setup ds: specdirectory').with( command: 'dscreate from-file /etc/dirsrv/template-specdirectory.inf', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-specdirectory', ) } it { is_expected.to contain_exec('Rehash cacertdir: specdirectory').with( command: 'openssl rehash /etc/openldap/cacerts', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } case os_facts[:operatingsystemmajrelease] when '8' it { is_expected.to contain_exec('stop specdirectory to create new token').with( command: 'systemctl stop dirsrv@specdirectory ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_comes_before('File[/etc/dirsrv/slapd-specdirectory/pin.txt]') } it { is_expected.to contain_exec('restart specdirectory to pick up new token').with( command: 'systemctl restart dirsrv@specdirectory ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } else it { is_expected.to contain_exec('stop specdirectory to create new token').with( command: 'service dirsrv stop specdirectory ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_comes_before('File[/etc/dirsrv/slapd-specdirectory/pin.txt]') } it { is_expected.to contain_exec('restart specdirectory to pick up new token').with( command: 'service dirsrv restart specdirectory ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } end end # rubocop:enable RepeatedExample it { is_expected.to contain_exec('Generate noise file: specdirectory').with( command: %r{echo \d+ | sha256sum | awk '{print $1}' > /tmp/noisefile-specdirectory}, path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_subscribes_to('Exec[stop specdirectory to create new token]').that_notifies( 'Exec[Generate password file: specdirectory]', ) } it { is_expected.to contain_exec('Generate password file: specdirectory').with( command: 'echo supersecure > /tmp/passfile-specdirectory', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies('Exec[Create cert DB: specdirectory]') } it { is_expected.to contain_exec('Create cert DB: specdirectory').with( command: 'certutil -N -d /etc/dirsrv/slapd-specdirectory -f /tmp/passfile-specdirectory', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies('Ssl_pkey[Generate CA private key: specdirectory]') } it { is_expected.to contain_ssl_pkey('Generate CA private key: specdirectory').with( size: 4096, ) } it { is_expected.to contain_x509_cert('Create CA cert: specdirectory').with( days: 3650, req_ext: false, ) } it { is_expected.to contain_exec('Add trust for CA: specdirectory').with( command: 'certutil -M -n "specdirectoryCA" -t CT,C,C -d /etc/dirsrv/slapd-specdirectory -f /tmp/passfile-specdirectory', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-specdirectory | grep "specdirectoryCA" | grep "CTu,Cu,Cu"', ).that_notifies('Exec[Export CA cert: specdirectory]') } it { is_expected.to contain_exec('Make server cert and add to database: specdirectory').with( cwd: '/etc/dirsrv/slapd-specdirectory', command: 'certutil -S -n "specdirectoryCert" -m 101 -s "cn=foo.example.com" -c "specdirectoryCA" -t "u,u,u" -v 120 -d /etc/dirsrv/slapd-specdirectory -k rsa -z /tmp/noisefile-specdirectory -f /tmp/passfile-specdirectory && sleep 2', # rubocop:disable LineLength path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies( [ 'Exec[Set permissions on database directory: specdirectory]', 'Exec[Clean up temp files: specdirectory]', 'Exec[Add trust for server cert: specdirectory]', ], ) } it { is_expected.to contain_exec('Add trust for server cert: specdirectory').with( command: 'certutil -M -n "specdirectoryCert" -t u,u,u -d /etc/dirsrv/slapd-specdirectory', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-specdirectory | grep "specdirectoryCert" | grep "u,u,u"', ).that_notifies('Exec[Export server cert: specdirectory]') } it { is_expected.to contain_exec('Set permissions on database directory: specdirectory').with( command: 'chown dirsrv:dirsrv /etc/dirsrv/slapd-specdirectory', refreshonly: true, ) } it { is_expected.to contain_exec('Export CA cert: specdirectory').with( cwd: '/etc/dirsrv/slapd-specdirectory', command: 'certutil -d /etc/dirsrv/slapd-specdirectory -L -n "specdirectoryCA" -a > /etc/dirsrv/slapd-specdirectory/specdirectoryCA.pem', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-specdirectory/specdirectoryCA.pem', ) } it { is_expected.to contain_file('/etc/openldap/cacerts/specdirectoryCA.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-specdirectory/specdirectoryCA.pem', ).that_requires('Exec[Export CA cert: specdirectory]').that_notifies( 'Exec[Rehash cacertdir: specdirectory]', ) } it { is_expected.to contain_exec('Clean up temp files: specdirectory').with( command: 'rm -f /tmp/noisefile-specdirectory /tmp/passfile-specdirectory', refreshonly: true, ) } it { is_expected.to contain_exec('Export server cert: specdirectory').with( cwd: '/etc/dirsrv/slapd-specdirectory', command: 'certutil -d /etc/dirsrv/slapd-specdirectory -L -n "specdirectoryCert" -a > specdirectoryCert.pem', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-specdirectory/specdirectoryCert.pem', ) } it { is_expected.to contain_file('/etc/openldap/cacerts/specdirectoryCert.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-specdirectory/specdirectoryCert.pem', ).that_requires('Exec[Export server cert: specdirectory]').that_notifies( 'Exec[Rehash cacertdir: specdirectory]', ) } it { is_expected.to contain_ds_389__ssl('specdirectory').with( cert_name: 'specdirectoryCert', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'foo.example.com', server_port: 389, user: 'dirsrv', group: 'dirsrv', minssf: 0, ssl_version_min: 'TLS1.1', ) } it { is_expected.to contain_ds_389__service('specdirectory') } it { is_expected.not_to contain_concat__fragment('specdirectory_cert') } it { is_expected.not_to contain_concat__fragment('specdirectory_ca_bundle') } it { is_expected.not_to contain_concat__fragment('specdirectory_key') } it { is_expected.not_to contain_concat('specdirectory_cert_bundle') } it { is_expected.not_to contain_exec('Create pkcs12 cert: specdirectory') } it { is_expected.not_to contain_exec('Add trust for CA0: specdirectory') } it { is_expected.not_to contain_exec('Export CA cert 0: specdirectory') } it { is_expected.not_to contain_file('/etc/openldap/cacerts/specdirectoryCA0.pem') } context 'when importing an external ssl cert bundle' do let(:params) do { root_dn: 'cn=Directory Manager', suffix: 'dc=example,dc=com', cert_db_pass: 'secret', root_dn_pass: 'supersecure', server_id: 'specdirectory', ssl: { 'cert_path' => 'puppet:///specfiles/ssl_cert.pem', 'key_path' => 'puppet:///specfiles/ssl_key.pem', 'ca_bundle_path' => 'puppet:///specfiles/ssl_ca.pem', 'ca_cert_names' => [ 'Spec Intermediate Certificate', 'Spec Root Certificate', ], 'cert_name' => 'Spec Certificate', }, } end it { is_expected.to compile } it { is_expected.to contain_concat__fragment('specdirectory_cert').with( target: 'specdirectory_cert_bundle', source: 'puppet:///specfiles/ssl_cert.pem', order: '0', ) } it { is_expected.to contain_concat__fragment('specdirectory_ca_bundle').with( target: 'specdirectory_cert_bundle', source: 'puppet:///specfiles/ssl_ca.pem', order: '1', ) } it { is_expected.to contain_concat__fragment('specdirectory_key').with( target: 'specdirectory_cert_bundle', source: 'puppet:///specfiles/ssl_key.pem', order: '2', ) } case os_facts[:osfamily] when 'Debian' it { is_expected.to contain_concat('specdirectory_cert_bundle').with( mode: '0600', path: '/etc/ssl/specdirectory-bundle.pem', ).that_notifies('Exec[Create pkcs12 cert: specdirectory]') } it { is_expected.to contain_exec('Create pkcs12 cert: specdirectory').with( command: 'openssl pkcs12 -export -password pass:secret -name foo.example.com -in /etc/ssl/specdirectory-bundle.pem -out /etc/ssl/specdirectory.p12', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies('Exec[Create cert DB: specdirectory]') } it { is_expected.to contain_exec('Create cert DB: specdirectory').with( command: 'pk12util -i /etc/ssl/specdirectory.p12 -d /etc/dirsrv/slapd-specdirectory -W secret -K supersecure', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } when 'RedHat' it { is_expected.to contain_concat('specdirectory_cert_bundle').with( mode: '0600', path: '/etc/pki/tls/certs/specdirectory-bundle.pem', ).that_notifies('Exec[Create pkcs12 cert: specdirectory]') } it { is_expected.to contain_exec('Create pkcs12 cert: specdirectory').with( command: 'openssl pkcs12 -export -password pass:secret -name foo.example.com -in /etc/pki/tls/certs/specdirectory-bundle.pem -out /etc/pki/tls/certs/specdirectory.p12', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies('Exec[Create cert DB: specdirectory]') } it { is_expected.to contain_exec('Create cert DB: specdirectory').with( command: 'pk12util -i /etc/pki/tls/certs/specdirectory.p12 -d /etc/dirsrv/slapd-specdirectory -W secret -K supersecure', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } end it { is_expected.to contain_exec('Add trust for CA0: specdirectory').with( command: 'certutil -M -n "Spec Intermediate Certificate" -t CT,, -d /etc/dirsrv/slapd-specdirectory', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-specdirectory | grep "Spec Intermediate Certificate" | grep "CT"', ).that_requires('Exec[Create cert DB: specdirectory]').that_notifies('Exec[Export CA cert 0: specdirectory]') } it { is_expected.to contain_exec('Export CA cert 0: specdirectory').with( cwd: '/etc/dirsrv/slapd-specdirectory', command: 'certutil -d /etc/dirsrv/slapd-specdirectory -L -n "Spec Intermediate Certificate" -a > specdirectoryCA0.pem', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-specdirectory/specdirectoryCA0.pem', ) } it { is_expected.to contain_file('/etc/openldap/cacerts/specdirectoryCA0.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-specdirectory/specdirectoryCA0.pem', ).that_requires('Exec[Export CA cert 0: specdirectory]').that_notifies('Exec[Rehash cacertdir: specdirectory]') } it { is_expected.to contain_exec('Add trust for CA1: specdirectory').with( command: 'certutil -M -n "Spec Root Certificate" -t CT,, -d /etc/dirsrv/slapd-specdirectory', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-specdirectory | grep "Spec Root Certificate" | grep "CT"', ).that_requires('Exec[Create cert DB: specdirectory]').that_notifies('Exec[Export CA cert 1: specdirectory]') } it { is_expected.to contain_exec('Export CA cert 1: specdirectory').with( cwd: '/etc/dirsrv/slapd-specdirectory', command: 'certutil -d /etc/dirsrv/slapd-specdirectory -L -n "Spec Root Certificate" -a > specdirectoryCA1.pem', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-specdirectory/specdirectoryCA1.pem', ) } it { is_expected.to contain_file('/etc/openldap/cacerts/specdirectoryCA1.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-specdirectory/specdirectoryCA1.pem', ).that_requires('Exec[Export CA cert 1: specdirectory]').that_notifies('Exec[Rehash cacertdir: specdirectory]') } it { is_expected.to contain_exec('Add trust for server cert: specdirectory').with( command: 'certutil -M -n "Spec Certificate" -t u,u,u -d /etc/dirsrv/slapd-specdirectory', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-specdirectory | grep "Spec Certificate" | grep "u,u,u"', ).that_notifies('Exec[Export server cert: specdirectory]') } it { is_expected.not_to contain_exec('Generate noise file: specdirectory') } it { is_expected.not_to contain_exec('Generate password file: specdirectory') } end context 'when setting up replication' do let(:params) do { root_dn: 'cn=Directory Manager', suffix: 'dc=example,dc=com', cert_db_pass: 'secret', root_dn_pass: 'supersecure', server_id: 'specdirectory', replication: { 'replication_pass' => 'supersecret', 'role' => 'consumer', }, } end it { is_expected.to compile } it { is_expected.to contain_ds_389__replication('specdirectory').with( replication_pass: 'supersecret', role: 'consumer', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', suffix: 'dc=example,dc=com', server_host: 'foo.example.com', server_port: 389, starttls: false, user: 'dirsrv', group: 'dirsrv', ).that_requires('Ds_389::Ssl[specdirectory]') } end context 'when loading additional ldifs' do let(:params) do { root_dn: 'cn=Directory Manager', suffix: 'dc=example,dc=com', cert_db_pass: 'secret', root_dn_pass: 'supersecure', server_id: 'specdirectory', modify_ldifs: { 'specmodify1' => 'puppet:///specfiles/specmodify1.ldif', 'specmodify2' => 'puppet:///specfiles/specmodify2.ldif', }, add_ldifs: { 'specadd1' => 'puppet:///specfiles/specadd1.ldif', 'specadd2' => 'puppet:///specfiles/specadd2.ldif', }, base_load_ldifs: { 'specbaseload1' => 'puppet:///specfiles/specbaseload1.ldif', 'specbaseload2' => 'puppet:///specfiles/specbaseload2.ldif', }, } end it { is_expected.to compile } it { is_expected.to contain_ds_389__modify('specmodify1').with( server_id: 'specdirectory', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'foo.example.com', server_port: 389, starttls: false, source: 'puppet:///specfiles/specmodify1.ldif', user: 'dirsrv', group: 'dirsrv', ).that_requires('Ds_389::Ssl[specdirectory]') } it { is_expected.to contain_file('/etc/dirsrv/slapd-specdirectory/specmodify1.ldif') } it { is_expected.to contain_exec('Modify ldif specmodify1: specdirectory') } it { is_expected.to contain_ds_389__modify('specmodify2').with( server_id: 'specdirectory', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'foo.example.com', server_port: 389, starttls: false, source: 'puppet:///specfiles/specmodify2.ldif', user: 'dirsrv', group: 'dirsrv', ).that_requires('Ds_389::Ssl[specdirectory]') } it { is_expected.to contain_file('/etc/dirsrv/slapd-specdirectory/specmodify2.ldif') } it { is_expected.to contain_exec('Modify ldif specmodify2: specdirectory') } it { is_expected.to contain_ds_389__add('specadd1').with( server_id: 'specdirectory', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'foo.example.com', server_port: 389, starttls: false, source: 'puppet:///specfiles/specadd1.ldif', user: 'dirsrv', group: 'dirsrv', ) } it { is_expected.to contain_file('/etc/dirsrv/slapd-specdirectory/specadd1.ldif') } it { is_expected.to contain_exec('Add ldif specadd1: specdirectory') } it { is_expected.to contain_ds_389__add('specadd2').with( server_id: 'specdirectory', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'foo.example.com', server_port: 389, starttls: false, source: 'puppet:///specfiles/specadd2.ldif', user: 'dirsrv', group: 'dirsrv', ) } it { is_expected.to contain_file('/etc/dirsrv/slapd-specdirectory/specadd2.ldif') } it { is_expected.to contain_exec('Add ldif specadd2: specdirectory') } it { is_expected.to contain_ds_389__add('specbaseload1').with( server_id: 'specdirectory', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'foo.example.com', server_port: 389, starttls: false, source: 'puppet:///specfiles/specbaseload1.ldif', user: 'dirsrv', group: 'dirsrv', ) } it { is_expected.to contain_file('/etc/dirsrv/slapd-specdirectory/specbaseload1.ldif') } it { is_expected.to contain_exec('Add ldif specbaseload1: specdirectory') } it { is_expected.to contain_ds_389__add('specbaseload2').with( server_id: 'specdirectory', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'foo.example.com', server_port: 389, starttls: false, source: 'puppet:///specfiles/specbaseload2.ldif', user: 'dirsrv', group: 'dirsrv', ) } it { is_expected.to contain_file('/etc/dirsrv/slapd-specdirectory/specbaseload2.ldif') } it { is_expected.to contain_exec('Add ldif specbaseload2: specdirectory') } end context 'when using custom ds_389 params' do let(:pre_condition) do 'class {"::ds_389": user => "custom_user", group => "custom_group", cacerts_path => "/custom/cacerts/path", }' end let(:params) do { root_dn: 'cn=Directory Manager', suffix: 'dc=example,dc=com', cert_db_pass: 'secret', root_dn_pass: 'supersecure', server_id: 'specdirectory', } end it { is_expected.to compile } it { is_expected.to contain_file('/etc/dirsrv/slapd-specdirectory/pin.txt').with( ensure: 'file', mode: '0440', owner: 'custom_user', group: 'custom_group', content: "Internal (Software) Token:supersecure\n", ).that_requires('Exec[setup ds: specdirectory]').that_notifies( 'Exec[restart specdirectory to pick up new token]', ) } it { is_expected.to contain_exec('Set permissions on database directory: specdirectory').with( command: 'chown custom_user:custom_group /etc/dirsrv/slapd-specdirectory', refreshonly: true, ) } it { is_expected.to contain_file('/custom/cacerts/path/specdirectoryCA.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-specdirectory/specdirectoryCA.pem', ).that_requires('Exec[Export CA cert: specdirectory]').that_notifies( 'Exec[Rehash cacertdir: specdirectory]', ) } it { is_expected.to contain_file('/custom/cacerts/path/specdirectoryCert.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-specdirectory/specdirectoryCert.pem', ).that_requires('Exec[Export server cert: specdirectory]').that_notifies( 'Exec[Rehash cacertdir: specdirectory]', ) } case os_facts[:osfamily] when 'Debian' # rubocop:disable RepeatedExample it { is_expected.to contain_exec('setup ds: specdirectory').with( command: 'dscreate from-file /etc/dirsrv/template-specdirectory.inf', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-specdirectory', ) } it { is_expected.to contain_exec('Rehash cacertdir: specdirectory').with( command: 'openssl rehash /custom/cacerts/path', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } when 'RedHat' it { is_expected.to contain_exec('setup ds: specdirectory').with( command: 'dscreate from-file /etc/dirsrv/template-specdirectory.inf', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-specdirectory', ) } it { is_expected.to contain_exec('Rehash cacertdir: specdirectory').with( command: 'openssl rehash /custom/cacerts/path', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } end it { is_expected.to contain_ds_389__ssl('specdirectory').with( cert_name: 'specdirectoryCert', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'foo.example.com', server_port: 389, user: 'custom_user', group: 'custom_group', minssf: 0, ssl_version_min: 'TLS1.1', ) } end end context 'with all params' do let(:params) do { root_dn: 'cn=Directory Manager', suffix: 'dc=test,dc=org', cert_db_pass: 'secret', root_dn_pass: 'supersecure', group: 'custom_group', user: 'custom_user', server_id: 'ldap01', server_host: 'ldap.test.org', server_port: 1389, server_ssl_port: 1636, minssf: 128, subject_alt_names: ['ldap01.test.org', 'ldap02.test.org'], } end it { is_expected.to compile } it { is_expected.to contain_file('/etc/dirsrv/slapd-ldap01/pin.txt').with( ensure: 'file', mode: '0440', owner: 'custom_user', group: 'custom_group', content: "Internal (Software) Token:supersecure\n", ).that_requires('Exec[setup ds: ldap01]').that_notifies( 'Exec[restart ldap01 to pick up new token]', ) } case os_facts[:osfamily] when 'Debian' it { is_expected.to contain_exec('setup ds: ldap01').with( command: 'dscreate from-file /etc/dirsrv/template-ldap01.inf', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-ldap01', ) } it { is_expected.to contain_exec('Rehash cacertdir: ldap01').with( command: 'openssl rehash /etc/openldap/cacerts', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } case os_facts[:operatingsystemmajrelease] when '10', '20.04' it { is_expected.to contain_exec('stop ldap01 to create new token').with( command: 'systemctl stop dirsrv@ldap01 ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } it { is_expected.to contain_exec('restart ldap01 to pick up new token').with( command: 'systemctl restart dirsrv@ldap01 ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } else it { is_expected.to contain_exec('stop ldap01 to create new token').with( command: 'service dirsrv stop ldap01 ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } it { is_expected.to contain_exec('restart ldap01 to pick up new token').with( command: 'service dirsrv restart ldap01 ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } end when 'RedHat' it { is_expected.to contain_exec('setup ds: ldap01').with( command: 'dscreate from-file /etc/dirsrv/template-ldap01.inf', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-ldap01', ) } it { is_expected.to contain_exec('Rehash cacertdir: ldap01').with( command: 'openssl rehash /etc/openldap/cacerts', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } case os_facts[:operatingsystemmajrelease] when '8' it { is_expected.to contain_exec('stop ldap01 to create new token').with( command: 'systemctl stop dirsrv@ldap01 ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } it { is_expected.to contain_exec('restart ldap01 to pick up new token').with( command: 'systemctl restart dirsrv@ldap01 ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } else it { is_expected.to contain_exec('stop ldap01 to create new token').with( command: 'service dirsrv stop ldap01 ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } it { is_expected.to contain_exec('restart ldap01 to pick up new token').with( command: 'service dirsrv restart ldap01 ; sleep 2', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } end end # rubocop:enable RepeatedExample it { is_expected.to contain_exec('Generate noise file: ldap01').with( command: %r{echo \d+ | sha256sum | awk '{print $1}' > /tmp/noisefile-ldap01}, path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_subscribes_to('Exec[stop ldap01 to create new token]').that_notifies( 'Exec[Generate password file: ldap01]', ) } it { is_expected.to contain_exec('Generate password file: ldap01').with( command: 'echo supersecure > /tmp/passfile-ldap01', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies('Exec[Create cert DB: ldap01]') } it { is_expected.to contain_exec('Create cert DB: ldap01').with( command: 'certutil -N -d /etc/dirsrv/slapd-ldap01 -f /tmp/passfile-ldap01', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies('Ssl_pkey[Generate CA private key: ldap01]') } it { is_expected.to contain_ssl_pkey('Generate CA private key: ldap01').with( size: 4096, ) } it { is_expected.to contain_x509_cert('Create CA cert: ldap01').with( days: 3650, req_ext: false, ) } it { is_expected.to contain_exec('Add trust for CA: ldap01').with( command: 'certutil -M -n "ldap01CA" -t CT,C,C -d /etc/dirsrv/slapd-ldap01 -f /tmp/passfile-ldap01', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-ldap01 | grep "ldap01CA" | grep "CTu,Cu,Cu"', ).that_notifies('Exec[Export CA cert: ldap01]') } it { is_expected.to contain_exec('Make server cert and add to database: ldap01').with( cwd: '/etc/dirsrv/slapd-ldap01', command: 'certutil -S -n "ldap01Cert" -m 101 -s "cn=ldap.test.org" -c "ldap01CA" -t "u,u,u" -v 120 -d /etc/dirsrv/slapd-ldap01 -k rsa -z /tmp/noisefile-ldap01 -f /tmp/passfile-ldap01 -8 ldap01.test.org,ldap02.test.org && sleep 2', # rubocop:disable LineLength path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies( [ 'Exec[Set permissions on database directory: ldap01]', 'Exec[Clean up temp files: ldap01]', 'Exec[Add trust for server cert: ldap01]', ], ) } it { is_expected.to contain_exec('Add trust for server cert: ldap01').with( command: 'certutil -M -n "ldap01Cert" -t u,u,u -d /etc/dirsrv/slapd-ldap01', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-ldap01 | grep "ldap01Cert" | grep "u,u,u"', ).that_notifies('Exec[Export server cert: ldap01]') } it { is_expected.to contain_exec('Set permissions on database directory: ldap01').with( command: 'chown custom_user:custom_group /etc/dirsrv/slapd-ldap01', refreshonly: true, ) } it { is_expected.to contain_exec('Export CA cert: ldap01').with( cwd: '/etc/dirsrv/slapd-ldap01', command: 'certutil -d /etc/dirsrv/slapd-ldap01 -L -n "ldap01CA" -a > /etc/dirsrv/slapd-ldap01/ldap01CA.pem', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-ldap01/ldap01CA.pem', ) } it { is_expected.to contain_file('/etc/openldap/cacerts/ldap01CA.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-ldap01/ldap01CA.pem', ).that_requires('Exec[Export CA cert: ldap01]').that_notifies( 'Exec[Rehash cacertdir: ldap01]', ) } it { is_expected.to contain_exec('Clean up temp files: ldap01').with( command: 'rm -f /tmp/noisefile-ldap01 /tmp/passfile-ldap01', refreshonly: true, ) } it { is_expected.to contain_exec('Export server cert: ldap01').with( cwd: '/etc/dirsrv/slapd-ldap01', command: 'certutil -d /etc/dirsrv/slapd-ldap01 -L -n "ldap01Cert" -a > ldap01Cert.pem', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-ldap01/ldap01Cert.pem', ) } it { is_expected.to contain_file('/etc/openldap/cacerts/ldap01Cert.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-ldap01/ldap01Cert.pem', ).that_requires('Exec[Export server cert: ldap01]').that_notifies( 'Exec[Rehash cacertdir: ldap01]', ) } it { is_expected.to contain_ds_389__ssl('ldap01').with( cert_name: 'ldap01Cert', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'ldap.test.org', server_port: 1389, user: 'custom_user', group: 'custom_group', minssf: 128, ssl_version_min: 'TLS1.1', ) } it { is_expected.to contain_ds_389__service('ldap01') } it { is_expected.to contain_exec('Import ssl ldif: ldap01') } it { is_expected.to contain_file('/etc/dirsrv/slapd-ldap01/ssl.ldif') } it { is_expected.to contain_service('dirsrv@ldap01') } it { is_expected.not_to contain_concat__fragment('ldap01_cert') } it { is_expected.not_to contain_concat__fragment('ldap01_ca_bundle') } it { is_expected.not_to contain_concat__fragment('ldap01_key') } it { is_expected.not_to contain_concat('ldap01_cert_bundle') } it { is_expected.not_to contain_exec('Create pkcs12 cert: ldap01') } it { is_expected.not_to contain_exec('Add trust for CA0: ldap01') } it { is_expected.not_to contain_exec('Export CA cert 0: ldap01') } it { is_expected.not_to contain_file('/etc/openldap/cacerts/ldap01CA0.pem') } context 'when importing an external ssl cert bundle' do let(:params) do { root_dn: 'cn=Directory Manager', suffix: 'dc=test,dc=org', cert_db_pass: 'secret', root_dn_pass: 'supersecure', group: 'custom_group', user: 'custom_user', server_id: 'ldap01', server_host: 'ldap.test.org', server_port: 1389, server_ssl_port: 1636, subject_alt_names: ['ldap01.test.org', 'ldap02.test.org'], ssl: { 'cert_path' => 'puppet:///specfiles/ssl_cert.pem', 'key_path' => 'puppet:///specfiles/ssl_key.pem', 'ca_bundle_path' => 'puppet:///specfiles/ssl_ca.pem', 'ca_cert_names' => [ 'Spec Intermediate Certificate', 'Spec Root Certificate', ], 'cert_name' => 'Spec Certificate', }, } end it { is_expected.to compile } it { is_expected.to contain_concat__fragment('ldap01_cert').with( target: 'ldap01_cert_bundle', source: 'puppet:///specfiles/ssl_cert.pem', order: '0', ) } it { is_expected.to contain_concat__fragment('ldap01_ca_bundle').with( target: 'ldap01_cert_bundle', source: 'puppet:///specfiles/ssl_ca.pem', order: '1', ) } it { is_expected.to contain_concat__fragment('ldap01_key').with( target: 'ldap01_cert_bundle', source: 'puppet:///specfiles/ssl_key.pem', order: '2', ) } case os_facts[:osfamily] when 'Debian' it { is_expected.to contain_concat('ldap01_cert_bundle').with( mode: '0600', path: '/etc/ssl/ldap01-bundle.pem', ).that_notifies('Exec[Create pkcs12 cert: ldap01]') } it { is_expected.to contain_exec('Create pkcs12 cert: ldap01').with( command: 'openssl pkcs12 -export -password pass:secret -name ldap.test.org -in /etc/ssl/ldap01-bundle.pem -out /etc/ssl/ldap01.p12', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies('Exec[Create cert DB: ldap01]') } it { is_expected.to contain_exec('Create cert DB: ldap01').with( command: 'pk12util -i /etc/ssl/ldap01.p12 -d /etc/dirsrv/slapd-ldap01 -W secret -K supersecure', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } when 'RedHat' it { is_expected.to contain_concat('ldap01_cert_bundle').with( mode: '0600', path: '/etc/pki/tls/certs/ldap01-bundle.pem', ).that_notifies('Exec[Create pkcs12 cert: ldap01]') } it { is_expected.to contain_exec('Create pkcs12 cert: ldap01').with( command: 'openssl pkcs12 -export -password pass:secret -name ldap.test.org -in /etc/pki/tls/certs/ldap01-bundle.pem -out /etc/pki/tls/certs/ldap01.p12', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ).that_notifies('Exec[Create cert DB: ldap01]') } it { is_expected.to contain_exec('Create cert DB: ldap01').with( command: 'pk12util -i /etc/pki/tls/certs/ldap01.p12 -d /etc/dirsrv/slapd-ldap01 -W secret -K supersecure', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) } end it { is_expected.to contain_exec('Add trust for CA0: ldap01').with( command: 'certutil -M -n "Spec Intermediate Certificate" -t CT,, -d /etc/dirsrv/slapd-ldap01', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-ldap01 | grep "Spec Intermediate Certificate" | grep "CT"', ).that_requires('Exec[Create cert DB: ldap01]').that_notifies('Exec[Export CA cert 0: ldap01]') } it { is_expected.to contain_exec('Export CA cert 0: ldap01').with( cwd: '/etc/dirsrv/slapd-ldap01', command: 'certutil -d /etc/dirsrv/slapd-ldap01 -L -n "Spec Intermediate Certificate" -a > ldap01CA0.pem', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-ldap01/ldap01CA0.pem', ) } it { is_expected.to contain_file('/etc/openldap/cacerts/ldap01CA0.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-ldap01/ldap01CA0.pem', ).that_requires('Exec[Export CA cert 0: ldap01]').that_notifies('Exec[Rehash cacertdir: ldap01]') } it { is_expected.to contain_exec('Add trust for CA1: ldap01').with( command: 'certutil -M -n "Spec Root Certificate" -t CT,, -d /etc/dirsrv/slapd-ldap01', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-ldap01 | grep "Spec Root Certificate" | grep "CT"', ).that_requires('Exec[Create cert DB: ldap01]').that_notifies('Exec[Export CA cert 1: ldap01]') } it { is_expected.to contain_exec('Export CA cert 1: ldap01').with( cwd: '/etc/dirsrv/slapd-ldap01', command: 'certutil -d /etc/dirsrv/slapd-ldap01 -L -n "Spec Root Certificate" -a > ldap01CA1.pem', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-ldap01/ldap01CA1.pem', ) } it { is_expected.to contain_file('/etc/openldap/cacerts/ldap01CA1.pem').with( ensure: 'file', source: '/etc/dirsrv/slapd-ldap01/ldap01CA1.pem', ).that_requires('Exec[Export CA cert 1: ldap01]').that_notifies('Exec[Rehash cacertdir: ldap01]') } it { is_expected.to contain_exec('Add trust for server cert: ldap01').with( command: 'certutil -M -n "Spec Certificate" -t u,u,u -d /etc/dirsrv/slapd-ldap01', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', unless: 'certutil -L -d /etc/dirsrv/slapd-ldap01 | grep "Spec Certificate" | grep "u,u,u"', ).that_notifies('Exec[Export server cert: ldap01]') } it { is_expected.not_to contain_exec('Generate noise file: ldap01') } it { is_expected.not_to contain_exec('Generate password file: ldap01') } end context 'when setting up replication' do let(:params) do { root_dn: 'cn=Directory Manager', suffix: 'dc=test,dc=org', cert_db_pass: 'secret', root_dn_pass: 'supersecure', group: 'custom_group', user: 'custom_user', server_id: 'ldap01', server_host: 'ldap.test.org', server_port: 1389, server_ssl_port: 1636, subject_alt_names: ['ldap01.test.org', 'ldap02.test.org'], minssf: 128, replication: { 'bind_dn' => 'cn=Replication Manager,cn=config', 'replication_pass' => 'supersecret', 'role' => 'consumer', }, } end it { is_expected.to compile } it { is_expected.to contain_ds_389__replication('ldap01').with( replication_pass: 'supersecret', role: 'consumer', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', suffix: 'dc=test,dc=org', server_host: 'ldap.test.org', server_port: 1389, starttls: true, user: 'custom_user', group: 'custom_group', ).that_requires('Ds_389::Ssl[ldap01]') } it { is_expected.to contain_exec('Add replication user: ldap01') } it { is_expected.to contain_file('/etc/dirsrv/slapd-ldap01/replication-user.ldif') } it { is_expected.to contain_anchor('ldap01_replication_suppliers').that_requires('Exec[Add replication user: ldap01]') } it { is_expected.to contain_anchor('ldap01_replication_hubs').that_requires('Anchor[ldap01_replication_suppliers]') } it { is_expected.to contain_anchor('ldap01_replication_consumers').that_requires('Anchor[ldap01_replication_hubs]') } end context 'when loading additional ldifs' do let(:params) do { root_dn: 'cn=Directory Manager', suffix: 'dc=test,dc=org', cert_db_pass: 'secret', root_dn_pass: 'supersecure', group: 'custom_group', user: 'custom_user', server_id: 'ldap01', server_host: 'ldap.test.org', server_port: 1389, server_ssl_port: 1636, subject_alt_names: ['ldap01.test.org', 'ldap02.test.org'], minssf: 128, modify_ldifs: { 'specmodify1' => 'puppet:///specfiles/specmodify1.ldif', 'specmodify2' => 'puppet:///specfiles/specmodify2.ldif', }, add_ldifs: { 'specadd1' => 'puppet:///specfiles/specadd1.ldif', 'specadd2' => 'puppet:///specfiles/specadd2.ldif', }, base_load_ldifs: { 'specbaseload1' => 'puppet:///specfiles/specbaseload1.ldif', 'specbaseload2' => 'puppet:///specfiles/specbaseload2.ldif', }, } end it { is_expected.to compile } it { is_expected.to contain_anchor('specdirectory_ldif_modify').that_requires('Service[dirsrv@ldap01]') } it { is_expected.to contain_anchor('specdirectory_ldif_add') } it { is_expected.to contain_anchor('specdirectory_ldif_base_load') } it { is_expected.to contain_ds_389__modify('specmodify1').with( server_id: 'ldap01', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'ldap.test.org', server_port: 1389, starttls: true, source: 'puppet:///specfiles/specmodify1.ldif', user: 'custom_user', group: 'custom_group', ).that_requires('Anchor[specdirectory_ldif_modify]').that_comes_before('Anchor[specdirectory_ldif_add]') } it { is_expected.to contain_file('/etc/dirsrv/slapd-ldap01/specmodify1.ldif') } it { is_expected.to contain_exec('Modify ldif specmodify1: ldap01') } it { is_expected.to contain_ds_389__modify('specmodify2').with( server_id: 'ldap01', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'ldap.test.org', server_port: 1389, starttls: true, source: 'puppet:///specfiles/specmodify2.ldif', user: 'custom_user', group: 'custom_group', ).that_requires('Anchor[specdirectory_ldif_modify]').that_comes_before('Anchor[specdirectory_ldif_add]') } it { is_expected.to contain_file('/etc/dirsrv/slapd-ldap01/specmodify2.ldif') } it { is_expected.to contain_exec('Modify ldif specmodify2: ldap01') } it { is_expected.to contain_ds_389__add('specadd1').with( server_id: 'ldap01', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'ldap.test.org', server_port: 1389, starttls: true, source: 'puppet:///specfiles/specadd1.ldif', user: 'custom_user', group: 'custom_group', ).that_requires('Anchor[specdirectory_ldif_add]').that_comes_before('Anchor[specdirectory_ldif_base_load]') } it { is_expected.to contain_file('/etc/dirsrv/slapd-ldap01/specadd1.ldif') } it { is_expected.to contain_exec('Add ldif specadd1: ldap01') } it { is_expected.to contain_ds_389__add('specadd2').with( server_id: 'ldap01', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'ldap.test.org', server_port: 1389, starttls: true, source: 'puppet:///specfiles/specadd2.ldif', user: 'custom_user', group: 'custom_group', ).that_requires('Anchor[specdirectory_ldif_add]').that_comes_before('Anchor[specdirectory_ldif_base_load]') } it { is_expected.to contain_file('/etc/dirsrv/slapd-ldap01/specadd2.ldif') } it { is_expected.to contain_exec('Add ldif specadd2: ldap01') } it { is_expected.to contain_ds_389__add('specbaseload1').with( server_id: 'ldap01', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'ldap.test.org', server_port: 1389, starttls: true, source: 'puppet:///specfiles/specbaseload1.ldif', user: 'custom_user', group: 'custom_group', ).that_requires('Anchor[specdirectory_ldif_base_load]') } it { is_expected.to contain_file('/etc/dirsrv/slapd-ldap01/specbaseload1.ldif') } it { is_expected.to contain_exec('Add ldif specbaseload1: ldap01') } it { is_expected.to contain_ds_389__add('specbaseload2').with( server_id: 'ldap01', root_dn: 'cn=Directory Manager', root_dn_pass: 'supersecure', server_host: 'ldap.test.org', server_port: 1389, starttls: true, source: 'puppet:///specfiles/specbaseload2.ldif', user: 'custom_user', group: 'custom_group', ).that_requires('Anchor[specdirectory_ldif_base_load]') } it { is_expected.to contain_file('/etc/dirsrv/slapd-ldap01/specbaseload2.ldif') } it { is_expected.to contain_exec('Add ldif specbaseload2: ldap01') } end end end end end
42.930144
274
0.549656
9c896222e832cae66257d628eec6400fcd75f1b5
4,750
hpp
C++
src/fly/net/connection.hpp
lichuan/fly
7927f819f74997314fb526c5d8ab4d88ea593b91
[ "Apache-2.0" ]
60
2015-06-23T12:36:33.000Z
2022-03-09T01:27:14.000Z
src/fly/net/connection.hpp
lichuan/fly
7927f819f74997314fb526c5d8ab4d88ea593b91
[ "Apache-2.0" ]
1
2021-12-21T11:23:04.000Z
2021-12-21T11:23:04.000Z
src/fly/net/connection.hpp
lichuan/fly
7927f819f74997314fb526c5d8ab4d88ea593b91
[ "Apache-2.0" ]
30
2015-08-03T07:22:04.000Z
2022-01-13T08:49:48.000Z
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * _______ _ * * ( ____ \ ( \ |\ /| * * | ( \/ | ( ( \ / ) * * | (__ | | \ (_) / * * | __) | | \ / * * | ( | | ) ( * * | ) | (____/\ | | * * |/ (_______/ \_/ * * * * * * fly is an awesome c++11 network library. * * * * @author: lichuan * * @qq: 308831759 * * @email: 308831759@qq.com * * @github: https://github.com/lichuan/fly * * @date: 2015-06-22 17:15:25 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef FLY__NET__CONNECTION #define FLY__NET__CONNECTION #include <memory> #include "fly/net/addr.hpp" #include "fly/net/message.hpp" #include "fly/net/message_chunk_queue.hpp" namespace fly { namespace net { template<typename T> class Poller_Executor; template<typename T> class Client; template<typename T> class Server; template<typename T> class Message; template<typename T> class Connection {}; //json protocol template<> class Connection<Json> : public std::enable_shared_from_this<Connection<Json>> { friend class Poller_Executor<Json>; friend class Server<Json>; friend class Client<Json>; public: Connection(int32 fd, const Addr &peer_addr); ~Connection(); uint64 id(); void close(); bool closed(); void send(const void *data, uint32 size); void send(rapidjson::Document &doc); const Addr& peer_addr(); bool is_passive(); void set_passive(bool is_passive); std::string key() const; void key(std::string k); private: int32 m_fd; void parse(); uint64 m_id = 0; uint32 m_max_msg_length = 0; uint32 m_cur_msg_length = 0; bool m_stop_parse = false; Addr m_peer_addr; bool m_is_passive; std::string m_key; std::atomic<bool> m_closed {false}; std::shared_ptr<Connection> m_self; //add ref Message_Chunk_Queue m_recv_msg_queue; Message_Chunk_Queue m_send_msg_queue; Poller_Executor<Json> *m_poller_executor = nullptr; static fly::base::ID_Allocator m_id_allocator; std::function<void(std::shared_ptr<Connection>)> m_close_cb; std::function<void(std::shared_ptr<Connection>)> m_be_closed_cb; std::function<bool(std::shared_ptr<Connection>)> m_init_cb; std::function<void(std::unique_ptr<Message<Json>>)> m_dispatch_cb; }; //websocket protocol template<> class Connection<Wsock> : public std::enable_shared_from_this<Connection<Wsock>> { friend class Poller_Executor<Wsock>; friend class Server<Wsock>; friend class Client<Wsock>; public: Connection(int32 fd, const Addr &peer_addr); ~Connection(); uint64 id(); void close(); bool closed(); void send(const void *data, uint32 size); void send(rapidjson::Document &doc); const Addr& peer_addr(); bool is_passive(); void set_passive(bool is_passive); std::string key() const; void key(std::string k); private: void send_raw(const void *data, uint32 size); void parse(); int32 m_fd; uint64 m_id = 0; uint32 m_max_msg_length = 0; uint8 m_cur_msg_length = 0; uint64 m_cur_msg_length_1 = 0; bool m_stop_parse = false; bool m_is_passive; bool m_handshake_phase = true; Addr m_peer_addr; std::string m_key; std::atomic<bool> m_closed {false}; std::shared_ptr<Connection> m_self; //add ref Message_Chunk_Queue m_recv_msg_queue; Message_Chunk_Queue m_send_msg_queue; Poller_Executor<Wsock> *m_poller_executor = nullptr; static fly::base::ID_Allocator m_id_allocator; std::function<void(std::shared_ptr<Connection>)> m_close_cb; std::function<void(std::shared_ptr<Connection>)> m_be_closed_cb; std::function<bool(std::shared_ptr<Connection>)> m_init_cb; std::function<void(std::unique_ptr<Message<Wsock>>)> m_dispatch_cb; }; } } #endif
33.216783
80
0.520211
92c04c469e95a7d4cf1f91ad0d44f73a4d04055f
1,515
h
C
DanDanPlayForiOS/Model/DDPLibrary.h
kansaer/DanDanPlayForiOS
9ce3831cb3807bdff07850b5f41588ee0c76f310
[ "MIT" ]
5
2021-02-05T20:24:39.000Z
2021-12-05T08:35:23.000Z
DanDanPlayForiOS/Model/DDPLibrary.h
kansaer/DanDanPlayForiOS
9ce3831cb3807bdff07850b5f41588ee0c76f310
[ "MIT" ]
8
2021-04-21T09:08:13.000Z
2021-06-06T16:13:44.000Z
DanDanPlayForiOS/Model/DDPLibrary.h
kansaer/DanDanPlayForiOS
9ce3831cb3807bdff07850b5f41588ee0c76f310
[ "MIT" ]
2
2021-04-05T06:17:47.000Z
2021-12-05T08:35:28.000Z
// // DDPLibrary.h // DanDanPlayForiOS // // Created by JimHuang on 2017/9/14. // Copyright © 2017年 JimHuang. All rights reserved. // 媒体库文件 #import "DDPBase.h" #import "DDPFile.h" @interface DDPLibrary : DDPBase /* identity -> AnimeId md5 -> Hash Name为此视频的文件名(去除路径信息) */ /** 弹幕库编号 */ @property (assign, nonatomic) NSUInteger episodeId; /** 主标题 */ @property (copy, nonatomic) NSString *animeTitle; /** 子标题 */ @property (copy, nonatomic) NSString *episodeTitle; /** 为此视频的特征码 */ @property (copy, nonatomic) NSString *md5; /** 此视频在硬盘上的完整路径 */ @property (copy, nonatomic) NSString *path; /** 文件体积,单位为Byte */ @property (assign, nonatomic) NSUInteger size; /** 用户对此视频内容的打分,目前全部为0 */ @property (assign, nonatomic) NSUInteger rate; /** 弹弹play媒体库收录此视频的时间 2016-12-12T00:54:14 */ @property (copy, nonatomic) NSString *created; /** 上次使用弹弹play播放此视频的时间 */ @property (copy, nonatomic) NSString *lastPlay; /** 视频时长,单位为秒 */ @property (assign, nonatomic) NSUInteger duration; /** 播放器使用的id */ @property (copy, nonatomic) NSString *playId; #pragma mark - /api/v1/current/video 返回 /** 为当前进度,取值范围0-1; */ @property (assign, nonatomic) CGFloat position; /** 为当前视频是否支持跳转进度,部分流媒体视频和直播视频不支持跳转; */ @property (assign, nonatomic) BOOL seekable; /** 当前播放器声音大小,取值范围0-100 */ @property (assign, nonatomic) NSUInteger volume; /** 当前播放器状态 旧版本可能不存在 所以需要判空 Bool */ @property (strong, nonatomic) NSNumber *playing; #pragma mark - 自定义属性 @property (assign, nonatomic) DDPFileType fileType; @end
14.852941
52
0.691749
8e1cd8bb354880e768d6dab244a1ffd4c56e291a
1,546
dart
Dart
lib/main/workoutList.dart
mishc9/fit_wheel
02ba9cb9c7ccc9c9e915c949a2f021a8ad88d459
[ "MIT" ]
null
null
null
lib/main/workoutList.dart
mishc9/fit_wheel
02ba9cb9c7ccc9c9e915c949a2f021a8ad88d459
[ "MIT" ]
null
null
null
lib/main/workoutList.dart
mishc9/fit_wheel
02ba9cb9c7ccc9c9e915c949a2f021a8ad88d459
[ "MIT" ]
null
null
null
import 'dart:async'; import 'package:fit_wheel/main/workoutRepr.dart'; import 'package:fit_wheel/planner/suggestor.dart'; import 'package:fit_wheel/workout.dart'; import 'package:flutter/material.dart'; class WorkoutListView extends StatefulWidget { final List<Workout> workouts; final WorkoutSuggestor suggestor; final Function() notifyParent; WorkoutListView( {Key? key, required this.workouts, required this.suggestor, required this.notifyParent}) : super(key: key); @override WorkoutListViewState createState() => WorkoutListViewState(); } class WorkoutListViewState extends State<WorkoutListView> { @override Widget build(BuildContext context) { // TODO: implement build return Expanded( child: ListView.builder( itemCount: widget.workouts.length, itemBuilder: (BuildContext context, int index) { return Card( child: Column( mainAxisSize: MainAxisSize.min, children: <Widget>[ ListTile( leading: const Icon(Icons.task), title: Text(widget.workouts[index].title), subtitle: Text(widget.workouts[index].contents.toString()), ), WorkoutReprWidget( workouts: widget.workouts, suggestor: widget.suggestor, index: index, notifyParent: widget.notifyParent), ], ), ); // Text(vehicles[index].toString()); }, )); } }
28.62963
75
0.615136
711a19199e56af6fe3dd389b9c16bd1a5e6c8927
2,318
ts
TypeScript
src/pages/api/axisnow/[isbn]/[vaultId].ts
NYPL-Simplified/circulation-patron-web
fce7c5fcd0eabaee09223f74a30e86e78ec1624d
[ "Apache-2.0" ]
4
2020-08-27T13:57:16.000Z
2022-03-14T19:03:13.000Z
src/pages/api/axisnow/[isbn]/[vaultId].ts
NYPL-Simplified/circulation-patron-web
fce7c5fcd0eabaee09223f74a30e86e78ec1624d
[ "Apache-2.0" ]
342
2016-07-14T17:35:57.000Z
2022-03-30T20:39:25.000Z
src/pages/api/axisnow/[isbn]/[vaultId].ts
NYPL-Simplified/circulation-patron-web
fce7c5fcd0eabaee09223f74a30e86e78ec1624d
[ "Apache-2.0" ]
7
2017-12-18T16:37:44.000Z
2022-03-24T21:26:20.000Z
/* eslint-disable camelcase */ import Decryptor from "@nypl-simplified-packages/axisnow-access-control-web"; import { RemoteFetcher, Epub } from "@nypl/epub-to-webpub"; import { NextApiHandler } from "next"; import extractParam from "dataflow/utils"; import track from "analytics/track"; /** * This is a handler for Open eBooks Axisnow encrypted EPUBS. * eg: http://localhost:3000/api/axisnow/[isbn]/[vaultId] */ const epubToWebpub: NextApiHandler = async (req, res) => { const book_vault_uuid = extractParam(req.query, "vaultId"); const isbn = extractParam(req.query, "isbn"); if (!Decryptor) { return res.status(500).json({ title: "Missing AxisNow Decryptor", detail: "@nypl-simplified-packages/axisnow-access-control-web package was not included in build.", status: 500 }); } try { const decryptor = await Decryptor.createDecryptor({ book_vault_uuid, isbn }); const containerXmlHref = decryptor?.containerUrl; const fetcher = new RemoteFetcher(containerXmlHref, decryptor); const epub = await Epub.build(containerXmlHref, fetcher, { useRelativeHrefs: false, decryptor, isAxisNow: true }); const manifest = await epub.webpubManifest; /** * Set browser cache-control: * - public: the manifest for a given book_vault_uuid and isbn shouldn't change * and thus it can be stored in a shared cache. * - s-maxage=49: A value is considered "fresh" for 1 minute. It won't be revalidated. * - stale-while-revalidate=86400: If the same request is made within one day, * revalidate in the background but serve the cached response first. */ res.setHeader( "Cache-Control", "private, s-maxage=59, stale-while-revalidate=86400" ); res.status(200).json(manifest); return; } catch (e) { if (e instanceof Error) { console.error(e); track.error(e); res.status(500).json({ title: "Epub Conversion Failure", detail: e.message, status: 500 }); return; } track.error(new Error("Unknown EPUB Conversion Failure")); res.status(500).json({ title: "Epub Conversion Failure", detail: "Unknown Error", status: 500 }); return; } }; export default epubToWebpub;
31.324324
98
0.654875
4abc9c7619f9d5a027af360a931a95384d7db499
966
cs
C#
ishjarta/Assets/Editor/AssetBundleBuilder.cs
FragonGamer/ishjarta
ac37fa862d1746b3755d61b0b213dd04252d99c0
[ "Unlicense" ]
null
null
null
ishjarta/Assets/Editor/AssetBundleBuilder.cs
FragonGamer/ishjarta
ac37fa862d1746b3755d61b0b213dd04252d99c0
[ "Unlicense" ]
63
2021-12-05T17:15:18.000Z
2022-03-19T19:35:31.000Z
ishjarta/Assets/Editor/AssetBundleBuilder.cs
FragonGamer/ishjarta
ac37fa862d1746b3755d61b0b213dd04252d99c0
[ "Unlicense" ]
1
2022-02-06T18:29:36.000Z
2022-02-06T18:29:36.000Z
using System.IO; using System.Text; using UnityEditor; using UnityEngine; public class AssetBundleBuilder { [MenuItem("Assets/Build AssetBundles")] static void BuildAllAssetBundles() { string assetBundleDirectory = $"Assets/StreamingAssets"; if (!Directory.Exists(assetBundleDirectory)) { Directory.CreateDirectory(assetBundleDirectory); } BuildPipeline.BuildAssetBundles(assetBundleDirectory, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows); AssetDatabase.Refresh(); } public class GetAssetBundleNames { [MenuItem("Assets/Get Asset Bundle names")] static void GetNames() { var names = AssetDatabase.GetAllAssetBundleNames(); foreach (string name in names) Debug.Log("Asset Bundle: " + name); } } }
28.411765
71
0.594203
b21d5f0a9baf68cab802182e82eb227c15f4f3ac
1,364
kt
Kotlin
editor/core/src/main/kotlin/com/jdiazcano/modulartd/plugins/bundled/AboutPlugin.kt
jdiazcano/modulartd
da72ab2ac1da8b0dab0358b8d310b5a99a9bb079
[ "Apache-2.0" ]
1
2016-11-11T14:47:22.000Z
2016-11-11T14:47:22.000Z
editor/core/src/main/kotlin/com/jdiazcano/modulartd/plugins/bundled/AboutPlugin.kt
jdiazcano/modulartd
da72ab2ac1da8b0dab0358b8d310b5a99a9bb079
[ "Apache-2.0" ]
null
null
null
editor/core/src/main/kotlin/com/jdiazcano/modulartd/plugins/bundled/AboutPlugin.kt
jdiazcano/modulartd
da72ab2ac1da8b0dab0358b8d310b5a99a9bb079
[ "Apache-2.0" ]
null
null
null
package com.jdiazcano.modulartd.plugins.bundled import com.badlogic.gdx.Input import com.jdiazcano.modulartd.keys.Modifiers import com.jdiazcano.modulartd.keys.ShortCut import com.jdiazcano.modulartd.plugins.Plugin import com.jdiazcano.modulartd.plugins.actions.Action import com.jdiazcano.modulartd.plugins.actions.Menus import com.jdiazcano.modulartd.plugins.actions.RegisterAction import com.jdiazcano.modulartd.plugins.actions.SeparatorPlace import com.jdiazcano.modulartd.plugins.ui.StageWrapper import com.jdiazcano.modulartd.utils.translate import com.kotcrab.vis.ui.widget.VisWindow class AboutPlugin : Plugin { override fun getName() = "About plugin" override fun getVersion() = 1 override fun getMinimumCompatibleVersion() = 1 override fun getPrefix() = "About" override fun onLoad() {} override fun onUnload() {} @RegisterAction(Menus.HELP) fun About() = AboutAction() } class AboutAction : Action("help.about", translate("help.about"), ShortCut(Input.Keys.Q, Modifiers(control = true)), SeparatorPlace.ABOVE) { override fun perform(stage: StageWrapper) { val window = VisWindow(translate("help.about")) window.closeOnEscape() window.addCloseButton() window.add("By me!!") // TODO add a proper about window.setCenterOnAdd(true) stage.addWindow(window) } }
32.47619
140
0.748534
24d791deb08cbec682aa2d62ff22e9d5d4623a3a
1,483
go
Go
models/issue_stopwatch_test.go
jonasfranz/gitea
d26f4da2fea361b7c7c24193ce62018c8a17a4a8
[ "MIT" ]
null
null
null
models/issue_stopwatch_test.go
jonasfranz/gitea
d26f4da2fea361b7c7c24193ce62018c8a17a4a8
[ "MIT" ]
null
null
null
models/issue_stopwatch_test.go
jonasfranz/gitea
d26f4da2fea361b7c7c24193ce62018c8a17a4a8
[ "MIT" ]
null
null
null
package models import ( "github.com/stretchr/testify/assert" "testing" "time" ) func TestGetStopwatchByID(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) sw, err := GetStopwatchByID(1) assert.Equal(t, sw.CreatedUnix, int64(1500988502)) assert.Equal(t, sw.UserID, int64(1)) // Tue Jul 25 13:15:02 2017 UTC assert.Equal(t, sw.Created, time.Unix(1500988502, 0)) assert.NoError(t, err) sw, err = GetStopwatchByID(3) assert.Error(t, err) assert.Equal(t, true, IsErrStopwatchNotExist(err)) } func TestCancelStopwatch(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) err := CancelStopwatch(1, 1) assert.NoError(t, err) AssertNotExistsBean(t, &Stopwatch{UserID: 1, IssueID: 1}) _ = AssertExistsAndLoadBean(t, &Comment{Type: CommentTypeCancelTracking, PosterID: 1, IssueID: 1}) assert.Nil(t, CancelStopwatch(1, 2)) } func TestStopwatchExists(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) assert.True(t, StopwatchExists(1, 1)) assert.False(t, StopwatchExists(1, 2)) } func TestCreateOrStopIssueStopwatch(t *testing.T) { assert.NoError(t, PrepareTestDatabase()) assert.NoError(t, CreateOrStopIssueStopwatch(3, 1)) sw := AssertExistsAndLoadBean(t, &Stopwatch{UserID: 3, IssueID: 1}).(*Stopwatch) assert.Equal(t, true, sw.Created.Before(time.Now())) assert.NoError(t, CreateOrStopIssueStopwatch(2, 2)) AssertNotExistsBean(t, &Stopwatch{UserID: 2, IssueID: 2}) AssertExistsAndLoadBean(t, &TrackedTime{UserID: 2, IssueID: 2}) }
27.462963
99
0.737694
4a0860dc989925e41620da1fd2f37f9d32138c67
7,875
cpp
C++
src/toolkits/ml_data_2/data_storage/internal_metadata.cpp
Bpowers4/turicreate
73dad213cc1c4f74337b905baea2b3a1e5a0266c
[ "BSD-3-Clause" ]
11,356
2017-12-08T19:42:32.000Z
2022-03-31T16:55:25.000Z
src/toolkits/ml_data_2/data_storage/internal_metadata.cpp
Bpowers4/turicreate
73dad213cc1c4f74337b905baea2b3a1e5a0266c
[ "BSD-3-Clause" ]
2,402
2017-12-08T22:31:01.000Z
2022-03-28T19:25:52.000Z
src/toolkits/ml_data_2/data_storage/internal_metadata.cpp
Bpowers4/turicreate
73dad213cc1c4f74337b905baea2b3a1e5a0266c
[ "BSD-3-Clause" ]
1,343
2017-12-08T19:47:19.000Z
2022-03-26T11:31:36.000Z
/* Copyright © 2017 Apple Inc. All rights reserved. * * Use of this source code is governed by a BSD-3-clause license that can * be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause */ #include <toolkits/ml_data_2/data_storage/internal_metadata.hpp> #include <toolkits/ml_data_2/ml_data_column_modes.hpp> #include <toolkits/ml_data_2/metadata.hpp> namespace turi { namespace v2 { namespace ml_data_internal { void column_metadata::setup( bool is_target_column, const std::string& _column_name, const std::shared_ptr<sarray<flexible_type> >& column, const std::map<std::string, ml_column_mode>& mode_overrides, const std::map<std::string, flexible_type>& options) { name = _column_name; original_column_type = column->get_type(); //////////////////////////////////////////////////////////////////////////////// // Step 1: Set the column mode mode = choose_column_mode(name, original_column_type, options, mode_overrides); //////////////////////////////////////////////////////////////////////////////// // Step 2: Set the column indexer std::string indexer_type; if(is_target_column) { indexer_type = options.at("target_column_indexer_type").get<std::string>(); } else { indexer_type = options.at("column_indexer_type").get<std::string>(); } indexer = column_indexer::factory_create( { {"indexer_type", to_variant(indexer_type)}, {"column_name", to_variant(name)}, {"mode", to_variant(mode)}, {"original_column_type", to_variant(original_column_type)}, {"options", to_variant(options)} }); //////////////////////////////////////////////////////////////////////////////// // Step 3: Set up the statistics. std::string statistics_type; if(is_target_column) { statistics_type = options.at("target_column_statistics_type").get<std::string>(); } else { statistics_type = options.at("column_statistics_type").get<std::string>(); } statistics = column_statistics::factory_create( { {"statistics_type", to_variant(statistics_type)}, {"column_name", to_variant(name)}, {"mode", to_variant(mode)}, {"original_column_type", to_variant(original_column_type)}, {"options", to_variant(options)} }); //////////////////////////////////////////////////////////////////////////////// // Step 4: If the column has a fixed size, we need to figure that out. if(v2::mode_has_fixed_size(mode)) { switch(mode) { case ml_column_mode::NUMERIC: case ml_column_mode::CATEGORICAL: column_data_size_if_fixed = 1; break; case ml_column_mode::NUMERIC_VECTOR: { // This is the only one that needs some care. We need to go // through and read it until we hit one that is not a missing // value. size_t num_rows = column->size(); auto reader = column->get_reader(); std::vector<flexible_type> buffer; column_data_size_if_fixed = size_t(-1); size_t row = 0; while(row < num_rows) { reader->read_rows(row, row + 1, buffer); if(buffer[0].get_type() == flex_type_enum::VECTOR) { column_data_size_if_fixed = buffer[0].get<flex_vec>().size(); break; } else if(buffer[0].get_type() == flex_type_enum::UNDEFINED) { ++row; continue; } else { ASSERT_MSG(false, "Non-vector type encountered in column of vectors."); } } if(column_data_size_if_fixed == size_t(-1)) { DASSERT_EQ(row, num_rows); logstream(LOG_WARNING) << "Column with only missing values encountered." << std::endl; column_data_size_if_fixed = 0; } break; } case ml_column_mode::UNTRANSLATED: // This isn't put into the row_block, so it doesn't count. column_data_size_if_fixed = 0; break; // The rest of these shouldn't be encountered here. case ml_column_mode::CATEGORICAL_VECTOR: case ml_column_mode::DICTIONARY: default: DASSERT_TRUE(false); } // DONE! } } /** Finalize training. */ void column_metadata::set_training_index_size() { index_size_at_train_time = column_size(); } /** If the global index offsets haven't been loaded already from the * serialization method, then set them. */ void column_metadata::set_training_index_offset(size_t previous_total) { DASSERT_TRUE(index_size_at_train_time != size_t(-1)); if(global_index_offset_at_train_time == size_t(-1)) global_index_offset_at_train_time = previous_total; } /** Serialization -- save. */ void column_metadata::save(turi::oarchive& oarc) const { size_t version = 2; std::map<std::string, variant_type> data = { {"version", to_variant(version)}, {"name", to_variant(name)}, {"mode", to_variant(mode)}, {"index_size_at_train_time", to_variant(index_size_at_train_time)}, {"original_column_type", to_variant(original_column_type)}, {"column_data_size_if_fixed", to_variant(column_data_size_if_fixed)}, {"global_index_offset_at_train_time", to_variant(global_index_offset_at_train_time)}}; variant_deep_save(data, oarc); oarc << indexer << statistics; } /** Serialization -- load. */ void column_metadata::load(turi::iarchive& iarc) { std::map<std::string, variant_type> data; variant_deep_load(data, iarc); // Extract the version part. size_t version = 1; if(data.count("version")) { version = variant_get_value<size_t>(data.at("version")); } #define __EXTRACT(var) var = variant_get_value<decltype(var)>(data.at(#var)); __EXTRACT(name); __EXTRACT(mode); __EXTRACT(original_column_type); __EXTRACT(index_size_at_train_time); __EXTRACT(column_data_size_if_fixed); // Now we need to see if the offset values are in there. If they // are not, then we have an old version. if(version >= 2) { __EXTRACT(global_index_offset_at_train_time); } else { // If -1, this will get reset by the wrapping metadata. We have // to do some gymnastics here for backward compatability of // models. global_index_offset_at_train_time = size_t(-1); } #undef __EXTRACT iarc >> indexer >> statistics; } std::shared_ptr<column_metadata> column_metadata::create_cleared_copy() const { auto ret = std::make_shared<column_metadata>(*this); ret->indexer = indexer->create_cleared_copy(); ret->statistics = statistics->create_cleared_copy(); return ret; } /** Set up the row metadata, along * */ void row_metadata::setup(const std::vector<column_metadata_ptr>& _metadata_vect, bool _has_target) { // Need to special case this one if(_metadata_vect.size() == 0) { has_target = 0; metadata_vect.clear(); total_num_columns = 0; num_x_columns = 0; target_is_indexed = false; constant_data_size = 0; data_size_is_constant = true; return; } has_target = _has_target; metadata_vect = _metadata_vect; total_num_columns = metadata_vect.size(); num_x_columns = (total_num_columns - (has_target ? 1 : 0)); target_is_indexed = (has_target && mode_is_indexed(metadata_vect.back()->mode)); // Now just need to set data_size_is_constant and data_size. size_t num_columns = metadata_vect.size(); constant_data_size = 0; data_size_is_constant = true; for(size_t c_idx = 0; c_idx < num_columns; ++c_idx) { if(metadata_vect[c_idx]->mode_has_fixed_size() ) { constant_data_size += metadata_vect[c_idx]->fixed_column_size(); } else { data_size_is_constant = false; break; } } if(!data_size_is_constant) constant_data_size = 0; } }}}
30.523256
100
0.636317
8547d1d157213457fa1f902e383cc58ea1cde10d
817
swift
Swift
RxSwift XLPagerTabStrip MVVM/ViewModel/Pager/Child/SamplePagerChildViewModel/SamplePagerChildViewModel.swift
tokijh/RxSwift-XLPagerTabStrip-MVVM
7e5ee27839649af50637576640a6f79071c257bb
[ "MIT" ]
7
2018-08-30T00:26:34.000Z
2019-10-28T16:09:54.000Z
RxSwift XLPagerTabStrip MVVM/ViewModel/Pager/Child/SamplePagerChildViewModel/SamplePagerChildViewModel.swift
tokijh/RxSwift-XLPagerTabStrip-MVVM
7e5ee27839649af50637576640a6f79071c257bb
[ "MIT" ]
1
2018-12-15T07:16:31.000Z
2018-12-27T03:37:54.000Z
RxSwift XLPagerTabStrip MVVM/ViewModel/Pager/Child/SamplePagerChildViewModel/SamplePagerChildViewModel.swift
tokijh/RxSwift-XLPagerTabStrip-MVVM
7e5ee27839649af50637576640a6f79071c257bb
[ "MIT" ]
null
null
null
// // SamplePagerChildViewModel.swift // RxSwift XLPagerTabStrip MVVM // // Created by Joonghyun-Yoon on 2018. 8. 24.. // Copyright © 2018년 tokijh. All rights reserved. // import RxSwift import RxCocoa class SamplePagerChildViewModel: SamplePagerChildViewModelType { let disposeBag = DisposeBag() required init(sample: Sample) { self.sample = BehaviorRelay<Sample>(value: sample) setup() } fileprivate func setup() { setupTitleText() } // MART Sample let sample: BehaviorRelay<Sample> // MARK Title Text let titleText = BehaviorRelay<String?>(value: nil) fileprivate func setupTitleText() { sample .map({ $0.title }) .bind(to: titleText) .disposed(by: disposeBag) } }
21.5
64
0.616891
0c7b604aa3876631996e11c82726a4cde3f6cf8b
4,730
swift
Swift
JNImagePicker/Classes/PhotoGallery/JNAssetsManager.swift
JNDisrupter/JNImagePicker
048ec3407678770a535ebca6c2e3eeb051f815e6
[ "MIT" ]
null
null
null
JNImagePicker/Classes/PhotoGallery/JNAssetsManager.swift
JNDisrupter/JNImagePicker
048ec3407678770a535ebca6c2e3eeb051f815e6
[ "MIT" ]
null
null
null
JNImagePicker/Classes/PhotoGallery/JNAssetsManager.swift
JNDisrupter/JNImagePicker
048ec3407678770a535ebca6c2e3eeb051f815e6
[ "MIT" ]
null
null
null
// // JNAssetsManager.swift // JNImagePicker // // Created by Mohammad Nabulsi on 5/13/19. // import Foundation import Photos /// JNAssets Manager class JNAssetsManager { /** Check permission to access assets - Parameter completion: Completion block. */ class func checkGalleryPermission(_ completion: @escaping (_ granted: Bool) -> Void) { var status: PHAuthorizationStatus if #available(iOS 14, *) { status = PHPhotoLibrary.authorizationStatus(for: PHAccessLevel.readWrite) }else{ status = PHPhotoLibrary.authorizationStatus() } switch status { case PHAuthorizationStatus.authorized, PHAuthorizationStatus.limited: completion(true) case PHAuthorizationStatus.notDetermined: PHPhotoLibrary.requestAuthorization { (status) in completion(status == PHAuthorizationStatus.authorized) } default: completion(false) } } /** Check permission to access camera - Parameter completion: Completion block. */ class func checkCameraPermission(_ completion: @escaping (_ granted: Bool) -> Void) { if AVCaptureDevice.authorizationStatus(for: AVMediaType.video) == AVAuthorizationStatus.authorized { completion(true) } else { AVCaptureDevice.requestAccess(for: AVMediaType.video, completionHandler: { (granted: Bool) -> Void in if granted == true { completion(true) } else { completion(false) } }) } } /** Get asset collections - Parameter type: The type for asset collection - Parameter subType: Subtype for collection - Returns: Result contains all collections */ func getAssetCollections(type: PHAssetCollectionType, subType: PHAssetCollectionSubtype, options: PHFetchOptions?) -> PHFetchResult<PHAssetCollection> { return PHAssetCollection.fetchAssetCollections(with: type, subtype: subType, options: options) } /** Get asset collections for subtypes - Parameter subTypes: Array of Subtype for collection - Returns: Result contains all collections */ func getAssetCollections(subTypes: [PHAssetCollectionSubtype], options: PHFetchOptions?) -> [PHAssetCollection] { var result = [PHAssetCollection]() for subtype in subTypes { let type = subtype.rawValue < PHAssetCollectionSubtype.smartAlbumGeneric.rawValue ? PHAssetCollectionType.album : PHAssetCollectionType.smartAlbum let fetchresult = self.getAssetCollections(type: type, subType: subtype, options: options) fetchresult.enumerateObjects { (collection, index, poiner) in result.append(collection) } } return result } /** Get assets in collection - Parameter collection: PHAsset collection to assets for - Parameter options: Options to fetch assets for. - Returns: Result of all assets */ func getAssets(in collection: PHAssetCollection, options: PHFetchOptions?) -> [PHAsset] { var assets = [PHAsset]() PHAsset.fetchAssets(in: collection, options: options).enumerateObjects { (asset, count, pointer) in assets.append(asset) } return assets } /** Get assets in collection for specific media type - Parameter collection: PHAsset collection to assets for - Parameter type: Media type to fetch for. - Returns: Result of all assets */ func getAssets(in collection: PHAssetCollection, type: PHAssetMediaType) -> [PHAsset] { let optionsToFilterImage = PHFetchOptions() optionsToFilterImage.predicate = NSPredicate(format: "mediaType = %d", type.rawValue) return self.getAssets(in: collection, options: optionsToFilterImage) } /** Get asset collection thumbnail - Parameter collection: The collection to get thumbnail for. - Parameter size: Size for the thumbnail. - Parameter completion: Completion block. */ func getAssetCollectionThumbnail(collection: PHAssetCollection, size: CGSize, completion: @escaping (UIImage?) -> Void) { if let firstAsset = self.getAssets(in: collection, options: nil).first { PHImageManager.default().requestImage(for: firstAsset, targetSize: size, contentMode: PHImageContentMode.aspectFill, options: nil) { (image, options) in completion(image) } } completion(nil) } }
36.10687
164
0.639112
56dc0491255c26ba4b3e69dbaf4c513c73ad42b5
3,724
go
Go
service/elasticsearchservice/api_op_DeleteOutboundCrossClusterSearchConnection.go
zparnold/aws-sdk-go-v2
459e964579b260913596740032b17caa7773a744
[ "Apache-2.0" ]
null
null
null
service/elasticsearchservice/api_op_DeleteOutboundCrossClusterSearchConnection.go
zparnold/aws-sdk-go-v2
459e964579b260913596740032b17caa7773a744
[ "Apache-2.0" ]
null
null
null
service/elasticsearchservice/api_op_DeleteOutboundCrossClusterSearchConnection.go
zparnold/aws-sdk-go-v2
459e964579b260913596740032b17caa7773a744
[ "Apache-2.0" ]
null
null
null
// Code generated by smithy-go-codegen DO NOT EDIT. package elasticsearchservice import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/service/elasticsearchservice/types" smithy "github.com/awslabs/smithy-go" "github.com/awslabs/smithy-go/middleware" smithyhttp "github.com/awslabs/smithy-go/transport/http" ) // Allows the source domain owner to delete an existing outbound cross-cluster // search connection. func (c *Client) DeleteOutboundCrossClusterSearchConnection(ctx context.Context, params *DeleteOutboundCrossClusterSearchConnectionInput, optFns ...func(*Options)) (*DeleteOutboundCrossClusterSearchConnectionOutput, error) { stack := middleware.NewStack("DeleteOutboundCrossClusterSearchConnection", smithyhttp.NewStackRequest) options := c.options.Copy() for _, fn := range optFns { fn(&options) } addawsRestjson1_serdeOpDeleteOutboundCrossClusterSearchConnectionMiddlewares(stack) awsmiddleware.AddRequestInvocationIDMiddleware(stack) smithyhttp.AddContentLengthMiddleware(stack) addResolveEndpointMiddleware(stack, options) v4.AddComputePayloadSHA256Middleware(stack) addRetryMiddlewares(stack, options) addHTTPSignerV4Middleware(stack, options) awsmiddleware.AddAttemptClockSkewMiddleware(stack) addClientUserAgent(stack) smithyhttp.AddErrorCloseResponseBodyMiddleware(stack) smithyhttp.AddCloseResponseBodyMiddleware(stack) addOpDeleteOutboundCrossClusterSearchConnectionValidationMiddleware(stack) stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteOutboundCrossClusterSearchConnection(options.Region), middleware.Before) addRequestIDRetrieverMiddleware(stack) addResponseErrorMiddleware(stack) for _, fn := range options.APIOptions { if err := fn(stack); err != nil { return nil, err } } handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack) result, metadata, err := handler.Handle(ctx, params) if err != nil { return nil, &smithy.OperationError{ ServiceID: ServiceID, OperationName: "DeleteOutboundCrossClusterSearchConnection", Err: err, } } out := result.(*DeleteOutboundCrossClusterSearchConnectionOutput) out.ResultMetadata = metadata return out, nil } // Container for the parameters to the DeleteOutboundCrossClusterSearchConnection // () operation. type DeleteOutboundCrossClusterSearchConnectionInput struct { // The id of the outbound connection that you want to permanently delete. // // This member is required. CrossClusterSearchConnectionId *string } // The result of a DeleteOutboundCrossClusterSearchConnection () operation. // Contains details of deleted outbound connection. type DeleteOutboundCrossClusterSearchConnectionOutput struct { // Specifies the OutboundCrossClusterSearchConnection () of deleted outbound // connection. CrossClusterSearchConnection *types.OutboundCrossClusterSearchConnection // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata } func addawsRestjson1_serdeOpDeleteOutboundCrossClusterSearchConnectionMiddlewares(stack *middleware.Stack) { stack.Serialize.Add(&awsRestjson1_serializeOpDeleteOutboundCrossClusterSearchConnection{}, middleware.After) stack.Deserialize.Add(&awsRestjson1_deserializeOpDeleteOutboundCrossClusterSearchConnection{}, middleware.After) } func newServiceMetadataMiddleware_opDeleteOutboundCrossClusterSearchConnection(region string) awsmiddleware.RegisterServiceMetadata { return awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "es", OperationName: "DeleteOutboundCrossClusterSearchConnection", } }
40.043011
224
0.821429
e8655177cffd8ee7381e7b04155c9e6b8b8f1d53
18,351
cc
C++
core/core.cc
theonlylawislove/omaha
7f70869253aeebadb4f52db5306bde5571d71524
[ "Apache-2.0" ]
1
2017-03-18T02:13:19.000Z
2017-03-18T02:13:19.000Z
core/core.cc
pauldotknopf/omaha
7f70869253aeebadb4f52db5306bde5571d71524
[ "Apache-2.0" ]
null
null
null
core/core.cc
pauldotknopf/omaha
7f70869253aeebadb4f52db5306bde5571d71524
[ "Apache-2.0" ]
null
null
null
// Copyright 2007-2009 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ======================================================================== // Core is the long-lived Omaha process. It runs one instance for the // machine and one instance for each user session, including console and TS // sessions. // If the same user is logged in multiple times, only one core process will // be running. #include "omaha/core/core.h" #include <lmsname.h> #include <atlsecurity.h> #include <algorithm> #include <map> #include <string> #include <vector> #include "omaha/common/app_util.h" #include "omaha/common/const_cmd_line.h" #include "omaha/common/const_object_names.h" #include "omaha/common/debug.h" #include "omaha/common/error.h" #include "omaha/common/logging.h" #include "omaha/common/module_utils.h" #include "omaha/common/path.h" #include "omaha/common/reactor.h" #include "omaha/common/reg_key.h" #include "omaha/common/service_utils.h" #include "omaha/common/shutdown_handler.h" #include "omaha/common/system.h" #include "omaha/common/time.h" #include "omaha/common/user_info.h" #include "omaha/common/utils.h" #include "omaha/common/vistautil.h" #include "omaha/core/core_metrics.h" #include "omaha/core/legacy_manifest_handler.h" #include "omaha/core/scheduler.h" #include "omaha/core/system_monitor.h" #include "omaha/goopdate/command_line_builder.h" #include "omaha/goopdate/config_manager.h" #include "omaha/goopdate/crash.h" #include "omaha/goopdate/program_instance.h" #include "omaha/goopdate/goopdate_utils.h" #include "omaha/goopdate/stats_uploader.h" namespace omaha { Core::Core() : is_system_(false), is_crash_handler_enabled_(false), main_thread_id_(0) { CORE_LOG(L1, (_T("[Core::Core]"))); } Core::~Core() { CORE_LOG(L1, (_T("[Core::~Core]"))); scheduler_.reset(NULL); system_monitor_.reset(NULL); } // We always return S_OK, because the core can be invoked from the system // scheduler, and the scheduler does not work well if the process returns // an error. We do not depend on the return values from the Core elsewhere. HRESULT Core::Main(bool is_system, bool is_crash_handler_enabled) { HRESULT hr = DoMain(is_system, is_crash_handler_enabled); if (FAILED(hr)) { OPT_LOG(LW, (_T("[Core::DoMain failed][0x%x]"), hr)); } return S_OK; } bool Core::AreScheduledTasksHealthy() const { if (!ServiceUtils::IsServiceRunning(SERVICE_SCHEDULE)) { ++metric_core_run_task_scheduler_not_running; CORE_LOG(LE, (_T("[Task Scheduler Service is not running]"))); return false; } if (!goopdate_utils::IsInstalledGoopdateTaskUA(is_system_)) { ++metric_core_run_scheduled_task_missing; CORE_LOG(LE, (_T("[UA Task not installed]"))); return false; } if (goopdate_utils::IsDisabledGoopdateTaskUA(is_system_)) { ++metric_core_run_scheduled_task_disabled; CORE_LOG(LE, (_T("[UA Task disabled]"))); return false; } HRESULT ua_task_last_exit_code = goopdate_utils::GetExitCodeGoopdateTaskUA(is_system_); if (ua_task_last_exit_code == SCHED_S_TASK_HAS_NOT_RUN && !ConfigManager::Is24HoursSinceInstall(is_system_)) { // Not 24 hours yet since install or update. Let us give the UA task the // benefit of the doubt, and assume all is well for right now. CORE_LOG(L3, (_T("[Not yet 24 hours since install/update]"))); ua_task_last_exit_code = S_OK; } metric_core_run_scheduled_task_exit_code = ua_task_last_exit_code; if (S_OK != ua_task_last_exit_code) { CORE_LOG(LE, (_T("[UA Task exit code][0x%x]"), ua_task_last_exit_code)); return false; } return true; } bool Core::IsServiceHealthy() const { if (!is_system_) { return true; } if (!goopdate_utils::IsServiceInstalled()) { ++metric_core_run_service_missing; CORE_LOG(LE, (_T("[GoogleUpdate Service is not installed]"))); return false; } if (ServiceUtils::IsServiceDisabled( ConfigManager::GetCurrentServiceName())) { ++metric_core_run_service_disabled; CORE_LOG(LE, (_T("[GoogleUpdate Service is disabled]"))); return false; } return true; } bool Core::IsCheckingForUpdates() const { if (!ConfigManager::Is24HoursSinceInstall(is_system_)) { CORE_LOG(L3, (_T("[Not yet 24 hours since install/update]"))); return true; } ConfigManager* cm = ConfigManager::Instance(); const int k14DaysSec = 14 * 24 * 60 * 60; if (cm->GetTimeSinceLastCheckedSec(is_system_) >= k14DaysSec) { ++metric_core_run_not_checking_for_updates; CORE_LOG(LE, (_T("[LastChecked older than 14 days]"))); return false; } return true; } // The Core will run all the time under the following conditions: // // * the task scheduler is not running, or // * the UA task is not installed, or // * the UA task is disabled, or // * the last exit code for the UA task is non-zero, or // * LastChecked time is older than 14 days. // // Under these conditions, Omaha uses the built-in scheduler hosted by the core // and it keeps the core running. // // In addition, for the machine GoogleUpdate, the Core will run all the time if // the service is not installed, or is disabled. In this case, Omaha uses the // elevator interface hosted by the core, and this keeps the core running. bool Core::ShouldRunForever() const { // The methods are being called individually to enable metrics capture. bool are_scheduled_tasks_healthy(AreScheduledTasksHealthy()); bool is_service_healthy(IsServiceHealthy()); bool is_checking_for_updates(IsCheckingForUpdates()); return !are_scheduled_tasks_healthy || !is_service_healthy || !is_checking_for_updates; } HRESULT Core::DoMain(bool is_system, bool is_crash_handler_enabled) { main_thread_id_ = ::GetCurrentThreadId(); is_system_ = is_system; is_crash_handler_enabled_ = is_crash_handler_enabled; if (ConfigManager::Instance()->IsOemInstalling(is_system_)) { // Exit immediately while an OEM is installing Windows. This prevents cores // or update workers from being started by the Scheduled Task or other means // before the system is sealed. OPT_LOG(L1, (_T("[Exiting because an OEM is installing Windows]"))); ASSERT1(is_system_); return S_OK; } // Do a code red check as soon as possible. StartCodeRed(); CORE_LOG(L2, (_T("[IsGoogler %d]"), ConfigManager::Instance()->IsGoogler())); NamedObjectAttributes single_core_attr; GetNamedObjectAttributes(kCoreSingleInstance, is_system, &single_core_attr); ProgramInstance instance(single_core_attr.name); bool is_already_running = !instance.EnsureSingleInstance(); if (is_already_running) { OPT_LOG(L1, (_T("[another core instance is already running]"))); return S_OK; } // TODO(omaha): the user Omaha core should run at medium integrity level and // it should deelevate itself if it does not, see bug 1549842. // Clean up the initial install directory and ignore the errors. HRESULT hr = CleanUpInitialManifestDirectory(); if (FAILED(hr)) { CORE_LOG(LW, (_T("[CleanUpInitialManifestDirectory failed][0x%08x]"), hr)); } // Start the crash handler if necessary. if (is_crash_handler_enabled_) { HRESULT hr = StartCrashHandler(); if (FAILED(hr)) { OPT_LOG(LW, (_T("[Failed to start crash handler][0x%08x]"), hr)); } } if (!ShouldRunForever()) { return S_OK; } // TODO(Omaha): Delay starting update worker when run at startup. StartUpdateWorkerInternal(); // Force the main thread to create a message queue so any future WM_QUIT // message posted by the ShutdownHandler will be received. If the main // thread does not have a message queue, the message can be lost. MSG msg = {0}; ::PeekMessage(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE); reactor_.reset(new Reactor); shutdown_handler_.reset(new ShutdownHandler); hr = shutdown_handler_->Initialize(reactor_.get(), this, is_system_); if (FAILED(hr)) { return hr; } if (!is_system_) { // We watch the legacy manifest install directory only if we are the // user core. The omaha1 -> omaha2 machine hand off occurs using the // /UI cmd line switch. VERIFY1(SUCCEEDED(InitializeManifestDirectoryWatcher())); } scheduler_.reset(new Scheduler(*this)); hr = scheduler_->Initialize(); if (FAILED(hr)) { return hr; } system_monitor_.reset(new SystemMonitor(is_system_)); VERIFY1(SUCCEEDED(system_monitor_->Initialize(true))); system_monitor_->set_observer(this); if (is_system_) { VERIFY(SUCCEEDED(RegisterCoreProxy()), (_T("The core may have been started when the registered version ") _T("of Google Update does not exist or one is not registered."))); } // Start processing messages and events from the system. hr = DoRun(); if (is_system) { UnregisterCoreProxy(); } return hr; } // Signals the core to shutdown. The shutdown method is called by a thread // running in the thread pool. It posts a WM_QUIT to the main thread, which // causes it to break out of the message loop. If the message can't be posted, // it terminates the process unconditionally. HRESULT Core::Shutdown() { return ShutdownInternal(); } HRESULT Core::ShutdownInternal() const { OPT_LOG(L1, (_T("[Google Update is shutting down...]"))); ASSERT1(::GetCurrentThreadId() != main_thread_id_); if (::PostThreadMessage(main_thread_id_, WM_QUIT, 0, 0)) { return S_OK; } ASSERT(false, (_T("Failed to post WM_QUIT"))); uint32 exit_code = static_cast<uint32>(E_ABORT); VERIFY1(::TerminateProcess(::GetCurrentProcess(), exit_code)); return S_OK; } void Core::LastCheckedDeleted() { OPT_LOG(L1, (_T("[Core::LastCheckedDeleted]"))); VERIFY1(SUCCEEDED(StartUpdateWorker())); } void Core::NoRegisteredClients() { OPT_LOG(L1, (_T("[Core::NoRegisteredClients]"))); VERIFY1(SUCCEEDED(StartUpdateWorker())); } HRESULT Core::DoRun() { OPT_LOG(L1, (_T("[Core::DoRun]"))); // Trim the process working set to minimum. It does not need a more complex // algorithm for now. Likely the working set will increase slightly over time // as the core is handling events. VERIFY1(::SetProcessWorkingSetSize(::GetCurrentProcess(), static_cast<uint32>(-1), static_cast<uint32>(-1))); return DoHandleEvents(); } HRESULT Core::DoHandleEvents() { CORE_LOG(L1, (_T("[Core::DoHandleEvents]"))); MSG msg = {0}; int result = 0; while ((result = ::GetMessage(&msg, 0, 0, 0)) != 0) { ::DispatchMessage(&msg); if (result == -1) { break; } } CORE_LOG(L3, (_T("[GetMessage returned %d]"), result)); return (result != -1) ? S_OK : HRESULTFromLastError(); } HRESULT Core::StartUpdateWorker() const { if (!ShouldRunForever()) { return ShutdownInternal(); } return StartUpdateWorkerInternal(); } HRESULT Core::StartUpdateWorkerInternal() const { // The uninstall check is tentative. There are stronger checks, protected // by locks, which are done by the worker process. size_t num_clients(0); const bool is_uninstall = FAILED(goopdate_utils::GetNumClients(is_system_, &num_clients)) || num_clients <= 1; CORE_LOG(L2, (_T("[Core::StartUpdateWorker][%u]"), num_clients)); CString exe_path = goopdate_utils::BuildGoogleUpdateExePath(is_system_); CommandLineBuilder builder(COMMANDLINE_MODE_UA); builder.set_install_source(kCmdLineInstallSourceCore); builder.set_is_uninstall_set(is_uninstall); CString cmd_line = builder.GetCommandLineArgs(); HRESULT hr = System::StartProcessWithArgs(exe_path, cmd_line); if (SUCCEEDED(hr)) { ++metric_core_worker_succeeded; } else { CORE_LOG(LE, (_T("[can't start update worker][0x%08x]"), hr)); } ++metric_core_worker_total; return hr; } HRESULT Core::StartCodeRed() const { if (RegKey::HasValue(MACHINE_REG_UPDATE_DEV, kRegValueNoCodeRedCheck)) { CORE_LOG(LW, (_T("[Code Red is disabled for this system]"))); return E_ABORT; } CORE_LOG(L2, (_T("[Core::StartCodeRed]"))); CString exe_path = goopdate_utils::BuildGoogleUpdateExePath(is_system_); CommandLineBuilder builder(COMMANDLINE_MODE_CODE_RED_CHECK); CString cmd_line = builder.GetCommandLineArgs(); HRESULT hr = System::StartProcessWithArgs(exe_path, cmd_line); if (SUCCEEDED(hr)) { ++metric_core_cr_succeeded; } else { CORE_LOG(LE, (_T("[can't start Code Red worker][0x%08x]"), hr)); } ++metric_core_cr_total; return hr; } HRESULT Core::StartCrashHandler() const { CORE_LOG(L2, (_T("[Core::StartCrashHandler]"))); CString exe_path = goopdate_utils::BuildGoogleUpdateServicesPath(is_system_); CommandLineBuilder builder(COMMANDLINE_MODE_CRASH_HANDLER); CString cmd_line = builder.GetCommandLineArgs(); HRESULT hr = System::StartProcessWithArgs(exe_path, cmd_line); if (SUCCEEDED(hr)) { ++metric_core_start_crash_handler_succeeded; } else { CORE_LOG(LE, (_T("[can't start Crash Handler][0x%08x]"), hr)); } ++metric_core_start_crash_handler_total; return hr; } HRESULT Core::InitializeManifestDirectoryWatcher() { // We watch the legacy manifest install directory only if we are the // user core. The omaha1 -> omaha2 machine hand off occurs using the // /UI cmd line switch. legacy_manifest_handler_.reset(new LegacyManifestHandler()); return legacy_manifest_handler_->Initialize(this); } HRESULT Core::StartInstallWorker() { // Get all the manifests that are present in the handoff directory. CString manifest_dir = ConfigManager::Instance()->GetUserInitialManifestStorageDir(); std::vector<CString> manifests; HRESULT hr = File::GetWildcards(manifest_dir, _T("*.gup"), &manifests); if (FAILED(hr)) { return hr; } std::vector<CString>::iterator it; for (it = manifests.begin(); it != manifests.end(); ++it) { // Launch the worker using /UIUser manifest_file. CString filename = *it; EnclosePath(&filename); CommandLineBuilder builder(COMMANDLINE_MODE_LEGACY_MANIFEST_HANDOFF); builder.set_legacy_manifest_path(filename); CString cmd_line = builder.GetCommandLineArgs(); HRESULT hr_ret = goopdate_utils::StartGoogleUpdateWithArgs(is_system_, cmd_line, NULL); if (FAILED(hr_ret)) { OPT_LOG(LE, (_T("[StartGoogleUpdateWithArgs failed][0x%08x]"), hr_ret)); hr = hr_ret; } } return hr; } HRESULT Core::CleanUpInitialManifestDirectory() { CORE_LOG(L2, (_T("[CleanUpInitialManifestDirectory]"))); const CString dir = ConfigManager::Instance()->GetUserInitialManifestStorageDir(); if (dir.IsEmpty()) { return GOOPDATE_E_CORE_INTERNAL_ERROR; } return DeleteDirectoryFiles(dir); } void Core::AggregateMetrics() const { CORE_LOG(L2, (_T("[aggregate core metrics]"))); CollectMetrics(); VERIFY1(SUCCEEDED(omaha::AggregateMetrics(is_system_))); } // Collects: working set, peak working set, handle count, process uptime, // user disk free space on the current drive, process kernel time, and process // user time. void Core::CollectMetrics() const { uint64 working_set(0), peak_working_set(0); VERIFY1(SUCCEEDED(System::GetProcessMemoryStatistics(&working_set, &peak_working_set, NULL, NULL))); metric_core_working_set = working_set; metric_core_peak_working_set = peak_working_set; metric_core_handle_count = System::GetProcessHandleCount(); FILETIME now = {0}; FILETIME creation_time = {0}; FILETIME exit_time = {0}; FILETIME kernel_time = {0}; FILETIME user_time = {0}; ::GetSystemTimeAsFileTime(&now); VERIFY1(::GetProcessTimes(::GetCurrentProcess(), &creation_time, &exit_time, &kernel_time, &user_time)); ASSERT1(FileTimeToInt64(now) >= FileTimeToInt64(creation_time)); uint64 uptime_100ns = FileTimeToInt64(now) - FileTimeToInt64(creation_time); metric_core_uptime_ms = uptime_100ns / kMillisecsTo100ns; metric_core_kernel_time_ms = FileTimeToInt64(kernel_time) / kMillisecsTo100ns; metric_core_user_time_ms = FileTimeToInt64(user_time) / kMillisecsTo100ns; uint64 free_bytes_current_user(0); uint64 total_bytes_current_user(0); uint64 free_bytes_all_users(0); CString directory_name(app_util::GetCurrentModuleDirectory()); VERIFY1(SUCCEEDED(System::GetDiskStatistics(directory_name, &free_bytes_current_user, &total_bytes_current_user, &free_bytes_all_users))); metric_core_disk_space_available = free_bytes_current_user; } HRESULT Core::RegisterCoreProxy() { CComObjectNoLock<GoogleUpdateCore>* google_update_core = new CComObjectNoLock<GoogleUpdateCore>; CDacl dacl; dacl.AddAllowedAce(Sids::System(), GENERIC_ALL); dacl.AddAllowedAce(Sids::Users(), GENERIC_READ); CSecurityDesc sd; sd.SetDacl(dacl); sd.MakeAbsolute(); SharedMemoryAttributes attr(kGoogleUpdateCoreSharedMemoryName, sd); google_update_core_proxy_.reset(new GoogleUpdateCoreProxy(false, &attr)); #if DEBUG // The core interface should be registered only once. CComPtr<IGoogleUpdateCore> core_interface; HRESULT hr = google_update_core_proxy_->GetObject(&core_interface); ASSERT1(FAILED(hr) || !core_interface); #endif return google_update_core_proxy_->RegisterObject(google_update_core); } void Core::UnregisterCoreProxy() { if (google_update_core_proxy_.get()) { google_update_core_proxy_->RevokeObject(); } } } // namespace omaha
33.42623
80
0.699144
5bb56cd1401fb8fdfec204e805a974882c26415d
4,334
cs
C#
Migration/MigrationV3V4/CSharp/V4StateBotFromV3Providers/Bot.Builder.Azure.V3ToV4/AzureSql/SqlBotDataStore.cs
Aliacf21/BotBuilder-Samples
be48548edafd4efdc074f5a59ef2bb3af735ad9a
[ "MIT" ]
1,998
2019-05-07T06:33:22.000Z
2022-03-31T12:59:15.000Z
Bot.Builder.Azure.V3ToV4/AzureSql/SqlBotDataStore.cs
EricDahlvang/BotBuilderV3V4UserStateMigration
56737d97707d1317b4a7b83e075c809053bdafe7
[ "MIT" ]
1,526
2020-09-05T18:57:14.000Z
2020-12-03T01:45:40.000Z
Bot.Builder.Azure.V3ToV4/AzureSql/SqlBotDataStore.cs
EricDahlvang/BotBuilderV3V4UserStateMigration
56737d97707d1317b4a7b83e075c809053bdafe7
[ "MIT" ]
2,820
2016-09-21T03:47:43.000Z
2019-05-03T15:12:46.000Z
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Bot.Builder.Azure.V3V4.AzureSql { /// <summary> /// <see cref="IBotDataStore{BotData}"/> Implementation using Azure SQL /// From https://github.com/microsoft/BotBuilder-Azure /// </summary> public class SqlBotDataStore : IBotDataStore<BotData> { string _connectionString { get; set; } /// <summary> /// Creates an instance of the <see cref="IBotDataStore{BotData}"/> that uses the azure sql storage. /// </summary> /// <param name="connectionString">The storage connection string.</param> public SqlBotDataStore(string connectionString) { _connectionString = connectionString; } async Task<BotData> IBotDataStore<BotData>.LoadAsync(IAddress key, BotStoreType botStoreType, CancellationToken cancellationToken) { using (var context = new SqlBotDataContext(_connectionString)) { SqlBotDataEntity entity = await SqlBotDataEntity.GetSqlBotDataEntity(key, botStoreType, context); if (entity == null) // empty record ready to be saved return new BotData(eTag: String.Empty, data: new Dictionary<string, object>()); // return botdata return new BotData(entity.ETag, entity.GetData()); } } async Task IBotDataStore<BotData>.SaveAsync(IAddress key, BotStoreType botStoreType, BotData botData, CancellationToken cancellationToken) { SqlBotDataEntity entity = new SqlBotDataEntity(botStoreType, key.BotId, key.ChannelId, key.ConversationId, key.UserId, botData.Data) { ETag = botData.ETag, ServiceUrl = key.ServiceUrl }; using (var context = new SqlBotDataContext(_connectionString)) { if (string.IsNullOrEmpty(botData.ETag)) { entity.ETag = Guid.NewGuid().ToString(); context.BotData.Add(entity); } else if (entity.ETag == "*") { var foundData = await SqlBotDataEntity.GetSqlBotDataEntity(key, botStoreType, context); if (botData.Data != null) { if (foundData == null) context.BotData.Add(entity); else { foundData.Data = entity.Data; foundData.ServiceUrl = entity.ServiceUrl; } } else { if (foundData != null) context.BotData.Remove(foundData); } } else { var foundData = await SqlBotDataEntity.GetSqlBotDataEntity(key, botStoreType, context); if (botData.Data != null) { if (foundData == null) context.BotData.Add(entity); else { foundData.Data = entity.Data; foundData.ServiceUrl = entity.ServiceUrl; foundData.ETag = entity.ETag; } } else { if (foundData != null) context.BotData.Remove(foundData); } } await context.SaveChangesAsync(); } } Task<bool> IBotDataStore<BotData>.FlushAsync(IAddress key, CancellationToken cancellationToken) { // Everything is saved. Flush is no-op return Task.FromResult(true); } } }
40.886792
146
0.479234
98416c164510200a07e978102c5f62831806ea04
2,680
lua
Lua
Interface/AddOns/LittleWigs/WoD/UpperBlackrockSpire/Ragewing.lua
ChinarG/Game-Wow-Plugins-Setting
e3fd3ddec1387c1f971dc195fec4fd9045d3105d
[ "Apache-2.0" ]
null
null
null
Interface/AddOns/LittleWigs/WoD/UpperBlackrockSpire/Ragewing.lua
ChinarG/Game-Wow-Plugins-Setting
e3fd3ddec1387c1f971dc195fec4fd9045d3105d
[ "Apache-2.0" ]
null
null
null
Interface/AddOns/LittleWigs/WoD/UpperBlackrockSpire/Ragewing.lua
ChinarG/Game-Wow-Plugins-Setting
e3fd3ddec1387c1f971dc195fec4fd9045d3105d
[ "Apache-2.0" ]
null
null
null
-------------------------------------------------------------------------------- -- Module Declaration -- local mod, CL = BigWigs:NewBoss("Ragewing the Untamed", 1358, 1229) if not mod then return end mod:RegisterEnableMob(76585) mod.engageId = 1760 mod.respawnTime = 11 -------------------------------------------------------------------------------- -- Locals -- local nextAddsWarning = 75 -------------------------------------------------------------------------------- -- Initialization -- function mod:GetOptions() return { {155620, "FLASH"}, -- Burning Rage 155057, -- Magma Pool {154996, "FLASH"}, -- Engulfing Fire -10740, -- Ragewing Whelp } end function mod:OnBossEnable() self:Log("SPELL_AURA_APPLIED", "BurningRage", 155620) self:Log("SPELL_AURA_APPLIED_DOSE", "BurningRage", 155620) self:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "EngulfingFire", "boss1") self:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", nil, "boss1") self:Log("SPELL_AURA_APPLIED", "SwirlingWinds", 167203) self:Log("SPELL_AURA_REMOVED", "SwirlingWindsOver", 167203) self:Log("SPELL_AURA_APPLIED", "MagmaPool", 155057) end function mod:OnEngage() nextAddsWarning = 75 -- 70% and 40% self:CDBar(154996, 15.7) -- Engulfing Fire end -------------------------------------------------------------------------------- -- Event Handlers -- function mod:BurningRage(args) self:Message(args.spellId, "orange", self:Dispeller("enrage", true) and "Info", CL.onboss:format(args.spellName)) if self:Dispeller("enrage", true) then self:Flash(args.spellId) end end function mod:EngulfingFire(_, _, _, spellId) if spellId == 154996 then -- Engulfing Fire self:Message(spellId, "yellow", "Warning") self:Flash(spellId) self:CDBar(spellId, 24) -- 24-28 end end function mod:UNIT_HEALTH_FREQUENT(event, unit) local hp = UnitHealth(unit) / UnitHealthMax(unit) * 100 if hp < nextAddsWarning then nextAddsWarning = nextAddsWarning - 30 self:Message(-10740, "green", nil, CL.soon:format(self:SpellName(93679)), false) if nextAddsWarning < 40 then self:UnregisterUnitEvent(event, unit) end end end function mod:SwirlingWinds() self:Message(-10740, "red", "Long", CL.percent:format(nextAddsWarning + 25, self:SpellName(93679)), 93679) -- 93679 = Summon Whelps self:Bar(-10740, 20, CL.intermission, 93679) -- Whelp icon self:StopBar(155025) -- Engulfing Fire end function mod:SwirlingWindsOver() if nextAddsWarning > 40 then self:CDBar(154996, self:Normal() and 9.3 or 12.8) -- Engulfing Fire end end function mod:MagmaPool(args) if self:Me(args.destGUID) then self:Message(args.spellId, "blue", "Alarm", CL.underyou:format(args.spellName)) end end
27.916667
132
0.64291
803ffa1deef9d4d80496f03ff9b0985c41133d39
11,660
java
Java
src/main/java/victus/StockQuoteTableView.java
ire603/INVICTUS
889f91b98603d8fceacb8faa65e6b5a405374a73
[ "Apache-2.0" ]
null
null
null
src/main/java/victus/StockQuoteTableView.java
ire603/INVICTUS
889f91b98603d8fceacb8faa65e6b5a405374a73
[ "Apache-2.0" ]
null
null
null
src/main/java/victus/StockQuoteTableView.java
ire603/INVICTUS
889f91b98603d8fceacb8faa65e6b5a405374a73
[ "Apache-2.0" ]
null
null
null
package victus; import javafx.beans.value.ObservableValue; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.concurrent.ScheduledService; import javafx.concurrent.Task; import javafx.concurrent.WorkerStateEvent; import javafx.scene.control.*; import javafx.scene.layout.GridPane; import javafx.util.Callback; import javafx.util.Duration; import victus.synchronize.Symbol; import pl.zankowski.iextrading4j.api.stocks.Quote; import pl.zankowski.iextrading4j.client.rest.request.stocks.QuoteRequestBuilder; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; public class StockQuoteTableView { private static TableView<StockQuoteOL> stockQuoteOLTableView = new TableView<>(); private static TableColumn<StockQuoteOL, String> symbolColumn = new TableColumn<>("Symbol"); private static TableColumn<StockQuoteOL, String> companyNameColumn = new TableColumn<>("Company"); private static TableColumn<StockQuoteOL, Number> lastPriceColumn = new TableColumn<>("Last Price"); private static TableColumn<StockQuoteOL, Number> changeColumn = new TableColumn<>("Change"); private static TableColumn<StockQuoteOL, Number> volumeColumn = new TableColumn<>("Volume"); private static ObservableList<StockQuoteOL> stockQuoteOLS = FXCollections.observableArrayList(); private static ScheduledService<ObservableList<StockQuoteOL>> scheduledService; private static Button start; private static TextArea enterSymbol; private static MysqlConnect mysqlConnect; private static GridPane gridPane; private static String symbol; private static StockQuote stockQuote; private static StockQuote[] stockQuotes; private static Button button; private static int ii = 0; private static int i = 0; private static StockQuoteOL[] stockQuoteOL1 = new StockQuoteOL[100]; public StockQuoteTableView(MysqlConnect mysqlConnect) { StockQuoteTableView.mysqlConnect = mysqlConnect; } public static ScrollPane stockQuoteOLTableView() { ScrollPane scrollPane = new ScrollPane(); stockQuoteOLTableView.setItems( stockQuoteOLS ); symbolColumn.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<StockQuoteOL, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(TableColumn.CellDataFeatures<StockQuoteOL, String> stockQuoteOLStringCellDataFeatures) { return stockQuoteOLStringCellDataFeatures.getValue().getSymbol(); } } ); companyNameColumn.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<StockQuoteOL, String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(TableColumn.CellDataFeatures<StockQuoteOL, String> stockQuoteOLStringCellDataFeatures) { return stockQuoteOLStringCellDataFeatures.getValue().getName(); } } ); lastPriceColumn.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<StockQuoteOL, Number>, ObservableValue<Number>>() { @Override public ObservableValue<Number> call(TableColumn.CellDataFeatures<StockQuoteOL, Number> stockQuoteOLNumberCellDataFeatures) { return stockQuoteOLNumberCellDataFeatures.getValue().getLastPrice(); } } ); volumeColumn.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<StockQuoteOL, Number>, ObservableValue<Number>>() { @Override public ObservableValue<Number> call(TableColumn.CellDataFeatures<StockQuoteOL, Number> stockQuoteOLNumberCellDataFeatures) { return stockQuoteOLNumberCellDataFeatures.getValue().getVolume(); } } ); changeColumn.setCellValueFactory( new Callback<TableColumn.CellDataFeatures<StockQuoteOL, Number>, ObservableValue<Number>>() { @Override public ObservableValue<Number> call(TableColumn.CellDataFeatures<StockQuoteOL, Number> stockQuoteOLNumberCellDataFeatures) { return stockQuoteOLNumberCellDataFeatures.getValue().changeProperty(); } } ); scheduledService= new PollingService(stockQuoteOLS); scheduledService.maximumFailureCountProperty().set(10); scheduledService.setPeriod(Duration.millis(10000)); scheduledService.setOnFailed(StockQuoteTableView::handle); stockQuoteOLTableView.getColumns().add(symbolColumn); stockQuoteOLTableView.getColumns().add(companyNameColumn); stockQuoteOLTableView.getColumns().add(lastPriceColumn); stockQuoteOLTableView.getColumns().add(volumeColumn); stockQuoteOLTableView.getColumns().add(changeColumn); stockQuoteOLTableView.setPrefSize(400, 150); scheduledService.start(); scrollPane.setContent( stockQuoteOLTableView ); return scrollPane; } public static GridPane gridPane() { List list = new ArrayList(); enterSymbol = new TextArea("Enter Symbol= Stock"); start = new Button("Start"); button = new Button("Enter New Symbol"); start.setOnAction(event -> { Thread thread = new Thread(new Symbol() { @Override public void run() { try { //PreparedStatement preparedStatement = mysqlConnect.connect().prepareStatement( // "SELECT * FROM screenedlist" //); //ResultSet resultSet = preparedStatement.executeQuery(); final boolean[] ref = new boolean[100]; ref[ii] = false; int clicked = 0; button.setOnAction( event -> { ref[ii] = true; if (ref[ii]) { String text = enterSymbol.getText(); List[] lists = new List[100]; lists[i] = Arrays.asList(text ); Iterator iterator = lists[i].iterator(); while (iterator.hasNext()) { stockQuote = Symbol.getSymbol( String.valueOf( iterator.next() ) ); stockQuotes = new StockQuote[10000]; stockQuotes[i] = new StockQuote( stockQuote.getSymbol(), stockQuote.getName(), stockQuote.getLastPrice(), stockQuote.getVolume(), stockQuote.getChange() ); stockQuoteOLS.addListener( new ListChangeListener<StockQuoteOL>() { @Override public void onChanged(Change<? extends StockQuoteOL> change) { System.out.printf("%nStock Added"); } } ); stockQuoteOL1[0] = new StockQuoteOL(stockQuotes[i].getSymbol(), stockQuotes[i].getName(), stockQuotes[i].getLastPrice(), stockQuotes[i].getVolume(), stockQuotes[i].getChange()); stockQuoteOLS.add(stockQuoteOL1[0] ); i++; } //for (int ii = 0; ii < list.size(); ii++) { // List<StockQuoteOL> list1 = new ArrayList<>(); // StockQuoteOL stockQuoteOL = new StockQuoteOL(); // // // //} } }); //i++; } catch (NullPointerException e) { e.printStackTrace(); } } }); thread.start(); }); enterSymbol.setPrefSize( 151, 11 ); gridPane = new GridPane(); gridPane.add(start, 1, 1); gridPane.add(enterSymbol, 2, 1); gridPane.add(button, 3, 1); return gridPane; } private static void handle(WorkerStateEvent event) { event.getSource().getException().printStackTrace(); System.out.printf("%nError in call %s : ", event.getSource().getException().getMessage()); } public static class PollingService extends ScheduledService<ObservableList<StockQuoteOL>> { private ObservableList<StockQuoteOL> listStockQuotes; PollingService(ObservableList<StockQuoteOL> listStockQuotes) { this.listStockQuotes = listStockQuotes; } @Override protected Task<ObservableList<StockQuoteOL>> createTask() { return new PollingTask(listStockQuotes); } } private static class PollingTask extends Task<ObservableList<StockQuoteOL>> { private ObservableList<StockQuoteOL> listStocks; PollingTask(ObservableList<StockQuoteOL> listStocks) { this.listStocks = listStocks; } @Override public ObservableList<StockQuoteOL> call() { try { listStocks.forEach(quote -> quote.getLastPrice().set(Symbol.getSymbol(quote.getSymbol().get()).getLastPrice())); listStocks.forEach(quote -> quote.getVolume().set(Symbol.getSymbol(quote.getSymbol().get()).getVolume())); listStocks.forEach(quote -> quote.changeProperty().set(Symbol.getSymbol(quote.getSymbol().get()).getChange())); return listStocks; } catch (ConcurrentModificationException e) { e.addSuppressed(new Throwable(e)); } return null; } } private static StockQuote getStockQuote(String symbol) { Quote quote = IEX.initiateIEX().executeRequest( new QuoteRequestBuilder() .withSymbol(symbol) .build() ); final Double latestPrice = quote.getLatestPrice().doubleValue(); StockQuote stockQuote = new StockQuote(); stockQuote.setLastPrice(latestPrice); stockQuote.setName(symbol); stockQuote.setVolume(quote.getLatestVolume().longValue()); stockQuote.setSymbol(symbol); stockQuote.setChange(quote.getChange().doubleValue()); System.out.printf("%nResult REST call: %s : %f : %d, %f", stockQuote.getSymbol(), stockQuote.getLastPrice(), stockQuote.getVolume(), stockQuote.getChange()); return stockQuote; } }
45.905512
140
0.571612
6b78467aa0f4e4c1ef95a613e7537f7ff4361e84
3,680
sql
SQL
Change/archive/datalayers/weather/weather_datalayersource.sql
NATO-NICS/nics-db
cff779aa604a3d064c9e23466f3260d32fbb42b7
[ "BSD-3-Clause" ]
null
null
null
Change/archive/datalayers/weather/weather_datalayersource.sql
NATO-NICS/nics-db
cff779aa604a3d064c9e23466f3260d32fbb42b7
[ "BSD-3-Clause" ]
null
null
null
Change/archive/datalayers/weather/weather_datalayersource.sql
NATO-NICS/nics-db
cff779aa604a3d064c9e23466f3260d32fbb42b7
[ "BSD-3-Clause" ]
1
2022-03-19T17:29:20.000Z
2022-03-19T17:29:20.000Z
155EF894-B2CE-40AF-ABFF-11C6EEFD2A13 2012-01-17 13:54:54 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A \N 17 EPSG:3857 0 \N \N \N 1 \N \N \N ED7A06E6-4329-43AB-89D0-3A7974132ED2 2012-01-17 14:53:13 811F85EC-9054-453D-81FB-E24F65E92B68 \N 24 EPSG:3857 0 \N \N \N 1 \N \N \N DC3FF1BB-AEFA-4CA5-851E-ECEB4515B69F 2012-04-11 16:46:27 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 5 EPSG:3857 0 \N \N \N 1 0.7 \N \N AFC28CB4-4123-4711-A612-AB887304F2D8 2012-01-17 14:52:19 DA7807CD-90BA-4F92-9BDF-A9AF5C2D8939 \N 2 EPSG:3857 0 \N \N \N 1 \N \N \N 733203DB-83D6-4937-AA3E-FDFF7CBC1E25 2012-01-17 15:02:55 690231A5-590A-46AF-92BE-16ECC80D2664 \N 25 EPSG:3857 0 \N \N \N 1 \N \N \N BF52A666-40CB-450B-8F0B-C6EBC62CC255 2012-05-04 18:55:32 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 21 EPSG:3857 0 \N \N \N 1 \N \N \N 0EEDB279-C543-48A5-BF38-4FC8650EB176 2012-05-04 18:57:09 A24CAC06-A205-4C41-83E2-FD7BE4428FA5 image/png 1 EPSG:3857 0 \N \N \N 1 0.7 \N \N A0CDCA34-0074-40B8-8EC8-4DC95EFF29D3 2012-04-11 16:53:59 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 41 EPSG:3857 0 \N \N \N 1 0.7 \N \N 947DC434-DBBF-488A-B4F7-414C7316D439 2012-01-17 15:01:44 690231A5-590A-46AF-92BE-16ECC80D2664 \N 9 EPSG:3857 0 \N \N \N 1 0.7 \N \N 768ECD4A-2188-460C-8EA0-50578D0EB7C6 2012-04-11 16:44:05 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 9 EPSG:3857 0 \N \N \N 1 0.7 \N \N AD4C3F15-2CA9-45EE-B8CA-0A051E0B7F7F 2012-04-11 16:56:29 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 53 EPSG:3857 0 \N \N \N 1 \N \N \N 75F5CD43-FCF3-4923-879C-414D7BCAE364 2012-05-04 18:56:29 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 1 EPSG:3857 0 \N \N \N 1 \N \N \N CB4DB9D0-2011-4C4F-A437-743CE590E610 2012-04-11 16:41:51 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 1 EPSG:3857 0 \N \N \N 1 0.7 \N \N 907177E8-04FF-4AE8-B13C-AAA0400C0E1F 2012-01-17 15:00:56 690231A5-590A-46AF-92BE-16ECC80D2664 \N 17 EPSG:3857 0 \N \N \N 1 0.7 \N \N 5858D280-E241-481A-9DD3-C4B4DD0B9AD7 2012-04-11 16:52:38 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 13 EPSG:3857 0 \N \N \N 1 0.7 \N \N 5D727A88-F886-416E-806F-2128E90E18C6 2015-10-15 19:42:37 02C4183C-330F-4BC3-B9D7-AF31E5D07A2E image/png 24 EPSG:3857 0 \N \N \N 1 \N \N \N F4F48E6B-B417-4A60-9E90-348C456E6D03 2015-10-15 15:30:34 07A2F800-66D3-4FC0-90BE-23643039C258 image/png 1 EPSG:3857 0 \N \N \N 1 \N \N \N 00B3A988-207D-4E21-936B-9176E3EDEE18 2015-10-15 19:43:01 02C4183C-330F-4BC3-B9D7-AF31E5D07A2E image/png 28 EPSG:3857 0 \N \N \N 1 \N \N \N B2F55445-6D8C-4885-BEDD-A605BB36F93D 2012-05-04 18:57:18 A24CAC06-A205-4C41-83E2-FD7BE4428FA5 image/png 9 EPSG:3857 0 \N \N \N 1 0.7 \N \N 53B8C109-0686-4A0B-BE26-B7661C6098C7 2012-04-11 16:50:18 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 49 EPSG:3857 0 \N \N \N 1 0.7 \N \N 61072555-8845-499C-9F8E-6805AD111015 2012-04-11 16:48:04 F7FE0819-06D2-4822-8CE9-AFEBD7FF725A image/png 45 EPSG:3857 0 \N \N \N 1 0.7 \N \N CBB58898-3C37-4F34-A21C-62DB702D3EF7 2012-01-17 14:50:49 DA7807CD-90BA-4F92-9BDF-A9AF5C2D8939 \N 3 EPSG:3857 0 \N \N \N 1 \N \N \N 95C2FA37-887B-4E07-9931-57A2C77B66F8 2012-01-17 14:53:31 DA7807CD-90BA-4F92-9BDF-A9AF5C2D8939 \N 0 EPSG:3857 0 \N \N \N 1 \N \N \N C1E706C5-4E15-4FCA-A294-4B1EC5FC7803 2012-01-17 14:52:48 DA7807CD-90BA-4F92-9BDF-A9AF5C2D8939 \N 1 EPSG:3857 0 \N \N \N 1 \N \N \N 5BF4B603-7817-4DD8-8F20-BD640D35675B 2012-01-17 14:53:49 DA7807CD-90BA-4F92-9BDF-A9AF5C2D8939 \N 4 EPSG:3857 0 \N \N \N 1 \N \N \N 44CA6603-9D51-45D3-B65D-84708238953E 2012-05-04 18:57:42 3057080D-CF28-4898-9EFA-F6C5D88244B5 image/png 1 EPSG:3857 0 \N \N \N 1 0.6 \N \N 02F1971F-5276-4F3A-986C-9EC10D70F130 2012-05-15 11:56:26 690231A5-590A-46AF-92BE-16ECC80D2664 image/png 1 EPSG:3857 0 \N \N \N 1 \N \N \N
131.428571
139
0.743207
c3c567a474940e419991972d3d9196ba5deacec5
1,220
rs
Rust
src/areas/debug.rs
chances/descartes
0f31b1830f15a402089832c7a87d74aba3912005
[ "MIT" ]
37
2019-06-06T20:21:41.000Z
2022-02-27T09:10:53.000Z
src/areas/debug.rs
aeickhoff/descartes
0f31b1830f15a402089832c7a87d74aba3912005
[ "MIT" ]
1
2019-10-12T09:26:18.000Z
2019-10-12T09:26:18.000Z
src/areas/debug.rs
chances/descartes
0f31b1830f15a402089832c7a87d74aba3912005
[ "MIT" ]
4
2019-08-23T16:13:48.000Z
2021-01-11T08:53:12.000Z
use super::{N, P2, LinePath}; impl LinePath { pub fn from_svg(string: &str) -> Option<Self> { let mut tokens = string.split_whitespace(); let mut points = vec![]; while let Some(command) = tokens.next() { if command == "M" || command == "L" { let x: N = tokens .next() .expect("Expected 1st token after M/L") .parse() .expect("Can't parse 1st token after M/L"); let y: N = tokens .next() .expect("Expected 2nd token after M/L") .parse() .expect("Can't parse 2nd token after M/L"); points.push(P2::new(x, y)); } else if command == "Z" { let first_point = points[0]; points.push(first_point) } } Self::new(points.into()) } pub fn to_svg(&self) -> String { format!( "M {}", self.points .iter() .map(|point| format!("{} {}", point.x, point.y)) .collect::<Vec<_>>() .join(" L ") ) } }
29.756098
64
0.402459
28e9555e323a0e6de420096fc5115fc9f05fd83c
1,387
cpp
C++
text.cpp
Palamariuk/TextAnalyzer
6423a7e318db682b830a6b9d9c17347678196b26
[ "MIT" ]
1
2021-02-08T11:21:04.000Z
2021-02-08T11:21:04.000Z
text.cpp
Palamariuk/TextAnalyzer
6423a7e318db682b830a6b9d9c17347678196b26
[ "MIT" ]
null
null
null
text.cpp
Palamariuk/TextAnalyzer
6423a7e318db682b830a6b9d9c17347678196b26
[ "MIT" ]
null
null
null
#include "text.h" #include <QFileDialog> #include <QFile> #include <QMessageBox> #include <QTextStream> Text::Text(QString text): text_(text){} Text::Text(QString file, QString text): file_(file), text_(text){} Text::Text(const Text &other): file_(other.file_), text_(other.text_){} void Text::readFromFile(QString fileName) { QFile file(fileName); if(!file.open(QIODevice::ReadOnly | QFile::Text)) { throw FileOpenningException(); } file_ = fileName; QTextStream in(&file); in >> (*this); isSaved_ = true; file.close(); } void Text::saveToFile(QString fileName) { QFile file(fileName); if(!file.open(QIODevice::WriteOnly | QFile::Text)) { throw FileSavingException(); } file_ = fileName; QTextStream out(&file); out << *(this); isSaved_ = true; file.close(); } void Text::clearAll() { text_.clear(); file_.clear(); isSaved_ = false; } /*Friend functions*/ void operator>>(QTextEdit *textEdit, Text &text){ text.text_ = textEdit->toPlainText(); } void operator<<(QTextEdit *textEdit, Text &text){ textEdit->setText(text.text_); } QTextStream &operator<<(QTextStream &out, Text &text) { out << text.text_; return out; } QTextStream &operator>>(QTextStream &in, Text &txt) { txt.text_ = in.readAll(); txt.isSaved_ = true; return in; }
16.914634
56
0.633021
8844b9b63b68a0e03e35b294b987e32f8995d895
1,679
cpp
C++
src/Qt5Gui/QTextListFormat.cpp
dafrito/luacxx
278bf8a7c6664536ea7f1dd1f59d35b6fb8d2dad
[ "MIT" ]
128
2015-01-07T19:47:09.000Z
2022-01-22T19:42:14.000Z
src/Qt5Gui/QTextListFormat.cpp
dafrito/luacxx
278bf8a7c6664536ea7f1dd1f59d35b6fb8d2dad
[ "MIT" ]
null
null
null
src/Qt5Gui/QTextListFormat.cpp
dafrito/luacxx
278bf8a7c6664536ea7f1dd1f59d35b6fb8d2dad
[ "MIT" ]
24
2015-01-07T19:47:10.000Z
2022-01-25T17:42:37.000Z
#include "QTextListFormat.hpp" #include "../convert/callable.hpp" #include "../convert/const_char_p.hpp" #include "../convert/numeric.hpp" #include "../thread.hpp" #include "../Qt5Core/QString.hpp" namespace lua { void QTextListFormat_metatable(lua_State* const state, const int pos) { lua::index mt(state, pos); mt["indent"] = &QTextListFormat::indent; mt["isValid"] = &QTextListFormat::isValid; mt["numberPrefix"] = &QTextListFormat::numberPrefix; mt["numberSuffix"] = &QTextListFormat::numberSuffix; mt["setIndent"] = &QTextListFormat::setIndent; mt["setNumberPrefix"] = &QTextListFormat::setNumberPrefix; mt["setNumberSuffix"] = &QTextListFormat::setNumberSuffix; mt["setStyle"] = &QTextListFormat::setStyle; mt["style"] = &QTextListFormat::style; } } // namespace lua int QTextListFormat_new(lua_State* const state) { lua::make<QTextListFormat>(state); // TODO Set up constructor return 1; } int luaopen_Qt5Gui_QTextListFormat(lua_State* const state) { lua::thread env(state); env["QTextListFormat"] = lua::value::table; env["QTextListFormat"]["new"] = QTextListFormat_new; auto t = env["QTextListFormat"]; // enum QTextListFormat::Style t["ListDisc"] = QTextListFormat::ListDisc; t["ListCircle"] = QTextListFormat::ListCircle; t["ListSquare"] = QTextListFormat::ListSquare; t["ListDecimal"] = QTextListFormat::ListDecimal; t["ListLowerAlpha"] = QTextListFormat::ListLowerAlpha; t["ListUpperAlpha"] = QTextListFormat::ListUpperAlpha; t["ListLowerRoman"] = QTextListFormat::ListLowerRoman; t["ListUpperRoman"] = QTextListFormat::ListUpperRoman; return 0; }
30.527273
69
0.70399
9c737f31e17d153fce6e0c86d58a2694b48c7283
1,780
cpp
C++
snark-logic/libs-source/multiprecision/test/test_mpc_overloads.cpp
podlodkin/podlodkin-freeton-year-control
e394c11f2414804d2fbde93a092ae589d4359739
[ "MIT" ]
1
2021-09-14T18:09:38.000Z
2021-09-14T18:09:38.000Z
snark-logic/libs-source/multiprecision/test/test_mpc_overloads.cpp
podlodkin/podlodkin-freeton-year-control
e394c11f2414804d2fbde93a092ae589d4359739
[ "MIT" ]
null
null
null
snark-logic/libs-source/multiprecision/test/test_mpc_overloads.cpp
podlodkin/podlodkin-freeton-year-control
e394c11f2414804d2fbde93a092ae589d4359739
[ "MIT" ]
1
2021-08-31T06:27:19.000Z
2021-08-31T06:27:19.000Z
// Copyright 2012 John Maddock. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt #include <type_traits> #include "test.hpp" #include <nil/crypto3/multiprecision/mpc.hpp> #include <boost/math/constants/constants.hpp> using nil::crypto3::multiprecision::mpc_complex_100; template<class Complex> void test_overloads() { typedef typename Complex::value_type Real; Complex ya = {5.2, 7.4}; Complex yb = {8.2, 7.3}; Real h = 0.0001; auto I0 = (ya + yb) * h; Complex I1 = I0 / 2 + yb * h; // I1 = I0; // not supposed to work. Complex z {2, 3}; typename Complex::value_type theta = 0.2; int n = 2; using std::sin; Complex arg = z * sin(theta) - n * theta; using std::exp; Real v = 0.2; Real cotv = 7.8; Real cscv = 8.2; Complex den = z + v * cscv * exp(-v * cotv); nil::crypto3::multiprecision::number<nil::crypto3::multiprecision::backends::mpc_complex_backend<100>> a = 2; nil::crypto3::multiprecision::number<nil::crypto3::multiprecision::backends::mpc_complex_backend<100>> b = 3; /* if (a <= b) { b = a; }*/ } template<class F, class Real> typename std::result_of_t<F(Real)> some_functional(F f, Real a, Real b) { if (a <= -boost::math::tools::max_value<Real>()) { return f(a); } return f(b); } template<class Complex> void test_functional() { typedef typename Complex::value_type Real; auto f = [](Real x) -> Complex { Complex z(x, 3); return z; }; Real a = 0; Real b = 1; Complex result = some_functional(f, a, b); } int main() { test_overloads<mpc_complex_100>(); test_functional<mpc_complex_100>(); }
26.176471
113
0.625843
0ac84bfcb2e1c51e7b040513afb3c5bbd100537b
765
go
Go
lib/types.go
flipace/hantera
7be8db0b065e4b60f455cc596f6587ef5d9e9a64
[ "Apache-2.0" ]
2
2017-04-10T06:16:59.000Z
2017-04-10T07:42:53.000Z
lib/types.go
flipace/hantera
7be8db0b065e4b60f455cc596f6587ef5d9e9a64
[ "Apache-2.0" ]
9
2017-04-14T06:40:10.000Z
2017-04-19T06:55:24.000Z
lib/types.go
flipace/hantera
7be8db0b065e4b60f455cc596f6587ef5d9e9a64
[ "Apache-2.0" ]
null
null
null
package lib // ProductConfig : config for product type ProductConfig struct { Name string Version string Description string Dependencies map[string]*DependencyConfig Steps Step } // DependencyConfig : config for dependency type DependencyConfig struct { Version string Description string Repository string Artifacts string } // Step : a step is a command of hantera for which additional commands/functionality can be configured type Step struct { Setup StepConfiguration Update StepConfiguration Dependencies StepConfiguration } // StepConfiguration : contains information about pre/post/override commands for a step type StepConfiguration struct { Pre []string Override []string Post []string }
23.181818
102
0.747712
42e534c14de37e5d10a1444f9f19b0c01e7c0521
2,996
swift
Swift
PufferExample/PufferExample/ViewController.swift
guoyingtao/Puffer
b8e21cb78ba195642ce4db1d8aa367821311ea06
[ "MIT" ]
16
2018-11-17T18:33:06.000Z
2022-02-25T11:11:30.000Z
PufferExample/PufferExample/ViewController.swift
mohsinalimat/Puffer
c63769409afbb11036e335541995b38a030945b1
[ "MIT" ]
1
2020-09-02T15:04:27.000Z
2021-02-10T04:43:43.000Z
PufferExample/PufferExample/ViewController.swift
mohsinalimat/Puffer
c63769409afbb11036e335541995b38a030945b1
[ "MIT" ]
3
2018-11-17T18:33:08.000Z
2022-01-10T07:34:42.000Z
// // ViewController.swift // PufferExample // // Created by Echo on 11/12/18. // Copyright © 2018 Echo. All rights reserved. // import UIKit import Puffer class ViewController: UIViewController { @IBOutlet weak var dial: RotationDial! @IBOutlet weak var roateAngleValue: UILabel! @IBOutlet weak var customRotationView: UIView! var orientation: Config.Orientation = .normal override func viewDidLoad() { super.viewDidLoad() customRotationView.isHidden = true dial.setup() dial.didRotate = {[weak self] angle in guard let self = self else { return } self.roateAngleValue.text = String(format:"%0.02f°", angle.degrees) if self.customRotationView.isHidden == false { self.customRotationView.transform = CGAffineTransform(rotationAngle: self.dial.getRotationAngle().radians) } } } private func resetStatus() { customRotationView.isHidden = true roateAngleValue.text = "0°" } @IBAction func color(_ sender: Any) { resetStatus() var config = Config() config.numberShowSpan = 2 config.centerAxisColor = .yellow config.bigScaleColor = .blue config.smallScaleColor = .red config.indicatorColor = .brown config.numberColor = .purple config.backgroundColor = .lightGray dial.setup(with: config) } @IBAction func reset(_ sender: Any) { resetStatus() dial.setup() } @IBAction func rotateLimit(_ sender: Any) { resetStatus() var config = Config() config.rotationLimitType = .limit(angle: CGAngle(degrees: 45)) dial.setup(with: config) } @IBAction func showLimit(_ sender: Any) { resetStatus() var config = Config() config.angleShowLimitType = .limit(angle: CGAngle(degrees: 60)) dial.setup(with: config) } @IBAction func changeOrientation(_ sender: Any) { resetStatus() var config = Config() config.angleShowLimitType = .limit(angle: CGAngle(degrees: 60)) if orientation == .normal { config.orientation = .left } else if orientation == .left { config.orientation = .upsideDown } else if orientation == .upsideDown { config.orientation = .right } else if orientation == .right { config.orientation = .normal } orientation = config.orientation dial.setup(with: config) } @IBAction func testCenter(_ sender: Any) { resetStatus() customRotationView.transform = .identity customRotationView.isHidden = false dial.setRotationCenter(by: customRotationView.center, of: self.view) dial.setup() } }
26.75
122
0.579773
629f85636b00d7ddfd68245152f2c8ebad2490eb
1,135
swift
Swift
FormUIKit/Sources/FormCustomTableViewCell.swift
sahandnayebaziz/FormKit
df3c88bd2751cb138394a1a03cd1ebd2fd567c3f
[ "MIT" ]
null
null
null
FormUIKit/Sources/FormCustomTableViewCell.swift
sahandnayebaziz/FormKit
df3c88bd2751cb138394a1a03cd1ebd2fd567c3f
[ "MIT" ]
null
null
null
FormUIKit/Sources/FormCustomTableViewCell.swift
sahandnayebaziz/FormKit
df3c88bd2751cb138394a1a03cd1ebd2fd567c3f
[ "MIT" ]
null
null
null
// // FormCustomDescription.swift // FormUIKit // // Created by Sahand on 7/8/18. // Copyright © 2018 Sahand. All rights reserved. // import Foundation import UIKit public protocol FormCustomFieldDescribable: FormFieldDescribable { var cellIdentifier: String { get set } var configureCell: ((FormCustomTableViewCell) -> Void)? { get } var validateCell: ((Bool, Bool, FormCustomTableViewCell) -> Void)? { get } } public struct FormCustomDescription: FormCustomFieldDescribable { public var tag: String public var cellIdentifier: String public var configureCell: ((FormCustomTableViewCell) -> Void)? public var validateCell: ((Bool, Bool, FormCustomTableViewCell) -> Void)? public init(tag: String, cellIdentifier: String) { self.tag = tag self.cellIdentifier = cellIdentifier } } open class FormCustomTableViewCell: UITableViewCell { open var formCustomDescription: FormCustomFieldDescribable? = nil open var layoutComplete = false open func set(for description: FormCustomFieldDescribable, value: Any?) {} open func resetCell() {} }
27.682927
78
0.709251
6d3efb71f49f8ecce98d5e5694ab182e8b7bf7db
150
dart
Dart
dartpad_codelabs/src/null_safety_workshop/step_08/snippet.dart
mynameishaheer/codelabs
bf319b368f5e99ca7471100978964482519fd704
[ "BSD-3-Clause" ]
630
2018-12-04T15:54:07.000Z
2022-03-31T13:17:05.000Z
dartpad_codelabs/src/null_safety_workshop/step_08/snippet.dart
mynameishaheer/codelabs
bf319b368f5e99ca7471100978964482519fd704
[ "BSD-3-Clause" ]
126
2019-04-10T18:28:41.000Z
2022-03-29T23:29:29.000Z
dartpad_codelabs/src/null_safety_workshop/step_08/snippet.dart
mynameishaheer/codelabs
bf319b368f5e99ca7471100978964482519fd704
[ "BSD-3-Clause" ]
750
2018-12-17T04:34:50.000Z
2022-03-31T19:55:46.000Z
int getLength(String? str) { // Try throwing an exception here if `str` is null. return str.length; } void main() { print(getLength(null)); }
15
53
0.66
49b606da4e46826c5ae851140aaa2c15fc71c4ce
847
html
HTML
manuscript/page-1411/body.html
marvindanig/the-deerslayer
683a4076cbd349051b1bbd279ae98931355f1afc
[ "CECILL-B" ]
null
null
null
manuscript/page-1411/body.html
marvindanig/the-deerslayer
683a4076cbd349051b1bbd279ae98931355f1afc
[ "CECILL-B" ]
null
null
null
manuscript/page-1411/body.html
marvindanig/the-deerslayer
683a4076cbd349051b1bbd279ae98931355f1afc
[ "CECILL-B" ]
null
null
null
<div class="leaf flex"><div class="inner justify"><p>&ldquo;It is so. Sumach has but one tongue; she can tell but one story. The pale face struck the Hurons lest the Hurons should strike him. The Hurons are a just nation; they will forget it. The chiefs will shut their eyes and pretend not to have seen it; the young men will believe the Panther and the Lynx have gone to far off hunts, and the Sumach will take her children by the hand, and go into the lodge of the pale-face and say&mdash;'See; these are your children; they are also mine&mdash;feed us, and we will live with you.'&rdquo;</p><p>&ldquo;The tarms are onadmissable, woman, and though I feel for your losses, which must be hard to bear, the tarms cannot be accepted. As to givin' you ven'son, in case we lived near enough together, that would be no great expl'ite;</p></div> </div>
847
847
0.755608
4ad2c29682552ea4ffaf4c0861dd047c378e3aec
3,850
cs
C#
PerpusApp/Source/Controllers/StaffCategoryController.cs
Tsucie/LibraryApp
8a2d932479ace6947a2bb62d1b7478d959b985ac
[ "MIT" ]
null
null
null
PerpusApp/Source/Controllers/StaffCategoryController.cs
Tsucie/LibraryApp
8a2d932479ace6947a2bb62d1b7478d959b985ac
[ "MIT" ]
null
null
null
PerpusApp/Source/Controllers/StaffCategoryController.cs
Tsucie/LibraryApp
8a2d932479ace6947a2bb62d1b7478d959b985ac
[ "MIT" ]
null
null
null
using System; using System.Data; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Http; using PerpusApp.Source.CRUD; using PerpusApp.Source.Models; using PerpusApp.Source.General; namespace PerpusApp.Source.Controller { [Route("PerpusApp/[controller]")] [ApiController] public class StaffCategoryController : ControllerBase { [HttpGet("GetList")] public async Task<IActionResult> ReadAllData() { try { List<StaffCategory> staffCategories = await Task.Run(() => StaffCategoryCRUD.ReadAll(Startup.db_perpus_ConnStr)); return Ok(staffCategories); } catch (Exception) { return BadRequest(); } } [HttpGet("GetData/{sc_id}")] public ActionResult ReadData([FromRoute] int sc_id) { ReturnMessage response = new ReturnMessage(); try { StaffCategory sc = StaffCategoryCRUD.Read(Startup.db_perpus_ConnStr, sc_id); if(sc.Equals(null)) throw new Exception("", new Exception("Error Get data from Database!")); return Ok(sc); } catch (Exception ex) { response.Error(ex); return Ok(response); } } [HttpPost("Add")] public ActionResult CreateData([FromBody] StaffCategory sc) { ReturnMessage response = new ReturnMessage(); try { if(string.IsNullOrEmpty(sc.sc_name)) throw new Exception("", new Exception("Data is not added. Incomplete data")); if(StaffCategoryCRUD.Create(Startup.db_perpus_ConnStr, sc) != 1) throw new Exception("", new Exception("Data is not added in database")); response.Code = 1; response.Message = "Kategori staff berhasil ditambahkan!"; return Ok(response); } catch (Exception ex) { response.Error(ex); return Ok(response); } } [HttpPut("Edit")] public ActionResult UpdateData([FromBody] StaffCategory sc) { ReturnMessage response = new ReturnMessage(); try { if(string.IsNullOrEmpty(sc.sc_name)) throw new Exception("", new Exception("Data is not updated. Incomplete data")); if(StaffCategoryCRUD.Update(Startup.db_perpus_ConnStr, (int)sc.sc_id, sc) != 1) throw new Exception("", new Exception("Data is not Updated in database")); response.Code = 1; response.Message = "Kategori staff berhasil di Update!"; return Ok(response); } catch (Exception ex) { response.Error(ex); return Ok(response); } } [HttpDelete("Delete")] public ActionResult DeleteData([FromBody] StaffCategory sc) { ReturnMessage response = new ReturnMessage(); try { if (sc.sc_id.Equals(null)) throw new Exception("", new Exception("Data is not deleted. Incomplete data")); if (StaffCategoryCRUD.Delete(Startup.db_perpus_ConnStr, (int)sc.sc_id) != 1) throw new Exception("", new Exception("Data is not deleted in database")); response.Code = 1; response.Message = "Kategori staff berhasil dihapus!"; return Ok(response); } catch (Exception ex) { response.Error(ex); return Ok(response); } } } }
32.083333
170
0.545974
6b2ed9e0e5b75c41b593757358d2aa1f27d53b2c
3,579
html
HTML
Practica3/templates/index.html
adrianmorente/PracticasDAI
0f0a032a9cade87298c2b7bcbad4ca4d6b867b1d
[ "MIT" ]
null
null
null
Practica3/templates/index.html
adrianmorente/PracticasDAI
0f0a032a9cade87298c2b7bcbad4ca4d6b867b1d
[ "MIT" ]
null
null
null
Practica3/templates/index.html
adrianmorente/PracticasDAI
0f0a032a9cade87298c2b7bcbad4ca4d6b867b1d
[ "MIT" ]
null
null
null
<!DOCTYPE html> <html> {% block head %} <head> <meta charset="utf-8"/> <title>AMorente - {% block title %}Home{% endblock %}</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}"/> <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"/> <link rel="icon" type="image/png" href="static/images/dark-icon.png" /> <link href="https://fonts.googleapis.com/css?family=Fredoka+One" rel="stylesheet" /> <link href="https://fonts.googleapis.com/css?family=Patua+One" rel="stylesheet" /> </head> {% endblock %} <body> {% block header %} <header class="w3-container w3-row w3-padding-16"> <div class="w3-third w3-padding-16 w3-center"> <img src="../static/images/user-icon.png" alt="Bball logo" style="width=100%"/> </div> <div id="center-header" class="w3-third w3-padding-16 w3-center"> <h1>{% block content_title %}Adrian Morente{% endblock %}</h1> <h3>{% block content_subtitle %}Welcome to my new page!{% endblock %}</h3> </div> <div class="w3-third w3-padding-16 w3-center"> {% if not loggedIn %} <form action="/" method="post"> <p>Username: <input type="text" name="username" /></p> <p>Password: <input type="password" name="password" /></p> <p><input type="submit" value="Login" /> <button><a href="/register">Sign up</a></button></p> </form> {% else %} <div class="logged"> <p>Welcome, dear {{ session['username'] }}</p> <p><a href="/logout">Log out</a></p> </div> {% endif %} </div> </header> {% endblock %} {% block content %} <div id="centered-content" class="w3-container w3-row w3-padding-16"> {% block navbar %} <div class="navbar w3-col m3 w3-padding-32"> <ul> {% block links %} <a href="/home"><li>Home</li></a> <a href="/github"><li>Github account</li></a> <a href="/contact"><li>Contact (Twitter)</li></a> {% if session['username'] %} <a href="/edit"><li>Edit</li></a> <br /> <a href={{ session['last_visited_1'] }}><li>Last visited page (1st)</li></a> <a href={{ session['last_visited_2'] }}><li>Last visited page (2nd)</li></a> <a href={{ session['last_visited_3'] }}><li>Last visited page (3rd)</li></a> {% endif %} {% endblock %} </ul> </div> {% endblock %} <div id="main-content" class="w3-col m8 w3-right w3-padding-16"> <div class="w3-container w3-center"> <h1>{% block content_section_title %}Home page{% endblock %}</h1> {% block centeredfield %} <div class="w3-center"> <a href="{% block content_image_link %}home{% endblock %}"> <img src="../static/images/{% block content_image %}home.png{% endblock %}" /> </a> </div> {% endblock %} {% block centeredfield_text %} <div class="w3-center"> <p>{% block content_section_text %}Hi, dear visitor. This is my new ugly page.{% endblock %}</p> </div> {% endblock %} </div> </div> </div> {% endblock %} {% block footer %} <footer class="w3-row w3-padding-16"> <h4>&copy; Adrián Morente Gabaldón (MIT License)</h4> </footer> {% endblock %} </body> </html>
38.483871
108
0.531992
fbd8c194f21ae9feffb24c89f9ada30a5fedb808
7,258
java
Java
jsource/ideal/development/actions/base_analysis_context.java
dynin/ideal
1c9bd5672174e44178bd64fb3596e26d5dd5c0ba
[ "BSD-3-Clause" ]
4
2020-05-07T14:47:39.000Z
2021-08-16T21:16:50.000Z
jsource/ideal/development/actions/base_analysis_context.java
dynin/ideal
1c9bd5672174e44178bd64fb3596e26d5dd5c0ba
[ "BSD-3-Clause" ]
null
null
null
jsource/ideal/development/actions/base_analysis_context.java
dynin/ideal
1c9bd5672174e44178bd64fb3596e26d5dd5c0ba
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright 2014-2021 The Ideal Authors. All rights reserved. * * Use of this source code is governed by a BSD-style * license that can be found in the LICENSE file or at * https://developers.google.com/open-source/licenses/bsd */ package ideal.development.actions; import ideal.library.elements.*; import ideal.library.graphs.*; import ideal.runtime.elements.*; import ideal.runtime.graphs.*; import javax.annotation.Nullable; import ideal.development.elements.*; import ideal.development.names.*; import ideal.development.constructs.*; import ideal.development.declarations.*; import ideal.development.types.*; import ideal.development.values.*; import ideal.development.flavors.*; import ideal.development.origins.*; import ideal.development.kinds.*; import ideal.development.notifications.*; public class base_analysis_context extends debuggable implements analysis_context { private static action_table actions = new action_table(); private final base_semantics language; private graph<principal_type, origin> the_type_graph; public final @Nullable function1<abstract_value, variable_declaration> constraints; public base_analysis_context(base_semantics language) { this.language = language; this.the_type_graph = new base_graph<principal_type, origin>(); this.constraints = null; if (!common_types.is_initialized()) { new common_types(this); } if (!common_values.is_initialized()) { common_values.initialize(); } } private base_analysis_context(base_analysis_context parent, @Nullable function1<abstract_value, variable_declaration> constraints) { this.language = parent.language; this.the_type_graph = parent.the_type_graph; this.constraints = constraints; } public analysis_context with_constraints( @Nullable function1<abstract_value, variable_declaration> constraints) { return new base_analysis_context(this, constraints); } @Override public language_settings settings() { return language; } @Override public readonly_list<action> lookup(type from, action_name name) { return actions.lookup(from, name); } @Override public void add(type from, action_name name, action the_action) { actions.add(from, name, the_action); } @Override public void add_supertype(type subtype, type supertype) { actions.add(subtype, special_name.SUPERTYPE, supertype.to_action(origin_utilities.no_origin)); } @Override public readonly_list<action> resolve(type from, action_name name, origin pos) { return language.resolve(actions, from, name, pos); } @Override public boolean is_subtype_of(abstract_value the_value, type the_type) { return language.is_subtype_of(actions, the_value, the_type); } @Override public type find_supertype_procedure(abstract_value the_value) { return language.find_supertype_procedure(actions, the_value); } public @Nullable action find_promotion(action from, type target, @Nullable function1<abstract_value, variable_declaration> constraint_mapper) { if (constraint_mapper != null) { @Nullable narrow_action the_action = can_narrow(from, constraint_mapper); if (the_action != null) { @Nullable action result = find_promotion(the_action, target, null); if (result != null) { return result.combine(the_action, origin_utilities.no_origin); } } } return language.find_promotion(actions, from.result().type_bound(), target); } public @Nullable narrow_action can_narrow(action from, @Nullable function1<abstract_value, variable_declaration> constraint_mapper) { @Nullable declaration the_declaration = declaration_util.get_declaration(from); if (the_declaration != null && the_declaration instanceof variable_declaration) { variable_declaration the_variable_declaration = (variable_declaration) the_declaration; @Nullable abstract_value narrowed = constraint_mapper.call(the_variable_declaration); if (narrowed != null) { origin the_origin = from; type narrowed_type = narrowed.type_bound(); if (from instanceof narrow_action) { return new narrow_action((((narrow_action) from).expression), narrowed_type, the_variable_declaration, the_origin); } else { return new narrow_action(from, narrowed_type, the_variable_declaration, the_origin); } } } return null; } @Override public action to_value(action expression, origin the_origin) { if (constraints != null) { // We need to specially handled narrowed variables here // because the reference type is not narrowed. // Say the variable declaration is "string or null foo", and it's narrowed to string. // The is_reference_type(the_type) would return a union type, which is not what we want. action narrowed_action = can_narrow(expression, constraints); if (narrowed_action != null) { return narrowed_action; } } type the_type = expression.result().type_bound(); if (common_types.is_reference_type(the_type)) { // TODO: check that flavor is readonly or mutable. type value_type = common_types.get_reference_parameter(the_type); // TODO: replace this with a promotion lookup. return promote(expression, value_type, the_origin); } else { return expression; } } @Override public boolean can_promote(action from, type target) { return find_promotion(from, target, constraints) != null; } @Override public action promote(action from, type target, origin pos) { if (from instanceof error_signal) { return from; } @Nullable action result = find_promotion(from, target, constraints); if (result != null) { return result.combine(from, pos); } else { error_signal signal = action_utilities.cant_promote(from.result(), target, pos); //return new error_action(signal); utilities.panic(signal.to_string()); return null; } } @Override public graph<principal_type, origin> type_graph() { return the_type_graph; } @Override public boolean is_parametrizable(type the_type) { if (the_type instanceof master_type) { return ((master_type) the_type).has_parametrizable_state(); } return common_types.is_procedure_type(the_type); } @Override public void declare_type(principal_type new_type, declaration_pass pass) { language.declare_type(new_type, pass, this); } @Override public master_type get_or_create_type(action_name name, kind kind, principal_type parent, flavor_profile the_flavor_profile) { readonly_list<type> types = action_utilities.lookup_types(this, parent, name); // TODO: handle error conditions if (types.size() == 1) { return (master_type) types.first(); } else { return action_utilities.make_type(this, kind, the_flavor_profile, name, parent, null, origin_utilities.builtin_origin); } } @Override public type_policy get_policy(kind the_kind) { return language.get_policy(the_kind); } @Override public string to_string() { return new base_string("context ", constraints.toString()); } }
32.693694
98
0.720722
90e2375c038e33be33c8bde6873a9ed8ac191480
8,042
py
Python
tests/core/method-class/test_method.py
shinnng/platon.py
3197fac3839896290210da04dd0d45f0bdc731ce
[ "MIT" ]
null
null
null
tests/core/method-class/test_method.py
shinnng/platon.py
3197fac3839896290210da04dd0d45f0bdc731ce
[ "MIT" ]
null
null
null
tests/core/method-class/test_method.py
shinnng/platon.py
3197fac3839896290210da04dd0d45f0bdc731ce
[ "MIT" ]
null
null
null
from inspect import ( isclass, ) import pytest from platon_utils.toolz import ( compose, ) from platon import ( PlatonTesterProvider, Web3, ) from platon.method import ( Method, _apply_request_formatters, default_root_munger, ) from platon.module import ( Module, apply_result_formatters, ) def test_method_accepts_callable_for_selector(): method = Method( mungers=[], json_rpc_method=lambda *_: 'platon_method', ) assert method.method_selector_fn() == 'platon_method' def test_method_selector_fn_accepts_str(): method = Method( mungers=None, json_rpc_method='platon_method', ) assert method.method_selector_fn() == 'platon_method' def test_method_selector_fn_invalid_arg(): with pytest.raises(ValueError): method = Method( mungers=[], json_rpc_method=555555, ) method.method_selector_fn() def test_get_formatters_default_formatter_for_falsy_config(): method = Method( mungers=[], json_rpc_method='platon_method', ) default_request_formatters = method.request_formatters(method.method_selector_fn()) default_result_formatters = method.result_formatters(method.method_selector_fn(), 'some module') assert _apply_request_formatters(['a', 'b', 'c'], default_request_formatters) == ('a', 'b', 'c') assert apply_result_formatters( default_result_formatters, ['a', 'b', 'c']) == ['a', 'b', 'c'] def test_get_formatters_non_falsy_config_retrieval(): method = Method( mungers=[], json_rpc_method='platon_getBalance', ) method_name = method.method_selector_fn() first_formatter = (method.request_formatters(method_name).first,) all_other_formatters = method.request_formatters(method_name).funcs assert len(first_formatter + all_other_formatters) == 2 # assert method.request_formatters('platon_nonmatching') == 'nonmatch' def test_input_munger_parameter_passthrough_matching_arity(): method = Method( mungers=[lambda m, z, y: ['success']], json_rpc_method='platon_method', ) method.input_munger(object(), ['first', 'second'], {}) == 'success' def test_input_munger_parameter_passthrough_mismatch_arity(): method = Method( mungers=[lambda m, z, y: 'success'], json_rpc_method='platon_method', ) with pytest.raises(TypeError): method.input_munger(object(), ['first', 'second', 'third'], {}) def test_input_munger_falsy_config_result_in_default_munger(): method = Method( mungers=[], json_rpc_method='platon_method', ) method.input_munger(object(), [], {}) == [] def test_default_input_munger_with_input_parameters_exception(): method = Method( mungers=[], json_rpc_method='platon_method', ) with pytest.raises(TypeError): method.input_munger(object(), [1], {}) @pytest.mark.parametrize( "method_config,args,kwargs,expected_request_result,expected_result_formatters_len", ( ( { 'mungers': [], }, [], {}, ValueError, 2 ), ( { 'mungers': [], 'json_rpc_method': 'platon_getBalance', }, ['unexpected_argument'], {}, TypeError, 2 ), ( { 'mungers': [default_root_munger], 'json_rpc_method': 'platon_getBalance', }, ['0x0000000000000000000000000000000000000000', 3], {}, ('platon_getBalance', (('0x' + '00' * 20), "0x3")), 2 ), ( { 'mungers': [default_root_munger], 'json_rpc_method': lambda *_: 'platon_getBalance', }, ['0x0000000000000000000000000000000000000000', 3], {}, ('platon_getBalance', (('0x' + '00' * 20), "0x3")), 2 ), ( { 'mungers': [ lambda m, x, y, z, addr: [x, y, addr], lambda m, x, y, addr: [x, addr], lambda m, x, addr: [addr, str(x)]], 'json_rpc_method': 'platon_getBalance', }, [1, 2, 3, ('0x' + '00' * 20)], {}, ('platon_getBalance', (('0x' + '00' * 20), "1")), 2, ), ( { 'mungers': [ lambda m, x, y, z: [x, y], lambda m, x, y: [x], lambda m, x: [str(x)]], 'json_rpc_method': 'platon_getBalance', }, [1, 2, 3, 4], {}, TypeError, 2, ), ( { 'mungers': [default_root_munger], 'json_rpc_method': 'platon_getBalance', }, ('0x0000000000000000000000000000000000000000', 3), {}, ('platon_getBalance', ('0x0000000000000000000000000000000000000000', '0x3')), 2, ), ( { 'mungers': [ lambda m, addr, x, y, z: [addr, x, y], lambda m, addr, x, y: [addr, x], lambda m, addr, x: [addr, str(x)]], 'json_rpc_method': 'platon_getBalance', }, [('0x' + '00' * 20), 1, 2, 3], {}, ('platon_getBalance', (('0x' + '00' * 20), '1')), 2, ), ( { 'mungers': None, 'json_rpc_method': 'platon_chainId', }, [], {}, ('platon_chainId', ()), 2, ) ), ids=[ 'raises-error-no-rpc-method', 'test-unexpected-arg', 'test-rpc-method-as-string', 'test-rpc-method-as-callable', 'test-arg-munger', 'test-munger-wrong-length-arg', 'test-request-formatters', 'test-mungers-and-request-formatters', 'test-response-formatters', ] ) def test_process_params( method_config, args, kwargs, expected_request_result, expected_result_formatters_len): if isclass(expected_request_result) and issubclass(expected_request_result, Exception): with pytest.raises(expected_request_result): method = Method(**method_config) request_params, output_formatter = method.process_params(object(), *args, **kwargs) else: method = Method(**method_config) request_params, output_formatter = method.process_params(object(), *args, **kwargs) assert request_params == expected_request_result first_formatter = (output_formatter[0].first,) all_other_formatters = output_formatter[0].funcs assert len(first_formatter + all_other_formatters) == expected_result_formatters_len def keywords(module, keyword_one, keyword_two): return module, [keyword_one, keyword_two] class Success(Exception): pass def return_exception_raising_formatter(method): def formatter(params): raise Success() return compose(formatter) class FakeModule(Module): method = Method( 'platon_method', mungers=[keywords], request_formatters=return_exception_raising_formatter) @pytest.fixture def dummy_w3(): return Web3( PlatonTesterProvider(), modules={'fake': (FakeModule,)}, middlewares=[]) def test_munger_class_method_access_raises_friendly_error(): with pytest.raises(TypeError, match='Direct calls to methods are not supported'): FakeModule.method(1, 2) def test_munger_arguments_by_keyword(dummy_w3): with pytest.raises(Success): dummy_w3.fake.method(keyword_one=1, keyword_two='latest') with pytest.raises(Success): dummy_w3.fake.method(1, keyword_two=2)
28.51773
100
0.560308
c7b8d049fa43f9b0ee9ffa7226f37aa37492ba4d
1,456
py
Python
tests/test_weighted_ref.py
bbux-dev/datacraft
c1f970b19cb5181de7099a3e7c4f73e8f0aa9519
[ "MIT" ]
null
null
null
tests/test_weighted_ref.py
bbux-dev/datacraft
c1f970b19cb5181de7099a3e7c4f73e8f0aa9519
[ "MIT" ]
3
2022-01-02T08:05:01.000Z
2022-01-30T17:58:09.000Z
tests/test_weighted_ref.py
bbux-dev/datacraft
c1f970b19cb5181de7099a3e7c4f73e8f0aa9519
[ "MIT" ]
null
null
null
# to trigger registration import pytest from datacraft import builder, suppliers, field_loader, SupplierException from datacraft.supplier.refs import weighted_ref_supplier # to trigger registration from datacraft import cli def test_weighted_ref_missing_key(): ref_weights = { 'foo': 0.5, 'bar': 0.4, 'baz': 0.1, } spec = builder.single_field('field', builder.weighted_ref(ref_weights)) \ .add_ref('foo', ['foo']) \ .add_ref('bar', 'bar') \ .add_ref('baz', {'baz': 0.999}) \ .build() key_supplier = suppliers.values(['foo', 'bar', 'baz', 'notvalid']) values_map = {key: suppliers.values(value) for key, value in spec['refs'].items()} supplier = weighted_ref_supplier(key_supplier, values_map) with pytest.raises(SupplierException) as exception: [supplier.next(i) for i in range(0, 10)] assert "Unknown Key 'notvalid' for Weighted Reference" in str(exception.value) def test_weighed_ref_count_as_list(): ref_weights = { 'one': 0.5, 'two': 0.4, 'tre': 0.1, } spec = builder.single_field('field', builder.weighted_ref(ref_weights, count=3)) \ .add_ref('one', 'uno') \ .add_ref('two', 'dos') \ .add_ref('tre', 'tres') \ .build() loader = field_loader(spec) supplier = loader.get('field') first = supplier.next(0) assert isinstance(first, list) assert len(first) == 3
29.714286
86
0.627747
3325770753d667e77743781366da32f9619358fe
735
cpp
C++
C语言程序设计基础/H23:逆波兰算术表达式.cpp
xiabee/BIT-CS
5d8d8331e6b9588773991a872c259e430ef1eae1
[ "Apache-2.0" ]
63
2021-01-10T02:32:17.000Z
2022-03-30T04:08:38.000Z
C语言程序设计基础/H23:逆波兰算术表达式.cpp
xiabee/BIT-CS
5d8d8331e6b9588773991a872c259e430ef1eae1
[ "Apache-2.0" ]
2
2021-06-09T05:38:58.000Z
2021-12-14T13:53:54.000Z
C语言程序设计基础/H23:逆波兰算术表达式.cpp
xiabee/BIT-CS
5d8d8331e6b9588773991a872c259e430ef1eae1
[ "Apache-2.0" ]
20
2021-01-12T11:49:36.000Z
2022-03-26T11:04:58.000Z
#include <stdio.h> int main() { char c[1000]; gets(c); int a[1000] = {0}, w = 0, r = 0; for (int i = 0; c[i] != '\0'; i++) { int temp = 0; if (c[i] >= '0' && c[i] <= '9') { while (c[i] >= '0' && c[i] <= '9') { temp = temp * 10 +( c[i] - '0'); i++; } // i--; a[w++] = temp; } else { if (c[i] == '+' || c[i] == '-' || c[i] == '*' || c[i] == '/') { switch (c[i]) { case '+': r = a[w-1] + a[w-2]; a[w-1] = r; break; case '-': r = a[w-2] - a[w-1]; a[w-1] = r; break; case '*': r = a[w-1] * a[w-2]; a[w-1] = r; break; case '/': r = a[w-2] / a[w-1]; a[w-1] = r; break; } for (int i = w-2; i - 1 >= 0; i--) a[i] = a[i-1]; } } } printf ("%d\n", r); }
15.978261
64
0.321088
48e2c0eba1a28aeee948bf1f4be2c5c208457638
769
dart
Dart
lib/di/machine_controller_scope.dart
NikitaMasev/control_machine
07953568e8ebf325c1eb8919e7d8d752c6d7a821
[ "Apache-2.0" ]
null
null
null
lib/di/machine_controller_scope.dart
NikitaMasev/control_machine
07953568e8ebf325c1eb8919e7d8d752c6d7a821
[ "Apache-2.0" ]
null
null
null
lib/di/machine_controller_scope.dart
NikitaMasev/control_machine
07953568e8ebf325c1eb8919e7d8d752c6d7a821
[ "Apache-2.0" ]
null
null
null
import 'package:control_machine/data/services/ble_characteristic_scanner.dart'; import 'package:control_machine/data/services/ble_writer.dart'; import 'package:control_machine/domain/controllers/machine_controller.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; class MachineControllerScope extends StatelessWidget { final Widget child; const MachineControllerScope({ Key? key, required this.child, }) : super(key: key); @override Widget build(BuildContext context) { return Provider<MachineController>.value( value: MachineControllerImpl( characteristicScanner: context.read<CharacteristicScanner>(), bleWriter: context.read<BleWriter>(), ), child: child, ); } }
29.576923
79
0.746424
fed90b927e3984e8289439a55be8f5fba48000af
769
html
HTML
manuscript/page-204/body.html
marvindanig/the-provincetown-plays
1d39409d578edfb2f60f335e4d8c49f22e48e8ea
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
manuscript/page-204/body.html
marvindanig/the-provincetown-plays
1d39409d578edfb2f60f335e4d8c49f22e48e8ea
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
manuscript/page-204/body.html
marvindanig/the-provincetown-plays
1d39409d578edfb2f60f335e4d8c49f22e48e8ea
[ "BlueOak-1.0.0", "MIT" ]
null
null
null
<div class="leaf "><div class="inner justify"><p>(ANTHONY <em>goes—into the other room.</em>)</p><p>HARRY: Why—why, yes. But—oh, Claire! Can't you take some pleasure in your work? (<em>as she stands there very still</em>) Emmons says you need a good long rest—and I think he's right.</p><p>TOM: Can't this help you, Claire? Let this be release. This—breath of the uncaptured.</p><p>CLAIRE: (<em>and though speaking, she remains just as still</em>)</p><p>Breath of the uncaptured?</p><p>You are a novelty.</p><p>Out?</p><p>You have been brought in.</p><p>A thousand years from now, when you are but a form too long repeated,</p><p>Perhaps the madness that gave you birth will burst again,</p><p>And from the prison that is you will leap pent queernesses</p></div> </div>
769
769
0.708713
83cc07191353cf31f6332d15ee962c3a330a2615
3,667
java
Java
src/main/java/jav/util/long_/sorter/LongMergeSort.java
njacinto/dataStructures
cd6e088fd9f644877313322f78bfe8631c4549c3
[ "MIT" ]
null
null
null
src/main/java/jav/util/long_/sorter/LongMergeSort.java
njacinto/dataStructures
cd6e088fd9f644877313322f78bfe8631c4549c3
[ "MIT" ]
null
null
null
src/main/java/jav/util/long_/sorter/LongMergeSort.java
njacinto/dataStructures
cd6e088fd9f644877313322f78bfe8631c4549c3
[ "MIT" ]
null
null
null
/* * Copyright (C) 2015. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301 USA */ package jav.util.long_.sorter; import jav.util.long_.comparator.LongComparator; import jav.util.long_.comparator.LongComparatorAsc; import jav.util.long_.comparator.LongComparatorWrapper; import java.util.Comparator; public class LongMergeSort implements LongSorter { public static final LongMergeSort INSTANCE = new LongMergeSort(); public static LongMergeSort getInstance() { return INSTANCE; } @Override public void sort(long[] data) { sort(data, LongComparatorAsc.INSTANCE); } @Override public void sort(long[] data, Comparator<Long> comparator) { sort(data, new LongComparatorWrapper(comparator)); } @Override public void sort(long[] data, LongComparator comparator) { sortArray(data, 0, data.length - 1, comparator); } @Override public void sort(long[] data, int from, int to) { sortArray(data, from, to - 1, LongComparatorAsc.INSTANCE); } @Override public void sort(long[] data, int from, int to, Comparator<Long> comparator) { sortArray(data, from, to - 1, new LongComparatorWrapper(comparator)); } @Override public void sort(long[] data, int from, int to, LongComparator comparator) { sortArray(data, from, to - 1, comparator); } // private methods private static void sortArray(long data[], int l, int h, LongComparator comparator) { if (l < h) { // Find the middle point int m = (l + h) / 2; // Sort first and second halves sortArray(data, l, m, comparator); sortArray(data, m + 1, h, comparator); // Merge the sorted halves merge(data, l, m, h, comparator); } } private static void merge(long data[], int l, int mid, int h, LongComparator comparator) { final int n1 = mid - l + 1; if (n1 != 1 || (h - mid) != 1) { // Create temp array final long L[] = new long[n1]; System.arraycopy(data, l, L, 0, n1); // Initial indexes int i = 0, j = mid + 1; int k = l; while (i < n1 && j <= h) { if (comparator.compare(L[i], data[j]) > 0) { data[k] = data[j++]; } else { if (k != i + l) { data[k] = L[i]; } i++; } k++; } // Copy remaining elements of L[] if any if (i + l != k) { while (i < n1) { data[k++] = L[i++]; } } } else if (comparator.compare(data[l], data[l + 1]) > 0) { // if only 2 elements, switch final long tmp = data[l]; data[l] = data[l + 1]; data[l + 1] = tmp; } } }
32.166667
94
0.565312
a7963aa48badd955af7517d7df572d2529e82d2b
14,889
asm
Assembly
extras/demos/Demo11/SysCore/Kernel/Debug/mmngr_virtual.asm
kammce/KinXOS
637ecc7a345e19df7ebffd95b476591ce1134829
[ "MIT" ]
null
null
null
extras/demos/Demo11/SysCore/Kernel/Debug/mmngr_virtual.asm
kammce/KinXOS
637ecc7a345e19df7ebffd95b476591ce1134829
[ "MIT" ]
null
null
null
extras/demos/Demo11/SysCore/Kernel/Debug/mmngr_virtual.asm
kammce/KinXOS
637ecc7a345e19df7ebffd95b476591ce1134829
[ "MIT" ]
null
null
null
; Listing generated by Microsoft (R) Optimizing Compiler Version 14.00.50727.42 TITLE c:\Documents and Settings\Michael\Desktop\bte_lighter\Demos\Demo11\SysCore\Kernel\mmngr_virtual.cpp .686P .XMM include listing.inc .model flat INCLUDELIB LIBCMT INCLUDELIB OLDNAMES PUBLIC ?_cur_directory@@3PAUpdirectory@@A ; _cur_directory PUBLIC ?_cur_pdbr@@3IA ; _cur_pdbr _BSS SEGMENT ?_cur_directory@@3PAUpdirectory@@A DD 01H DUP (?) ; _cur_directory ?_cur_pdbr@@3IA DD 01H DUP (?) ; _cur_pdbr _BSS ENDS PUBLIC ?vmmngr_ptable_virt_to_index@@YAII@Z ; vmmngr_ptable_virt_to_index ; Function compile flags: /Ogtpy ; File c:\documents and settings\michael\desktop\bte_lighter\demos\demo11\syscore\kernel\mmngr_virtual.cpp ; COMDAT ?vmmngr_ptable_virt_to_index@@YAII@Z _TEXT SEGMENT _addr$ = 8 ; size = 4 ?vmmngr_ptable_virt_to_index@@YAII@Z PROC ; vmmngr_ptable_virt_to_index, COMDAT ; 64 : ; 65 : //! return index only if address doesnt exceed page table address space size ; 66 : return (addr >= PTABLE_ADDR_SPACE_SIZE) ? 0 : addr/PAGE_SIZE; mov eax, DWORD PTR _addr$[esp-4] cmp eax, 4194304 ; 00400000H jb SHORT $LN3@vmmngr_pta xor eax, eax ; 67 : } ret 0 $LN3@vmmngr_pta: ; 64 : ; 65 : //! return index only if address doesnt exceed page table address space size ; 66 : return (addr >= PTABLE_ADDR_SPACE_SIZE) ? 0 : addr/PAGE_SIZE; shr eax, 12 ; 0000000cH ; 67 : } ret 0 ?vmmngr_ptable_virt_to_index@@YAII@Z ENDP ; vmmngr_ptable_virt_to_index _TEXT ENDS PUBLIC ?vmmngr_ptable_lookup_entry@@YAPAIPAUptable@@I@Z ; vmmngr_ptable_lookup_entry ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_ptable_lookup_entry@@YAPAIPAUptable@@I@Z _TEXT SEGMENT _p$ = 8 ; size = 4 _addr$ = 12 ; size = 4 ?vmmngr_ptable_lookup_entry@@YAPAIPAUptable@@I@Z PROC ; vmmngr_ptable_lookup_entry, COMDAT ; 70 : ; 71 : if (p) mov ecx, DWORD PTR _p$[esp-4] test ecx, ecx je SHORT $LN1@vmmngr_pta@2 ; 72 : return &p->m_entries[ vmmngr_ptable_virt_to_index (addr) ]; mov eax, DWORD PTR _addr$[esp-4] cmp eax, 4194304 ; 00400000H jb SHORT $LN6@vmmngr_pta@2 xor eax, eax lea eax, DWORD PTR [ecx+eax*4] ; 74 : } ret 0 ; 72 : return &p->m_entries[ vmmngr_ptable_virt_to_index (addr) ]; $LN6@vmmngr_pta@2: shr eax, 12 ; 0000000cH lea eax, DWORD PTR [ecx+eax*4] ; 74 : } ret 0 $LN1@vmmngr_pta@2: ; 73 : return 0; xor eax, eax ; 74 : } ret 0 ?vmmngr_ptable_lookup_entry@@YAPAIPAUptable@@I@Z ENDP ; vmmngr_ptable_lookup_entry _TEXT ENDS PUBLIC ?vmmngr_ptable_clear@@YAXPAUptable@@@Z ; vmmngr_ptable_clear EXTRN ?memset@@YAPAXPAXDI@Z:PROC ; memset ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_ptable_clear@@YAXPAUptable@@@Z _TEXT SEGMENT _p$ = 8 ; size = 4 ?vmmngr_ptable_clear@@YAXPAUptable@@@Z PROC ; vmmngr_ptable_clear, COMDAT ; 77 : ; 78 : if (p) mov eax, DWORD PTR _p$[esp-4] test eax, eax je SHORT $LN1@vmmngr_pta@3 ; 79 : memset ( p,0,sizeof (ptable) ); push 4096 ; 00001000H push 0 push eax call ?memset@@YAPAXPAXDI@Z ; memset add esp, 12 ; 0000000cH $LN1@vmmngr_pta@3: ; 80 : } ret 0 ?vmmngr_ptable_clear@@YAXPAUptable@@@Z ENDP ; vmmngr_ptable_clear _TEXT ENDS PUBLIC ?vmmngr_pdirectory_clear@@YAXPAUpdirectory@@@Z ; vmmngr_pdirectory_clear ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_pdirectory_clear@@YAXPAUpdirectory@@@Z _TEXT SEGMENT _dir$ = 8 ; size = 4 ?vmmngr_pdirectory_clear@@YAXPAUpdirectory@@@Z PROC ; vmmngr_pdirectory_clear, COMDAT ; 83 : ; 84 : if (dir) mov eax, DWORD PTR _dir$[esp-4] test eax, eax je SHORT $LN1@vmmngr_pdi ; 85 : memset ( dir,0,sizeof (pdirectory) ); push 4096 ; 00001000H push 0 push eax call ?memset@@YAPAXPAXDI@Z ; memset add esp, 12 ; 0000000cH $LN1@vmmngr_pdi: ; 86 : } ret 0 ?vmmngr_pdirectory_clear@@YAXPAUpdirectory@@@Z ENDP ; vmmngr_pdirectory_clear _TEXT ENDS PUBLIC ?vmmngr_pdirectory_virt_to_index@@YAII@Z ; vmmngr_pdirectory_virt_to_index ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_pdirectory_virt_to_index@@YAII@Z _TEXT SEGMENT _addr$ = 8 ; size = 4 ?vmmngr_pdirectory_virt_to_index@@YAII@Z PROC ; vmmngr_pdirectory_virt_to_index, COMDAT ; 89 : ; 90 : //! return index only if address doesnt exceed 4gb (page directory address space size) ; 91 : return (addr >= DTABLE_ADDR_SPACE_SIZE) ? 0 : addr/PAGE_SIZE; mov eax, DWORD PTR _addr$[esp-4] xor ecx, ecx cmp ecx, 1 jl SHORT $LN3@vmmngr_pdi@2 jg SHORT $LN5@vmmngr_pdi@2 test eax, eax jb SHORT $LN3@vmmngr_pdi@2 $LN5@vmmngr_pdi@2: xor eax, eax ; 92 : } ret 0 $LN3@vmmngr_pdi@2: ; 89 : ; 90 : //! return index only if address doesnt exceed 4gb (page directory address space size) ; 91 : return (addr >= DTABLE_ADDR_SPACE_SIZE) ? 0 : addr/PAGE_SIZE; shr eax, 12 ; 0000000cH ; 92 : } ret 0 ?vmmngr_pdirectory_virt_to_index@@YAII@Z ENDP ; vmmngr_pdirectory_virt_to_index _TEXT ENDS PUBLIC ?vmmngr_pdirectory_lookup_entry@@YAPAIPAUpdirectory@@I@Z ; vmmngr_pdirectory_lookup_entry ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_pdirectory_lookup_entry@@YAPAIPAUpdirectory@@I@Z _TEXT SEGMENT _p$ = 8 ; size = 4 _addr$ = 12 ; size = 4 ?vmmngr_pdirectory_lookup_entry@@YAPAIPAUpdirectory@@I@Z PROC ; vmmngr_pdirectory_lookup_entry, COMDAT ; 95 : ; 96 : if (p) mov ecx, DWORD PTR _p$[esp-4] test ecx, ecx je SHORT $LN1@vmmngr_pdi@3 ; 97 : return &p->m_entries[ vmmngr_ptable_virt_to_index (addr) ]; mov eax, DWORD PTR _addr$[esp-4] cmp eax, 4194304 ; 00400000H jb SHORT $LN6@vmmngr_pdi@3 xor eax, eax lea eax, DWORD PTR [ecx+eax*4] ; 99 : } ret 0 ; 97 : return &p->m_entries[ vmmngr_ptable_virt_to_index (addr) ]; $LN6@vmmngr_pdi@3: shr eax, 12 ; 0000000cH lea eax, DWORD PTR [ecx+eax*4] ; 99 : } ret 0 $LN1@vmmngr_pdi@3: ; 98 : return 0; xor eax, eax ; 99 : } ret 0 ?vmmngr_pdirectory_lookup_entry@@YAPAIPAUpdirectory@@I@Z ENDP ; vmmngr_pdirectory_lookup_entry _TEXT ENDS PUBLIC ?vmmngr_switch_pdirectory@@YA_NPAUpdirectory@@@Z ; vmmngr_switch_pdirectory EXTRN ?pmmngr_load_PDBR@@YAXI@Z:PROC ; pmmngr_load_PDBR ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_switch_pdirectory@@YA_NPAUpdirectory@@@Z _TEXT SEGMENT _dir$ = 8 ; size = 4 ?vmmngr_switch_pdirectory@@YA_NPAUpdirectory@@@Z PROC ; vmmngr_switch_pdirectory, COMDAT ; 102 : ; 103 : if (!dir) mov eax, DWORD PTR _dir$[esp-4] test eax, eax jne SHORT $LN1@vmmngr_swi ; 104 : return false; xor al, al ; 109 : } ret 0 $LN1@vmmngr_swi: ; 105 : ; 106 : _cur_directory = dir; mov DWORD PTR ?_cur_directory@@3PAUpdirectory@@A, eax ; _cur_directory ; 107 : pmmngr_load_PDBR (_cur_pdbr); mov eax, DWORD PTR ?_cur_pdbr@@3IA ; _cur_pdbr push eax call ?pmmngr_load_PDBR@@YAXI@Z ; pmmngr_load_PDBR add esp, 4 ; 108 : return true; mov al, 1 ; 109 : } ret 0 ?vmmngr_switch_pdirectory@@YA_NPAUpdirectory@@@Z ENDP ; vmmngr_switch_pdirectory _TEXT ENDS PUBLIC ?vmmngr_flush_tlb_entry@@YAXI@Z ; vmmngr_flush_tlb_entry ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_flush_tlb_entry@@YAXI@Z _TEXT SEGMENT _addr$ = 8 ; size = 4 ?vmmngr_flush_tlb_entry@@YAXI@Z PROC ; vmmngr_flush_tlb_entry, COMDAT ; 112 : ; 113 : #ifdef _MSC_VER ; 114 : _asm { ; 115 : cli cli ; 116 : invlpg addr invlpg DWORD PTR _addr$[esp-4] ; 117 : sti sti ; 118 : } ; 119 : #endif ; 120 : } ret 0 ?vmmngr_flush_tlb_entry@@YAXI@Z ENDP ; vmmngr_flush_tlb_entry _TEXT ENDS PUBLIC ?vmmngr_get_directory@@YAPAUpdirectory@@XZ ; vmmngr_get_directory ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_get_directory@@YAPAUpdirectory@@XZ _TEXT SEGMENT ?vmmngr_get_directory@@YAPAUpdirectory@@XZ PROC ; vmmngr_get_directory, COMDAT ; 123 : ; 124 : return _cur_directory; mov eax, DWORD PTR ?_cur_directory@@3PAUpdirectory@@A ; _cur_directory ; 125 : } ret 0 ?vmmngr_get_directory@@YAPAUpdirectory@@XZ ENDP ; vmmngr_get_directory _TEXT ENDS PUBLIC ?vmmngr_alloc_page@@YA_NPAI@Z ; vmmngr_alloc_page EXTRN ?pt_entry_add_attrib@@YAXPAII@Z:PROC ; pt_entry_add_attrib EXTRN ?pt_entry_set_frame@@YAXPAII@Z:PROC ; pt_entry_set_frame EXTRN ?pmmngr_alloc_block@@YAPAXXZ:PROC ; pmmngr_alloc_block ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_alloc_page@@YA_NPAI@Z _TEXT SEGMENT _e$ = 8 ; size = 4 ?vmmngr_alloc_page@@YA_NPAI@Z PROC ; vmmngr_alloc_page, COMDAT ; 128 : ; 129 : //! allocate a free physical frame ; 130 : void* p = pmmngr_alloc_block (); call ?pmmngr_alloc_block@@YAPAXXZ ; pmmngr_alloc_block ; 131 : if (!p) test eax, eax jne SHORT $LN1@vmmngr_all ; 132 : return false; xor al, al ; 139 : } ret 0 $LN1@vmmngr_all: push esi ; 133 : ; 134 : //! map it to the page ; 135 : pt_entry_set_frame (e, (physical_addr)p); mov esi, DWORD PTR _e$[esp] push eax push esi call ?pt_entry_set_frame@@YAXPAII@Z ; pt_entry_set_frame ; 136 : pt_entry_add_attrib (e, I86_PTE_PRESENT); push 1 push esi call ?pt_entry_add_attrib@@YAXPAII@Z ; pt_entry_add_attrib add esp, 16 ; 00000010H ; 137 : ; 138 : return true; mov al, 1 pop esi ; 139 : } ret 0 ?vmmngr_alloc_page@@YA_NPAI@Z ENDP ; vmmngr_alloc_page _TEXT ENDS PUBLIC ?vmmngr_free_page@@YAXPAI@Z ; vmmngr_free_page EXTRN ?pt_entry_del_attrib@@YAXPAII@Z:PROC ; pt_entry_del_attrib EXTRN ?pmmngr_free_block@@YAXPAX@Z:PROC ; pmmngr_free_block EXTRN ?pt_entry_pfn@@YAII@Z:PROC ; pt_entry_pfn ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_free_page@@YAXPAI@Z _TEXT SEGMENT _e$ = 8 ; size = 4 ?vmmngr_free_page@@YAXPAI@Z PROC ; vmmngr_free_page, COMDAT ; 141 : void vmmngr_free_page (pt_entry* e) { push esi ; 142 : ; 143 : void* p = (void*)pt_entry_pfn (*e); mov esi, DWORD PTR _e$[esp] mov eax, DWORD PTR [esi] push eax call ?pt_entry_pfn@@YAII@Z ; pt_entry_pfn add esp, 4 ; 144 : if (p) test eax, eax je SHORT $LN1@vmmngr_fre ; 145 : pmmngr_free_block (p); push eax call ?pmmngr_free_block@@YAXPAX@Z ; pmmngr_free_block add esp, 4 $LN1@vmmngr_fre: ; 146 : ; 147 : pt_entry_del_attrib (e, I86_PTE_PRESENT); push 1 push esi call ?pt_entry_del_attrib@@YAXPAII@Z ; pt_entry_del_attrib add esp, 8 pop esi ; 148 : } ret 0 ?vmmngr_free_page@@YAXPAI@Z ENDP ; vmmngr_free_page _TEXT ENDS PUBLIC ?vmmngr_initialize@@YAXXZ ; vmmngr_initialize EXTRN ?pmmngr_paging_enable@@YAX_N@Z:PROC ; pmmngr_paging_enable EXTRN ?pd_entry_set_frame@@YAXPAII@Z:PROC ; pd_entry_set_frame EXTRN ?pd_entry_add_attrib@@YAXPAII@Z:PROC ; pd_entry_add_attrib EXTRN ?pmmngr_alloc_blocks@@YAPAXI@Z:PROC ; pmmngr_alloc_blocks ; Function compile flags: /Ogtpy ; COMDAT ?vmmngr_initialize@@YAXXZ _TEXT SEGMENT _page$2784 = -4 ; size = 4 ?vmmngr_initialize@@YAXXZ PROC ; vmmngr_initialize, COMDAT ; 150 : void vmmngr_initialize () { push ecx push edi ; 151 : ; 152 : //! allocate default page table ; 153 : ptable* table = (ptable*) pmmngr_alloc_block (); call ?pmmngr_alloc_block@@YAPAXXZ ; pmmngr_alloc_block mov edi, eax ; 154 : if (!table) test edi, edi je $LN6@vmmngr_ini push ebx push esi ; 155 : return; ; 156 : ; 157 : //! clear page table ; 158 : vmmngr_ptable_clear (table); push 4096 ; 00001000H push 0 push edi call ?memset@@YAPAXPAXDI@Z ; memset add esp, 12 ; 0000000cH ; 159 : ; 160 : //! idenitity map the page table (First 4mb of virtual memory mapped to same phys address) ; 161 : for (int i=0, frame=0; i<1024; i++, frame+=4096) { xor esi, esi mov ebx, 1024 ; 00000400H npad 6 $LL4@vmmngr_ini: ; 162 : ; 163 : //! create a new page ; 164 : pt_entry page=0; ; 165 : pt_entry_add_attrib (&page, I86_PTE_PRESENT); lea eax, DWORD PTR _page$2784[esp+16] push 1 push eax mov DWORD PTR _page$2784[esp+24], 0 call ?pt_entry_add_attrib@@YAXPAII@Z ; pt_entry_add_attrib ; 166 : pt_entry_set_frame (&page, frame); lea ecx, DWORD PTR _page$2784[esp+24] push esi push ecx call ?pt_entry_set_frame@@YAXPAII@Z ; pt_entry_set_frame add esp, 16 ; 00000010H ; 167 : ; 168 : //! ...and add it to the page table ; 169 : table->m_entries [vmmngr_ptable_virt_to_index (frame) ] = page; cmp esi, 4194304 ; 00400000H jb SHORT $LN13@vmmngr_ini xor eax, eax jmp SHORT $LN14@vmmngr_ini $LN13@vmmngr_ini: mov eax, esi shr eax, 12 ; 0000000cH $LN14@vmmngr_ini: mov edx, DWORD PTR _page$2784[esp+16] add esi, 4096 ; 00001000H sub ebx, 1 mov DWORD PTR [edi+eax*4], edx jne SHORT $LL4@vmmngr_ini ; 170 : } ; 171 : ; 172 : //! create default directory table ; 173 : pdirectory* dir = (pdirectory*) pmmngr_alloc_blocks (3); push 3 call ?pmmngr_alloc_blocks@@YAPAXI@Z ; pmmngr_alloc_blocks mov esi, eax add esp, 4 ; 174 : if (!dir) test esi, esi je SHORT $LN32@vmmngr_ini ; 175 : return; ; 176 : ; 177 : //! clear directory table and set it as current ; 178 : vmmngr_pdirectory_clear (dir); push 4096 ; 00001000H push 0 push esi call ?memset@@YAPAXPAXDI@Z ; memset ; 179 : ; 180 : //! get first entry in dir table and set it up to point to our table ; 181 : pd_entry* entry = vmmngr_pdirectory_lookup_entry (dir,0); ; 182 : pd_entry_add_attrib (entry, I86_PDE_PRESENT); push 1 push esi call ?pd_entry_add_attrib@@YAXPAII@Z ; pd_entry_add_attrib ; 183 : pd_entry_add_attrib (entry, I86_PDE_WRITABLE); push 2 push esi call ?pd_entry_add_attrib@@YAXPAII@Z ; pd_entry_add_attrib ; 184 : pd_entry_set_frame (entry, (physical_addr)table); push edi push esi call ?pd_entry_set_frame@@YAXPAII@Z ; pd_entry_set_frame ; 185 : ; 186 : //! store current PDBR ; 187 : _cur_pdbr = (physical_addr) &dir->m_entries; ; 188 : ; 189 : //! switch to our page directory ; 190 : vmmngr_switch_pdirectory (dir); push esi mov DWORD PTR ?_cur_pdbr@@3IA, esi ; _cur_pdbr mov DWORD PTR ?_cur_directory@@3PAUpdirectory@@A, esi ; _cur_directory call ?pmmngr_load_PDBR@@YAXI@Z ; pmmngr_load_PDBR ; 191 : ; 192 : //! enable paging ; 193 : pmmngr_paging_enable (true); push 1 call ?pmmngr_paging_enable@@YAX_N@Z ; pmmngr_paging_enable add esp, 44 ; 0000002cH $LN32@vmmngr_ini: pop esi pop ebx $LN6@vmmngr_ini: pop edi ; 194 : } pop ecx ret 0 ?vmmngr_initialize@@YAXXZ ENDP ; vmmngr_initialize _TEXT ENDS END
24.77371
107
0.675868
94bc5c66d96175e64f6a69aa5924eb544ed45eab
17,508
sql
SQL
go/src/app/migrations/99_record_insert.sql
misoten-iw-g2/lovechan
87eb77afa3bed30a02ae3a04a8d0e00207c80161
[ "MIT" ]
2
2017-12-11T06:12:01.000Z
2018-01-16T19:21:11.000Z
go/src/app/migrations/99_record_insert.sql
misoten-iw-g2/lovechan
87eb77afa3bed30a02ae3a04a8d0e00207c80161
[ "MIT" ]
22
2017-09-29T08:57:59.000Z
2018-01-05T03:00:37.000Z
go/src/app/migrations/99_record_insert.sql
misoten-iw-g2/lovechan
87eb77afa3bed30a02ae3a04a8d0e00207c80161
[ "MIT" ]
1
2017-10-01T18:21:48.000Z
2017-10-01T18:21:48.000Z
-- +migrate Up -- questions INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('1', '体調はどうですか?', '体調はどうですか?', '1', 'questions-1.mp4', 'questions-1.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('2', 'イベント楽しんでますか?', 'イベント楽しんでますか?', '2', 'questions-2.mp4', 'questions-2.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('3', '今日は寒かったですね', '今日は寒かったですね', '2', 'questions-3.mp4', 'questions-3.wav', 'sadness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('4', '昨晩はどんな夢を見ましたか?', '昨晩はどんな夢を見ましたか?', '2', 'questions-4.mp4', 'questions-4.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('5', '明日の予定はなんですか?', '明日の予定はなんですか?', '1', 'questions-5.mp4', 'questions-5.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('6', '晩御飯はなにを食べる予定ですか?', '晩御飯はなにを食べる予定ですか?', '1', 'questions-6.mp4', 'questions-6.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('7', 'どのブースがおもしろかったですか?', 'どのブースがおもしろかったですか?', '2', 'questions-7.mp4', 'questions-7.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('8', 'あけましておめでとうございます!', 'あけましておめでとうございます!', '1', 'questions-8.mp4', 'questions-8.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('9', '私って、、何歳に見えますか?', '私って、、何歳に見えますか??', '2', 'questions-9.mp4', 'questions-9.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('10', 'おせち料理は食べましたか?', 'おせち料理は食べましたか?', '2', 'questions-10.mp4', 'questions-10.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('12', 'はるについてどう思いましたか?', 'HALについてどう思いましたか?', '2', 'questions-12.mp4', 'questions-12.wav', 'happiness', '100'); INSERT INTO `questions` (`id`, `question`, `question_display`, `answer_type`, `video_file_name`, `voice_file_name`, `voice_emotion`, `voice_speed`) VALUES ('13', '異性の好きなタイプは?', '異性の好きなタイプは?', '1', 'questions-13.mp4', 'questions-13.wav', 'happiness', '100'); -- free_answers INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('1', '1', '1', 'free_answers-1-1.mp4', 'free_answers-1-1.wav', 'すばらしいです!引き続きお身体を大事にしてくださいね!', 'すばらしいです!ひきつづきおからだをだいじにしてくださいね!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('2', '1', '2', 'free_answers-1-2.mp4', 'free_answers-1-2.wav', 'インフルエンザが流行っているので気をつけてくださいね!', 'インフルエンザがはやっているのできをつけてくださいね!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('3', '1', '3', 'free_answers-1-3.mp4', 'free_answers-1-3.wav', 'えーー体調に気をつけてくださいね', 'えーー体調に気をつけてくださいね', 'sadness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('4', '5', '1', 'free_answers-5-4.mp4', 'free_answers-5-4.wav', '明日も楽しんでいきましょう!', 'あしたもたのしんでいきましょう!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('5', '5', '2', 'free_answers-5-5.mp4', 'free_answers-5-5.wav', '何か面白いことが起きるといいですね', 'なにかおもしろいことがおきるといいですね!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('6', '5', '3', 'free_answers-5-6.mp4', 'free_answers-5-6.wav', '良い日になりますように', '良い日になりますように', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('7', '6', '1', 'free_answers-6-7.mp4', 'free_answers-6-7.wav', 'いいですね!私も食べたいです!', 'いいですね!わたしもたべたいです!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('8', '6', '2', 'free_answers-6-8.mp4', 'free_answers-6-8.wav', 'おいしそうです。お腹減った。', 'おいしそうです!おなかへった。', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('9', '6', '3', 'free_answers-6-9.mp4', 'free_answers-6-9.wav', 'おいしいものを食べて元気出しましょう!', 'おいしいものをたべて、げんきをだしましょう!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('10', '8', '1', 'free_answers-8-10.mp4', 'free_answers-8-10.wav', '今年もよろしくお願いします!', 'ことしもよろしくおねがいします!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('11', '8', '2', 'free_answers-8-11.mp4', 'free_answers-8-11.wav', '今年もよろしくお願いします!', 'ことしもよろしくおねがいします!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('12', '8', '3', 'free_answers-8-12.mp4', 'free_answers-8-12.wav', '今年もよろしくお願いします!', 'ことしもよろしくおねがいします!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('13', '13', '1', 'free_answers-13-13.mp4', 'free_answers-13-13.wav', 'おお〜♡そういう人に出会えるといいですね!', 'おーーー、そういうひとにであえるといいですね!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('14', '13', '2', 'free_answers-13-14.mp4', 'free_answers-13-14.wav', 'おお〜♡そういう人に出会えるといいですね!', 'おーーー、そういうひとにであえるといいですね!', 'happiness', '100'); INSERT INTO `free_answers` (`id`, `question_id`, `emotion`, `video_file_name`, `voice_file_name`, `answer_display`, `answer`, `voice_emotion`, `voice_speed`) VALUES ('15', '13', '3', 'free_answers-13-15.mp4', 'free_answers-13-15.wav', 'おお〜♡そういう人に出会えるといいですね!', 'おーーー、そういうひとにであえるといいですね!', 'happiness', '100'); -- choice_answers INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('1', '2', 'うれしい!このあともたのしんでくださいね!', 'うれしい!この後も楽しんで下さいね!', 'choice_answers-2-1.mp4', 'choice_answers-2-1.wav', '楽しい', '楽しい,たのしい', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('2', '2', 'え!?でもでもわたしのブースたのしかったですよね?', 'え!?でもでも私のブース楽しかったですよね・・・?', 'choice_answers-2-2.mp4', 'choice_answers-2-2.wav', '普通', '普通,ふつう', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('3', '2', 'もっとたのしんでいきましょー!', 'もっと楽しんでいきましょー!', 'choice_answers-2-3.mp4', 'choice_answers-2-3.wav', '面白くない', '面白くない,おもしろくない', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('4', '3', '夜は冷え込むので気をつけてくださいね', '夜は冷え込むので気をつけてくださいね', 'choice_answers-3-4.mp4', 'choice_answers-3-4.wav', '寒い', '寒い,さむい', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('5', '3', 'かぜをひかないようにきをつけましょう!', '風邪ひかないように気をつけましょう!', 'choice_answers-3-5.mp4', 'choice_answers-3-5.wav', '普通', '普通,ふつう', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('6', '3', 'えーー!おからだつよいんですね!', 'えええ!お身体つよいんですね!', 'choice_answers-3-6.mp4', 'choice_answers-3-6.wav', '暑い', '暑い,あつい', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('7', '4', 'わたしもきょうはお肉いっぱいにかこまれたゆめをみました!', '私も今日はおにくいっぱいに囲まれた夢をみました!', 'choice_answers-4-7.mp4', 'choice_answers-4-7.wav', '面白かった', '面白かった,おもしろかった', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('8', '4', 'きょうはいい夢がみられるようにお祈りしておきます', '今日はいい夢がみられるようにお祈りしておきます', 'choice_answers-4-8.mp4', 'choice_answers-4-8.wav', '見てない', '見てない,みてない', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('9', '4', 'それはさんざんでしたね・・・きっときょうはいいゆめがみられますよ!', 'それは散々でしたね・・・きっと今日はいい夢がみられますよ!', 'choice_answers-4-9.mp4', 'choice_answers-4-9.wav', '悪夢', '悪夢,あくむ', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('10', '7', 'ですよね!さすがー!!', 'ですよね!さすが!', 'choice_answers-7-10.mp4', 'choice_answers-7-10.wav', 'ここ', 'ここ', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('11', '7', 'Hよんにーななでしょ!', 'H427でしょ!', 'choice_answers-7-11.mp4', 'choice_answers-7-11.wav', 'それ以外', 'それ以外,それいがい', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('12', '7', 'Hよんにーななでしょ!', 'H427でしょ!', 'choice_answers-7-12.mp4', 'choice_answers-7-12.wav', 'ない', 'ない', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('13', '9', 'せいかいでーす!', '正解でーす!', 'choice_answers-9-13.mp4', 'choice_answers-9-13.wav', '3663', '3663', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('14', '9', 'じつはわたし・・・えいえんの3663歳なんです', '実は・・・私・・・永遠の꒰♡꒱(3663)歳なんです', 'choice_answers-9-14.mp4', 'choice_answers-9-14.wav', '23', '23', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('15', '9', 'じつはわたし・・・えいえんの3663歳なんです', '実は・・・私・・・永遠の꒰♡꒱(3663)歳なんです', 'choice_answers-9-15.mp4', 'choice_answers-9-15.wav', '1000', '1000', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('16', '9', 'じつはわたし・・・えいえんの3663歳なんです', '実は・・・私・・・永遠の꒰♡꒱(3663)歳なんです', 'choice_answers-9-16.mp4', 'choice_answers-9-16.wav', '30', '30', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('17', '10', 'わたしはまだなんです。ずるいです', '私はまだなんです。ずるいです', 'choice_answers-10-17.mp4', 'choice_answers-10-17.wav', 'はい', 'はい', 'sadness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('18', '10', 'わたしもなんです!いっしょにたべましょう', '私もなんです!一緒に食べましょう♡', 'choice_answers-10-18.mp4', 'choice_answers-10-18.wav', 'いいえ', 'いいえ', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('22', '12', 'ありがとうございます!とってもたのしいがっこうなんですよ!', 'ありがとうございます!と~っても楽しい学校なんですよ!', 'choice_answers-12-22.mp4', 'choice_answers-12-22.wav', '良さそう', '良さそう,よさそう', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('23', '12', 'ぜひこのあともみらいそうぞうてんをたのしんでください!きっとみりょくがみつかるはずです!', '是非この後も未来創造展を楽しんで下さい!きっと魅力が見つかるはずです!', 'choice_answers-12-23.mp4', 'choice_answers-12-23.wav', '普通', '普通,ふつう', 'happiness', '100'); INSERT INTO `choice_answers` (`id`, `question_id`, `answer`, `answer_display`, `video_file_name`, `voice_file_name`, `choice_display` ,`choice`,`voice_emotion`, `voice_speed`) VALUES ('24', '12', 'そんな・・・', 'そんな・・・・・・・・・・・・・・・・・・・・・・・・・・・・', 'choice_answers-12-24.mp4', 'choice_answers-12-24.wav', 'だめそう', 'だめそう', 'sadness', '100'); -- requests INSERT INTO `requests` (`id`, `video_file_name`, `voice_file_name`, `request_display` ,`request`) VALUES ('1', 'requests-1.mp4', 'requests-1.wav', '踊って', '踊って,おどって'); INSERT INTO `requests` (`id`, `video_file_name`, `voice_file_name`, `request_display` ,`request`) VALUES ('2', 'requests-2.mp4', 'requests-2.wav', '一発芸して', '一発芸して,いっぱつげいして'); -- user_answers INSERT INTO `user_answers` (`question`, `answer`, `score`, `question_id`, `emotion`, `created_at`) VALUES ('たいちょうはどうですか?', '今日は最高です', 0.7, 1, 1, '2017-11-15 03:10:00'), ('たいちょうはどうですか?', '眠い', 0.2, 1, 2, '2017-11-15 03:10:01'), ('イベント楽しんでますか?', '楽しい', 0.8, 2, 1, '2017-11-15 03:10:02'), ('明日の予定はなんですか?', '高級料理食べに行くの', 0.4, 5, 1, '2017-11-15 03:12:33'), ('今日は寒かったですね', '暑い', 0, 3, 2, '2017-11-15 03:13:00'), ('晩御飯はなにを食べる予定ですか?', 'ご飯', 0, 6, 2, '2017-11-15 03:14:14'), ('私って、、何歳に見えますか?', '100', 0, 9, 2, '2017-11-15 03:14:15'), ('イベント楽しんでますか?', '普通', -0.3, 2, 3, '2017-11-15 03:14:17'), ('イベント楽しんでますか?', '面白くない', -0.8, 2, 3, '2017-11-15 03:14:26'), ('今日は寒かったですね', '寒かったです', -0.6, 3, 3, '2017-11-15 03:14:27'), ('たいちょうはどうですか?', '普通だよ', -0.4, 1, 3, '2017-11-15 03:14:36'), ('今日は寒かったですね', '暑かったです', 0.2, 3, 2, '2017-11-15 03:10:52'), ('今日は寒かったですね', '寒い', 0.1, 3, 2, '2017-11-15 03:15:09'), ('今日は寒かったですね', '寒かったです', -0.6, 3, 3, '2017-11-15 03:16:14'), ('明日の予定はなんですか?', '何もない', -0.7, 5, 3, '2017-11-15 03:17:46'), ('昨晩はどんな夢を見ましたか?', '悪夢', 0, 4, 2, '2017-11-15 03:18:19'), ('昨晩はどんな夢を見ましたか?', '見てない', -0.3, 4, 3, '2017-11-15 03:19:25'), ('昨晩はどんな夢を見ましたか?', '面白かった', 0.8, 4, 1, '2017-11-15 03:20:33'), ('明日の予定はなんですか?', '外食しにいく', 0.1, 5, 2, '2017-11-15 03:22:14'), ('晩御飯はなにを食べる予定ですか?', '食べない', -0.4, 6, 3, '2017-11-15 03:23:00'), ('晩御飯はなにを食べる予定ですか?', 'ラーメン食べるよ', 0, 6, 2, '2017-11-15 03:25:12'), ('どのブースがおもしろかったですか?', 'ここ', 0.3, 7, 1, '2017-11-15 03:27:39'), ('どのブースがおもしろかったですか?', 'それ以外', 0.2, 7, 2, '2017-11-15 03:33:45'), ('どのブースがおもしろかったですか?', 'ない', -0.2, 7, 2, '2017-11-15 03:33:48'), ('あけましておめでとうございます!今年も一緒に頑張りましょう!', 'よろしく', 0.5, 8, 1, '2017-11-15 03:24:00'), ('私って、、何歳に見えますか?', '3663', 0, 9, 2, '2017-11-15 03:44:20'), ('私って、、何歳に見えますか?', '10', 0, 9, 2, '2017-11-15 03:54:29'), ('私って、、何歳に見えますか?', '100', 0, 9, 2, '2017-11-15 04:14:32'), ('おせち料理は食べましたか?', 'はい', 0.1, 10, 2, '2017-11-15 04:14:46'), ('おせち料理は食べましたか?', 'いいえ', 0, 10, 2, '2017-11-15 04:14:49'), ('はるについてどう思いましたか?', '良さそう', 0.9, 12, 1, '2017-11-16 03:17:21'), ('はるについてどう思いましたか?', '普通', -0.3, 12, 3, '2017-11-16 03:17:28'), ('はるについてどう思いましたか?', 'だめそう', -0.6, 12, 3, '2017-11-16 03:17:35'), ('異性の好きなタイプは?', 'イケメン', 0.8, 13, 1, '2017-11-16 03:17:46'), ('異性の好きなタイプは?', 'オタク', 0, 13, 2, '2017-11-16 03:17:50'), ('異性の好きなタイプは?', 'かっこいい', 0.9, 13, 1, '2017-11-16 03:17:56'), ('びっしゅさんのライブ楽しみですね!', '最高!楽しみ!', 0.8, 14, 1, '2017-11-16 03:18:12'), ('びっしゅさんのライブ楽しみですね!', 'いえーい!', 0.1, 14, 2, '2017-11-16 03:18:18'); COMMIT; -- +migrate Down
169.980583
375
0.678775
bf9b0913073164566efddf0a2667adfe6a736dad
69
dart
Dart
lib/src/logic/model/news_models/news_models.dart
domesticmouse/News360
4aa831051f9904f73dcb4fc7cb4cc5a0d37e72da
[ "MIT" ]
1
2022-02-09T00:15:38.000Z
2022-02-09T00:15:38.000Z
lib/src/logic/model/news_models/news_models.dart
domesticmouse/News360
4aa831051f9904f73dcb4fc7cb4cc5a0d37e72da
[ "MIT" ]
1
2022-01-24T06:59:49.000Z
2022-01-24T07:00:03.000Z
lib/src/logic/model/news_models/news_models.dart
domesticmouse/News360
4aa831051f9904f73dcb4fc7cb4cc5a0d37e72da
[ "MIT" ]
1
2022-01-24T06:20:33.000Z
2022-01-24T06:20:33.000Z
export 'archive_data_model.dart'; export 'headline_data_model.dart';
23
34
0.826087
cc45ec13f39168d49bb5ef6e3091b3d9ca0224e9
42,532
asm
Assembly
init.asm
ZYFFF166/operating_system_creatingthread
7228487aba72357d30714dae041229511e46192a
[ "MIT-0" ]
null
null
null
init.asm
ZYFFF166/operating_system_creatingthread
7228487aba72357d30714dae041229511e46192a
[ "MIT-0" ]
null
null
null
init.asm
ZYFFF166/operating_system_creatingthread
7228487aba72357d30714dae041229511e46192a
[ "MIT-0" ]
null
null
null
_init: file format elf32-i386 Disassembly of section .text: 00000000 <main>: char *argv[] = { "sh", 0 }; int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc pushl -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 53 push %ebx e: 51 push %ecx int pid, wpid; if(open("console", O_RDWR) < 0){ f: 83 ec 08 sub $0x8,%esp 12: 6a 02 push $0x2 14: 68 64 07 00 00 push $0x764 19: e8 48 03 00 00 call 366 <open> 1e: 83 c4 10 add $0x10,%esp 21: 85 c0 test %eax,%eax 23: 0f 88 93 00 00 00 js bc <main+0xbc> mknod("console", 1, 1); open("console", O_RDWR); } dup(0); // stdout 29: 83 ec 0c sub $0xc,%esp 2c: 6a 00 push $0x0 2e: e8 6b 03 00 00 call 39e <dup> dup(0); // stderr 33: c7 04 24 00 00 00 00 movl $0x0,(%esp) 3a: e8 5f 03 00 00 call 39e <dup> 3f: 83 c4 10 add $0x10,%esp 42: 66 90 xchg %ax,%ax for(;;){ printf(1, "init: starting sh\n"); 44: 83 ec 08 sub $0x8,%esp 47: 68 6c 07 00 00 push $0x76c 4c: 6a 01 push $0x1 4e: e8 05 04 00 00 call 458 <printf> pid = fork(); 53: e8 c6 02 00 00 call 31e <fork> 58: 89 c3 mov %eax,%ebx if(pid < 0){ 5a: 83 c4 10 add $0x10,%esp 5d: 85 c0 test %eax,%eax 5f: 78 24 js 85 <main+0x85> printf(1, "init: fork failed\n"); exit(); } if(pid == 0){ 61: 74 35 je 98 <main+0x98> 63: 90 nop exec("sh", argv); printf(1, "init: exec sh failed\n"); exit(); } while((wpid=wait()) >= 0 && wpid != pid) 64: e8 c5 02 00 00 call 32e <wait> 69: 85 c0 test %eax,%eax 6b: 78 d7 js 44 <main+0x44> 6d: 39 c3 cmp %eax,%ebx 6f: 74 d3 je 44 <main+0x44> printf(1, "zombie!\n"); 71: 83 ec 08 sub $0x8,%esp 74: 68 ab 07 00 00 push $0x7ab 79: 6a 01 push $0x1 7b: e8 d8 03 00 00 call 458 <printf> 80: 83 c4 10 add $0x10,%esp 83: eb df jmp 64 <main+0x64> printf(1, "init: fork failed\n"); 85: 53 push %ebx 86: 53 push %ebx 87: 68 7f 07 00 00 push $0x77f 8c: 6a 01 push $0x1 8e: e8 c5 03 00 00 call 458 <printf> exit(); 93: e8 8e 02 00 00 call 326 <exit> exec("sh", argv); 98: 50 push %eax 99: 50 push %eax 9a: 68 f0 0a 00 00 push $0xaf0 9f: 68 92 07 00 00 push $0x792 a4: e8 b5 02 00 00 call 35e <exec> printf(1, "init: exec sh failed\n"); a9: 5a pop %edx aa: 59 pop %ecx ab: 68 95 07 00 00 push $0x795 b0: 6a 01 push $0x1 b2: e8 a1 03 00 00 call 458 <printf> exit(); b7: e8 6a 02 00 00 call 326 <exit> mknod("console", 1, 1); bc: 50 push %eax bd: 6a 01 push $0x1 bf: 6a 01 push $0x1 c1: 68 64 07 00 00 push $0x764 c6: e8 a3 02 00 00 call 36e <mknod> open("console", O_RDWR); cb: 58 pop %eax cc: 5a pop %edx cd: 6a 02 push $0x2 cf: 68 64 07 00 00 push $0x764 d4: e8 8d 02 00 00 call 366 <open> d9: 83 c4 10 add $0x10,%esp dc: e9 48 ff ff ff jmp 29 <main+0x29> e1: 66 90 xchg %ax,%ax e3: 90 nop 000000e4 <strcpy>: #include "fs.h" #define PGSIZE 4096 char* strcpy(char *s, const char *t) { e4: 55 push %ebp e5: 89 e5 mov %esp,%ebp e7: 53 push %ebx e8: 8b 4d 08 mov 0x8(%ebp),%ecx eb: 8b 5d 0c mov 0xc(%ebp),%ebx char *os; os = s; while((*s++ = *t++) != 0) ee: 31 c0 xor %eax,%eax f0: 8a 14 03 mov (%ebx,%eax,1),%dl f3: 88 14 01 mov %dl,(%ecx,%eax,1) f6: 40 inc %eax f7: 84 d2 test %dl,%dl f9: 75 f5 jne f0 <strcpy+0xc> ; return os; } fb: 89 c8 mov %ecx,%eax fd: 5b pop %ebx fe: 5d pop %ebp ff: c3 ret 00000100 <strcmp>: int strcmp(const char *p, const char *q) { 100: 55 push %ebp 101: 89 e5 mov %esp,%ebp 103: 53 push %ebx 104: 8b 5d 08 mov 0x8(%ebp),%ebx 107: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) 10a: 0f b6 03 movzbl (%ebx),%eax 10d: 0f b6 0a movzbl (%edx),%ecx 110: 84 c0 test %al,%al 112: 75 10 jne 124 <strcmp+0x24> 114: eb 1a jmp 130 <strcmp+0x30> 116: 66 90 xchg %ax,%ax p++, q++; 118: 43 inc %ebx 119: 42 inc %edx while(*p && *p == *q) 11a: 0f b6 03 movzbl (%ebx),%eax 11d: 0f b6 0a movzbl (%edx),%ecx 120: 84 c0 test %al,%al 122: 74 0c je 130 <strcmp+0x30> 124: 38 c8 cmp %cl,%al 126: 74 f0 je 118 <strcmp+0x18> return (uchar)*p - (uchar)*q; 128: 29 c8 sub %ecx,%eax } 12a: 5b pop %ebx 12b: 5d pop %ebp 12c: c3 ret 12d: 8d 76 00 lea 0x0(%esi),%esi 130: 31 c0 xor %eax,%eax return (uchar)*p - (uchar)*q; 132: 29 c8 sub %ecx,%eax } 134: 5b pop %ebx 135: 5d pop %ebp 136: c3 ret 137: 90 nop 00000138 <strlen>: uint strlen(const char *s) { 138: 55 push %ebp 139: 89 e5 mov %esp,%ebp 13b: 8b 55 08 mov 0x8(%ebp),%edx int n; for(n = 0; s[n]; n++) 13e: 80 3a 00 cmpb $0x0,(%edx) 141: 74 15 je 158 <strlen+0x20> 143: 31 c0 xor %eax,%eax 145: 8d 76 00 lea 0x0(%esi),%esi 148: 40 inc %eax 149: 89 c1 mov %eax,%ecx 14b: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) 14f: 75 f7 jne 148 <strlen+0x10> ; return n; } 151: 89 c8 mov %ecx,%eax 153: 5d pop %ebp 154: c3 ret 155: 8d 76 00 lea 0x0(%esi),%esi for(n = 0; s[n]; n++) 158: 31 c9 xor %ecx,%ecx } 15a: 89 c8 mov %ecx,%eax 15c: 5d pop %ebp 15d: c3 ret 15e: 66 90 xchg %ax,%ax 00000160 <memset>: void* memset(void *dst, int c, uint n) { 160: 55 push %ebp 161: 89 e5 mov %esp,%ebp 163: 57 push %edi } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 164: 8b 7d 08 mov 0x8(%ebp),%edi 167: 8b 4d 10 mov 0x10(%ebp),%ecx 16a: 8b 45 0c mov 0xc(%ebp),%eax 16d: fc cld 16e: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 170: 8b 45 08 mov 0x8(%ebp),%eax 173: 5f pop %edi 174: 5d pop %ebp 175: c3 ret 176: 66 90 xchg %ax,%ax 00000178 <strchr>: char* strchr(const char *s, char c) { 178: 55 push %ebp 179: 89 e5 mov %esp,%ebp 17b: 8b 45 08 mov 0x8(%ebp),%eax 17e: 8a 4d 0c mov 0xc(%ebp),%cl for(; *s; s++) 181: 8a 10 mov (%eax),%dl 183: 84 d2 test %dl,%dl 185: 75 0c jne 193 <strchr+0x1b> 187: eb 13 jmp 19c <strchr+0x24> 189: 8d 76 00 lea 0x0(%esi),%esi 18c: 40 inc %eax 18d: 8a 10 mov (%eax),%dl 18f: 84 d2 test %dl,%dl 191: 74 09 je 19c <strchr+0x24> if(*s == c) 193: 38 d1 cmp %dl,%cl 195: 75 f5 jne 18c <strchr+0x14> return (char*)s; return 0; } 197: 5d pop %ebp 198: c3 ret 199: 8d 76 00 lea 0x0(%esi),%esi return 0; 19c: 31 c0 xor %eax,%eax } 19e: 5d pop %ebp 19f: c3 ret 000001a0 <gets>: char* gets(char *buf, int max) { 1a0: 55 push %ebp 1a1: 89 e5 mov %esp,%ebp 1a3: 57 push %edi 1a4: 56 push %esi 1a5: 53 push %ebx 1a6: 83 ec 1c sub $0x1c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 1a9: 8b 75 08 mov 0x8(%ebp),%esi 1ac: bb 01 00 00 00 mov $0x1,%ebx 1b1: 29 f3 sub %esi,%ebx cc = read(0, &c, 1); 1b3: 8d 7d e7 lea -0x19(%ebp),%edi for(i=0; i+1 < max; ){ 1b6: eb 20 jmp 1d8 <gets+0x38> cc = read(0, &c, 1); 1b8: 50 push %eax 1b9: 6a 01 push $0x1 1bb: 57 push %edi 1bc: 6a 00 push $0x0 1be: e8 7b 01 00 00 call 33e <read> if(cc < 1) 1c3: 83 c4 10 add $0x10,%esp 1c6: 85 c0 test %eax,%eax 1c8: 7e 16 jle 1e0 <gets+0x40> break; buf[i++] = c; 1ca: 8a 45 e7 mov -0x19(%ebp),%al 1cd: 88 06 mov %al,(%esi) if(c == '\n' || c == '\r') 1cf: 46 inc %esi 1d0: 3c 0a cmp $0xa,%al 1d2: 74 0c je 1e0 <gets+0x40> 1d4: 3c 0d cmp $0xd,%al 1d6: 74 08 je 1e0 <gets+0x40> for(i=0; i+1 < max; ){ 1d8: 8d 04 33 lea (%ebx,%esi,1),%eax 1db: 39 45 0c cmp %eax,0xc(%ebp) 1de: 7f d8 jg 1b8 <gets+0x18> break; } buf[i] = '\0'; 1e0: c6 06 00 movb $0x0,(%esi) return buf; } 1e3: 8b 45 08 mov 0x8(%ebp),%eax 1e6: 8d 65 f4 lea -0xc(%ebp),%esp 1e9: 5b pop %ebx 1ea: 5e pop %esi 1eb: 5f pop %edi 1ec: 5d pop %ebp 1ed: c3 ret 1ee: 66 90 xchg %ax,%ax 000001f0 <stat>: int stat(const char *n, struct stat *st) { 1f0: 55 push %ebp 1f1: 89 e5 mov %esp,%ebp 1f3: 56 push %esi 1f4: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 1f5: 83 ec 08 sub $0x8,%esp 1f8: 6a 00 push $0x0 1fa: ff 75 08 pushl 0x8(%ebp) 1fd: e8 64 01 00 00 call 366 <open> if(fd < 0) 202: 83 c4 10 add $0x10,%esp 205: 85 c0 test %eax,%eax 207: 78 27 js 230 <stat+0x40> 209: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); 20b: 83 ec 08 sub $0x8,%esp 20e: ff 75 0c pushl 0xc(%ebp) 211: 50 push %eax 212: e8 67 01 00 00 call 37e <fstat> 217: 89 c6 mov %eax,%esi close(fd); 219: 89 1c 24 mov %ebx,(%esp) 21c: e8 2d 01 00 00 call 34e <close> return r; 221: 83 c4 10 add $0x10,%esp } 224: 89 f0 mov %esi,%eax 226: 8d 65 f8 lea -0x8(%ebp),%esp 229: 5b pop %ebx 22a: 5e pop %esi 22b: 5d pop %ebp 22c: c3 ret 22d: 8d 76 00 lea 0x0(%esi),%esi return -1; 230: be ff ff ff ff mov $0xffffffff,%esi 235: eb ed jmp 224 <stat+0x34> 237: 90 nop 00000238 <atoi>: int atoi(const char *s) { 238: 55 push %ebp 239: 89 e5 mov %esp,%ebp 23b: 53 push %ebx 23c: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; while('0' <= *s && *s <= '9') 23f: 0f be 01 movsbl (%ecx),%eax 242: 8d 50 d0 lea -0x30(%eax),%edx 245: 80 fa 09 cmp $0x9,%dl n = 0; 248: ba 00 00 00 00 mov $0x0,%edx while('0' <= *s && *s <= '9') 24d: 77 16 ja 265 <atoi+0x2d> 24f: 90 nop n = n*10 + *s++ - '0'; 250: 41 inc %ecx 251: 8d 14 92 lea (%edx,%edx,4),%edx 254: 01 d2 add %edx,%edx 256: 8d 54 02 d0 lea -0x30(%edx,%eax,1),%edx while('0' <= *s && *s <= '9') 25a: 0f be 01 movsbl (%ecx),%eax 25d: 8d 58 d0 lea -0x30(%eax),%ebx 260: 80 fb 09 cmp $0x9,%bl 263: 76 eb jbe 250 <atoi+0x18> return n; } 265: 89 d0 mov %edx,%eax 267: 5b pop %ebx 268: 5d pop %ebp 269: c3 ret 26a: 66 90 xchg %ax,%ax 0000026c <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 26c: 55 push %ebp 26d: 89 e5 mov %esp,%ebp 26f: 57 push %edi 270: 56 push %esi 271: 8b 45 08 mov 0x8(%ebp),%eax 274: 8b 75 0c mov 0xc(%ebp),%esi 277: 8b 55 10 mov 0x10(%ebp),%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 27a: 85 d2 test %edx,%edx 27c: 7e 0b jle 289 <memmove+0x1d> 27e: 01 c2 add %eax,%edx dst = vdst; 280: 89 c7 mov %eax,%edi 282: 66 90 xchg %ax,%ax *dst++ = *src++; 284: a4 movsb %ds:(%esi),%es:(%edi) while(n-- > 0) 285: 39 fa cmp %edi,%edx 287: 75 fb jne 284 <memmove+0x18> return vdst; } 289: 5e pop %esi 28a: 5f pop %edi 28b: 5d pop %ebp 28c: c3 ret 28d: 8d 76 00 lea 0x0(%esi),%esi 00000290 <lock_init>: // thread library void lock_init(lock_t *lock) { 290: 55 push %ebp 291: 89 e5 mov %esp,%ebp lock->locked = 0; 293: 8b 45 08 mov 0x8(%ebp),%eax 296: c7 00 00 00 00 00 movl $0x0,(%eax) } 29c: 5d pop %ebp 29d: c3 ret 29e: 66 90 xchg %ax,%ax 000002a0 <lock_acquire>: void lock_acquire(lock_t *lock) { 2a0: 55 push %ebp 2a1: 89 e5 mov %esp,%ebp 2a3: 8b 55 08 mov 0x8(%ebp),%edx xchg(volatile uint *addr, uint newval) { uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 2a6: b9 01 00 00 00 mov $0x1,%ecx 2ab: 90 nop 2ac: 89 c8 mov %ecx,%eax 2ae: f0 87 02 lock xchg %eax,(%edx) while(xchg(&(lock->locked), 1) != 0); 2b1: 85 c0 test %eax,%eax 2b3: 75 f7 jne 2ac <lock_acquire+0xc> } 2b5: 5d pop %ebp 2b6: c3 ret 2b7: 90 nop 000002b8 <lock_release>: void lock_release(lock_t *lock) { 2b8: 55 push %ebp 2b9: 89 e5 mov %esp,%ebp 2bb: 8b 55 08 mov 0x8(%ebp),%edx 2be: 31 c0 xor %eax,%eax 2c0: f0 87 02 lock xchg %eax,(%edx) xchg(&(lock->locked), 0); } 2c3: 5d pop %ebp 2c4: c3 ret 2c5: 8d 76 00 lea 0x0(%esi),%esi 000002c8 <thread_create>: void *thread_create(void*(start_routine)(void*), void *arg) { 2c8: 55 push %ebp 2c9: 89 e5 mov %esp,%ebp 2cb: 83 ec 14 sub $0x14,%esp void *stack = malloc(2 * PGSIZE); 2ce: 68 00 20 00 00 push $0x2000 2d3: e8 94 03 00 00 call 66c <malloc> if((uint)stack % PGSIZE) 2d8: 83 c4 10 add $0x10,%esp 2db: 89 c2 mov %eax,%edx 2dd: 81 e2 ff 0f 00 00 and $0xfff,%edx 2e3: 74 07 je 2ec <thread_create+0x24> stack = stack + (PGSIZE - (uint)stack % PGSIZE); 2e5: 29 d0 sub %edx,%eax 2e7: 05 00 10 00 00 add $0x1000,%eax int size = 8; int tid = clone(start_routine, stack, size, arg); 2ec: ff 75 0c pushl 0xc(%ebp) 2ef: 6a 08 push $0x8 2f1: 50 push %eax 2f2: ff 75 08 pushl 0x8(%ebp) 2f5: e8 cc 00 00 00 call 3c6 <clone> if (tid < 0) { 2fa: 83 c4 10 add $0x10,%esp 2fd: 85 c0 test %eax,%eax 2ff: 78 07 js 308 <thread_create+0x40> printf(1, "# Clone failed\n"); return 0; } return 0; } 301: 31 c0 xor %eax,%eax 303: c9 leave 304: c3 ret 305: 8d 76 00 lea 0x0(%esi),%esi printf(1, "# Clone failed\n"); 308: 83 ec 08 sub $0x8,%esp 30b: 68 b4 07 00 00 push $0x7b4 310: 6a 01 push $0x1 312: e8 41 01 00 00 call 458 <printf> return 0; 317: 83 c4 10 add $0x10,%esp } 31a: 31 c0 xor %eax,%eax 31c: c9 leave 31d: c3 ret 0000031e <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 31e: b8 01 00 00 00 mov $0x1,%eax 323: cd 40 int $0x40 325: c3 ret 00000326 <exit>: SYSCALL(exit) 326: b8 02 00 00 00 mov $0x2,%eax 32b: cd 40 int $0x40 32d: c3 ret 0000032e <wait>: SYSCALL(wait) 32e: b8 03 00 00 00 mov $0x3,%eax 333: cd 40 int $0x40 335: c3 ret 00000336 <pipe>: SYSCALL(pipe) 336: b8 04 00 00 00 mov $0x4,%eax 33b: cd 40 int $0x40 33d: c3 ret 0000033e <read>: SYSCALL(read) 33e: b8 05 00 00 00 mov $0x5,%eax 343: cd 40 int $0x40 345: c3 ret 00000346 <write>: SYSCALL(write) 346: b8 10 00 00 00 mov $0x10,%eax 34b: cd 40 int $0x40 34d: c3 ret 0000034e <close>: SYSCALL(close) 34e: b8 15 00 00 00 mov $0x15,%eax 353: cd 40 int $0x40 355: c3 ret 00000356 <kill>: SYSCALL(kill) 356: b8 06 00 00 00 mov $0x6,%eax 35b: cd 40 int $0x40 35d: c3 ret 0000035e <exec>: SYSCALL(exec) 35e: b8 07 00 00 00 mov $0x7,%eax 363: cd 40 int $0x40 365: c3 ret 00000366 <open>: SYSCALL(open) 366: b8 0f 00 00 00 mov $0xf,%eax 36b: cd 40 int $0x40 36d: c3 ret 0000036e <mknod>: SYSCALL(mknod) 36e: b8 11 00 00 00 mov $0x11,%eax 373: cd 40 int $0x40 375: c3 ret 00000376 <unlink>: SYSCALL(unlink) 376: b8 12 00 00 00 mov $0x12,%eax 37b: cd 40 int $0x40 37d: c3 ret 0000037e <fstat>: SYSCALL(fstat) 37e: b8 08 00 00 00 mov $0x8,%eax 383: cd 40 int $0x40 385: c3 ret 00000386 <link>: SYSCALL(link) 386: b8 13 00 00 00 mov $0x13,%eax 38b: cd 40 int $0x40 38d: c3 ret 0000038e <mkdir>: SYSCALL(mkdir) 38e: b8 14 00 00 00 mov $0x14,%eax 393: cd 40 int $0x40 395: c3 ret 00000396 <chdir>: SYSCALL(chdir) 396: b8 09 00 00 00 mov $0x9,%eax 39b: cd 40 int $0x40 39d: c3 ret 0000039e <dup>: SYSCALL(dup) 39e: b8 0a 00 00 00 mov $0xa,%eax 3a3: cd 40 int $0x40 3a5: c3 ret 000003a6 <getpid>: SYSCALL(getpid) 3a6: b8 0b 00 00 00 mov $0xb,%eax 3ab: cd 40 int $0x40 3ad: c3 ret 000003ae <sbrk>: SYSCALL(sbrk) 3ae: b8 0c 00 00 00 mov $0xc,%eax 3b3: cd 40 int $0x40 3b5: c3 ret 000003b6 <sleep>: SYSCALL(sleep) 3b6: b8 0d 00 00 00 mov $0xd,%eax 3bb: cd 40 int $0x40 3bd: c3 ret 000003be <uptime>: SYSCALL(uptime) 3be: b8 0e 00 00 00 mov $0xe,%eax 3c3: cd 40 int $0x40 3c5: c3 ret 000003c6 <clone>: 3c6: b8 16 00 00 00 mov $0x16,%eax 3cb: cd 40 int $0x40 3cd: c3 ret 3ce: 66 90 xchg %ax,%ax 000003d0 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 3d0: 55 push %ebp 3d1: 89 e5 mov %esp,%ebp 3d3: 57 push %edi 3d4: 56 push %esi 3d5: 53 push %ebx 3d6: 83 ec 3c sub $0x3c,%esp 3d9: 89 45 bc mov %eax,-0x44(%ebp) 3dc: 89 4d c4 mov %ecx,-0x3c(%ebp) uint x; neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; 3df: 89 d1 mov %edx,%ecx if(sgn && xx < 0){ 3e1: 8b 5d 08 mov 0x8(%ebp),%ebx 3e4: 85 db test %ebx,%ebx 3e6: 74 04 je 3ec <printint+0x1c> 3e8: 85 d2 test %edx,%edx 3ea: 78 68 js 454 <printint+0x84> neg = 0; 3ec: c7 45 08 00 00 00 00 movl $0x0,0x8(%ebp) } else { x = xx; } i = 0; 3f3: 31 ff xor %edi,%edi 3f5: 8d 75 d7 lea -0x29(%ebp),%esi do{ buf[i++] = digits[x % base]; 3f8: 89 c8 mov %ecx,%eax 3fa: 31 d2 xor %edx,%edx 3fc: f7 75 c4 divl -0x3c(%ebp) 3ff: 89 fb mov %edi,%ebx 401: 8d 7f 01 lea 0x1(%edi),%edi 404: 8a 92 cc 07 00 00 mov 0x7cc(%edx),%dl 40a: 88 54 1e 01 mov %dl,0x1(%esi,%ebx,1) 40e: 89 4d c0 mov %ecx,-0x40(%ebp) }while((x /= base) != 0); 411: 89 c1 mov %eax,%ecx 413: 8b 45 c4 mov -0x3c(%ebp),%eax 416: 3b 45 c0 cmp -0x40(%ebp),%eax 419: 76 dd jbe 3f8 <printint+0x28> if(neg) 41b: 8b 4d 08 mov 0x8(%ebp),%ecx 41e: 85 c9 test %ecx,%ecx 420: 74 09 je 42b <printint+0x5b> buf[i++] = '-'; 422: c6 44 3d d8 2d movb $0x2d,-0x28(%ebp,%edi,1) buf[i++] = digits[x % base]; 427: 89 fb mov %edi,%ebx buf[i++] = '-'; 429: b2 2d mov $0x2d,%dl 42b: 8d 5c 1d d7 lea -0x29(%ebp,%ebx,1),%ebx 42f: 8b 7d bc mov -0x44(%ebp),%edi 432: eb 03 jmp 437 <printint+0x67> 434: 8a 13 mov (%ebx),%dl 436: 4b dec %ebx while(--i >= 0) putc(fd, buf[i]); 437: 88 55 d7 mov %dl,-0x29(%ebp) write(fd, &c, 1); 43a: 50 push %eax 43b: 6a 01 push $0x1 43d: 56 push %esi 43e: 57 push %edi 43f: e8 02 ff ff ff call 346 <write> while(--i >= 0) 444: 83 c4 10 add $0x10,%esp 447: 39 de cmp %ebx,%esi 449: 75 e9 jne 434 <printint+0x64> } 44b: 8d 65 f4 lea -0xc(%ebp),%esp 44e: 5b pop %ebx 44f: 5e pop %esi 450: 5f pop %edi 451: 5d pop %ebp 452: c3 ret 453: 90 nop x = -xx; 454: f7 d9 neg %ecx 456: eb 9b jmp 3f3 <printint+0x23> 00000458 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 458: 55 push %ebp 459: 89 e5 mov %esp,%ebp 45b: 57 push %edi 45c: 56 push %esi 45d: 53 push %ebx 45e: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 461: 8b 75 0c mov 0xc(%ebp),%esi 464: 8a 1e mov (%esi),%bl 466: 84 db test %bl,%bl 468: 0f 84 a3 00 00 00 je 511 <printf+0xb9> 46e: 46 inc %esi ap = (uint*)(void*)&fmt + 1; 46f: 8d 45 10 lea 0x10(%ebp),%eax 472: 89 45 d0 mov %eax,-0x30(%ebp) state = 0; 475: 31 d2 xor %edx,%edx write(fd, &c, 1); 477: 8d 7d e7 lea -0x19(%ebp),%edi 47a: eb 29 jmp 4a5 <printf+0x4d> 47c: 89 55 d4 mov %edx,-0x2c(%ebp) c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 47f: 83 f8 25 cmp $0x25,%eax 482: 0f 84 94 00 00 00 je 51c <printf+0xc4> state = '%'; } else { putc(fd, c); 488: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); 48b: 50 push %eax 48c: 6a 01 push $0x1 48e: 57 push %edi 48f: ff 75 08 pushl 0x8(%ebp) 492: e8 af fe ff ff call 346 <write> putc(fd, c); 497: 83 c4 10 add $0x10,%esp 49a: 8b 55 d4 mov -0x2c(%ebp),%edx 49d: 46 inc %esi for(i = 0; fmt[i]; i++){ 49e: 8a 5e ff mov -0x1(%esi),%bl 4a1: 84 db test %bl,%bl 4a3: 74 6c je 511 <printf+0xb9> c = fmt[i] & 0xff; 4a5: 0f be cb movsbl %bl,%ecx 4a8: 0f b6 c3 movzbl %bl,%eax if(state == 0){ 4ab: 85 d2 test %edx,%edx 4ad: 74 cd je 47c <printf+0x24> } } else if(state == '%'){ 4af: 83 fa 25 cmp $0x25,%edx 4b2: 75 e9 jne 49d <printf+0x45> if(c == 'd'){ 4b4: 83 f8 64 cmp $0x64,%eax 4b7: 0f 84 97 00 00 00 je 554 <printf+0xfc> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 4bd: 81 e1 f7 00 00 00 and $0xf7,%ecx 4c3: 83 f9 70 cmp $0x70,%ecx 4c6: 74 60 je 528 <printf+0xd0> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 4c8: 83 f8 73 cmp $0x73,%eax 4cb: 0f 84 8f 00 00 00 je 560 <printf+0x108> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 4d1: 83 f8 63 cmp $0x63,%eax 4d4: 0f 84 d6 00 00 00 je 5b0 <printf+0x158> putc(fd, *ap); ap++; } else if(c == '%'){ 4da: 83 f8 25 cmp $0x25,%eax 4dd: 0f 84 c1 00 00 00 je 5a4 <printf+0x14c> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 4e3: c6 45 e7 25 movb $0x25,-0x19(%ebp) write(fd, &c, 1); 4e7: 50 push %eax 4e8: 6a 01 push $0x1 4ea: 57 push %edi 4eb: ff 75 08 pushl 0x8(%ebp) 4ee: e8 53 fe ff ff call 346 <write> putc(fd, c); 4f3: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); 4f6: 83 c4 0c add $0xc,%esp 4f9: 6a 01 push $0x1 4fb: 57 push %edi 4fc: ff 75 08 pushl 0x8(%ebp) 4ff: e8 42 fe ff ff call 346 <write> putc(fd, c); 504: 83 c4 10 add $0x10,%esp } state = 0; 507: 31 d2 xor %edx,%edx 509: 46 inc %esi for(i = 0; fmt[i]; i++){ 50a: 8a 5e ff mov -0x1(%esi),%bl 50d: 84 db test %bl,%bl 50f: 75 94 jne 4a5 <printf+0x4d> } } } 511: 8d 65 f4 lea -0xc(%ebp),%esp 514: 5b pop %ebx 515: 5e pop %esi 516: 5f pop %edi 517: 5d pop %ebp 518: c3 ret 519: 8d 76 00 lea 0x0(%esi),%esi state = '%'; 51c: ba 25 00 00 00 mov $0x25,%edx 521: e9 77 ff ff ff jmp 49d <printf+0x45> 526: 66 90 xchg %ax,%ax printint(fd, *ap, 16, 0); 528: 83 ec 0c sub $0xc,%esp 52b: 6a 00 push $0x0 52d: b9 10 00 00 00 mov $0x10,%ecx 532: 8b 5d d0 mov -0x30(%ebp),%ebx 535: 8b 13 mov (%ebx),%edx 537: 8b 45 08 mov 0x8(%ebp),%eax 53a: e8 91 fe ff ff call 3d0 <printint> ap++; 53f: 89 d8 mov %ebx,%eax 541: 83 c0 04 add $0x4,%eax 544: 89 45 d0 mov %eax,-0x30(%ebp) 547: 83 c4 10 add $0x10,%esp state = 0; 54a: 31 d2 xor %edx,%edx ap++; 54c: e9 4c ff ff ff jmp 49d <printf+0x45> 551: 8d 76 00 lea 0x0(%esi),%esi printint(fd, *ap, 10, 1); 554: 83 ec 0c sub $0xc,%esp 557: 6a 01 push $0x1 559: b9 0a 00 00 00 mov $0xa,%ecx 55e: eb d2 jmp 532 <printf+0xda> s = (char*)*ap; 560: 8b 45 d0 mov -0x30(%ebp),%eax 563: 8b 18 mov (%eax),%ebx ap++; 565: 83 c0 04 add $0x4,%eax 568: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) 56b: 85 db test %ebx,%ebx 56d: 74 65 je 5d4 <printf+0x17c> while(*s != 0){ 56f: 8a 03 mov (%ebx),%al 571: 84 c0 test %al,%al 573: 74 70 je 5e5 <printf+0x18d> 575: 89 75 d4 mov %esi,-0x2c(%ebp) 578: 89 de mov %ebx,%esi 57a: 8b 5d 08 mov 0x8(%ebp),%ebx 57d: 8d 76 00 lea 0x0(%esi),%esi putc(fd, *s); 580: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); 583: 50 push %eax 584: 6a 01 push $0x1 586: 57 push %edi 587: 53 push %ebx 588: e8 b9 fd ff ff call 346 <write> s++; 58d: 46 inc %esi while(*s != 0){ 58e: 8a 06 mov (%esi),%al 590: 83 c4 10 add $0x10,%esp 593: 84 c0 test %al,%al 595: 75 e9 jne 580 <printf+0x128> 597: 8b 75 d4 mov -0x2c(%ebp),%esi state = 0; 59a: 31 d2 xor %edx,%edx 59c: e9 fc fe ff ff jmp 49d <printf+0x45> 5a1: 8d 76 00 lea 0x0(%esi),%esi putc(fd, c); 5a4: 88 5d e7 mov %bl,-0x19(%ebp) write(fd, &c, 1); 5a7: 52 push %edx 5a8: e9 4c ff ff ff jmp 4f9 <printf+0xa1> 5ad: 8d 76 00 lea 0x0(%esi),%esi putc(fd, *ap); 5b0: 8b 5d d0 mov -0x30(%ebp),%ebx 5b3: 8b 03 mov (%ebx),%eax 5b5: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); 5b8: 51 push %ecx 5b9: 6a 01 push $0x1 5bb: 57 push %edi 5bc: ff 75 08 pushl 0x8(%ebp) 5bf: e8 82 fd ff ff call 346 <write> ap++; 5c4: 83 c3 04 add $0x4,%ebx 5c7: 89 5d d0 mov %ebx,-0x30(%ebp) 5ca: 83 c4 10 add $0x10,%esp state = 0; 5cd: 31 d2 xor %edx,%edx 5cf: e9 c9 fe ff ff jmp 49d <printf+0x45> s = "(null)"; 5d4: bb c4 07 00 00 mov $0x7c4,%ebx while(*s != 0){ 5d9: b0 28 mov $0x28,%al 5db: 89 75 d4 mov %esi,-0x2c(%ebp) 5de: 89 de mov %ebx,%esi 5e0: 8b 5d 08 mov 0x8(%ebp),%ebx 5e3: eb 9b jmp 580 <printf+0x128> state = 0; 5e5: 31 d2 xor %edx,%edx 5e7: e9 b1 fe ff ff jmp 49d <printf+0x45> 000005ec <free>: static Header base; static Header *freep; void free(void *ap) { 5ec: 55 push %ebp 5ed: 89 e5 mov %esp,%ebp 5ef: 57 push %edi 5f0: 56 push %esi 5f1: 53 push %ebx 5f2: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; 5f5: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 5f8: a1 f8 0a 00 00 mov 0xaf8,%eax 5fd: 8b 10 mov (%eax),%edx 5ff: 39 c8 cmp %ecx,%eax 601: 73 11 jae 614 <free+0x28> 603: 90 nop 604: 39 d1 cmp %edx,%ecx 606: 72 14 jb 61c <free+0x30> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 608: 39 d0 cmp %edx,%eax 60a: 73 10 jae 61c <free+0x30> { 60c: 89 d0 mov %edx,%eax 60e: 8b 10 mov (%eax),%edx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 610: 39 c8 cmp %ecx,%eax 612: 72 f0 jb 604 <free+0x18> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 614: 39 d0 cmp %edx,%eax 616: 72 f4 jb 60c <free+0x20> 618: 39 d1 cmp %edx,%ecx 61a: 73 f0 jae 60c <free+0x20> break; if(bp + bp->s.size == p->s.ptr){ 61c: 8b 73 fc mov -0x4(%ebx),%esi 61f: 8d 3c f1 lea (%ecx,%esi,8),%edi 622: 39 fa cmp %edi,%edx 624: 74 1a je 640 <free+0x54> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 626: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 629: 8b 50 04 mov 0x4(%eax),%edx 62c: 8d 34 d0 lea (%eax,%edx,8),%esi 62f: 39 f1 cmp %esi,%ecx 631: 74 24 je 657 <free+0x6b> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 633: 89 08 mov %ecx,(%eax) freep = p; 635: a3 f8 0a 00 00 mov %eax,0xaf8 } 63a: 5b pop %ebx 63b: 5e pop %esi 63c: 5f pop %edi 63d: 5d pop %ebp 63e: c3 ret 63f: 90 nop bp->s.size += p->s.ptr->s.size; 640: 03 72 04 add 0x4(%edx),%esi 643: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 646: 8b 10 mov (%eax),%edx 648: 8b 12 mov (%edx),%edx 64a: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 64d: 8b 50 04 mov 0x4(%eax),%edx 650: 8d 34 d0 lea (%eax,%edx,8),%esi 653: 39 f1 cmp %esi,%ecx 655: 75 dc jne 633 <free+0x47> p->s.size += bp->s.size; 657: 03 53 fc add -0x4(%ebx),%edx 65a: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 65d: 8b 53 f8 mov -0x8(%ebx),%edx 660: 89 10 mov %edx,(%eax) freep = p; 662: a3 f8 0a 00 00 mov %eax,0xaf8 } 667: 5b pop %ebx 668: 5e pop %esi 669: 5f pop %edi 66a: 5d pop %ebp 66b: c3 ret 0000066c <malloc>: return freep; } void* malloc(uint nbytes) { 66c: 55 push %ebp 66d: 89 e5 mov %esp,%ebp 66f: 57 push %edi 670: 56 push %esi 671: 53 push %ebx 672: 83 ec 1c sub $0x1c,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 675: 8b 45 08 mov 0x8(%ebp),%eax 678: 8d 70 07 lea 0x7(%eax),%esi 67b: c1 ee 03 shr $0x3,%esi 67e: 46 inc %esi if((prevp = freep) == 0){ 67f: 8b 3d f8 0a 00 00 mov 0xaf8,%edi 685: 85 ff test %edi,%edi 687: 0f 84 a3 00 00 00 je 730 <malloc+0xc4> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 68d: 8b 07 mov (%edi),%eax if(p->s.size >= nunits){ 68f: 8b 48 04 mov 0x4(%eax),%ecx 692: 39 f1 cmp %esi,%ecx 694: 73 67 jae 6fd <malloc+0x91> 696: 89 f3 mov %esi,%ebx 698: 81 fe 00 10 00 00 cmp $0x1000,%esi 69e: 0f 82 80 00 00 00 jb 724 <malloc+0xb8> p = sbrk(nu * sizeof(Header)); 6a4: 8d 0c dd 00 00 00 00 lea 0x0(,%ebx,8),%ecx 6ab: 89 4d e4 mov %ecx,-0x1c(%ebp) 6ae: eb 11 jmp 6c1 <malloc+0x55> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 6b0: 8b 10 mov (%eax),%edx if(p->s.size >= nunits){ 6b2: 8b 4a 04 mov 0x4(%edx),%ecx 6b5: 39 f1 cmp %esi,%ecx 6b7: 73 4b jae 704 <malloc+0x98> 6b9: 8b 3d f8 0a 00 00 mov 0xaf8,%edi 6bf: 89 d0 mov %edx,%eax p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 6c1: 39 c7 cmp %eax,%edi 6c3: 75 eb jne 6b0 <malloc+0x44> p = sbrk(nu * sizeof(Header)); 6c5: 83 ec 0c sub $0xc,%esp 6c8: ff 75 e4 pushl -0x1c(%ebp) 6cb: e8 de fc ff ff call 3ae <sbrk> if(p == (char*)-1) 6d0: 83 c4 10 add $0x10,%esp 6d3: 83 f8 ff cmp $0xffffffff,%eax 6d6: 74 1b je 6f3 <malloc+0x87> hp->s.size = nu; 6d8: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 6db: 83 ec 0c sub $0xc,%esp 6de: 83 c0 08 add $0x8,%eax 6e1: 50 push %eax 6e2: e8 05 ff ff ff call 5ec <free> return freep; 6e7: a1 f8 0a 00 00 mov 0xaf8,%eax if((p = morecore(nunits)) == 0) 6ec: 83 c4 10 add $0x10,%esp 6ef: 85 c0 test %eax,%eax 6f1: 75 bd jne 6b0 <malloc+0x44> return 0; 6f3: 31 c0 xor %eax,%eax } } 6f5: 8d 65 f4 lea -0xc(%ebp),%esp 6f8: 5b pop %ebx 6f9: 5e pop %esi 6fa: 5f pop %edi 6fb: 5d pop %ebp 6fc: c3 ret if(p->s.size >= nunits){ 6fd: 89 c2 mov %eax,%edx 6ff: 89 f8 mov %edi,%eax 701: 8d 76 00 lea 0x0(%esi),%esi if(p->s.size == nunits) 704: 39 ce cmp %ecx,%esi 706: 74 54 je 75c <malloc+0xf0> p->s.size -= nunits; 708: 29 f1 sub %esi,%ecx 70a: 89 4a 04 mov %ecx,0x4(%edx) p += p->s.size; 70d: 8d 14 ca lea (%edx,%ecx,8),%edx p->s.size = nunits; 710: 89 72 04 mov %esi,0x4(%edx) freep = prevp; 713: a3 f8 0a 00 00 mov %eax,0xaf8 return (void*)(p + 1); 718: 8d 42 08 lea 0x8(%edx),%eax } 71b: 8d 65 f4 lea -0xc(%ebp),%esp 71e: 5b pop %ebx 71f: 5e pop %esi 720: 5f pop %edi 721: 5d pop %ebp 722: c3 ret 723: 90 nop 724: bb 00 10 00 00 mov $0x1000,%ebx 729: e9 76 ff ff ff jmp 6a4 <malloc+0x38> 72e: 66 90 xchg %ax,%ax base.s.ptr = freep = prevp = &base; 730: c7 05 f8 0a 00 00 fc movl $0xafc,0xaf8 737: 0a 00 00 73a: c7 05 fc 0a 00 00 fc movl $0xafc,0xafc 741: 0a 00 00 base.s.size = 0; 744: c7 05 00 0b 00 00 00 movl $0x0,0xb00 74b: 00 00 00 74e: bf fc 0a 00 00 mov $0xafc,%edi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 753: 89 f8 mov %edi,%eax 755: e9 3c ff ff ff jmp 696 <malloc+0x2a> 75a: 66 90 xchg %ax,%ax prevp->s.ptr = p->s.ptr; 75c: 8b 0a mov (%edx),%ecx 75e: 89 08 mov %ecx,(%eax) 760: eb b1 jmp 713 <malloc+0xa7>
33.569061
61
0.405506
cbe2598c0912c34261edb7cbb25371f17e141c23
831
asm
Assembly
programs/oeis/025/A025736.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
1
2021-03-15T11:38:20.000Z
2021-03-15T11:38:20.000Z
programs/oeis/025/A025736.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
programs/oeis/025/A025736.asm
jmorken/loda
99c09d2641e858b074f6344a352d13bc55601571
[ "Apache-2.0" ]
null
null
null
; A025736: Index of 9^n within sequence of numbers of form 6^i*9^j. ; 1,3,6,10,15,22,30,39,49,61,74,88,103,119,137,156,176,197,220,244,269,295,322,351,381,412,444,478,513,549,586,625,665,706,748,791,836,882,929,977,1027,1078,1130,1183,1237,1293,1350,1408,1467,1528,1590,1653,1717 mov $16,$0 mov $18,$0 add $18,1 lpb $18 clr $0,16 mov $0,$16 sub $18,1 sub $0,$18 mov $13,$0 mov $15,$0 add $15,1 lpb $15 mov $0,$13 sub $15,1 sub $0,$15 mov $9,$0 mov $11,2 lpb $11 mov $0,$9 sub $11,1 add $0,$11 sub $0,1 mul $0,14 mov $1,$0 div $1,62 mov $12,$11 lpb $12 mov $10,$1 sub $12,1 lpe lpe lpb $9 mov $9,0 sub $10,$1 lpe mov $1,$10 add $1,1 add $14,$1 lpe add $17,$14 lpe mov $1,$17
18.065217
211
0.521059
40625f489a4990b5467b14ce04ce068dc6daabf7
910
py
Python
src/backend/database_migrations/versions/20210602_211244_small_modifications_to_samples_table.py
chanzuckerberg/czgenepi
87bd2b1739acdfe2c7c25663fafb01dc24c5e2fd
[ "MIT" ]
5
2021-02-04T20:18:46.000Z
2021-09-09T13:42:42.000Z
src/backend/database_migrations/versions/20210602_211244_small_modifications_to_samples_table.py
chanzuckerberg/aspen
9853778a7ef68b0446751657af5a835f98dde3dc
[ "MIT" ]
422
2021-01-30T04:16:00.000Z
2022-01-31T23:18:44.000Z
src/backend/database_migrations/versions/20210602_211244_small_modifications_to_samples_table.py
chanzuckerberg/covidr
afe05d703d30ec18ac83944bfb551c313cb216c4
[ "MIT" ]
1
2021-05-20T14:54:39.000Z
2021-05-20T14:54:39.000Z
"""small modifications to samples table Create Date: 2021-06-02 21:12:45.468074 """ import enumtables # noqa: F401 import sqlalchemy as sa from alembic import op revision = "20210602_211244" down_revision = "20210526_162747" branch_labels = None depends_on = None def upgrade(): op.alter_column( "samples", "czb_failed_genome_recovery", existing_type=sa.BOOLEAN(), nullable=True, existing_comment="This is set to true iff this is sample sequenced by CZB and failed genome recovery.", existing_server_default=sa.text("true"), schema="aspen", ) update_organism_sql = sa.sql.text( "UPDATE aspen.samples SET organism ='Severe acute respiratory syndrome coronavirus 2'" ) conn = op.get_bind() conn.execute(update_organism_sql) def downgrade(): raise NotImplementedError("Downgrading the database is not allowed")
24.594595
111
0.701099
9570d82216aeb76cd3609209b5efbd6b3f7c3e71
456
css
CSS
ClientApp/src/css/Device.css
dylrob34/Sharp-Witted-Plantation-Genie
02450dccd55f674c9a9c70e39ca83bc7e42036b2
[ "MIT" ]
null
null
null
ClientApp/src/css/Device.css
dylrob34/Sharp-Witted-Plantation-Genie
02450dccd55f674c9a9c70e39ca83bc7e42036b2
[ "MIT" ]
7
2020-02-09T00:14:23.000Z
2022-02-26T19:59:07.000Z
ClientApp/src/css/Device.css
dylrob34/Sharp-Witted-Plantation-Genie
02450dccd55f674c9a9c70e39ca83bc7e42036b2
[ "MIT" ]
2
2019-11-08T16:53:36.000Z
2019-11-08T17:24:12.000Z
.device{ list-style: none; } .device-button-group{ display: flex; justify-content: flex-end; margin-bottom: .6rem; } .device-button{ transition: transform .2s;; font-size: 1.1rem; } .device-button:hover{ transform: scale(1.3); } .device-highlights{ display: flex; } .device-image{ width: 50%; } .device-details{ display: flex; flex-direction: column; justify-content: center; padding-left: 1rem; }
13.818182
31
0.627193
6dda950daf43a052202779c4abaf2a793eaa9bd4
29,627
ps1
PowerShell
tests/Unit/DSC_SqlDatabase.Tests.ps1
LowlyDBA/SqlServerDsc
630eeaeac8910da64edf7458c76d41d7bb3601fa
[ "MIT" ]
117
2017-12-04T01:48:57.000Z
2019-11-26T08:22:14.000Z
tests/Unit/DSC_SqlDatabase.Tests.ps1
LowlyDBA/SqlServerDsc
630eeaeac8910da64edf7458c76d41d7bb3601fa
[ "MIT" ]
671
2017-11-28T18:50:26.000Z
2019-11-26T16:05:31.000Z
tests/Unit/DSC_SqlDatabase.Tests.ps1
LowlyDBA/SqlServerDsc
630eeaeac8910da64edf7458c76d41d7bb3601fa
[ "MIT" ]
94
2017-11-28T19:44:29.000Z
2019-11-13T03:11:54.000Z
<# .SYNOPSIS Automated unit test for DSC_SqlDatabase DSC resource. #> Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1') if (-not (Test-BuildCategory -Type 'Unit')) { return } $script:dscModuleName = 'SqlServerDsc' $script:dscResourceName = 'DSC_SqlDatabase' function Invoke-TestSetup { try { Import-Module -Name DscResource.Test -Force -ErrorAction 'Stop' } catch [System.IO.FileNotFoundException] { throw 'DscResource.Test module dependency not found. Please run ".\build.ps1 -Tasks build" first.' } $script:testEnvironment = Initialize-TestEnvironment ` -DSCModuleName $script:dscModuleName ` -DSCResourceName $script:dscResourceName ` -ResourceType 'Mof' ` -TestType 'Unit' } function Invoke-TestCleanup { Restore-TestEnvironment -TestEnvironment $script:testEnvironment } Invoke-TestSetup try { InModuleScope $script:dscResourceName { $mockServerName = 'localhost' $mockInstanceName = 'MSSQLSERVER' $mockInstanceVersionMajor = 13 $mockSqlDatabaseName = 'AdventureWorks' $mockInvalidOperationForCreateMethod = $false $mockInvalidOperationForDropMethod = $false $mockInvalidOperationForAlterMethod = $false $mockExpectedDatabaseNameToCreate = 'Contoso' $mockExpectedDatabaseNameToDrop = 'Sales' $mockSqlDatabaseCollation = 'SQL_Latin1_General_CP1_CI_AS' $mockSqlDatabaseCompatibilityLevel = 'Version130' $mockSqlDatabaseRecoveryModel = 'Full' $mockSqlDatabaseOwner = 'sa' # Default parameters that are used for the It-blocks $mockDefaultParameters = @{ InstanceName = $mockInstanceName ServerName = $mockServerName } #region Function mocks $mockConnectSQL = { return @( ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name InstanceName -Value $mockInstanceName -PassThru | Add-Member -MemberType NoteProperty -Name ComputerNamePhysicalNetBIOS -Value $mockServerName -PassThru | Add-Member -MemberType NoteProperty -Name Collation -Value $mockSqlDatabaseCollation -PassThru | Add-Member -MemberType NoteProperty -Name VersionMajor -Value $mockInstanceVersionMajor -PassThru | Add-Member -MemberType ScriptMethod -Name EnumCollations -Value { return @( ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty Name -Value $mockSqlDatabaseCollation -PassThru ), ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty Name -Value 'SQL_Latin1_General_CP1_CS_AS' -PassThru ), ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty Name -Value 'SQL_Latin1_General_Pref_CP850_CI_AS' -PassThru ) ) } -PassThru -Force | Add-Member -MemberType ScriptProperty -Name Databases -Value { return @{ $mockSqlDatabaseName = ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name 'Name' -Value $mockSqlDatabaseName -PassThru | Add-Member -MemberType NoteProperty -Name 'Collation' -Value $mockSqlDatabaseCollation -PassThru | Add-Member -MemberType NoteProperty -Name 'CompatibilityLevel' -Value $mockSqlDatabaseCompatibilityLevel -PassThru | Add-Member -MemberType NoteProperty -Name 'RecoveryModel' -Value $mockSqlDatabaseRecoveryModel -PassThru | Add-Member -MemberType NoteProperty -Name 'Owner' -Value $mockSqlDatabaseOwner -PassThru | Add-Member -MemberType ScriptMethod -Name 'Drop' -Value { if ($mockInvalidOperationForDropMethod) { throw 'Mock Drop Method was called with invalid operation.' } if ( $this.Name -ne $mockExpectedDatabaseNameToDrop ) { throw "Called mocked Drop() method without dropping the right database. Expected '{0}'. But was '{1}'." ` -f $mockExpectedDatabaseNameToDrop, $this.Name } } -PassThru | Add-Member -MemberType ScriptMethod -Name 'SetOwner' -Value { $script:methodSetOwnerWasCalled += 1 } -PassThru | Add-Member -MemberType ScriptMethod -Name 'Alter' -Value { if ($mockInvalidOperationForAlterMethod) { throw 'Mock Alter Method was called with invalid operation.' } } -PassThru ) } } -PassThru -Force ) ) } $mockNewObjectDatabase = { return @( ( New-Object -TypeName Object | Add-Member -MemberType NoteProperty -Name Name -Value $mockSqlDatabaseName -PassThru | Add-Member -MemberType NoteProperty -Name Collation -Value '' -PassThru | Add-Member -MemberType NoteProperty -Name CompatibilityLevel -Value '' -PassThru | Add-Member -MemberType NoteProperty -Name RecoveryModel -Value '' -PassThru | Add-Member -MemberType NoteProperty -Name Owner -Value '' -PassThru | Add-Member -MemberType ScriptMethod -Name Create -Value { if ($mockInvalidOperationForCreateMethod) { throw 'Mock Create Method was called with invalid operation.' } if ( $this.Name -ne $mockExpectedDatabaseNameToCreate ) { throw "Called mocked Create() method without adding the right database. Expected '{0}'. But was '{1}'." ` -f $mockExpectedDatabaseNameToCreate, $this.Name } } -PassThru | Add-Member -MemberType ScriptMethod -Name 'SetOwner' -Value { $script:methodSetOwnerWasCalled += 1 } -PassThru -Force ) ) } #endregion Describe 'DSC_SqlDatabase\Get-TargetResource' -Tag 'Get' { BeforeEach { Mock -CommandName Connect-SQL -MockWith $mockConnectSQL -Verifiable } Context 'When the system is not in the desired state' { $testParameters = $mockDefaultParameters.Clone() $testParameters['Name'] = 'UnknownDatabase' It 'Should return the state as absent' { $result = Get-TargetResource @testParameters $result.Ensure | Should -Be 'Absent' } It 'Should return the same values as passed as parameters' { $result = Get-TargetResource @testParameters $result.ServerName | Should -Be $testParameters.ServerName $result.InstanceName | Should -Be $testParameters.InstanceName $result.Name | Should -Be $testParameters.Name $result.Collation | Should -BeNullOrEmpty $result.CompatibilityLevel | Should -BeNullOrEmpty $result.RecoveryModel | Should -BeNullOrEmpty $result.Owner | Should -BeNullOrEmpty } It 'Should call the mock function Connect-SQL' { Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 2 -Scope Context } } Context 'When the system is in the desired state for a database' { $testParameters = $mockDefaultParameters.Clone() $testParameters['Name'] = 'AdventureWorks' It 'Should return the state as present' { $result = Get-TargetResource @testParameters $result.Ensure | Should -Be 'Present' } It 'Should return the same values as passed as parameters' { $result = Get-TargetResource @testParameters $result.ServerName | Should -Be $testParameters.ServerName $result.InstanceName | Should -Be $testParameters.InstanceName $result.Name | Should -Be $testParameters.Name $result.Collation | Should -Be $mockSqlDatabaseCollation $result.CompatibilityLevel | Should -Be $mockSqlDatabaseCompatibilityLevel $result.RecoveryModel | Should -Be $mockSqlDatabaseRecoveryModel $result.OwnerName | Should -Be $mockSqlDatabaseOwner } It 'Should call the mock function Connect-SQL' { Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 2 -Scope Context } } Assert-VerifiableMock } Describe 'DSC_SqlDatabase\Test-TargetResource' -Tag 'Test' { BeforeEach { Mock -CommandName Connect-SQL -MockWith $mockConnectSQL -Verifiable } Context 'When the system is not in the desired state and Ensure is set to Present' { It 'Should return the state as false when desired database does not exist' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'UnknownDatabase' Ensure = 'Present' Collation = 'SQL_Latin1_General_CP1_CS_AS' CompatibilityLevel = 'Version130' } $result = Test-TargetResource @testParameters $result | Should -Be $false } It 'Should return the state as false when desired database exists but has the incorrect collation' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Present' Collation = 'SQL_Latin1_General_CP1_CS_AS' } $result = Test-TargetResource @testParameters $result | Should -Be $false } It 'Should return the state as false when desired database exists but has the incorrect compatibility level' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Present' CompatibilityLevel = 'Version120' } $result = Test-TargetResource @testParameters $result | Should -Be $false } It 'Should return the state as false when desired database exists but has the incorrect recovery model' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Present' RecoveryModel = 'Simple' } $result = Test-TargetResource @testParameters $result | Should -Be $false } It 'Should return the state as false when desired database exists but has the incorrect owner' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Present' OwnerName = 'NewLoginName' } $result = Test-TargetResource @testParameters $result | Should -Be $false } It 'Should call the mock function Connect-SQL' { Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 5 -Scope Context } } Context 'When the system is not in the desired state and Ensure is set to Absent' { It 'Should return the state as false when non-desired database exist' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Absent' } $result = Test-TargetResource @testParameters $result | Should -Be $false } It 'Should call the mock function Connect-SQL' { Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope Context } } Context 'When the system is in the desired state and Ensure is set to Present' { It 'Should return the state as true when desired database exist' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Present' Collation = 'SQL_Latin1_General_CP1_CI_AS' CompatibilityLevel = 'Version130' } $result = Test-TargetResource @testParameters $result | Should -Be $true } It 'Should return the state as true when desired database exists and has the correct collation' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Present' Collation = 'SQL_Latin1_General_CP1_CI_AS' } $result = Test-TargetResource @testParameters $result | Should -Be $true } It 'Should return the state as true when desired database exists and has the correct compatibility level' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Present' CompatibilityLevel = 'Version130' } $result = Test-TargetResource @testParameters $result | Should -Be $true } It 'Should return the state as true when desired database exists and has the correct recovery model' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Present' RecoveryModel = 'Full' } $result = Test-TargetResource @testParameters $result | Should -Be $true } It 'Should call the mock function Connect-SQL' { Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 4 -Scope Context } } Context 'When the system is in the desired state and Ensure is set to Absent' { It 'Should return the state as true when desired database does not exist' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'UnknownDatabase' Ensure = 'Absent' } $result = Test-TargetResource @testParameters $result | Should -Be $true } It 'Should call the mock function Connect-SQL' { Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope Context } } Assert-VerifiableMock } Describe 'DSC_SqlDatabase\Set-TargetResource' -Tag 'Set' { BeforeEach { Mock -CommandName Connect-SQL -MockWith $mockConnectSQL -Verifiable Mock -CommandName New-Object -MockWith $mockNewObjectDatabase -ParameterFilter { $TypeName -eq 'Microsoft.SqlServer.Management.Smo.Database' } -Verifiable } $mockSqlDatabaseName = 'Contoso' $mockExpectedDatabaseNameToCreate = 'Contoso' Context 'When the system is not in the desired state and Ensure is set to Present' { BeforeEach { $script:methodSetOwnerWasCalled = 0 } Context 'When creating a new database with just mandatory parameters' { It 'Should not throw when creating the database' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'NewDatabase' Ensure = 'Present' } { Set-TargetResource @testParameters } | Should -Not -Throw } It 'Should call the mock function New-Object with TypeName equal to Microsoft.SqlServer.Management.Smo.Database' { Assert-MockCalled -CommandName New-Object -Exactly -Times 1 -ParameterFilter { $TypeName -eq 'Microsoft.SqlServer.Management.Smo.Database' } -Scope Context } } Context 'When creating a new database and specifying recovery model' { It 'Should not throw when creating the database' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'NewDatabase' Ensure = 'Present' RecoveryModel = 'Full' } { Set-TargetResource @testParameters } | Should -Not -Throw } } Context 'When creating a new database and specifying owner' { It 'Should not throw when creating the database' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'NewDatabase' Ensure = 'Present' OwnerName = 'LoginName' } { Set-TargetResource @testParameters } | Should -Not -Throw $script:methodSetOwnerWasCalled | Should -Be 1 } } Context 'When creating a new database and specifying collation' { It 'Should not throw when creating the database' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'NewDatabase' Ensure = 'Present' Collation = 'SQL_Latin1_General_CP1_CI_AS' } { Set-TargetResource @testParameters } | Should -Not -Throw } } Context 'When creating a new database and specifying compatibility level' { It 'Should not throw when creating the database' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'NewDatabase' Ensure = 'Present' CompatibilityLevel = 'Version130' } { Set-TargetResource @testParameters } | Should -Not -Throw } } It 'Should not throw when changing the database collation' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'Contoso' Ensure = 'Present' Collation = 'SQL_Latin1_General_CP1_CS_AS' } { Set-TargetResource @testParameters } | Should -Not -Throw } It 'Should not throw when changing the database compatibility level' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'Contoso' Ensure = 'Present' CompatibilityLevel = 'Version130' } { Set-TargetResource @testParameters } | Should -Not -Throw } It 'Should not throw when changing the database recovery model' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'Contoso' Ensure = 'Present' RecoveryModel = 'Simple' } { Set-TargetResource @testParameters } | Should -Not -Throw } It 'Should not throw when changing the owner' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'Contoso' Ensure = 'Present' OwnerName = 'NewLoginName' } { Set-TargetResource @testParameters } | Should -Not -Throw $script:methodSetOwnerWasCalled | Should -Be 1 } It 'Should call the mock function Connect-SQL' { Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 4 -Scope Context } It 'Should throw when trying to use an unsupported compatibility level' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'Contoso' Ensure = 'Present' CompatibilityLevel = 'Version140' } $mockErrorMessage = $script:localizedData.InvalidCompatibilityLevel -f $testParameters.CompatibilityLevel, $mockInstanceName { Set-TargetResource @testParameters } | Should -Throw $mockErrorMessage } } $mockExpectedDatabaseNameToDrop = 'Sales' $mockSqlDatabaseName = 'Sales' Context 'When the system is not in the desired state and Ensure is set to Absent' { It 'Should not throw when dropping the database' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'Sales' Ensure = 'Absent' } { Set-TargetResource @testParameters } | Should -Not -Throw } It 'Should call the mock function Connect-SQL' { Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope Context } } $mockInvalidOperationForCreateMethod = $true $mockInvalidOperationForAlterMethod = $true Context 'When the system is not in the desired state and Ensure is set to Present' { It 'Should throw the correct error when Create() method was called with invalid operation' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'NewDatabase' Ensure = 'Present' } $errorMessage = $script:localizedData.FailedToCreateDatabase -f $testParameters.Name { Set-TargetResource @testParameters } | Should -Throw $errorMessage Assert-MockCalled -CommandName New-Object -Exactly -Times 1 -ParameterFilter { $TypeName -eq 'Microsoft.SqlServer.Management.Smo.Database' } -Scope It } It 'Should throw the correct error when Alter() method was called with invalid operation' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = $mockSqlDatabaseName Ensure = 'Present' Collation = 'SQL_Latin1_General_Pref_CP850_CI_AS' } $errorMessage = $script:localizedData.FailedToUpdateDatabase -f $testParameters.Name { Set-TargetResource @testParameters } | Should -Throw $errorMessage } It 'Should throw the correct error when invalid collation is specified' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'Sales' Ensure = 'Present' Collation = 'InvalidCollation' } $errorMessage = $script:localizedData.InvalidCollation -f $testParameters.Collation, $testParameters.InstanceName { Set-TargetResource @testParameters } | Should -Throw $errorMessage Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope It } } $mockSqlDatabaseName = 'AdventureWorks' $mockInvalidOperationForDropMethod = $true Context 'When the system is not in the desired state and Ensure is set to Absent' { $testParameters = $mockDefaultParameters $testParameters += @{ Name = 'AdventureWorks' Ensure = 'Absent' Collation = 'SQL_Latin1_General_CP1_CS_AS' } It 'Should throw the correct error when Drop() method was called with invalid operation' { $errorMessage = $script:localizedData.FailedToDropDatabase -f $testParameters.Name { Set-TargetResource @testParameters } | Should -Throw $errorMessage } It 'Should call the mock function Connect-SQL' { Assert-MockCalled -CommandName Connect-SQL -Exactly -Times 1 -Scope Context } } Assert-VerifiableMock } } } finally { Invoke-TestCleanup }
47.101749
169
0.474702
6add8142c3ac5a0600b39651944b69411985434b
6,967
sql
SQL
src/main/resources/schema.sql
jgammon612/myfuselab
29707692b51ad33dc3f1b5af6b27a14d668e82af
[ "Apache-2.0" ]
null
null
null
src/main/resources/schema.sql
jgammon612/myfuselab
29707692b51ad33dc3f1b5af6b27a14d668e82af
[ "Apache-2.0" ]
null
null
null
src/main/resources/schema.sql
jgammon612/myfuselab
29707692b51ad33dc3f1b5af6b27a14d668e82af
[ "Apache-2.0" ]
null
null
null
DROP TABLE vendors; CREATE TABLE vendors ( company_id INT NOT NULL, company_name VARCHAR(20) NOT NULL, website_url VARCHAR(30) NOT NULL, address_1 VARCHAR(30) NOT NULL, address_2 VARCHAR(30), zip_code VARCHAR(20) NOT NULL, city VARCHAR(15) NOT NULL, state VARCHAR(15) NOT NULL, country VARCHAR(15) NOT NULL, logo_url VARCHAR(100) NOT NULL, vendor_risk VARCHAR(100), certified_status VARCHAR(20), sanction_status VARCHAR(20), itemid int, country_id VARCHAR(2), PRIMARY KEY (company_id) ); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (1,"Schlumberger","slb.com","5599 San Felipe St","","77056","Houston","TX","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/1.jpg","LOW","","",40151513,"US"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (2,"Halliburton","halliburton.com","3000 N. Sam Houston Pkwy E.","","77032","Houston","TX","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/2.jpg","LOW","","",40151524,"US"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (3,"Baker Hughes","bhge.com","17021 Aldine Westfield","","77073","Houston","TX","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/3.jpg","LOW","","",40151508,"US"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (4,"Cubility","cubility.com","Fabrikkveien 40"," 4323","","","Sandnes","","Norway","https://git.rhlabs.net/oildemo/taskman/raw/master/images/4.jpg","AVERAGE","",40151524,"NO"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (5,"Hoerbiger","hoerbiger.com","3350 Gateway Drive","","33069","Pompano Beach","FL","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/5.jpg","LOW","","",40151513,"US"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (6,"Utex Industries","amerifrac.com","245 Koomey Rd","","77423","Brookshire","TX","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/6.jpg","LOW","","",40151524,"US"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (7,"Summit","summitesp.com","835 West 41st Street South","","74107","Tulsa","OK","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/7.jpg","LOW","","",40151508,"US"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (8,"Borets","borets.com","Calle 146 №64-120","Zona Industrial Etapa","4004","Maracaibo","","Venezuela","https://git.rhlabs.net/oildemo/taskman/raw/master/images/8.jpg","HIGH","","",40151513,"VE"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (9,"Canadian ESP","cai-esp.com","5307 72A Avenue NW","","T6B 2J1","Edmonton","AB","Canada","https://git.rhlabs.net/oildemo/taskman/raw/master/images/9.jpg","LOW","","",40151513,"CA"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (10,"Sercel","sercel.com","17200 Park Row","","77084","Houston","TX","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/10.jpg","LOW","","",40151524,"US"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (11,"Novomet","novomet-usa.com","23567 Clay Road","Grand Parkway Industrial Park","77493","Katy","TX","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/11.jpg","LOW","","",40151513,"US"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (12,"Dover","doverals.com","2445 Technology Forest Rd","Suite 900","77381","The Woodlands","TX","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/12.jpg","LOW","","",40151524,"US"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (13,"Pumpiran","pumpiran.org","Vali Asr Ave","Mirdamad Square","1969613313","Tehran","","Iran","https://git.rhlabs.net/oildemo/taskman/raw/master/images/13.jpg","HIGH","","",40151513,"IR"); INSERT INTO vendors (company_id,company_name,website_url,address_1,address_2,zip_code,city,state,country,logo_url,vendor_risk,certified_status,sanction_status,itemid,country_id) VALUES (14,"Mitsubishi","mhi.com","20 East Greenway Plaza","Suite 830","77046","Houston","TX","USA","https://git.rhlabs.net/oildemo/taskman/raw/master/images/14.jpg","LOW","","",40151524,"US"); DROP TABLE sanctions; CREATE TABLE sanctions ( sanction_id INT NOT NULL, country_id VARCHAR(2), country VARCHAR(15), country_code INT, sanction_start DATE, sanction_duration VARCHAR(3), PRIMARY KEY (sanction_id) ); INSERT INTO sanctions (sanction_id,country_id,country,country_code,sanction_start,sanction_duration) VALUES (1,"MM","Burma",95,"1988-01-01",100); INSERT INTO sanctions (sanction_id,country_id,country,country_code,sanction_start,sanction_duration) VALUES (2,"CI","Cote de Ivoire",225,"2004-11-15",100); INSERT INTO sanctions (sanction_id,country_id,country,country_code,sanction_start,sanction_duration) VALUES (3,"CU","Cuba",53,"1961-09-04",50); INSERT INTO sanctions (sanction_id,country_id,country,country_code,sanction_start,sanction_duration) VALUES (4,"IR","Iran",98,"2006-07-31",100); INSERT INTO sanctions (sanction_id,country_id,country,country_code,sanction_start,sanction_duration) VALUES (5,"KP","North Korea",850,"1993-01-01",100); INSERT INTO sanctions (sanction_id,country_id,country,country_code,sanction_start,sanction_duration) VALUES (6,"SY","Syria",963,"2012-04-21",0.5);
120.12069
386
0.760299
bf344f75f20296e306215289429407f153fdf774
14,859
lua
Lua
pkg/tz/data.lua
a-schaefers/oasis
5d89587063f0f1a633d7ede3965961a116da27a0
[ "0BSD" ]
1
2020-01-30T14:50:40.000Z
2020-01-30T14:50:40.000Z
pkg/tz/data.lua
a-schaefers/oasis
5d89587063f0f1a633d7ede3965961a116da27a0
[ "0BSD" ]
null
null
null
pkg/tz/data.lua
a-schaefers/oasis
5d89587063f0f1a633d7ede3965961a116da27a0
[ "0BSD" ]
null
null
null
-- 2,<cd src && awk -f ../data.awk africa antarctica asia australasia europe northamerica southamerica etcetera factory return { africa={ ["Africa/Algiers"]=false, ["Atlantic/Cape_Verde"]=false, ["Africa/Ndjamena"]=false, ["Africa/Abidjan"]=false, ["Africa/Bamako"]="Africa/Abidjan", ["Africa/Banjul"]="Africa/Abidjan", ["Africa/Conakry"]="Africa/Abidjan", ["Africa/Dakar"]="Africa/Abidjan", ["Africa/Freetown"]="Africa/Abidjan", ["Africa/Lome"]="Africa/Abidjan", ["Africa/Nouakchott"]="Africa/Abidjan", ["Africa/Ouagadougou"]="Africa/Abidjan", ["Atlantic/St_Helena"]="Africa/Abidjan", ["Africa/Cairo"]=false, ["Africa/Accra"]=false, ["Africa/Bissau"]=false, ["Africa/Nairobi"]=false, ["Africa/Addis_Ababa"]="Africa/Nairobi", ["Africa/Asmara"]="Africa/Nairobi", ["Africa/Dar_es_Salaam"]="Africa/Nairobi", ["Africa/Djibouti"]="Africa/Nairobi", ["Africa/Kampala"]="Africa/Nairobi", ["Africa/Mogadishu"]="Africa/Nairobi", ["Indian/Antananarivo"]="Africa/Nairobi", ["Indian/Comoro"]="Africa/Nairobi", ["Indian/Mayotte"]="Africa/Nairobi", ["Africa/Monrovia"]=false, ["Africa/Tripoli"]=false, ["Indian/Mauritius"]=false, ["Africa/Casablanca"]=false, ["Africa/El_Aaiun"]=false, ["Africa/Maputo"]=false, ["Africa/Blantyre"]="Africa/Maputo", ["Africa/Bujumbura"]="Africa/Maputo", ["Africa/Gaborone"]="Africa/Maputo", ["Africa/Harare"]="Africa/Maputo", ["Africa/Kigali"]="Africa/Maputo", ["Africa/Lubumbashi"]="Africa/Maputo", ["Africa/Lusaka"]="Africa/Maputo", ["Africa/Windhoek"]=false, ["Africa/Lagos"]=false, ["Africa/Bangui"]="Africa/Lagos", ["Africa/Brazzaville"]="Africa/Lagos", ["Africa/Douala"]="Africa/Lagos", ["Africa/Kinshasa"]="Africa/Lagos", ["Africa/Libreville"]="Africa/Lagos", ["Africa/Luanda"]="Africa/Lagos", ["Africa/Malabo"]="Africa/Lagos", ["Africa/Niamey"]="Africa/Lagos", ["Africa/Porto-Novo"]="Africa/Lagos", ["Indian/Reunion"]=false, ["Africa/Sao_Tome"]=false, ["Indian/Mahe"]=false, ["Africa/Johannesburg"]=false, ["Africa/Maseru"]="Africa/Johannesburg", ["Africa/Mbabane"]="Africa/Johannesburg", ["Africa/Khartoum"]=false, ["Africa/Juba"]=false, ["Africa/Tunis"]=false, }, antarctica={ ["Antarctica/Casey"]=false, ["Antarctica/Davis"]=false, ["Antarctica/Mawson"]=false, ["Indian/Kerguelen"]=false, ["Antarctica/DumontDUrville"]=false, ["Antarctica/Syowa"]=false, ["Antarctica/Troll"]=false, ["Antarctica/Vostok"]=false, ["Antarctica/Rothera"]=false, }, asia={ ["Asia/Kabul"]=false, ["Asia/Yerevan"]=false, ["Asia/Baku"]=false, ["Asia/Dhaka"]=false, ["Asia/Thimphu"]=false, ["Indian/Chagos"]=false, ["Asia/Brunei"]=false, ["Asia/Yangon"]=false, ["Asia/Shanghai"]=false, ["Asia/Urumqi"]=false, ["Asia/Hong_Kong"]=false, ["Asia/Taipei"]=false, ["Asia/Macau"]=false, ["Asia/Nicosia"]=false, ["Asia/Famagusta"]=false, ["Europe/Nicosia"]="Asia/Nicosia", ["Asia/Tbilisi"]=false, ["Asia/Dili"]=false, ["Asia/Kolkata"]=false, ["Asia/Jakarta"]=false, ["Asia/Pontianak"]=false, ["Asia/Makassar"]=false, ["Asia/Jayapura"]=false, ["Asia/Tehran"]=false, ["Asia/Baghdad"]=false, ["Asia/Jerusalem"]=false, ["Asia/Tokyo"]=false, ["Asia/Amman"]=false, ["Asia/Almaty"]=false, ["Asia/Qyzylorda"]=false, ["Asia/Qostanay"]=false, ["Asia/Aqtobe"]=false, ["Asia/Aqtau"]=false, ["Asia/Atyrau"]=false, ["Asia/Oral"]=false, ["Asia/Bishkek"]=false, ["Asia/Seoul"]=false, ["Asia/Pyongyang"]=false, ["Asia/Beirut"]=false, ["Asia/Kuala_Lumpur"]=false, ["Asia/Kuching"]=false, ["Indian/Maldives"]=false, ["Asia/Hovd"]=false, ["Asia/Ulaanbaatar"]=false, ["Asia/Choibalsan"]=false, ["Asia/Kathmandu"]=false, ["Asia/Karachi"]=false, ["Asia/Gaza"]=false, ["Asia/Hebron"]=false, ["Asia/Manila"]=false, ["Asia/Qatar"]=false, ["Asia/Bahrain"]="Asia/Qatar", ["Asia/Riyadh"]=false, ["Asia/Aden"]="Asia/Riyadh", ["Asia/Kuwait"]="Asia/Riyadh", ["Asia/Singapore"]=false, ["Asia/Colombo"]=false, ["Asia/Damascus"]=false, ["Asia/Dushanbe"]=false, ["Asia/Bangkok"]=false, ["Asia/Phnom_Penh"]="Asia/Bangkok", ["Asia/Vientiane"]="Asia/Bangkok", ["Asia/Ashgabat"]=false, ["Asia/Dubai"]=false, ["Asia/Muscat"]="Asia/Dubai", ["Asia/Samarkand"]=false, ["Asia/Tashkent"]=false, ["Asia/Ho_Chi_Minh"]=false, }, australasia={ ["Australia/Darwin"]=false, ["Australia/Perth"]=false, ["Australia/Eucla"]=false, ["Australia/Brisbane"]=false, ["Australia/Lindeman"]=false, ["Australia/Adelaide"]=false, ["Australia/Hobart"]=false, ["Australia/Currie"]=false, ["Australia/Melbourne"]=false, ["Australia/Sydney"]=false, ["Australia/Broken_Hill"]=false, ["Australia/Lord_Howe"]=false, ["Antarctica/Macquarie"]=false, ["Indian/Christmas"]=false, ["Indian/Cocos"]=false, ["Pacific/Fiji"]=false, ["Pacific/Gambier"]=false, ["Pacific/Marquesas"]=false, ["Pacific/Tahiti"]=false, ["Pacific/Guam"]=false, ["Pacific/Saipan"]="Pacific/Guam", ["Pacific/Tarawa"]=false, ["Pacific/Enderbury"]=false, ["Pacific/Kiritimati"]=false, ["Pacific/Majuro"]=false, ["Pacific/Kwajalein"]=false, ["Pacific/Chuuk"]=false, ["Pacific/Pohnpei"]=false, ["Pacific/Kosrae"]=false, ["Pacific/Nauru"]=false, ["Pacific/Noumea"]=false, ["Pacific/Auckland"]=false, ["Pacific/Chatham"]=false, ["Antarctica/McMurdo"]="Pacific/Auckland", ["Pacific/Rarotonga"]=false, ["Pacific/Niue"]=false, ["Pacific/Norfolk"]=false, ["Pacific/Palau"]=false, ["Pacific/Port_Moresby"]=false, ["Pacific/Bougainville"]=false, ["Pacific/Pitcairn"]=false, ["Pacific/Pago_Pago"]=false, ["Pacific/Midway"]="Pacific/Pago_Pago", ["Pacific/Apia"]=false, ["Pacific/Guadalcanal"]=false, ["Pacific/Fakaofo"]=false, ["Pacific/Tongatapu"]=false, ["Pacific/Funafuti"]=false, ["Pacific/Wake"]=false, ["Pacific/Efate"]=false, ["Pacific/Wallis"]=false, }, europe={ ["Europe/London"]=false, ["Europe/Jersey"]="Europe/London", ["Europe/Guernsey"]="Europe/London", ["Europe/Isle_of_Man"]="Europe/London", ["Europe/Dublin"]=false, ["WET"]=false, ["CET"]=false, ["MET"]=false, ["EET"]=false, ["Europe/Tirane"]=false, ["Europe/Andorra"]=false, ["Europe/Vienna"]=false, ["Europe/Minsk"]=false, ["Europe/Brussels"]=false, ["Europe/Sofia"]=false, ["Europe/Prague"]=false, ["Europe/Copenhagen"]=false, ["Atlantic/Faroe"]=false, ["America/Danmarkshavn"]=false, ["America/Scoresbysund"]=false, ["America/Godthab"]=false, ["America/Thule"]=false, ["Europe/Tallinn"]=false, ["Europe/Helsinki"]=false, ["Europe/Mariehamn"]="Europe/Helsinki", ["Europe/Paris"]=false, ["Europe/Berlin"]=false, ["Europe/Busingen"]="Europe/Zurich", ["Europe/Gibraltar"]=false, ["Europe/Athens"]=false, ["Europe/Budapest"]=false, ["Atlantic/Reykjavik"]=false, ["Europe/Rome"]=false, ["Europe/Vatican"]="Europe/Rome", ["Europe/San_Marino"]="Europe/Rome", ["Europe/Riga"]=false, ["Europe/Vaduz"]="Europe/Zurich", ["Europe/Vilnius"]=false, ["Europe/Luxembourg"]=false, ["Europe/Malta"]=false, ["Europe/Chisinau"]=false, ["Europe/Monaco"]=false, ["Europe/Amsterdam"]=false, ["Europe/Oslo"]=false, ["Arctic/Longyearbyen"]="Europe/Oslo", ["Europe/Warsaw"]=false, ["Europe/Lisbon"]=false, ["Atlantic/Azores"]=false, ["Atlantic/Madeira"]=false, ["Europe/Bucharest"]=false, ["Europe/Kaliningrad"]=false, ["Europe/Moscow"]=false, ["Europe/Simferopol"]=false, ["Europe/Astrakhan"]=false, ["Europe/Volgograd"]=false, ["Europe/Saratov"]=false, ["Europe/Kirov"]=false, ["Europe/Samara"]=false, ["Europe/Ulyanovsk"]=false, ["Asia/Yekaterinburg"]=false, ["Asia/Omsk"]=false, ["Asia/Barnaul"]=false, ["Asia/Novosibirsk"]=false, ["Asia/Tomsk"]=false, ["Asia/Novokuznetsk"]=false, ["Asia/Krasnoyarsk"]=false, ["Asia/Irkutsk"]=false, ["Asia/Chita"]=false, ["Asia/Yakutsk"]=false, ["Asia/Vladivostok"]=false, ["Asia/Khandyga"]=false, ["Asia/Sakhalin"]=false, ["Asia/Magadan"]=false, ["Asia/Srednekolymsk"]=false, ["Asia/Ust-Nera"]=false, ["Asia/Kamchatka"]=false, ["Asia/Anadyr"]=false, ["Europe/Belgrade"]=false, ["Europe/Ljubljana"]="Europe/Belgrade", ["Europe/Podgorica"]="Europe/Belgrade", ["Europe/Sarajevo"]="Europe/Belgrade", ["Europe/Skopje"]="Europe/Belgrade", ["Europe/Zagreb"]="Europe/Belgrade", ["Europe/Bratislava"]="Europe/Prague", ["Europe/Madrid"]=false, ["Africa/Ceuta"]=false, ["Atlantic/Canary"]=false, ["Europe/Stockholm"]=false, ["Europe/Zurich"]=false, ["Europe/Istanbul"]=false, ["Asia/Istanbul"]="Europe/Istanbul", ["Europe/Kiev"]=false, ["Europe/Uzhgorod"]=false, ["Europe/Zaporozhye"]=false, }, northamerica={ ["EST"]=false, ["MST"]=false, ["HST"]=false, ["EST5EDT"]=false, ["CST6CDT"]=false, ["MST7MDT"]=false, ["PST8PDT"]=false, ["America/New_York"]=false, ["America/Chicago"]=false, ["America/North_Dakota/Center"]=false, ["America/North_Dakota/New_Salem"]=false, ["America/North_Dakota/Beulah"]=false, ["America/Denver"]=false, ["America/Los_Angeles"]=false, ["America/Juneau"]=false, ["America/Sitka"]=false, ["America/Metlakatla"]=false, ["America/Yakutat"]=false, ["America/Anchorage"]=false, ["America/Nome"]=false, ["America/Adak"]=false, ["Pacific/Honolulu"]=false, ["America/Phoenix"]=false, ["America/Boise"]=false, ["America/Indiana/Indianapolis"]=false, ["America/Indiana/Marengo"]=false, ["America/Indiana/Vincennes"]=false, ["America/Indiana/Tell_City"]=false, ["America/Indiana/Petersburg"]=false, ["America/Indiana/Knox"]=false, ["America/Indiana/Winamac"]=false, ["America/Indiana/Vevay"]=false, ["America/Kentucky/Louisville"]=false, ["America/Kentucky/Monticello"]=false, ["America/Detroit"]=false, ["America/Menominee"]=false, ["America/St_Johns"]=false, ["America/Goose_Bay"]=false, ["America/Halifax"]=false, ["America/Glace_Bay"]=false, ["America/Moncton"]=false, ["America/Blanc-Sablon"]=false, ["America/Toronto"]=false, ["America/Thunder_Bay"]=false, ["America/Nipigon"]=false, ["America/Rainy_River"]=false, ["America/Atikokan"]=false, ["America/Winnipeg"]=false, ["America/Regina"]=false, ["America/Swift_Current"]=false, ["America/Edmonton"]=false, ["America/Vancouver"]=false, ["America/Dawson_Creek"]=false, ["America/Fort_Nelson"]=false, ["America/Creston"]=false, ["America/Pangnirtung"]=false, ["America/Iqaluit"]=false, ["America/Resolute"]=false, ["America/Rankin_Inlet"]=false, ["America/Cambridge_Bay"]=false, ["America/Yellowknife"]=false, ["America/Inuvik"]=false, ["America/Whitehorse"]=false, ["America/Dawson"]=false, ["America/Cancun"]=false, ["America/Merida"]=false, ["America/Matamoros"]=false, ["America/Monterrey"]=false, ["America/Mexico_City"]=false, ["America/Ojinaga"]=false, ["America/Chihuahua"]=false, ["America/Hermosillo"]=false, ["America/Mazatlan"]=false, ["America/Bahia_Banderas"]=false, ["America/Tijuana"]=false, ["America/Nassau"]=false, ["America/Barbados"]=false, ["America/Belize"]=false, ["Atlantic/Bermuda"]=false, ["America/Costa_Rica"]=false, ["America/Havana"]=false, ["America/Santo_Domingo"]=false, ["America/El_Salvador"]=false, ["America/Guatemala"]=false, ["America/Port-au-Prince"]=false, ["America/Tegucigalpa"]=false, ["America/Jamaica"]=false, ["America/Martinique"]=false, ["America/Managua"]=false, ["America/Panama"]=false, ["America/Cayman"]="America/Panama", ["America/Puerto_Rico"]=false, ["America/Miquelon"]=false, ["America/Grand_Turk"]=false, }, southamerica={ ["America/Argentina/Buenos_Aires"]=false, ["America/Argentina/Cordoba"]=false, ["America/Argentina/Salta"]=false, ["America/Argentina/Tucuman"]=false, ["America/Argentina/La_Rioja"]=false, ["America/Argentina/San_Juan"]=false, ["America/Argentina/Jujuy"]=false, ["America/Argentina/Catamarca"]=false, ["America/Argentina/Mendoza"]=false, ["America/Argentina/San_Luis"]=false, ["America/Argentina/Rio_Gallegos"]=false, ["America/Argentina/Ushuaia"]=false, ["America/Aruba"]="America/Curacao", ["America/La_Paz"]=false, ["America/Noronha"]=false, ["America/Belem"]=false, ["America/Santarem"]=false, ["America/Fortaleza"]=false, ["America/Recife"]=false, ["America/Araguaina"]=false, ["America/Maceio"]=false, ["America/Bahia"]=false, ["America/Sao_Paulo"]=false, ["America/Campo_Grande"]=false, ["America/Cuiaba"]=false, ["America/Porto_Velho"]=false, ["America/Boa_Vista"]=false, ["America/Manaus"]=false, ["America/Eirunepe"]=false, ["America/Rio_Branco"]=false, ["America/Santiago"]=false, ["America/Punta_Arenas"]=false, ["Pacific/Easter"]=false, ["Antarctica/Palmer"]=false, ["America/Bogota"]=false, ["America/Curacao"]=false, ["America/Lower_Princes"]="America/Curacao", ["America/Kralendijk"]="America/Curacao", ["America/Guayaquil"]=false, ["Pacific/Galapagos"]=false, ["Atlantic/Stanley"]=false, ["America/Cayenne"]=false, ["America/Guyana"]=false, ["America/Asuncion"]=false, ["America/Lima"]=false, ["Atlantic/South_Georgia"]=false, ["America/Paramaribo"]=false, ["America/Port_of_Spain"]=false, ["America/Anguilla"]="America/Port_of_Spain", ["America/Antigua"]="America/Port_of_Spain", ["America/Dominica"]="America/Port_of_Spain", ["America/Grenada"]="America/Port_of_Spain", ["America/Guadeloupe"]="America/Port_of_Spain", ["America/Marigot"]="America/Port_of_Spain", ["America/Montserrat"]="America/Port_of_Spain", ["America/St_Barthelemy"]="America/Port_of_Spain", ["America/St_Kitts"]="America/Port_of_Spain", ["America/St_Lucia"]="America/Port_of_Spain", ["America/St_Thomas"]="America/Port_of_Spain", ["America/St_Vincent"]="America/Port_of_Spain", ["America/Tortola"]="America/Port_of_Spain", ["America/Montevideo"]=false, ["America/Caracas"]=false, }, etcetera={ ["Etc/GMT"]=false, ["Etc/UTC"]=false, ["GMT"]="Etc/GMT", ["Etc/Universal"]="Etc/UTC", ["Etc/Zulu"]="Etc/UTC", ["Etc/Greenwich"]="Etc/GMT", ["Etc/GMT-0"]="Etc/GMT", ["Etc/GMT+0"]="Etc/GMT", ["Etc/GMT0"]="Etc/GMT", ["Etc/GMT-14"]=false, ["Etc/GMT-13"]=false, ["Etc/GMT-12"]=false, ["Etc/GMT-11"]=false, ["Etc/GMT-10"]=false, ["Etc/GMT-9"]=false, ["Etc/GMT-8"]=false, ["Etc/GMT-7"]=false, ["Etc/GMT-6"]=false, ["Etc/GMT-5"]=false, ["Etc/GMT-4"]=false, ["Etc/GMT-3"]=false, ["Etc/GMT-2"]=false, ["Etc/GMT-1"]=false, ["Etc/GMT+1"]=false, ["Etc/GMT+2"]=false, ["Etc/GMT+3"]=false, ["Etc/GMT+4"]=false, ["Etc/GMT+5"]=false, ["Etc/GMT+6"]=false, ["Etc/GMT+7"]=false, ["Etc/GMT+8"]=false, ["Etc/GMT+9"]=false, ["Etc/GMT+10"]=false, ["Etc/GMT+11"]=false, ["Etc/GMT+12"]=false, }, factory={ ["Factory"]=false, }, }
29.957661
119
0.653611
8036a65ae97b8344904231942863d5ceeb928c73
2,549
java
Java
eitax-batch-ebay/src/main/java/com/eitax/recall/rest/ebay/shopping/xsd/StorefrontType.java
shokoro3434/test2
499ac8de93f3952bd9f2d81bf0f727ca18e522b3
[ "Apache-2.0" ]
null
null
null
eitax-batch-ebay/src/main/java/com/eitax/recall/rest/ebay/shopping/xsd/StorefrontType.java
shokoro3434/test2
499ac8de93f3952bd9f2d81bf0f727ca18e522b3
[ "Apache-2.0" ]
1
2015-09-04T21:20:44.000Z
2015-09-04T23:48:54.000Z
eitax-batch-ebay/src/main/java/com/eitax/recall/rest/ebay/shopping/xsd/StorefrontType.java
shokoro3434/test2
499ac8de93f3952bd9f2d81bf0f727ca18e522b3
[ "Apache-2.0" ]
null
null
null
// // このファイルは、JavaTM Architecture for XML Binding(JAXB) Reference Implementation、v2.2.8-b130911.1802によって生成されました // <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>を参照してください // ソース・スキーマの再コンパイル時にこのファイルの変更は失われます。 // 生成日: 2015.08.24 時間 02:38:24 AM JST // package com.eitax.recall.rest.ebay.shopping.xsd; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; /** * * Contains information related to the item in the context of * a seller's eBay Store. Applicable for auction and Basic Fixed Price items listed by eBay Stores sellers. * * * <p>StorefrontType complex typeのJavaクラス。 * * <p>次のスキーマ・フラグメントは、このクラス内に含まれる予期されるコンテンツを指定します。 * * <pre> * &lt;complexType name="StorefrontType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="StoreURL" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/> * &lt;element name="StoreName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "StorefrontType", propOrder = { "storeURL", "storeName" }) public class StorefrontType { @XmlElement(name = "StoreURL") @XmlSchemaType(name = "anyURI") protected String storeURL; @XmlElement(name = "StoreName") protected String storeName; /** * storeURLプロパティの値を取得します。 * * @return * possible object is * {@link String } * */ public String getStoreURL() { return storeURL; } /** * storeURLプロパティの値を設定します。 * * @param value * allowed object is * {@link String } * */ public void setStoreURL(String value) { this.storeURL = value; } /** * storeNameプロパティの値を取得します。 * * @return * possible object is * {@link String } * */ public String getStoreName() { return storeName; } /** * storeNameプロパティの値を設定します。 * * @param value * allowed object is * {@link String } * */ public void setStoreName(String value) { this.storeName = value; } }
24.27619
111
0.614751
1706d29c6d3cd36d6463558c30a18705d9dbd12d
2,408
ps1
PowerShell
scripts/Get-PhpNightly.ps1
shivammathur/php-builder-windows
3c17fbe6e6708c93d866ec7a0831002090248c8d
[ "MIT" ]
25
2020-08-10T16:21:08.000Z
2021-12-17T08:31:28.000Z
scripts/Get-PhpNightly.ps1
shivammathur/php-builder-windows
3c17fbe6e6708c93d866ec7a0831002090248c8d
[ "MIT" ]
1
2022-02-10T22:59:44.000Z
2022-02-11T16:15:04.000Z
scripts/Get-PhpNightly.ps1
shivammathur/php-builder-windows
3c17fbe6e6708c93d866ec7a0831002090248c8d
[ "MIT" ]
68
2020-08-20T02:15:57.000Z
2022-03-15T12:36:55.000Z
<# .Synopsis Installs PHP nightly. .Description Download and installs a nightly version of PHP. .Parameter Architecture The architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit). .Parameter ThreadSafe A boolean value to indicate if the Thread-Safe version should be installed or not. You usually install the ThreadSafe version if you plan to use PHP with Apache, or the NonThreadSafe version if you'll use PHP in CGI mode. .Parameter Path The path of the directory where PHP will be installed. .Parameter Version The PHP version #> param ( [Parameter(Mandatory = $true, Position = 1, HelpMessage = 'Architecture of the PHP to be installed (x86 for 32-bit, x64 for 64-bit)')] [ValidateSet('x86', 'x64')] [string] $Architecture, [Parameter(Mandatory = $true, Position = 2, HelpMessage = 'Install a Thread-Safe version?')] [bool] $ThreadSafe, [Parameter(Mandatory = $true, Position = 3, HelpMessage = 'The path of the directory where PHP will be installed')] [ValidateLength(1, [int]::MaxValue)] [string] $Path, [Parameter(Mandatory = $false, Position = 4, HelpMessage = 'The PHP version')] [ValidateLength(1, [int]::MaxValue)] [string] $Version = '8.1' ) if(-not(Test-Path $Path)) { New-Item -Type 'directory' $Path } $ts = '-nts' if($ThreadSafe) { $ts = '' } if($Version -eq '8.0') { Install-Php -Version $Version -Architecture $Architecture -ThreadSafe $ThreadSafe -InstallVC -Path $Path -TimeZone UTC -InitialPhpIni Production -Force } else { Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-builder-windows/releases/download/php$Version/php-$Version.0-dev$ts-Win32-vs16-$Architecture.zip" -OutFile $Path\master.zip Expand-Archive -Path $Path\master.zip -DestinationPath $Path -Force Copy-Item $Path\php.ini-production -Destination $Path\php.ini } Move-Item -Path $Path\ext\php_oci8_12c.dll -Destination $Path\ext\php_oci8.dll -Force $ts = 'nts' if($ThreadSafe) { $ts = 'ts' } "xdebug", "pcov" | ForEach-Object { Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/shivammathur/php-extensions-windows/releases/latest/download/php$Version`_$ts`_$Architecture`_$_.dll" -OutFile $Path"\ext\php`_$_.dll" } $ini_content = @" extension_dir=$Path\ext default_charset=UTF-8 zend_extension=php_opcache.dll opcache.enable=1 opcache.jit_buffer_size=256M opcache.jit=1235 "@ Add-Content -Path $Path\php.ini -Value $ini_content
41.517241
232
0.739618
ef4ba4e51485f21c5c3161cc19cc47970f73327e
809
asm
Assembly
programs/oeis/024/A024108.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
22
2018-02-06T19:19:31.000Z
2022-01-17T21:53:31.000Z
programs/oeis/024/A024108.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
41
2021-02-22T19:00:34.000Z
2021-08-28T10:47:47.000Z
programs/oeis/024/A024108.asm
neoneye/loda
afe9559fb53ee12e3040da54bd6aa47283e0d9ec
[ "Apache-2.0" ]
5
2021-02-24T21:14:16.000Z
2021-08-09T19:48:05.000Z
; A024108: a(n) = 9^n-n^7. ; 1,8,-47,-1458,-9823,-19076,251505,3959426,40949569,382637520,3476784401,31361572438,282393704673,2541803079812,22876687041457,205890961235274,1853019920416385,16677181289327896,150094634684779089,1350851716779120350,12157665457776928801,109418989129711270668,984770902181116874993,8862938119649096270482,79766443076867923391937,717897987691846485254624,6461081889226665267122065,58149737003040049230036966,523347633027360523720583009,4710128697246244817671727380,42391158275216203492424433201,381520424476945831601137284698,3433683820292512484623489350913,30903154382632612361878023360552,278128389443693511257233252881617,2503155504993241601315507646788974,22528399544939174411840069510608545,202755595904452569706561235941076636 mov $1,9 pow $1,$0 pow $0,7 sub $1,$0 mov $0,$1
89.888889
732
0.89864
522f525c62d0f66c5d4791e65dc68edee5a34c18
1,975
ps1
PowerShell
Random/Find-UnsecureWIFIConnection.ps1
Velocet/PowerShell
7788825979297d87f58b15cef5aaf316196dbff3
[ "MIT" ]
5
2016-10-18T18:21:07.000Z
2021-04-06T19:19:54.000Z
Random/Find-UnsecureWIFIConnection.ps1
Velocet/PowerShell
7788825979297d87f58b15cef5aaf316196dbff3
[ "MIT" ]
2
2016-10-16T14:55:59.000Z
2017-03-23T02:29:30.000Z
Random/Find-UnsecureWIFIConnection.ps1
Velocet/PowerShell
7788825979297d87f58b15cef5aaf316196dbff3
[ "MIT" ]
1
2016-10-10T15:21:07.000Z
2016-10-10T15:21:07.000Z
# https://geekeefy.wordpress.com/2016/09/17/powershell-find-unsecurewificonnections-nearby/ Function Show-NotifyBalloon($Title, $Message) { [system.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null $Global:Balloon = New-Object System.Windows.Forms.NotifyIcon $Balloon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon((Get-Process -id $pid | Select-Object -ExpandProperty Path)) $Balloon.BalloonTipIcon = 'Info' $Balloon.BalloonTipText = $Message $Balloon.BalloonTipTitle = $Title $Balloon.Visible = $true $Balloon.ShowBalloonTip(10000) Start-Sleep -Seconds 20 $Balloon.Visible =$false; $Balloon.Dispose() } Function Find-UnsecureWIFIConnection { Param( [Switch] $LogWithTimestamp ) $data = (netsh wlan show networks mode=Bssid | ?{$_ -like "SSID*" -or $_ -like "*Authentication*" -or $_ -like "*Encryption*"}).trim() $result = For($i = 0;$i -lt $data.count;) { ''|Select @{n='Connection';e={($data[$i].split(':')[1]).trim()}}, @{n='Authentication';e={($data[$i+1].split(':')[1]).trim()}}, @{n='Encryption';e={($data[$i+2].split(':')[1]).trim()}} $i=$i+3 } If($LogWithTimestamp) { $result | ?{$_.connection -ne '' -and $_.encryption -like "*none*"}|select *, @{n="TimeStamp";e={(Get-Date).ToString("HH:mm:ss dd-MMM-yyyy")}} | tee -Variable Result } else { $result | ?{$_.connection -ne '' -and $_.encryption -like "*none*"}| Tee -Variable Result } $result | Export-Csv -Path "$env:TEMP\UnsecureWiFi_Logs.csv" -NoTypeInformation -Append } $UnsecureConnections = Find-UnsecureWIFIConnection -LogWithTimestamp $Message = $UnsecureConnections.connection | %{$_+[System.Environment]::NewLine} $Title = "$($UnsecureConnections.connection.count) Unsecure Connections Found nearby" Show-NotifyBalloon $Title $Message
37.980769
192
0.627848
2f2b03065c5b012d0b1676734c00f178d5bdc81e
3,303
java
Java
htb/fatty-10.10.10.174/fatty-client/org/springframework/context/support/DelegatingMessageSource.java
benhunter/ctf
3de1a222ea0034ef15eb6b75585b03a6ee37ec37
[ "MIT" ]
null
null
null
htb/fatty-10.10.10.174/fatty-client/org/springframework/context/support/DelegatingMessageSource.java
benhunter/ctf
3de1a222ea0034ef15eb6b75585b03a6ee37ec37
[ "MIT" ]
1
2022-03-31T22:44:36.000Z
2022-03-31T22:44:36.000Z
htb/fatty-10.10.10.174/fatty-client/org/springframework/context/support/DelegatingMessageSource.java
benhunter/ctf
3de1a222ea0034ef15eb6b75585b03a6ee37ec37
[ "MIT" ]
null
null
null
/* */ package org.springframework.context.support; /* */ /* */ import java.util.Locale; /* */ import org.springframework.context.HierarchicalMessageSource; /* */ import org.springframework.context.MessageSource; /* */ import org.springframework.context.MessageSourceResolvable; /* */ import org.springframework.context.NoSuchMessageException; /* */ import org.springframework.lang.Nullable; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class DelegatingMessageSource /* */ extends MessageSourceSupport /* */ implements HierarchicalMessageSource /* */ { /* */ @Nullable /* */ private MessageSource parentMessageSource; /* */ /* */ public void setParentMessageSource(@Nullable MessageSource parent) { /* 46 */ this.parentMessageSource = parent; /* */ } /* */ /* */ /* */ @Nullable /* */ public MessageSource getParentMessageSource() { /* 52 */ return this.parentMessageSource; /* */ } /* */ /* */ /* */ /* */ @Nullable /* */ public String getMessage(String code, @Nullable Object[] args, @Nullable String defaultMessage, Locale locale) { /* 59 */ if (this.parentMessageSource != null) { /* 60 */ return this.parentMessageSource.getMessage(code, args, defaultMessage, locale); /* */ } /* 62 */ if (defaultMessage != null) { /* 63 */ return renderDefaultMessage(defaultMessage, args, locale); /* */ } /* */ /* 66 */ return null; /* */ } /* */ /* */ /* */ /* */ public String getMessage(String code, @Nullable Object[] args, Locale locale) throws NoSuchMessageException { /* 72 */ if (this.parentMessageSource != null) { /* 73 */ return this.parentMessageSource.getMessage(code, args, locale); /* */ } /* */ /* 76 */ throw new NoSuchMessageException(code, locale); /* */ } /* */ /* */ /* */ /* */ public String getMessage(MessageSourceResolvable resolvable, Locale locale) throws NoSuchMessageException { /* 82 */ if (this.parentMessageSource != null) { /* 83 */ return this.parentMessageSource.getMessage(resolvable, locale); /* */ } /* */ /* 86 */ if (resolvable.getDefaultMessage() != null) { /* 87 */ return renderDefaultMessage(resolvable.getDefaultMessage(), resolvable.getArguments(), locale); /* */ } /* 89 */ String[] codes = resolvable.getCodes(); /* 90 */ String code = (codes != null && codes.length > 0) ? codes[0] : ""; /* 91 */ throw new NoSuchMessageException(code, locale); /* */ } /* */ /* */ /* */ /* */ /* */ public String toString() { /* 98 */ return (this.parentMessageSource != null) ? this.parentMessageSource.toString() : "Empty MessageSource"; /* */ } /* */ } /* Location: /home/kali/ctf/htb/fatty-10.10.10.174/ftp/fatty-client.jar!/org/springframework/context/support/DelegatingMessageSource.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
31.160377
151
0.540721
99414e92cae3ce3b86c70adb76bf4daaa5feb049
725
h
C
project2D/node.h
NixSane/AI---bootstrap---Nixon-Sok
b96cc81e80203bf7b8b55e6c60d8529419e6848f
[ "MIT" ]
null
null
null
project2D/node.h
NixSane/AI---bootstrap---Nixon-Sok
b96cc81e80203bf7b8b55e6c60d8529419e6848f
[ "MIT" ]
null
null
null
project2D/node.h
NixSane/AI---bootstrap---Nixon-Sok
b96cc81e80203bf7b8b55e6c60d8529419e6848f
[ "MIT" ]
null
null
null
#pragma once #include <vector> template <typename T> class edge; template <typename T> class node { public: node<T>(const T& a_data) : m_data(a_data) {} ~node() {} void add_edge(edge<T>* a_edge) { m_edges.push_back(a_edge); } void remove_edge(edge<T>* a_edge) { auto iter = std::find(m_edges.begin(), m_edges.end(), a_edge); m_edges.erase(iter); } std::vector<edge<T>*>& get_edges() { return m_edges; } std::vector<edge<T>*> m_edges; T m_data; node<T>* m_previous = nullptr; // Added this for pathing int m_g_score = 0; // Weighted pathing void reset() // For clearing graph faster { m_previous = nullptr; m_g_score = 0; } };
16.111111
65
0.6
d265729f4909eb7268c50de2cdd7e8556ac076aa
5,009
php
PHP
App/Models/Comptable.php
ngbla/eschool
eec48b1eb2f62a20b53f9a9b96143b6282bc0235
[ "MIT" ]
null
null
null
App/Models/Comptable.php
ngbla/eschool
eec48b1eb2f62a20b53f9a9b96143b6282bc0235
[ "MIT" ]
null
null
null
App/Models/Comptable.php
ngbla/eschool
eec48b1eb2f62a20b53f9a9b96143b6282bc0235
[ "MIT" ]
null
null
null
<?php namespace App\Models; use PDO; date_default_timezone_set("Africa/Abidjan"); /** * Example user model * * PHP version 7.0 */ class Comptable extends \Core\Model { public static function get_entreeBy($id_univ) { // conex_id conex_id_personne fk_iduniv conex_ip conex_date_heure conex_navigateur conex_continent_pays conex_coordonne conex_etat conex_message $sql = "SELECT SUM(montant) AS Entree FROM operation WHERE type_op = 1 AND univ = ".$id_univ; //print_r($sql); $result = Comptable::sql_query_get($sql); if ($result != 0 && !empty($result)) { return $result[0]['Entree']; } else { return 0; } } public static function get_sortieBy($id_univ) { // conex_id conex_id_personne fk_iduniv conex_ip conex_date_heure conex_navigateur conex_continent_pays conex_coordonne conex_etat conex_message $sql = "SELECT SUM(montant) AS Sortie FROM operation WHERE type_op = 2 AND univ = ".$id_univ; //print_r($sql); $result = Comptable::sql_query_get($sql); if ($result != 0 && !empty($result)) { return $result[0]['Sortie']; } else { return 0; } } public static function get_allVersementsBy($id_univ) { // conex_id conex_id_personne fk_iduniv conex_ip conex_date_heure conex_navigateur conex_continent_pays conex_coordonne conex_etat conex_message $sql = "SELECT *,eleve.id_eleve_eleve AS id_eleve, personne.id_type AS IdPers, personne.id_pers_personne AS IdPersV,eleve.id_eleve_eleve AS id_eleve, ligneversement.dateajout AS DatePay , ligneversement.id AS IdVers FROM personne, eleve, ligneversement WHERE personne.type_pers = 1 AND personne.id_type = eleve.id_eleve_eleve AND ligneversement.id_eleve = eleve.id_eleve_eleve AND personne.fk_iduniv = ".$id_univ." ORDER BY ligneversement.id DESC"; //print_r($sql); $result = Comptable::sql_query_get($sql); if ($result != 0 && !empty($result)) { return $result; } else { return 0; } } public static function get_elevegrpeBy($id_niv,$id_classe,$id_eleve) { // conex_id conex_id_personne fk_iduniv conex_ip conex_date_heure conex_navigateur conex_continent_pays conex_coordonne conex_etat conex_message $sql = "SELECT * FROM eleve_estds_groupe,groupe WHERE elv_ds_grpe_etat=1 AND eleve_estds_groupe.elv_ds_grpe_groupe =groupe.groupe_id AND groupe.fk_idniveau=".$id_niv." AND groupe.groupe_classe=".$id_classe." AND eleve_estds_groupe.elv_ds_grpe_idelev=".$id_eleve; //print_r($sql); $result = Comptable::sql_query_get($sql); if ($result != 0 && !empty($result)) { return $result; } else { return 0; } } public static function get_univ_scolarite($id_univ) { // conex_id conex_id_personne fk_iduniv conex_ip conex_date_heure conex_navigateur conex_continent_pays conex_coordonne conex_etat conex_message $sql = 'SELECT * FROM frais_scolarite,classe,niveau WHERE frais_scolarite.classe=classe.id_classe_classe AND frais_scolarite.niveau=niveau.id_niveau AND frais_scolarite.univ='.$id_univ.' ORDER BY classe.libelle ASC'; //print_r($sql); $result = Admin::sql_query_get($sql); if ($result != 0 && !empty($result)) { return $result; } else { return 0; } } public static function get_univtype_scolarite($id_univ) { // conex_id conex_id_personne fk_iduniv conex_ip conex_date_heure conex_navigateur conex_continent_pays conex_coordonne conex_etat conex_message $sql = 'SELECT * FROM (SELECT addtypefrais.*,classe.libelle AS lib_class,niveau.libelle_niveau FROM addtypefrais,classe,niveau WHERE addtypefrais.classe=classe.id_classe_classe AND addtypefrais.niveau=niveau.id_niveau AND addtypefrais.univ='.$id_univ.' ORDER BY classe.libelle ASC) tmp_typ_frais LEFT JOIN typefrais ON tmp_typ_frais.typefrais =typefrais.id'; //print_r($sql); $result = Admin::sql_query_get($sql); if ($result != 0 && !empty($result)) { return $result; } else { return 0; } } //Fucntion permettant d'executer les sql pour recuperer des valeur (prend le sql en paramettre et retourne le resultat); public static function sql_query_get($sql) { $db = static::getDB(); $stmt = $db->query($sql); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); if (empty($result) || $result == 0) { return 0; } else { return $result; } } }
45.126126
457
0.625275
fed8e5dab746838cf56e01bce005a11f56bd9f34
2,110
html
HTML
app/views/v2_1-citizen/error/checkboxes.html
dommn/nsjsa-prototype
a80cc4f48e46d42b9683fbcb8d7646ffff91854f
[ "MIT" ]
null
null
null
app/views/v2_1-citizen/error/checkboxes.html
dommn/nsjsa-prototype
a80cc4f48e46d42b9683fbcb8d7646ffff91854f
[ "MIT" ]
1
2022-03-31T15:28:35.000Z
2022-03-31T15:28:35.000Z
app/views/v2_1-citizen/error/checkboxes.html
dommn/nsjsa-prototype
a80cc4f48e46d42b9683fbcb8d7646ffff91854f
[ "MIT" ]
4
2021-04-10T22:17:52.000Z
2022-03-10T10:35:41.000Z
{% extends "layout.html" %} {% set showErrors = data["show"] == "errors" %} {% block pageTitle %} {% if showErrors %} Error: Checkbox Error Test Page {% else %} Checkbox Error Test Page data.radios = "" {% endif %} {% endblock %} {% block beforeContent %} {% endblock %} {% block content %} <div class="govuk-grid-row"> <div class="govuk-grid-column-two-thirds"> <form action="checkboxes" method="post"> {% set formSettings = [ {id: "checkbox-yes", text: "Yes"}, {id: "checkbox-no", text: "No"}, {id: "checkbox-maybe", text: "Maybe"} ] %} {% if showErrors and data.checkboxes == undefined %} {{ govukErrorSummary({ "titleText": "There is a problem with your answer", "errorList": [ { "text": "Please answer the question", "href": "#" + formSettings[0].id } ], classes: "govuk-!-margin-top-6" }) }} {% set errorMessage = { text: "Sorry I didn't quite catch that" } %} {% endif %} {{ govukCheckboxes({ id: "checkboxes", name: "checkboxes", errorMessage: errorMessage, fieldset: { legend: { text: "Would you please answer this question?", isPageHeading: true, classes: "govuk-fieldset__legend--l" } }, items: [{ id: formSettings[0].id, name: formSettings[0].id, value: formSettings[0].id, text: formSettings[0].text }, { id: formSettings[1].id, name: formSettings[1].id, value: formSettings[1].id, text: formSettings[1].text }, { id: formSettings[2].id, name: formSettings[2].id, value: formSettings[2].id, text: formSettings[2].text }] }) }} {{ govukButton({ text: "Continue" }) }} </form> </div> </div> {% endblock %}
25.421687
78
0.472986
9c305e23f53fd923017204703190755545a8c274
1,520
cpp
C++
libvast/src/base.cpp
rdettai/vast
0b3cf41011df5fe8a4e8430fa6a1d6f1c50a18fa
[ "BSD-3-Clause" ]
63
2016-04-22T01:50:03.000Z
2019-07-31T15:50:36.000Z
libvast/src/base.cpp
rdettai/vast
0b3cf41011df5fe8a4e8430fa6a1d6f1c50a18fa
[ "BSD-3-Clause" ]
216
2017-01-24T16:25:43.000Z
2019-08-01T19:37:00.000Z
libvast/src/base.cpp
rdettai/vast
0b3cf41011df5fe8a4e8430fa6a1d6f1c50a18fa
[ "BSD-3-Clause" ]
28
2016-05-19T13:09:19.000Z
2019-04-12T15:11:42.000Z
// _ _____ __________ // | | / / _ | / __/_ __/ Visibility // | |/ / __ |_\ \ / / Across // |___/_/ |_/___/ /_/ Space and Time // // SPDX-FileCopyrightText: (c) 2016 The VAST Contributors // SPDX-License-Identifier: BSD-3-Clause #include "vast/base.hpp" #include <algorithm> namespace vast { base base::uniform(value_type b, size_t n) { return base{vector_type(n, b)}; } base::base(vector_type xs) : values_{std::move(xs)} { } base::base(std::initializer_list<value_type> xs) : values_{std::move(xs)} { } bool base::well_defined() const { return !values_.empty() && std::all_of(begin(), end(), [](auto x) { return x >= 2; }); } bool base::empty() const { return values_.empty(); } size_t base::size() const { return values_.size(); } size_t base::memusage() const { return values_.capacity() * sizeof(value_type); } typename base::value_type& base::operator[](size_t i) { return values_[i]; } typename base::value_type base::operator[](size_t i) const { return values_[i]; } const typename base::value_type* base::data() const { return values_.data(); } typename base::iterator base::begin() { return values_.begin(); } typename base::const_iterator base::begin() const { return values_.begin(); } typename base::iterator base::end() { return values_.end(); } typename base::const_iterator base::end() const { return values_.end(); } bool operator==(const base& x, const base& y) { return x.values_ == y.values_; } } // namespace vast
20
75
0.644079
fbb5cbb7123b9b41bee3fb1c76606f857b95b606
1,778
java
Java
actors/subclassses/Berserker.java
clayboy2/BattleOfMinions
f96cebe76f9a45abe455a6ea2dc5286f52786c20
[ "Apache-2.0" ]
null
null
null
actors/subclassses/Berserker.java
clayboy2/BattleOfMinions
f96cebe76f9a45abe455a6ea2dc5286f52786c20
[ "Apache-2.0" ]
null
null
null
actors/subclassses/Berserker.java
clayboy2/BattleOfMinions
f96cebe76f9a45abe455a6ea2dc5286f52786c20
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2018 austen. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package actors.subclassses; import actors.Placeable; import actors.Unit; import actors.Warrior; import utils.Dice; /** * * @author austen */ public class Berserker extends Warrior{ private void init() { Dice attackDice = new Dice(100,100); Dice defenseDice = new Dice(1,12); Dice damageDice = new Dice(1,8); super.init(2, attackDice, defenseDice, damageDice, 30); super.addAttack("cleaving strike"); super.addAttack("dash"); } public Berserker() { super("Jerry",12,'B'); init(); } public Berserker(String name) { super(name,12,'B'); init(); } public Berserker(String name, int maxHP) { super(name,maxHP,'B'); init(); } public Berserker(String name, int maxHP, char token) { super(name, maxHP,token); init(); } public Berserker(String name, int maxHP, char token, int UID) { super(name,maxHP,token,UID); init(); } @Override public String getUnitType() { return "Berserker"; } @Override public void levelUp() { } }
22.794872
75
0.613048
6c14bf09b5ebe1a1b954ef2075b3c179d7ae4b63
532
go
Go
s3/s3.go
cyberdelia/s3
9b8fcbf3aec808f1c7a131ba7c533ead4f3eea3f
[ "MIT" ]
3
2017-03-02T03:53:09.000Z
2017-03-04T19:29:46.000Z
vendor/github.com/cyberdelia/aws/s3/s3.go
cyberdelia/law
1f2b6dadad36f00a2553f3c08b27bf6c2ddeb72f
[ "MIT" ]
null
null
null
vendor/github.com/cyberdelia/aws/s3/s3.go
cyberdelia/law
1f2b6dadad36f00a2553f3c08b27bf6c2ddeb72f
[ "MIT" ]
1
2017-04-08T13:38:50.000Z
2017-04-08T13:38:50.000Z
package s3 import ( "net/http" "os" "github.com/cyberdelia/aws" ) // DefaultSigner is the default Signer and is use for all requests. var DefaultSigner = &aws.V4Signer{ Region: os.Getenv("AWS_REGION"), AccessKey: os.Getenv("AWS_ACCESS_KEY_ID"), SecretKey: os.Getenv("AWS_SECRET_ACCESS_KEY"), SecurityToken: os.Getenv("AWS_SECURITY_TOKEN"), Service: "s3", } // DefaultClient is the default http.Client used for all requests. var DefaultClient = &http.Client{ Transport: DefaultSigner.Transport(), }
23.130435
67
0.714286
74536907f66d54c73ea2f3dd70cb4a91256a8108
86,253
html
HTML
testdoc/html/mcedit2.editortools.html
mcedit/mcedit.github.com
1c22079d28af8e297707d7fe6ba87fd85d05e637
[ "CC-BY-4.0" ]
4
2017-07-02T19:34:06.000Z
2020-01-30T21:26:39.000Z
testdoc/html/mcedit2.editortools.html
mcedit/mcedit.github.com
1c22079d28af8e297707d7fe6ba87fd85d05e637
[ "CC-BY-4.0" ]
3
2016-05-15T15:48:25.000Z
2018-09-22T18:04:32.000Z
testdoc/html/mcedit2.editortools.html
mcedit/mcedit.github.com
1c22079d28af8e297707d7fe6ba87fd85d05e637
[ "CC-BY-4.0" ]
5
2015-04-26T06:59:11.000Z
2022-01-18T04:12:49.000Z
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>mcedit2.editortools package &mdash; mceditlib 0.1 documentation</title> <link rel="stylesheet" href="static/default.css" type="text/css" /> <link rel="stylesheet" href="static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: './', VERSION: '0.1', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="static/jquery.js"></script> <script type="text/javascript" src="static/underscore.js"></script> <script type="text/javascript" src="static/doctools.js"></script> <link rel="top" title="mceditlib 0.1 documentation" href="index.html" /> <link rel="up" title="mcedit2 package" href="mcedit2.html" /> <link rel="next" title="mcedit2.editortools.brush package" href="mcedit2.editortools.brush.html" /> <link rel="prev" title="mcedit2.editorcommands package" href="mcedit2.editorcommands.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="mcedit2.editortools.brush.html" title="mcedit2.editortools.brush package" accesskey="N">next</a> |</li> <li class="right" > <a href="mcedit2.editorcommands.html" title="mcedit2.editorcommands package" accesskey="P">previous</a> |</li> <li><a href="index.html">mceditlib 0.1 documentation</a> &raquo;</li> <li><a href="mcedit2.html" accesskey="U">mcedit2 package</a> &raquo;</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="mcedit2-editortools-package"> <h1>mcedit2.editortools package<a class="headerlink" href="#mcedit2-editortools-package" title="Permalink to this headline">¶</a></h1> <div class="section" id="subpackages"> <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2> <div class="toctree-wrapper compound"> <ul> <li class="toctree-l1"><a class="reference internal" href="mcedit2.editortools.brush.html">mcedit2.editortools.brush package</a><ul> <li class="toctree-l2"><a class="reference internal" href="mcedit2.editortools.brush.html#module-mcedit2.editortools.brush">Module contents</a></li> </ul> </li> </ul> </div> </div> <div class="section" id="submodules"> <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2> </div> <div class="section" id="module-mcedit2.editortools.edit_chunk"> <span id="mcedit2-editortools-edit-chunk-module"></span><h2>mcedit2.editortools.edit_chunk module<a class="headerlink" href="#module-mcedit2.editortools.edit_chunk" title="Permalink to this headline">¶</a></h2> <p>player</p> <dl class="class"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.edit_chunk.</tt><tt class="descname">ChunkTool</tt><big>(</big><em>editorSession</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#mcedit2.editortools.EditorTool" title="mcedit2.editortools.EditorTool"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.editortools.EditorTool</span></tt></a></p> <dl class="attribute"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.name"> <tt class="descname">name</tt><em class="property"> = u'Edit Chunk'</em><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.name" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.iconName"> <tt class="descname">iconName</tt><em class="property"> = u'edit_chunk'</em><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.iconName" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.toolInactive"> <tt class="descname">toolInactive</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.toolInactive"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.toolInactive" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.updateChunkWidget"> <tt class="descname">updateChunkWidget</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.updateChunkWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.updateChunkWidget" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.terrainPopulatedDidChange"> <tt class="descname">terrainPopulatedDidChange</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.terrainPopulatedDidChange"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.terrainPopulatedDidChange" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.lightPopulatedDidChange"> <tt class="descname">lightPopulatedDidChange</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.lightPopulatedDidChange"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.lightPopulatedDidChange" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.inhabitedTimeDidChange"> <tt class="descname">inhabitedTimeDidChange</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.inhabitedTimeDidChange"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.inhabitedTimeDidChange" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.updateTimeDidChange"> <tt class="descname">updateTimeDidChange</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.updateTimeDidChange"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.updateTimeDidChange" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.tabDidChange"> <tt class="descname">tabDidChange</tt><big>(</big><em>index</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.tabDidChange"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.tabDidChange" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.mousePress"> <tt class="descname">mousePress</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.mousePress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.mousePress" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.selectChunk"> <tt class="descname">selectChunk</tt><big>(</big><em>cx</em>, <em>cz</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.selectChunk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.selectChunk" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.setSelectedChunk"> <tt class="descname">setSelectedChunk</tt><big>(</big><em>chunk</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.setSelectedChunk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.setSelectedChunk" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.updateNBTView"> <tt class="descname">updateNBTView</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.updateNBTView"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.updateNBTView" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.chunkPositionDidChange"> <tt class="descname">chunkPositionDidChange</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_chunk.html#ChunkTool.chunkPositionDidChange"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.chunkPositionDidChange" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.edit_chunk.ChunkTool.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x0000000008B39888&gt;</em><a class="headerlink" href="#mcedit2.editortools.edit_chunk.ChunkTool.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> </div> <div class="section" id="module-mcedit2.editortools.edit_entity"> <span id="mcedit2-editortools-edit-entity-module"></span><h2>mcedit2.editortools.edit_entity module<a class="headerlink" href="#module-mcedit2.editortools.edit_entity" title="Permalink to this headline">¶</a></h2> <p>select</p> <dl class="class"> <dt id="mcedit2.editortools.edit_entity.SelectEntityCommand"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.edit_entity.</tt><tt class="descname">SelectEntityCommand</tt><big>(</big><em>tool</em>, <em>ray</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#SelectEntityCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.SelectEntityCommand" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">PySide.QtGui.QUndoCommand</span></tt></p> <dl class="method"> <dt id="mcedit2.editortools.edit_entity.SelectEntityCommand.undo"> <tt class="descname">undo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#SelectEntityCommand.undo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.SelectEntityCommand.undo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_entity.SelectEntityCommand.redo"> <tt class="descname">redo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#SelectEntityCommand.redo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.SelectEntityCommand.redo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.edit_entity.EntityTool"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.edit_entity.</tt><tt class="descname">EntityTool</tt><big>(</big><em>editorSession</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#EntityTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#mcedit2.editortools.EditorTool" title="mcedit2.editortools.EditorTool"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.editortools.EditorTool</span></tt></a></p> <dl class="attribute"> <dt id="mcedit2.editortools.edit_entity.EntityTool.name"> <tt class="descname">name</tt><em class="property"> = u'Edit Entity'</em><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.name" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.edit_entity.EntityTool.iconName"> <tt class="descname">iconName</tt><em class="property"> = u'edit_entity'</em><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.iconName" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.edit_entity.EntityTool.selectionRay"> <tt class="descname">selectionRay</tt><em class="property"> = None</em><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.selectionRay" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.edit_entity.EntityTool.currentEntity"> <tt class="descname">currentEntity</tt><em class="property"> = None</em><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.currentEntity" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_entity.EntityTool.createToolWidget"> <tt class="descname">createToolWidget</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#EntityTool.createToolWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.createToolWidget" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_entity.EntityTool.editWasMade"> <tt class="descname">editWasMade</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#EntityTool.editWasMade"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.editWasMade" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_entity.EntityTool.mousePress"> <tt class="descname">mousePress</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#EntityTool.mousePress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.mousePress" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_entity.EntityTool.setSelectionRay"> <tt class="descname">setSelectionRay</tt><big>(</big><em>ray</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#EntityTool.setSelectionRay"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.setSelectionRay" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.edit_entity.EntityTool.setSelectedEntity"> <tt class="descname">setSelectedEntity</tt><big>(</big><em>index</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#EntityTool.setSelectedEntity"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.setSelectedEntity" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.edit_entity.EntityTool.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x0000000009C9FBC8&gt;</em><a class="headerlink" href="#mcedit2.editortools.edit_entity.EntityTool.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="function"> <dt id="mcedit2.editortools.edit_entity.entitiesOnRay"> <tt class="descclassname">mcedit2.editortools.edit_entity.</tt><tt class="descname">entitiesOnRay</tt><big>(</big><em>dimension</em>, <em>ray</em>, <em>rayWidth=0.75</em>, <em>maxDistance=1000</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/edit_entity.html#entitiesOnRay"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.edit_entity.entitiesOnRay" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </div> <div class="section" id="module-mcedit2.editortools.flood_fill"> <span id="mcedit2-editortools-flood-fill-module"></span><h2>mcedit2.editortools.flood_fill module<a class="headerlink" href="#module-mcedit2.editortools.flood_fill" title="Permalink to this headline">¶</a></h2> <p>flood_fill</p> <dl class="class"> <dt id="mcedit2.editortools.flood_fill.FloodFillTool"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.flood_fill.</tt><tt class="descname">FloodFillTool</tt><big>(</big><em>editorSession</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/flood_fill.html#FloodFillTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.flood_fill.FloodFillTool" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#mcedit2.editortools.EditorTool" title="mcedit2.editortools.EditorTool"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.editortools.EditorTool</span></tt></a></p> <dl class="attribute"> <dt id="mcedit2.editortools.flood_fill.FloodFillTool.name"> <tt class="descname">name</tt><em class="property"> = 'Flood Fill'</em><a class="headerlink" href="#mcedit2.editortools.flood_fill.FloodFillTool.name" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.flood_fill.FloodFillTool.iconName"> <tt class="descname">iconName</tt><em class="property"> = 'flood_fill'</em><a class="headerlink" href="#mcedit2.editortools.flood_fill.FloodFillTool.iconName" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.flood_fill.FloodFillTool.mousePress"> <tt class="descname">mousePress</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/flood_fill.html#FloodFillTool.mousePress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.flood_fill.FloodFillTool.mousePress" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.flood_fill.FloodFillTool.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x0000000008D99B88&gt;</em><a class="headerlink" href="#mcedit2.editortools.flood_fill.FloodFillTool.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.flood_fill.FloodFillCommand"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.flood_fill.</tt><tt class="descname">FloodFillCommand</tt><big>(</big><em>editorSession</em>, <em>point</em>, <em>blockInfo</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/flood_fill.html#FloodFillCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.flood_fill.FloodFillCommand" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="mcedit2.html#mcedit2.command.SimplePerformCommand" title="mcedit2.command.SimplePerformCommand"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.command.SimplePerformCommand</span></tt></a></p> <dl class="method"> <dt id="mcedit2.editortools.flood_fill.FloodFillCommand.perform"> <tt class="descname">perform</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/flood_fill.html#FloodFillCommand.perform"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.flood_fill.FloodFillCommand.perform" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> </div> <div class="section" id="module-mcedit2.editortools.generate"> <span id="mcedit2-editortools-generate-module"></span><h2>mcedit2.editortools.generate module<a class="headerlink" href="#module-mcedit2.editortools.generate" title="Permalink to this headline">¶</a></h2> <p>create</p> <dl class="class"> <dt id="mcedit2.editortools.generate.GeneratePlugin"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.generate.</tt><tt class="descname">GeneratePlugin</tt><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GeneratePlugin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GeneratePlugin" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">PySide.QtCore.QObject</span></tt></p> <dl class="method"> <dt id="mcedit2.editortools.generate.GeneratePlugin.generatePreview"> <tt class="descname">generatePreview</tt><big>(</big><em>bounds</em>, <em>blocktypes</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GeneratePlugin.generatePreview"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GeneratePlugin.generatePreview" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.GeneratePlugin.getPreviewNode"> <tt class="descname">getPreviewNode</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GeneratePlugin.getPreviewNode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GeneratePlugin.getPreviewNode" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.generate.GeneratePlugin.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x000000000A19A148&gt;</em><a class="headerlink" href="#mcedit2.editortools.generate.GeneratePlugin.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.generate.TreeGen"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.generate.</tt><tt class="descname">TreeGen</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#TreeGen"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.TreeGen" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#mcedit2.editortools.generate.GeneratePlugin" title="mcedit2.editortools.generate.GeneratePlugin"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.editortools.generate.GeneratePlugin</span></tt></a></p> <dl class="method"> <dt id="mcedit2.editortools.generate.TreeGen.getOptionsWidget"> <tt class="descname">getOptionsWidget</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#TreeGen.getOptionsWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.TreeGen.getOptionsWidget" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.TreeGen.generate"> <tt class="descname">generate</tt><big>(</big><em>bounds</em>, <em>blocktypes</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#TreeGen.generate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.TreeGen.generate" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.generate.TreeGen.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x000000000A19A1C8&gt;</em><a class="headerlink" href="#mcedit2.editortools.generate.TreeGen.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.generate.GenerateTool"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.generate.</tt><tt class="descname">GenerateTool</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GenerateTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#mcedit2.editortools.EditorTool" title="mcedit2.editortools.EditorTool"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.editortools.EditorTool</span></tt></a></p> <dl class="attribute"> <dt id="mcedit2.editortools.generate.GenerateTool.name"> <tt class="descname">name</tt><em class="property"> = u'Generate'</em><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.name" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.generate.GenerateTool.iconName"> <tt class="descname">iconName</tt><em class="property"> = u'generate'</em><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.iconName" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.generate.GenerateTool.instantDisplayChunks"> <tt class="descname">instantDisplayChunks</tt><em class="property"> = 32</em><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.instantDisplayChunks" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.GenerateTool.createToolWidget"> <tt class="descname">createToolWidget</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GenerateTool.createToolWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.createToolWidget" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.GenerateTool.generatorTypeChanged"> <tt class="descname">generatorTypeChanged</tt><big>(</big><em>index</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GenerateTool.generatorTypeChanged"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.generatorTypeChanged" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.GenerateTool.mousePress"> <tt class="descname">mousePress</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GenerateTool.mousePress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.mousePress" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.GenerateTool.mouseMove"> <tt class="descname">mouseMove</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GenerateTool.mouseMove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.mouseMove" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.GenerateTool.mouseRelease"> <tt class="descname">mouseRelease</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GenerateTool.mouseRelease"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.mouseRelease" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.GenerateTool.boundsDidChange"> <tt class="descname">boundsDidChange</tt><big>(</big><em>bounds</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GenerateTool.boundsDidChange"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.boundsDidChange" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.GenerateTool.boundsDidChangeDone"> <tt class="descname">boundsDidChangeDone</tt><big>(</big><em>bounds</em>, <em>newSelection</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GenerateTool.boundsDidChangeDone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.boundsDidChangeDone" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.generate.GenerateTool.displaySchematic"> <tt class="descname">displaySchematic</tt><big>(</big><em>schematic</em>, <em>offset</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/generate.html#GenerateTool.displaySchematic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.displaySchematic" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.generate.GenerateTool.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x000000000A19A108&gt;</em><a class="headerlink" href="#mcedit2.editortools.generate.GenerateTool.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> </div> <div class="section" id="module-mcedit2.editortools.move"> <span id="mcedit2-editortools-move-module"></span><h2>mcedit2.editortools.move module<a class="headerlink" href="#module-mcedit2.editortools.move" title="Permalink to this headline">¶</a></h2> <p>move</p> <dl class="class"> <dt id="mcedit2.editortools.move.MoveSelectionCommand"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.move.</tt><tt class="descname">MoveSelectionCommand</tt><big>(</big><em>moveTool</em>, <em>pendingImport</em>, <em>text=None</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveSelectionCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveSelectionCommand" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="mcedit2.html#mcedit2.command.SimpleRevisionCommand" title="mcedit2.command.SimpleRevisionCommand"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.command.SimpleRevisionCommand</span></tt></a></p> <dl class="method"> <dt id="mcedit2.editortools.move.MoveSelectionCommand.undo"> <tt class="descname">undo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveSelectionCommand.undo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveSelectionCommand.undo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveSelectionCommand.redo"> <tt class="descname">redo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveSelectionCommand.redo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveSelectionCommand.redo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.move.MoveOffsetCommand"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.move.</tt><tt class="descname">MoveOffsetCommand</tt><big>(</big><em>moveTool</em>, <em>oldPoint</em>, <em>newPoint</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveOffsetCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveOffsetCommand" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">PySide.QtGui.QUndoCommand</span></tt></p> <dl class="method"> <dt id="mcedit2.editortools.move.MoveOffsetCommand.undo"> <tt class="descname">undo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveOffsetCommand.undo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveOffsetCommand.undo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveOffsetCommand.redo"> <tt class="descname">redo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveOffsetCommand.redo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveOffsetCommand.redo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.move.MoveFinishCommand"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.move.</tt><tt class="descname">MoveFinishCommand</tt><big>(</big><em>moveTool</em>, <em>pendingImport</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveFinishCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveFinishCommand" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="mcedit2.html#mcedit2.command.SimpleRevisionCommand" title="mcedit2.command.SimpleRevisionCommand"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.command.SimpleRevisionCommand</span></tt></a></p> <dl class="method"> <dt id="mcedit2.editortools.move.MoveFinishCommand.undo"> <tt class="descname">undo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveFinishCommand.undo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveFinishCommand.undo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveFinishCommand.redo"> <tt class="descname">redo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveFinishCommand.redo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveFinishCommand.redo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.move.CoordinateWidget"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.move.</tt><tt class="descname">CoordinateWidget</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#CoordinateWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.CoordinateWidget" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">PySide.QtGui.QWidget</span></tt></p> <dl class="attribute"> <dt id="mcedit2.editortools.move.CoordinateWidget.pointChanged"> <tt class="descname">pointChanged</tt><em class="property"> = &lt;PySide.QtCore.Signal object at 0x000000000A2D9260&gt;</em><a class="headerlink" href="#mcedit2.editortools.move.CoordinateWidget.pointChanged" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.move.CoordinateWidget.point"> <tt class="descname">point</tt><a class="reference internal" href="_modules/mcedit2/editortools/move.html#CoordinateWidget.point"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.CoordinateWidget.point" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.CoordinateWidget.setX"> <tt class="descname">setX</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#CoordinateWidget.setX"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.CoordinateWidget.setX" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.CoordinateWidget.setY"> <tt class="descname">setY</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#CoordinateWidget.setY"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.CoordinateWidget.setY" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.CoordinateWidget.setZ"> <tt class="descname">setZ</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#CoordinateWidget.setZ"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.CoordinateWidget.setZ" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.move.CoordinateWidget.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x000000000A2D5288&gt;</em><a class="headerlink" href="#mcedit2.editortools.move.CoordinateWidget.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.move.PendingImportNode"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.move.</tt><tt class="descname">PendingImportNode</tt><big>(</big><em>pendingImport</em>, <em>textureAtlas</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#PendingImportNode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.PendingImportNode" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="mcedit2.rendering.html#mcedit2.rendering.scenegraph.TranslateNode" title="mcedit2.rendering.scenegraph.TranslateNode"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.rendering.scenegraph.TranslateNode</span></tt></a></p> <dl class="attribute"> <dt id="mcedit2.editortools.move.PendingImportNode.pos"> <tt class="descname">pos</tt><a class="reference internal" href="_modules/mcedit2/editortools/move.html#PendingImportNode.pos"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.PendingImportNode.pos" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.PendingImportNode.hoverFace"> <tt class="descname">hoverFace</tt><big>(</big><em>face</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#PendingImportNode.hoverFace"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.PendingImportNode.hoverFace" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.move.MoveTool"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.move.</tt><tt class="descname">MoveTool</tt><big>(</big><em>editorSession</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#mcedit2.editortools.EditorTool" title="mcedit2.editortools.EditorTool"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.editortools.EditorTool</span></tt></a></p> <dl class="attribute"> <dt id="mcedit2.editortools.move.MoveTool.iconName"> <tt class="descname">iconName</tt><em class="property"> = 'move'</em><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.iconName" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.move.MoveTool.name"> <tt class="descname">name</tt><em class="property"> = 'Move'</em><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.name" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.move.MoveTool.movePosition"> <tt class="descname">movePosition</tt><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.movePosition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.movePosition" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.pointInputChanged"> <tt class="descname">pointInputChanged</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.pointInputChanged"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.pointInputChanged" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.addPendingImport"> <tt class="descname">addPendingImport</tt><big>(</big><em>pendingImport</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.addPendingImport"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.addPendingImport" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.removePendingImport"> <tt class="descname">removePendingImport</tt><big>(</big><em>pendingImport</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.removePendingImport"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.removePendingImport" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.doMoveOffsetCommand"> <tt class="descname">doMoveOffsetCommand</tt><big>(</big><em>oldPoint</em>, <em>newPoint</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.doMoveOffsetCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.doMoveOffsetCommand" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.listClicked"> <tt class="descname">listClicked</tt><big>(</big><em>index</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.listClicked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.listClicked" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.listDoubleClicked"> <tt class="descname">listDoubleClicked</tt><big>(</big><em>index</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.listDoubleClicked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.listDoubleClicked" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.move.MoveTool.currentImport"> <tt class="descname">currentImport</tt><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.currentImport"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.currentImport" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.move.MoveTool.currentImportNode"> <tt class="descname">currentImportNode</tt><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.currentImportNode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.currentImportNode" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.move.MoveTool.schematicBox"> <tt class="descname">schematicBox</tt><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.schematicBox"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.schematicBox" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.dragMovePoint"> <tt class="descname">dragMovePoint</tt><big>(</big><em>ray</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.dragMovePoint"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.dragMovePoint" title="Permalink to this definition">¶</a></dt> <dd><dl class="docutils"> <dt>Return a point representing the intersection between the mouse ray</dt> <dd>and an imaginary plane coplanar to the dragged face</dd> </dl> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body">Vector</td> </tr> </tbody> </table> </dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.mouseMove"> <tt class="descname">mouseMove</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.mouseMove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.mouseMove" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.mouseDrag"> <tt class="descname">mouseDrag</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.mouseDrag"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.mouseDrag" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.mousePress"> <tt class="descname">mousePress</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.mousePress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.mousePress" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.move.MoveTool.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x000000000A2D52C8&gt;</em><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.mouseRelease"> <tt class="descname">mouseRelease</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.mouseRelease"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.mouseRelease" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.toolActive"> <tt class="descname">toolActive</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.toolActive"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.toolActive" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.toolInactive"> <tt class="descname">toolInactive</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.toolInactive"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.toolInactive" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.move.MoveTool.confirmImport"> <tt class="descname">confirmImport</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/move.html#MoveTool.confirmImport"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.move.MoveTool.confirmImport" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> </div> <div class="section" id="module-mcedit2.editortools.select"> <span id="mcedit2-editortools-select-module"></span><h2>mcedit2.editortools.select module<a class="headerlink" href="#module-mcedit2.editortools.select" title="Permalink to this headline">¶</a></h2> <p>select</p> <dl class="class"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.select.</tt><tt class="descname">SelectionCoordinateWidget</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCoordinateWidget"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">PySide.QtGui.QWidget</span></tt></p> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.editSizeClicked"> <tt class="descname">editSizeClicked</tt><big>(</big><em>state</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCoordinateWidget.editSizeClicked"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.editSizeClicked" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.boxChanged"> <tt class="descname">boxChanged</tt><em class="property"> = &lt;PySide.QtCore.Signal object at 0x00000000045B7068&gt;</em><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.boxChanged" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.boundingBox"> <tt class="descname">boundingBox</tt><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCoordinateWidget.boundingBox"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.boundingBox" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.setMinX"> <tt class="descname">setMinX</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCoordinateWidget.setMinX"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.setMinX" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.setMinY"> <tt class="descname">setMinY</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCoordinateWidget.setMinY"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.setMinY" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.setMinZ"> <tt class="descname">setMinZ</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCoordinateWidget.setMinZ"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.setMinZ" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.setMaxX"> <tt class="descname">setMaxX</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCoordinateWidget.setMaxX"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.setMaxX" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.setMaxY"> <tt class="descname">setMaxY</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCoordinateWidget.setMaxY"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.setMaxY" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.setMaxZ"> <tt class="descname">setMaxZ</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCoordinateWidget.setMaxZ"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.setMaxZ" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionCoordinateWidget.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x00000000056BB988&gt;</em><a class="headerlink" href="#mcedit2.editortools.select.SelectionCoordinateWidget.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.select.SelectCommand"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.select.</tt><tt class="descname">SelectCommand</tt><big>(</big><em>selectionTool</em>, <em>box</em>, <em>text=None</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectCommand"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectCommand" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">PySide.QtGui.QUndoCommand</span></tt></p> <dl class="method"> <dt id="mcedit2.editortools.select.SelectCommand.undo"> <tt class="descname">undo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectCommand.undo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectCommand.undo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectCommand.redo"> <tt class="descname">redo</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectCommand.redo"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectCommand.redo" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.select.SelectionTool"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.select.</tt><tt class="descname">SelectionTool</tt><big>(</big><em>editorSession</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="#mcedit2.editortools.EditorTool" title="mcedit2.editortools.EditorTool"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.editortools.EditorTool</span></tt></a></p> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionTool.name"> <tt class="descname">name</tt><em class="property"> = u'Select'</em><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.name" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionTool.iconName"> <tt class="descname">iconName</tt><em class="property"> = u'select_blocks'</em><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.iconName" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.shapeDidChange"> <tt class="descname">shapeDidChange</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.shapeDidChange"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.shapeDidChange" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.toolActive"> <tt class="descname">toolActive</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.toolActive"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.toolActive" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.toolInactive"> <tt class="descname">toolInactive</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.toolInactive"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.toolInactive" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionTool.hideSelectionWalls"> <tt class="descname">hideSelectionWalls</tt><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.hideSelectionWalls"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.hideSelectionWalls" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionTool.currentSelection"> <tt class="descname">currentSelection</tt><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.currentSelection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.currentSelection" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.coordInputChanged"> <tt class="descname">coordInputChanged</tt><big>(</big><em>box</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.coordInputChanged"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.coordInputChanged" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.selectionDidChange"> <tt class="descname">selectionDidChange</tt><big>(</big><em>value</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.selectionDidChange"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.selectionDidChange" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.updateNodes"> <tt class="descname">updateNodes</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.updateNodes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.updateNodes" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.deleteSelection"> <tt class="descname">deleteSelection</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.deleteSelection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.deleteSelection" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.deleteBlocks"> <tt class="descname">deleteBlocks</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.deleteBlocks"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.deleteBlocks" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.deleteEntities"> <tt class="descname">deleteEntities</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.deleteEntities"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.deleteEntities" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.fill"> <tt class="descname">fill</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.fill"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.fill" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.boxHandleResized"> <tt class="descname">boxHandleResized</tt><big>(</big><em>box</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.boxHandleResized"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.boxHandleResized" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.boxHandleResizedDone"> <tt class="descname">boxHandleResizedDone</tt><big>(</big><em>box</em>, <em>newSelection</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.boxHandleResizedDone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.boxHandleResizedDone" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.mousePress"> <tt class="descname">mousePress</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.mousePress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.mousePress" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.mouseMove"> <tt class="descname">mouseMove</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.mouseMove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.mouseMove" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.mouseDrag"> <tt class="descname">mouseDrag</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.mouseDrag"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.mouseDrag" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.mouseRelease"> <tt class="descname">mouseRelease</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.mouseRelease"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.mouseRelease" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.deselect"> <tt class="descname">deselect</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.deselect"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.deselect" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionTool.selectionColor"> <tt class="descname">selectionColor</tt><em class="property"> = (0.8, 0.8, 1.0)</em><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.selectionColor" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionTool.alpha"> <tt class="descname">alpha</tt><em class="property"> = 0.33</em><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.alpha" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionTool.showPreviousSelection"> <tt class="descname">showPreviousSelection</tt><em class="property"> = True</em><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.showPreviousSelection" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionTool.createShapedSelection"> <tt class="descname">createShapedSelection</tt><big>(</big><em>box</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionTool.createShapedSelection"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.createShapedSelection" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionTool.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x00000000056BBB88&gt;</em><a class="headerlink" href="#mcedit2.editortools.select.SelectionTool.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.select.SelectionCursorRenderNode"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.select.</tt><tt class="descname">SelectionCursorRenderNode</tt><big>(</big><em>sceneNode</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCursorRenderNode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCursorRenderNode" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="mcedit2.rendering.html#mcedit2.rendering.rendergraph.RenderNode" title="mcedit2.rendering.rendergraph.RenderNode"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.rendering.rendergraph.RenderNode</span></tt></a></p> <dl class="method"> <dt id="mcedit2.editortools.select.SelectionCursorRenderNode.drawSelf"> <tt class="descname">drawSelf</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCursorRenderNode.drawSelf"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCursorRenderNode.drawSelf" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> <dl class="class"> <dt id="mcedit2.editortools.select.SelectionCursor"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.select.</tt><tt class="descname">SelectionCursor</tt><big>(</big><em>point=(x=0</em>, <em>y=0</em>, <em>z=0)</em>, <em>face=Face(West)</em>, <em>color=(0.3</em>, <em>0.3</em>, <em>1)</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCursor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCursor" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <a class="reference internal" href="mcedit2.rendering.html#mcedit2.rendering.scenegraph.Node" title="mcedit2.rendering.scenegraph.Node"><tt class="xref py py-class docutils literal"><span class="pre">mcedit2.rendering.scenegraph.Node</span></tt></a></p> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionCursor.RenderNodeClass"> <tt class="descname">RenderNodeClass</tt><a class="headerlink" href="#mcedit2.editortools.select.SelectionCursor.RenderNodeClass" title="Permalink to this definition">¶</a></dt> <dd><p>alias of <a class="reference internal" href="#mcedit2.editortools.select.SelectionCursorRenderNode" title="mcedit2.editortools.select.SelectionCursorRenderNode"><tt class="xref py py-class docutils literal"><span class="pre">SelectionCursorRenderNode</span></tt></a></p> </dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionCursor.point"> <tt class="descname">point</tt><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCursor.point"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCursor.point" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionCursor.face"> <tt class="descname">face</tt><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCursor.face"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCursor.face" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.select.SelectionCursor.color"> <tt class="descname">color</tt><a class="reference internal" href="_modules/mcedit2/editortools/select.html#SelectionCursor.color"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.select.SelectionCursor.color" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> </div> <div class="section" id="module-mcedit2.editortools"> <span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-mcedit2.editortools" title="Permalink to this headline">¶</a></h2> <p>__init__.py</p> <dl class="function"> <dt id="mcedit2.editortools.RegisterTool"> <tt class="descclassname">mcedit2.editortools.</tt><tt class="descname">RegisterTool</tt><big>(</big><em>cls</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools.html#RegisterTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.RegisterTool" title="Permalink to this definition">¶</a></dt> <dd><p>Register a tool class. Class must inherit from EditorTool.</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="nd">@RegisterTool</span> <span class="gp">&gt;&gt;&gt; </span><span class="k">class</span> <span class="nc">MyTool</span><span class="p">(</span><span class="n">EditorTool</span><span class="p">):</span> <span class="gp">&gt;&gt;&gt; </span> <span class="k">pass</span> </pre></div> </div> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>cls</strong> &#8211; </td> </tr> <tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td> </tr> <tr class="field-odd field"><th class="field-name">Return type:</th><td class="field-body"></td> </tr> </tbody> </table> </dd></dl> <dl class="function"> <dt id="mcedit2.editortools.ToolClasses"> <tt class="descclassname">mcedit2.editortools.</tt><tt class="descname">ToolClasses</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools.html#ToolClasses"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.ToolClasses" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="class"> <dt id="mcedit2.editortools.EditorTool"> <em class="property">class </em><tt class="descclassname">mcedit2.editortools.</tt><tt class="descname">EditorTool</tt><big>(</big><em>editorSession</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools.html#EditorTool"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.EditorTool" title="Permalink to this definition">¶</a></dt> <dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">PySide.QtCore.QObject</span></tt></p> <dl class="attribute"> <dt id="mcedit2.editortools.EditorTool.name"> <tt class="descname">name</tt><em class="property"> = u'Unnamed tool'</em><a class="headerlink" href="#mcedit2.editortools.EditorTool.name" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.EditorTool.iconName"> <tt class="descname">iconName</tt><em class="property"> = None</em><a class="headerlink" href="#mcedit2.editortools.EditorTool.iconName" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.EditorTool.toolWidget"> <tt class="descname">toolWidget</tt><em class="property"> = None</em><a class="headerlink" href="#mcedit2.editortools.EditorTool.toolWidget" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.EditorTool.cursorNode"> <tt class="descname">cursorNode</tt><em class="property"> = None</em><a class="headerlink" href="#mcedit2.editortools.EditorTool.cursorNode" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.EditorTool.overlayNode"> <tt class="descname">overlayNode</tt><em class="property"> = None</em><a class="headerlink" href="#mcedit2.editortools.EditorTool.overlayNode" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> <dl class="method"> <dt id="mcedit2.editortools.EditorTool.mousePress"> <tt class="descname">mousePress</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools.html#EditorTool.mousePress"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.EditorTool.mousePress" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> </tbody> </table> <p>event has been augmented with these attributes:</p> <blockquote> <div>point, ray, blockPosition, blockFace</div></blockquote> </dd></dl> <dl class="method"> <dt id="mcedit2.editortools.EditorTool.mouseMove"> <tt class="descname">mouseMove</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools.html#EditorTool.mouseMove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.EditorTool.mouseMove" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> </tbody> </table> <p>event has been augmented</p> </dd></dl> <dl class="method"> <dt id="mcedit2.editortools.EditorTool.mouseDrag"> <tt class="descname">mouseDrag</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools.html#EditorTool.mouseDrag"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.EditorTool.mouseDrag" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> </tbody> </table> <p>event has been augmented</p> </dd></dl> <dl class="method"> <dt id="mcedit2.editortools.EditorTool.mouseRelease"> <tt class="descname">mouseRelease</tt><big>(</big><em>event</em><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools.html#EditorTool.mouseRelease"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.EditorTool.mouseRelease" title="Permalink to this definition">¶</a></dt> <dd><table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> </tbody> </table> <p>event has been augmented</p> </dd></dl> <dl class="method"> <dt id="mcedit2.editortools.EditorTool.toolActive"> <tt class="descname">toolActive</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools.html#EditorTool.toolActive"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.EditorTool.toolActive" title="Permalink to this definition">¶</a></dt> <dd><p>Called when this tool is selected. :return: :rtype:</p> </dd></dl> <dl class="method"> <dt id="mcedit2.editortools.EditorTool.toolInactive"> <tt class="descname">toolInactive</tt><big>(</big><big>)</big><a class="reference internal" href="_modules/mcedit2/editortools.html#EditorTool.toolInactive"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#mcedit2.editortools.EditorTool.toolInactive" title="Permalink to this definition">¶</a></dt> <dd><p>Called when a different tool is selected. :return: :rtype:</p> </dd></dl> <dl class="attribute"> <dt id="mcedit2.editortools.EditorTool.staticMetaObject"> <tt class="descname">staticMetaObject</tt><em class="property"> = &lt;PySide.QtCore.QMetaObject object at 0x000000000841F708&gt;</em><a class="headerlink" href="#mcedit2.editortools.EditorTool.staticMetaObject" title="Permalink to this definition">¶</a></dt> <dd></dd></dl> </dd></dl> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">mcedit2.editortools package</a><ul> <li><a class="reference internal" href="#subpackages">Subpackages</a></li> <li><a class="reference internal" href="#submodules">Submodules</a></li> <li><a class="reference internal" href="#module-mcedit2.editortools.edit_chunk">mcedit2.editortools.edit_chunk module</a></li> <li><a class="reference internal" href="#module-mcedit2.editortools.edit_entity">mcedit2.editortools.edit_entity module</a></li> <li><a class="reference internal" href="#module-mcedit2.editortools.flood_fill">mcedit2.editortools.flood_fill module</a></li> <li><a class="reference internal" href="#module-mcedit2.editortools.generate">mcedit2.editortools.generate module</a></li> <li><a class="reference internal" href="#module-mcedit2.editortools.move">mcedit2.editortools.move module</a></li> <li><a class="reference internal" href="#module-mcedit2.editortools.select">mcedit2.editortools.select module</a></li> <li><a class="reference internal" href="#module-mcedit2.editortools">Module contents</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="mcedit2.editorcommands.html" title="previous chapter">mcedit2.editorcommands package</a></p> <h4>Next topic</h4> <p class="topless"><a href="mcedit2.editortools.brush.html" title="next chapter">mcedit2.editortools.brush package</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="sources/mcedit2.editortools.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="py-modindex.html" title="Python Module Index" >modules</a> |</li> <li class="right" > <a href="mcedit2.editortools.brush.html" title="mcedit2.editortools.brush package" >next</a> |</li> <li class="right" > <a href="mcedit2.editorcommands.html" title="mcedit2.editorcommands package" >previous</a> |</li> <li><a href="index.html">mceditlib 0.1 documentation</a> &raquo;</li> <li><a href="mcedit2.html" >mcedit2 package</a> &raquo;</li> </ul> </div> <div class="footer"> &copy; Copyright 2013, David Vierra. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3. </div> </body> </html>
79.937905
538
0.736577
9c8b720e8a6b89bc05134995d3183d84a536a4f7
16,104
cpp
C++
ugene/src/ugeneui/src/main_window/DockManagerImpl.cpp
iganna/lspec
c75cba3e4fa9a46abeecbf31b5d467827cf4fec0
[ "MIT" ]
null
null
null
ugene/src/ugeneui/src/main_window/DockManagerImpl.cpp
iganna/lspec
c75cba3e4fa9a46abeecbf31b5d467827cf4fec0
[ "MIT" ]
null
null
null
ugene/src/ugeneui/src/main_window/DockManagerImpl.cpp
iganna/lspec
c75cba3e4fa9a46abeecbf31b5d467827cf4fec0
[ "MIT" ]
null
null
null
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2012 UniPro <ugene@unipro.ru> * http://ugene.unipro.ru * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ #include "DockManagerImpl.h" #include "MainWindowImpl.h" #include <task_view/TaskStatusBar.h> #include <U2Core/AppContext.h> #include <U2Core/Settings.h> namespace U2 { #define DOCK_SETTINGS QString("mwdockview/") DockWrapWidget::DockWrapWidget(QWidget* _w) : w(_w) { QVBoxLayout* l = new QVBoxLayout(); l->setMargin(0); l->setSpacing(0); setLayout(l); l->addWidget(w); setWindowTitle(w->windowTitle()); setWindowIcon(w->windowIcon()); // setAttribute(Qt::WA_DeleteOnClose); } DockWrapWidget::~DockWrapWidget() { w = NULL; //for breakpoint } MWDockManagerImpl::MWDockManagerImpl(MainWindowImpl* _mw) : MWDockManager(_mw), mwImpl(_mw), mw(_mw->getQMainWindow()) { for (int i=0;i<MWDockArea_MaxDocks;i++) { activeDocks[i] = NULL; toggleDockState[i] = NULL; } mw->setDockOptions(QMainWindow::AnimatedDocks); //prepare dock-toolbars dockLeft = new QToolBar("left_dock_bar", mw); dockLeft->setObjectName("left_dock_bar"); dockLeft->setMovable(false); dockLeft->setFloatable(false); dockLeft->hide(); mw->addToolBar(Qt::LeftToolBarArea, dockLeft); dockRight = new QToolBar("right_dock_bar",mw); dockRight->setObjectName("right_dock_bar"); dockRight->setMovable(false); dockRight->setFloatable(false); dockRight->hide(); mw->addToolBar(Qt::RightToolBarArea, dockRight); dockBottom= new QToolBar("bottom_dock_bar", mw); dockBottom->setObjectName("bottom_dock_bar"); dockBottom->setMovable(false); dockBottom->setFloatable(false); mw->addToolBar(Qt::BottomToolBarArea, dockBottom); statusBarAction = dockBottom->addWidget(new TaskStatusBar()); readLastActiveDocksState(); QAction* tga = new QAction(this); tga->setShortcut(QKeySequence("Alt+`")); tga->setShortcutContext(Qt::ApplicationShortcut); connect(tga, SIGNAL(triggered()), SLOT(sl_toggleDocks())); mw->addAction(tga); mainWindowIsHidden = false; mw->installEventFilter(this); } MWDockManagerImpl::~MWDockManagerImpl() { saveLastActiveDocksState(); foreach(DockData* d, docks) { destroyDockData(d); } } void MWDockManagerImpl::readLastActiveDocksState() { Settings* s = AppContext::getSettings(); for (int i=0;i<MWDockArea_MaxDocks; i++) { lastActiveDocksState[i] = s->getValue(DOCK_SETTINGS + "dockTitle"+i).toString(); } } void MWDockManagerImpl::saveLastActiveDocksState() { Settings* s = AppContext::getSettings(); for (int i=0;i<MWDockArea_MaxDocks; i++) { s->setValue(DOCK_SETTINGS + "dockTitle"+i, lastActiveDocksState[i]); } } QToolBar* MWDockManagerImpl::getDockBar(MWDockArea a) const { switch(a) { case MWDockArea_Left: return dockLeft; case MWDockArea_Right: return dockRight; case MWDockArea_Bottom: return dockBottom; default: break; } return NULL; } #define MAX_LABEL_BASE_WIDTH 90 #define MAX_LABEL_EXTRA_WIDTH 20 #define IDEAL_LABEL_HEIGHT 25 #define MIN_LABEL_EXTRA_HEIGHT 6 #define ICON_TEXT_DIST 6 #define ICON_SIZE 16 static void updateLabel(DockData* d, bool active) { QFont font;//app default QFontMetrics fm(font); QString text = d->wrapWidget->windowTitle(); QKeySequence ks = d->action == NULL ? QKeySequence(): d->action->shortcut(); QString keyPrefix = ""; if (ks.count() == 1) { for (int k = (int)Qt::Key_0; k <= (int)Qt::Key_9; k++) { if (ks[0] == (k | (int)Qt::ALT)) { keyPrefix = QString::number(k - (int)Qt::Key_0) + ": "; break; } } } QIcon icon = d->wrapWidget->windowIcon(); bool hasIcon = !icon.isNull(); int iconSize = hasIcon ? ICON_SIZE : 0; int iconTextDist = hasIcon ? ICON_TEXT_DIST : 0; int textWidth = fm.width(keyPrefix + text); int textHeight = fm.height(); bool vertical = d->area == MWDockArea_Bottom ? false : true; int d1 = qMax(textWidth+iconSize+iconTextDist, MAX_LABEL_BASE_WIDTH) + MAX_LABEL_EXTRA_WIDTH; int d2 = qMax(IDEAL_LABEL_HEIGHT, textHeight + MIN_LABEL_EXTRA_HEIGHT); QPixmap pix(vertical ? d2 : d1, vertical ? d1 : d2); #ifdef Q_WS_WIN pix.fill(Qt::transparent); #else QColor bgColor = QApplication::palette().brush(QPalette::Window).color(); pix.fill(bgColor); #endif QRect pixRect = pix.rect(); QPainter paint; paint.begin(&pix); //rounded rect paint.setPen(Qt::black); QRectF roundedRect(2, 2, pixRect.width()-4,pixRect.height()-4); #ifdef Q_WS_WIN QColor fillColor = QColor(0, 0, 0, active ? 30 : 5); #else QColor fillColor = bgColor; if (active) { fillColor = bgColor.darker(115); } #endif paint.fillRect(roundedRect, fillColor); paint.drawLine((int) roundedRect.left() + 1, (int)roundedRect.top(), (int)roundedRect.right() - 1, (int)roundedRect.top()); paint.drawLine((int)roundedRect.left() + 1, (int)roundedRect.bottom(), (int)roundedRect.right() - 1, (int)roundedRect.bottom()); paint.drawLine((int)roundedRect.left(), (int)roundedRect.top() + 1, (int)roundedRect.left(), (int)roundedRect.bottom() - 1); paint.drawLine((int)roundedRect.right(), (int)roundedRect.top() + 1, (int)roundedRect.right(), (int)roundedRect.bottom() - 1); //text int xText = 0; int yText = 0; int aText = fm.ascent(); int fontYOffset = aText / 2; int fontXOffset = (d1 - textWidth - iconSize - iconTextDist) / 2 + iconSize + iconTextDist; if (d->area == MWDockArea_Left) { paint.rotate(-90); xText = fontXOffset-d1; yText = pixRect.width()/2 + fontYOffset; } else if (d->area == MWDockArea_Right) { paint.rotate(90); xText = fontXOffset; yText = -pixRect.width()/2 + fontYOffset; } else { xText = fontXOffset; yText = pixRect.height()/2 + fontYOffset; } if (hasIcon) { int xIcon = xText - iconTextDist - iconSize; QPixmap p = icon.pixmap(iconSize, iconSize); if (d->area == MWDockArea_Left) { paint.drawPixmap(xIcon, 1 + (pix.width() - iconSize) / 2, p); } else if (d->area == MWDockArea_Right) { paint.drawPixmap(xIcon, -(1 + (pix.width() - iconSize) / 2) - iconSize, p); } else { paint.drawPixmap(xIcon, 1 + (pix.height() - iconSize) / 2, p); } } int prefixDx = 0; if (!keyPrefix.isEmpty()) { font.setUnderline(true); paint.setFont(font); prefixDx = fm.width(keyPrefix.at(0)); paint.drawText(xText, yText, keyPrefix.left(1)); text = keyPrefix.mid(1) + text; font.setUnderline(false); } paint.setFont(font); paint.drawText(xText + prefixDx, yText, text); paint.end(); d->label->resize(pix.size()); d->label->setPixmap(pix); } static bool ksInUse(const QKeySequence& ks, const QList<DockData*>& docks) { foreach(DockData* d, docks) { if (d->action!=NULL && d->action->shortcut() == ks) { return true; } } return false; } QAction* MWDockManagerImpl::registerDock(MWDockArea area, QWidget* w, const QKeySequence& ks) { bool showDock = w->objectName() == lastActiveDocksState[area]; QToolBar* tb = getDockBar(area); DockData* data = new DockData(); data->area = area; data->label = new QLabel(tb); data->wrapWidget = new DockWrapWidget(w); data->wrapWidget->setObjectName("wrap_widget_"+w->objectName()); data->label->setObjectName("doc_lable_"+w->objectName()); data->label->installEventFilter(this); if (area != MWDockArea_Bottom) { tb->addWidget(data->label); } else { tb->insertWidget(statusBarAction, data->label); } connect(w, SIGNAL(destroyed()), SLOT(sl_widgetDestroyed())); QString ttip = w->windowTitle(); if (!ks.isEmpty() && !ksInUse(ks, docks)) { data->action = new QAction(data->label); data->action->setShortcut(ks); data->action->setShortcutContext(Qt::ApplicationShortcut); connect(data->action, SIGNAL(triggered()), SLOT(sl_toggleDock())); data->label->addAction(data->action); ttip+=" ("+ks.toString()+")"; } data->label->setToolTip(ttip); updateLabel(data, false); docks.append(data); if (tb->isHidden()) { tb->show(); } if (showDock) { openDock(data); } else { data->wrapWidget->setVisible(false); } return NULL; } QWidget* MWDockManagerImpl::toggleDock(const QString& widgetObjName) { DockData* d = findDockByName(widgetObjName); if (d!=NULL) { toggleDock(d); return d->wrapWidget->w; } return NULL; } void MWDockManagerImpl::sl_toggleDock() { QAction* a = qobject_cast<QAction*>(sender()); QLabel* l = qobject_cast<QLabel*>(a->parent()); DockData* d = findDockByLabel(l); toggleDock(d); } void MWDockManagerImpl::updateTB(MWDockArea a) { if (a == MWDockArea_Bottom) { return; //bottom TB is always on; } int nChilds = 0; foreach (DockData* d, docks) { if (d->area == a) { nChilds++; } } QToolBar* tb = getDockBar(a); if (nChilds == 0 && tb->isVisible()) { tb->hide(); } else if (nChilds != 0 && tb->isHidden()) { tb->show(); } } QWidget* MWDockManagerImpl::findWidget(const QString& widgetObjName) { DockData* d = findDockByName(widgetObjName); return d == NULL ? NULL : d->wrapWidget->w; } QWidget* MWDockManagerImpl::getActiveWidget(MWDockArea a) { DockData* d = getActiveDock(a); return d == NULL ? NULL : d->wrapWidget->w; } DockData* MWDockManagerImpl::getActiveDock(MWDockArea a) const { DockData* d = activeDocks[a]; assert(d == NULL || d->dock!=NULL); assert(d == NULL || d->wrapWidget != NULL); return d; } QWidget* MWDockManagerImpl::activateDock(const QString& widgetObjName) { DockData* d = findDockByName(widgetObjName); if (d!=NULL) { openDock(d); return d->wrapWidget->w; } return NULL; } void MWDockManagerImpl::openDock(DockData* d) { //check if already opened if (getActiveDock(d->area)==d) { return; } assert(d->wrapWidget->isHidden()); //hide active dock if exists DockData* activeDock = getActiveDock(d->area); if (activeDock!=NULL) { closeDock(activeDock); } assert(getActiveDock(d->area) == NULL); //open new dock assert(d->wrapWidget != NULL); updateLabel(d, true); restoreDockGeometry(d); d->dock = new QDockWidget(); d->dock->setObjectName("mw_docArea"); d->dock->setFeatures(QDockWidget::DockWidgetClosable); d->dock->setWidget(d->wrapWidget); d->dock->setWindowTitle(d->wrapWidget->windowTitle()); d->dock->setWindowIcon(d->wrapWidget->windowIcon()); activeDocks[d->area] = d; connect(d->dock, SIGNAL(visibilityChanged(bool)), SLOT(sl_dockVisibilityChanged(bool))); Qt::DockWidgetArea mwarea = d->area == MWDockArea_Left ? Qt::LeftDockWidgetArea : d->area == MWDockArea_Right ? Qt::RightDockWidgetArea : Qt::BottomDockWidgetArea; d->dock->setAttribute(Qt::WA_DeleteOnClose); mw->addDockWidget(mwarea, d->dock); lastActiveDocksState[d->area] = d->wrapWidget->w->objectName(); } void MWDockManagerImpl::closeDock(DockData* d) { activeDocks[d->area] = NULL; if (d->wrapWidget!=NULL) { //widget is closed manually by user ->detach it from its parent to avoid deletion on d->dock->close(); updateLabel(d, false); saveDockGeometry(d); lastActiveDocksState[d->area].clear(); d->wrapWidget->setParent(NULL); d->wrapWidget->setVisible(false); } d->dock->close(); // will delete dock widget because of Qt::WA_DeleteOnClose d->dock = NULL; } void MWDockManagerImpl::destroyDockData(DockData* d) { if (d->dock!=NULL) { saveDockGeometry(d); } delete d->label; d->wrapWidget->deleteLater(); d->wrapWidget = NULL; if (d->dock!=NULL) { d->dock->close(); } docks.removeOne(d); updateTB(d->area); delete d; } void MWDockManagerImpl::sl_dockVisibilityChanged(bool visible) { if (visible) { return; } if (mw->isMinimized() || mainWindowIsHidden) { return; } QDockWidget* dock = qobject_cast<QDockWidget*>(sender()); DockData* dd = findDockByDockWidget(dock); assert(dd != NULL); closeDock(dd); } void MWDockManagerImpl::sl_widgetDestroyed() { QWidget* w = qobject_cast<QWidget*>(sender()); foreach(DockData* d, docks) { if (d->wrapWidget->w == w) { destroyDockData(d); break; } } } DockData* MWDockManagerImpl::findDockByName(const QString& objName) const { foreach(DockData* d, docks) { if (d->wrapWidget->w->objectName() == objName) { return d; } } return NULL; } DockData* MWDockManagerImpl::findDockByLabel(QLabel* l) const { foreach(DockData* d, docks) { if (d->label == l) { return d; } } return NULL; } DockData* MWDockManagerImpl::findDockByDockWidget(QDockWidget* dock) const { foreach(DockData* d, docks) { if (d->dock == dock) { return d; } } return NULL; } bool MWDockManagerImpl::eventFilter(QObject *obj, QEvent *event) { if (obj == mw) { if (event->type() == QEvent::Hide ) { mainWindowIsHidden = true; } else if (event->type() == QEvent::Show) { mainWindowIsHidden = false; } else { return false; } } if (event->type() == QEvent::MouseButtonRelease) { QMouseEvent* me = (QMouseEvent*)event; if (me->button() == Qt::LeftButton) { DockData* data = findDockByLabel((QLabel*)obj); assert(data); if (!data) { return false; } toggleDock(data); } } return false; } void MWDockManagerImpl::toggleDock(DockData* d) { if (d->dock!=NULL) { closeDock(d); } else { openDock(d); } } void MWDockManagerImpl::saveDockGeometry(DockData* dd) { const QString& id = dd->wrapWidget->w->objectName(); const QSize& size = dd->wrapWidget->w->size(); Settings* s = AppContext::getSettings(); s->setValue(DOCK_SETTINGS+id+"/size", size); } void MWDockManagerImpl::restoreDockGeometry(DockData* dd) { Settings* s = AppContext::getSettings(); dd->wrapWidget->hint= s->getValue(DOCK_SETTINGS+dd->wrapWidget->w->objectName()+"/size", QSize(300, 200)).toSize(); } void MWDockManagerImpl::sl_toggleDocks() { bool isOpen = false; for(int i = 0; i < MWDockArea_MaxDocks; i++) { if (activeDocks[i] != NULL) { isOpen = true; break; } } if (isOpen) { for(int i = 0; i < MWDockArea_MaxDocks; i++) { if ((toggleDockState[i] = activeDocks[i]) != NULL) { closeDock(activeDocks[i]); } } } else { for(int i = 0; i < MWDockArea_MaxDocks; i++) { if (toggleDockState[i]) { openDock(toggleDockState[i]); } } } } } //namespace
29.657459
133
0.625062
d4f8b92921f59673730c845d83b812114464f141
2,459
kt
Kotlin
Backpack/src/main/java/net/skyscanner/backpack/barchart/internal/ChartLineDecoration.kt
reneargento/backpack-android
ca945bf8c88e9c841e958c14f81411cfbf9d5c1e
[ "Apache-2.0" ]
61
2018-08-21T15:18:06.000Z
2022-02-23T16:08:42.000Z
Backpack/src/main/java/net/skyscanner/backpack/barchart/internal/ChartLineDecoration.kt
sachin2dehury/backpack-android
3dd39686f80b62deebb6435fa82ed9c65d88afa9
[ "Apache-2.0" ]
530
2018-01-22T21:20:39.000Z
2022-03-29T10:17:39.000Z
Backpack/src/main/java/net/skyscanner/backpack/barchart/internal/ChartLineDecoration.kt
sachin2dehury/backpack-android
3dd39686f80b62deebb6435fa82ed9c65d88afa9
[ "Apache-2.0" ]
27
2018-09-05T10:55:21.000Z
2021-09-17T18:33:45.000Z
/** * Backpack for Android - Skyscanner's Design System * * Copyright 2018-2021 Skyscanner Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package net.skyscanner.backpack.barchart.internal import android.content.res.Resources import android.graphics.Canvas import android.graphics.Paint import android.util.TypedValue import androidx.recyclerview.widget.RecyclerView import net.skyscanner.backpack.barchart.BpkBarChart import net.skyscanner.backpack.util.Consumer import net.skyscanner.backpack.util.forEach import net.skyscanner.backpack.util.getColorForState internal class ChartLineDecoration( private val resources: Resources, private val colors: BpkBarChart.Colors ) : RecyclerView.ItemDecoration(), Consumer<ChartBarHolder> { private val paint = Paint().apply { strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1f, resources.displayMetrics) style = Paint.Style.FILL_AND_STROKE } private var position = Float.MIN_VALUE override fun invoke(holder: ChartBarHolder) { if (!holder.itemView.isSelected) { this.position = holder.chartRoundedTopPosition } else { this.position = Float.MIN_VALUE } } override fun onDraw(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { super.onDraw(c, parent, state) if (position == Float.MIN_VALUE) return drawLine(c, parent, 0, parent.width) } override fun onDrawOver(c: Canvas, parent: RecyclerView, state: RecyclerView.State) { super.onDrawOver(c, parent, state) if (position == Float.MIN_VALUE) return parent.forEach { if (it.isSelected) { drawLine(c, parent, it.left, it.right) } } } private fun drawLine(c: Canvas, parent: RecyclerView, left: Int, right: Int) { val lineY = position + parent.paddingTop paint.color = colors.chartLine.getColorForState(parent.drawableState) c.drawLine(left.toFloat(), lineY, right.toFloat(), lineY, paint) } }
33.22973
102
0.742578
9520e846f90016377be591e248e6ad0ce5c6fe09
543
swift
Swift
TestExamplesTests/SignUp/TestDoubles/Mocks/MockSignUpManager.swift
hrebinik/BDDTest
d8c0b7c2dc9e3f29299a9c60c131154abd4d2c69
[ "Apache-2.0" ]
1
2021-06-29T13:14:02.000Z
2021-06-29T13:14:02.000Z
TestExamplesTests/SignUp/TestDoubles/Mocks/MockSignUpManager.swift
hrebinik/BDDTest
d8c0b7c2dc9e3f29299a9c60c131154abd4d2c69
[ "Apache-2.0" ]
null
null
null
TestExamplesTests/SignUp/TestDoubles/Mocks/MockSignUpManager.swift
hrebinik/BDDTest
d8c0b7c2dc9e3f29299a9c60c131154abd4d2c69
[ "Apache-2.0" ]
1
2021-06-29T13:13:36.000Z
2021-06-29T13:13:36.000Z
// // MockSignUpManager.swift // TestExamplesTests // // Created by Anton Panteleimenko on 10.06.2021. // import Foundation @testable import TestExamples class MockSignUpManager: SignUpManagerProtocol { var processUserSignupCalled: Bool = false required init(modelFieldValidator: SignUpValidatorProtocol, networkService: SignupNetworkProtocol, delegate: SignUpResultDelegateProtocol) {} func processUserSignup(model: SignUpFieldModelProtocol) { processUserSignupCalled = true } }
22.625
63
0.732965
51093c4932aa06fe8fb45e9e83cee8e12a07d03e
219
asm
Assembly
libsrc/_DEVELOPMENT/adt/b_vector/c/sccz80/b_vector_erase_block.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
8
2017-01-18T12:02:17.000Z
2021-06-12T09:40:28.000Z
libsrc/_DEVELOPMENT/adt/b_vector/c/sccz80/b_vector_erase_block.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
1
2017-03-06T07:41:56.000Z
2017-03-06T07:41:56.000Z
libsrc/_DEVELOPMENT/adt/b_vector/c/sccz80/b_vector_erase_block.asm
teknoplop/z88dk
bb03fbfd6b2ab0f397a1358559089f9cd3706485
[ "ClArtistic" ]
3
2017-03-07T03:19:40.000Z
2021-09-15T17:59:19.000Z
; size_t b_vector_erase_block(b_vector_t *v, size_t idx, size_t n) SECTION code_clib SECTION code_adt_b_vector PUBLIC b_vector_erase_block EXTERN b_array_erase_block defc b_vector_erase_block = b_array_erase_block
18.25
66
0.853881
0ab4f065b9e5a586bf4dce339ec291db46b2b0de
683
go
Go
langserver/completion_test.go
Shivkumar13/go-langserver
5fa789cfa7e51c6b2661f1eb7f95bb90594fe6de
[ "MIT" ]
1,241
2016-11-03T07:33:41.000Z
2022-03-24T06:18:20.000Z
langserver/completion_test.go
Shivkumar13/go-langserver
5fa789cfa7e51c6b2661f1eb7f95bb90594fe6de
[ "MIT" ]
283
2016-10-27T09:44:42.000Z
2021-11-08T07:24:43.000Z
langserver/completion_test.go
Shivkumar13/go-langserver
5fa789cfa7e51c6b2661f1eb7f95bb90594fe6de
[ "MIT" ]
121
2016-11-03T20:31:13.000Z
2021-04-20T17:29:14.000Z
package langserver import ( "reflect" "testing" ) func TestParseFuncArgs(t *testing.T) { got := parseFuncArgs("func(a int, b bool, c interface{}, d string...) ([]string, error)") want := []string{"a int", "b bool", "c interface{}", "d string..."} if !reflect.DeepEqual(got, want) { t.Fatalf("Wrong function args parsed. got: %s want: %s", got, want) } } func TestGenSnippetArgs(t *testing.T) { got := genSnippetArgs([]string{"a int", "b bool", "c interface{}", "d string..."}) want := []string{"${1:a int}", "${2:b bool}", "${3:c interface{\\}}", "${4:d string...}"} if !reflect.DeepEqual(got, want) { t.Fatalf("Wrong snippet args. got: %s want: %s", got, want) } }
29.695652
90
0.607613
9c004fbf0e8234e96db52f412d9b0ec8f1c6807d
4,399
cpp
C++
lib/utils/button.cpp
rvt/espgaggia
fe7806c7bc31c05df6b4309f62f08df8d05e8ac0
[ "MIT" ]
13
2021-02-03T09:48:23.000Z
2022-01-05T15:23:28.000Z
lib/utils/button.cpp
rvt/espgaggia
fe7806c7bc31c05df6b4309f62f08df8d05e8ac0
[ "MIT" ]
null
null
null
lib/utils/button.cpp
rvt/espgaggia
fe7806c7bc31c05df6b4309f62f08df8d05e8ac0
[ "MIT" ]
null
null
null
#include "button.hpp" #include <cstdint> #include <algorithm> #ifndef UNIT_TEST #include <Arduino.h> #else extern "C" uint32_t millis(); extern "C" uint32_t pinMode(uint8_t, uint8_t); extern "C" uint32_t digitalRead(uint8_t); #define INPUT_PULLUP 2 #define A0 0xa0 #endif // Bit positions (std::bitset) for each type of press #define DIGITAL_KNOB_CURRENT 0 #define DIGITAL_KNOB_IS_SINGLE_CLICK 1 #define DIGITAL_KNOB_IS_DOUBLE_CLICK 2 #define DIGITAL_KNOB_IS_LONG_PRESS 3 #define DIGITAL_KNOB_IS_EDGE_UP 4 #define DIGITAL_KNOB_IS_EDGE_DOWN 5 //Hysteresis to detect low/high states for debounce #define DIGITAL_KNOB_HIGH 225 #define DIGITAL_KNOB_LOW 25 // Bitmasks for detething the type of press based on the type of press 32 or 64 bit #define DIGITAL_KNOB_SINGLE_CLICK_AMASK 0b00000111111111111000000000000000 #define DIGITAL_KNOB_SINGLE_CLICK_TMASK 0b00000000111111100000000000000000 #define DIGITAL_KNOB_DOUBLE_CLICK_AMASK 0b00001111111100000000000111111110 #define DIGITAL_KNOB_DOUBLE_CLICK_TMASK 0b00000011110000000000000001111000 #define DIGITAL_KNOB_LONG_PRESS_AMASK 0b11111111111111111111111111111111 #define DIGITAL_KNOB_LONG_PRESS_TMASK 0b00000001111111111111111111111111 Button::Button() : Button(true, 150) { } Button::Button(bool p_invert, int16_t p_alpha) : m_invert(p_invert), m_alpha(p_alpha), m_rawValue(0x00), m_value({}), m_status({0x00}) { } void Button::handle() { // Debounce input int16_t correction = (((raw() ^ m_invert) ? 0xff : 0) - m_rawValue) * 100; m_rawValue = m_rawValue + correction / m_alpha; m_rawValue = std::max((int16_t)0, std::min(m_rawValue, (int16_t)0xff)); bool previousButtonState = m_value[DIGITAL_KNOB_CURRENT]; // Hysteresis for digital input if (m_rawValue > DIGITAL_KNOB_HIGH) { m_value[DIGITAL_KNOB_CURRENT] = true; } else if (m_rawValue < DIGITAL_KNOB_LOW) { m_value[DIGITAL_KNOB_CURRENT] = false; } // Shift and insert current bit into register m_status.m_status32 = m_status.m_status32 << 1; m_status.m_status8[0] = m_status.m_status8[0] | m_value[DIGITAL_KNOB_CURRENT]; // Reset buttons if they where not captured for a duration if (m_status.m_status32 == 0x00) { resetButtons(); } // Detect up/down edges m_value[DIGITAL_KNOB_IS_EDGE_UP] = (m_value[DIGITAL_KNOB_CURRENT] && !previousButtonState); m_value[DIGITAL_KNOB_IS_EDGE_DOWN] = (previousButtonState && !m_value[DIGITAL_KNOB_CURRENT]); // detect long press if ((m_status.m_status32 | DIGITAL_KNOB_LONG_PRESS_AMASK) == DIGITAL_KNOB_LONG_PRESS_AMASK && (m_status.m_status32 & DIGITAL_KNOB_LONG_PRESS_TMASK) == DIGITAL_KNOB_LONG_PRESS_TMASK) { m_value[DIGITAL_KNOB_IS_LONG_PRESS] = true; } // Detect single click if ((m_status.m_status32 | DIGITAL_KNOB_SINGLE_CLICK_AMASK) == DIGITAL_KNOB_SINGLE_CLICK_AMASK && (m_status.m_status32 & DIGITAL_KNOB_SINGLE_CLICK_TMASK) == DIGITAL_KNOB_SINGLE_CLICK_TMASK) { m_value[DIGITAL_KNOB_IS_SINGLE_CLICK] = true; m_status.m_status32 = 0x00; } // Detect double click if ((m_status.m_status32 | DIGITAL_KNOB_DOUBLE_CLICK_AMASK) == DIGITAL_KNOB_DOUBLE_CLICK_AMASK && (m_status.m_status32 & DIGITAL_KNOB_DOUBLE_CLICK_TMASK) == DIGITAL_KNOB_DOUBLE_CLICK_TMASK) { m_value[DIGITAL_KNOB_IS_DOUBLE_CLICK] = true; m_status.m_status32 = 0x00; } } bool Button::current() const { return m_value[DIGITAL_KNOB_CURRENT]; } bool Button::isSingle() const { bool v = m_value[DIGITAL_KNOB_IS_SINGLE_CLICK]; m_value[DIGITAL_KNOB_IS_SINGLE_CLICK] = false; return v; } bool Button::isEdgeUp() const { bool v = m_value[DIGITAL_KNOB_IS_EDGE_UP]; // m_value[DIGITAL_KNOB_IS_EDGE_UP] = false; return v; } bool Button::isEdgeDown() const { bool v = m_value[DIGITAL_KNOB_IS_EDGE_DOWN]; // m_value[DIGITAL_KNOB_IS_EDGE_DOWN] = false; return v; } bool Button::isDouble() const { bool v = m_value[DIGITAL_KNOB_IS_DOUBLE_CLICK]; // m_value[DIGITAL_KNOB_IS_DOUBLE_CLICK] = false; return v; } bool Button::isLong() const { bool v = m_value[DIGITAL_KNOB_IS_LONG_PRESS]; // m_value[DIGITAL_KNOB_IS_LONG_PRESS] = false; return v; } void Button::resetButtons() const { m_value = 0x00 | m_value[DIGITAL_KNOB_CURRENT]; } void Button::reset() const { m_status.m_status32 = 0x00; }
31.198582
101
0.743351
16147e584bb969a6885ad273dabf27e256eb52c6
1,342
h
C
qmk_firmware/keyboards/handwired/pill60/config.h
DanTupi/personal_setup
911b4951e4d8b78d6ea8ca335229e2e970fda871
[ "MIT" ]
null
null
null
qmk_firmware/keyboards/handwired/pill60/config.h
DanTupi/personal_setup
911b4951e4d8b78d6ea8ca335229e2e970fda871
[ "MIT" ]
null
null
null
qmk_firmware/keyboards/handwired/pill60/config.h
DanTupi/personal_setup
911b4951e4d8b78d6ea8ca335229e2e970fda871
[ "MIT" ]
null
null
null
/* Copyright 2020 Imam Rafii * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "config_common.h" #define VENDOR_ID 0x4454 #define PRODUCT_ID 0x5444 #define DEVICE_VER 0x0001 #define MANUFACTURER "IktaS" #define PRODUCT "Pill60" #define MATRIX_ROWS 5 #define MATRIX_COLS 14 #define DIODE_DIRECTION COL2ROW /* Set 0 if debouncing isn't needed */ #define DEBOUNCE 1 /* Backlighting include */ #define BACKLIGHT_PIN B14 #define BACKLIGHT_PWM_DRIVER PWMD5 #define BACKLIGHT_PWM_CHANNEL 1 #define BACKLIGHT_LEVELS 5 #define BREATHING_PERIOD 6 /* Encoder */ #define ENCODERS_PAD_A \ { B9 } #define ENCODERS_PAD_B \ { B8 } #define ENCODER_RESOLUTION 2
28.553191
74
0.725782
8f03dabfbe99fef00ae3cd00ba264540b67da3be
788
java
Java
mybatis-helper-single-database-test/src/main/java/io/github/happytimor/mybatis/helper/single/database/test/domain/TeacherInfo.java
happytimor/mybatis-helper
2ebf6bb9565d261a16bd17a568d1097728b2f319
[ "Apache-2.0" ]
8
2019-10-08T08:20:31.000Z
2022-01-13T02:26:15.000Z
mybatis-helper-single-database-test/src/main/java/io/github/happytimor/mybatis/helper/single/database/test/domain/TeacherInfo.java
happytimor/mybatis-helper
2ebf6bb9565d261a16bd17a568d1097728b2f319
[ "Apache-2.0" ]
1
2021-04-28T10:30:33.000Z
2021-04-28T10:30:33.000Z
mybatis-helper-single-database-test/src/main/java/io/github/happytimor/mybatis/helper/single/database/test/domain/TeacherInfo.java
happytimor/mybatis-helper
2ebf6bb9565d261a16bd17a568d1097728b2f319
[ "Apache-2.0" ]
null
null
null
package io.github.happytimor.mybatis.helper.single.database.test.domain; /** * @author chenpeng */ public class TeacherInfo { private Integer id; private String name; private Boolean deleted; private Boolean offline; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Boolean getDeleted() { return deleted; } public void setDeleted(Boolean deleted) { this.deleted = deleted; } public Boolean getOffline() { return offline; } public void setOffline(Boolean offline) { this.offline = offline; } }
17.909091
72
0.602792
0aa3c443a3a828d415f8141ee1c079b0ff4b60af
1,619
swift
Swift
XLayout/XLayout/XLayoutConstraintParam.swift
HsiangHo/XLayout
7221bde18159f89bd7af0e0645faa434f753eaf7
[ "MIT" ]
24
2019-08-29T07:28:48.000Z
2021-09-12T14:25:16.000Z
XLayout/XLayout/XLayoutConstraintParam.swift
mohsinalimat/XLayout
f1ff69c05882b46d808cd9cc78e34c4d22dc0f61
[ "MIT" ]
null
null
null
XLayout/XLayout/XLayoutConstraintParam.swift
mohsinalimat/XLayout
f1ff69c05882b46d808cd9cc78e34c4d22dc0f61
[ "MIT" ]
5
2019-08-30T10:20:12.000Z
2020-03-18T11:05:56.000Z
// // XLayoutConstraintParam.swift // XLayout // // Created by Jovi on 7/3/19. // Copyright © 2019 Jovi. All rights reserved. // import Foundation public class XLayoutConstraintParam { public var relation: XLayoutRelation public var secondItem: XLayoutView? public var attribute: XLayoutAttribute public var multiplier: CGFloat public var constant: CGFloat public var priority: XLayoutPriority var isSmart: Bool var context: Any? init(secItem: XLayoutView, attr: XLayoutAttribute, context: Any? = nil) { self.secondItem = secItem self.attribute = attr self.relation = .equal self.multiplier = 1.0 self.constant = 0 self.priority = XLayoutPriority.init(rawValue: 1000) self.isSmart = false self.context = context } init(isSmart: Bool = false) { self.secondItem = nil self.attribute = XLayoutAttribute.notAnAttribute self.relation = .equal self.multiplier = 1.0 self.constant = 0 self.priority = XLayoutPriority.init(rawValue: 1000) self.isSmart = isSmart self.context = nil } } extension XLayoutConstraintParam: Copyable { func copy() -> XLayoutConstraintParam { let instance = XLayoutConstraintParam.init(isSmart: self.isSmart) instance.secondItem = self.secondItem instance.attribute = self.attribute instance.relation = self.relation instance.multiplier = self.multiplier instance.constant = self.constant instance.priority = self.priority return instance } }
28.910714
77
0.663372
fc3c4e4613f435767327cc3c7782be4682baf8d6
3,497
css
CSS
public/style.css
ahtihska/beta
bb8c773f2945e2493b4f1a054245a8a8d16c8d81
[ "MIT" ]
1
2021-07-11T10:05:29.000Z
2021-07-11T10:05:29.000Z
public/style.css
ahtihska/beta
bb8c773f2945e2493b4f1a054245a8a8d16c8d81
[ "MIT" ]
null
null
null
public/style.css
ahtihska/beta
bb8c773f2945e2493b4f1a054245a8a8d16c8d81
[ "MIT" ]
null
null
null
*{ margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Lato', sans-serif; background: url("https://cdn.discordapp.com/attachments/852609611692245032/860200123808350258/wp6451487_Large.png"); background-repeat: no-repeat; background-size: cover; background-attachment: fixed; background-position: center; } video-grid{ display: flex; justify-content: center; } video { height: 300px; width: 400px; object-fit: cover; } .main { height: 100vh; display: flex; } .main__left { flex: 0.8; display: flex; flex-direction: column; border: 30px #ffffff; border-radius: 50px; } .main__right { flex: 0.2; } .main__videos { opacity: 0.8; } .main__videos{ flex-grow: 1; background-color: #A5539D; display: flex; justify-content: center; align-items: center; margin-top: 25px; margin-left: 10px; border-top-left-radius: 60px; border-top-right-radius: 60px; justify-content: center; align-items: center; } .main__controls { display: flex; background-color: #7c5295; color: #2B092A; padding: 5px; margin-bottom: 25px; margin-left: 10px; justify-content: space-between; border-bottom-left-radius: 25px; border-bottom-right-radius: 25px; } .main__controls__block{ display: flex; } .main__controls__button { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 8px 10px; min-width: 80px; cursor: pointer; } .main__controls__button:hover { background-color: #ebaefd; border-radius: 100px; transform: translateY(-3px); box-shadow: 0 15px 20px rgba(0, 0, 0, 0.2); transition: all 0.3s; } .main__controls__button:active { background-color: #ebaefd; border-radius: 100px; transform: translateY(-1px); box-shadow: 0 10px 10px rgba(0, 0, 0, 0.2); transition: all 0.3s; } .main__controls__button i { font-size: 20px; } .main__right { display: flex; flex-direction: column; background-color :#E69ACB; border: 10px solid #F1C4E1; border-radius: 60px; position: fixed; top: 180px; bottom: 120px; right: 60px; width: 300px; } .main__header { padding-top: 5px; color:#232946; text-align: center; } .main__chat_window { flex-grow: 1; overflow-y: scroll; scrollbar-width: none; } .messages{ list-style: none; } .message { margin-left: 5px; padding: 20px 40px; color: white; background-color: #652D5D; border-radius: 100px; margin-top: 6px; } .main__message_container input { margin-bottom: 10px; margin-left: 45px; padding-top: 5px; padding-bottom: 5px; padding-left: 20px; flex-grow: 1; background-color: #652D5D; border-radius: 100px; border: 1px solid #652D5D; color: #ffffff; } .leave_meeting { color: hsl(71, 83%, 61%); } .leave_meeting:hover { color: #2F0E2B; } .unmute, .stop { color: #1A0A18; } .messages { list-style: none; } .main__message_container { color: black; } @media (max-width: 992px) { .alert-validate::before { visibility: visible; opacity: 1; } } /*////////////////////////////////////////////////////////////////// [ responsive ]*/ @media (max-width: 480px) { .wrap-login100 { padding-left: 15px; padding-right: 15px; } }
17.39801
120
0.607092
508fc198d46ada79da881d4a18194582707f003c
6,778
html
HTML
app/templates/base.html
Starscream-11813/CpZen
211f7322dbd02d484f1782e941cb202dd0c20443
[ "MIT" ]
5
2021-10-19T16:01:27.000Z
2022-02-14T01:05:39.000Z
app/templates/base.html
Starscream-11813/CpZen
211f7322dbd02d484f1782e941cb202dd0c20443
[ "MIT" ]
null
null
null
app/templates/base.html
Starscream-11813/CpZen
211f7322dbd02d484f1782e941cb202dd0c20443
[ "MIT" ]
null
null
null
<html> <head> {{ codemirror.include_codemirror() }} <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> {%if current_user.is_authenticated%} <title>{{current_user.username}}-CpZen</title> {%else%} <title>CpZen</title> {%endif%} <link rel="icon" href="../static/cpicon.ico"> <link rel="stylesheet" href="../static/css/bootstrap.min.css"> <link rel="stylesheet" href="../addon/hint/show-hint.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> <script> function toggle(id) { if (document.getElementById(id).style.display == 'none') { document.getElementById(id).style.display = 'block'; } else { document.getElementById(id).style.display = 'none'; } } function doDL(s){ function dataUrl(data) {return "data:x-application/text," + escape(data); } window.open(dataUrl(s)); } </script> </head> <body> <div> <nav class="navbar navbar-expand navbar-light-md navbar-dark justify-content-md-start" style="background-color: #b1c451;"> <!-- <nav class="navbar navbar-expand-md navbar-dark border border-light bg-info" style="box-shadow: 0 4px 8px 0 rgba(255, 255, 255, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);"></nav> --> <div class="container"> <a class="navbar-brand text-dark" href="{{url_for('index')}}"><img src="https://i.im.ge/2021/07/23/7cJCa.png" alt="cplogo" style="width: 60px; height: 40px;"> </a> <ul class="nav navbar-nav navbar-collapse"> <li class="nav-item"><a href="{{url_for('index')}}" style="text-decoration: none;"> <b style="font-size: 2vw; color: black; font-family: 'Product Sans Medium'; font-weight: bold;">CpZen</b> <p style="font-size: 1vw; color: black; font-family: 'Product Sans';">for the Competitive Programmers</p></a> </li> </ul> <div class="collapse navbar-collapse"> <ul class = "nav navbar-nav navbar-left nav-pills" style="font-family: 'Product Sans';"> {%if current_user.is_anonymous %} <li class="nav-item"> <a class="btn btn-outline-dark" href="{{url_for('profileStatistics')}}"> <div class="item" style="vertical-align: top; display: inline-block;"> <img src="https://img.icons8.com/small/24/000000/user-male-circle.png"/> <span class="tab" style="display: block;">Profile Statistics</span> </div> </a> </li> <li class="nav-item"> <a class="btn btn-outline-dark" href="{{url_for('upcomingContests')}}"> <div class="item" style="vertical-align: top; display: inline-block;"> <img src="https://img.icons8.com/material-outlined/24/000000/clock--v1.png"/> <span class="tab" style="display: block;">Upcoming Contests</span> </div> </a> </li> {%else%} <li class="nav-item"> <a class="btn btn-outline-dark" href="{{url_for('profileStatistics')}}"> <div class="item" style="vertical-align: top; display: inline-block;"> <img src="https://img.icons8.com/small/24/000000/user-male-circle.png"/> <span class="tab" style="display: block;">Profile Statistics</span> </div> </a> </li> <li class="nav-item"> <a class="btn btn-outline-dark" href="{{url_for('upcomingContests')}}"> <div class="item" style="vertical-align: top; display: inline-block;"> <img src="https://img.icons8.com/material-outlined/24/000000/clock--v1.png"/> <span class="tab" style="display: block;">Upcoming Contests</span> </div> </a> </li> <a class="btn btn-outline-dark" href="{{url_for('saved')}}"> <div class="item" style="vertical-align: top; display: inline-block;"> <img src="https://img.icons8.com/material-outlined/24/000000/cloud-checked.png"/> <span class="tab" style="display: block;">Saved Files</span> </div> </a> <li> <a class="btn btn-outline-dark" href="{{url_for('template')}}"> <div class="item" style="vertical-align: top; display: inline-block;"> <img src="https://img.icons8.com/ios-glyphs/24/000000/google-code.png"/> <span class="tab" style="display: block;">Templates</span> </div> </a> </li> <li class="nav-item"> <a class="btn btn-outline-dark" href="{{url_for('algorithm_list')}}"> <div class="item" style="vertical-align: top; display: inline-block;"> <img src="https://img.icons8.com/external-itim2101-lineal-itim2101/24/000000/external-algorithm-artificial-intelligence-itim2101-lineal-itim2101.png"/> <span class="tab" style="display: block;">Algorithms</span> </div> </a> </li> </ul> {%endif%} </div> <ul class = "nav navbar-nav navbar-right" style="font-family: 'Product Sans';"> {%if current_user.is_anonymous %} <li> <a class="btn navbar-btn ml-2 text-white btn-secondary" href="{{url_for('login')}}">Login</a> </li> {%else%} <li> <a class="btn navbar-btn ml-2 text-white btn-secondary" href="{{url_for('logout')}}">Logout</a> </li> </ul> {%endif%} </div> </nav> </div> <div> {% with messages = get_flashed_messages() %} {% if messages %} {% for message in messages %} <div style="position:relative;padding:.75rem 1.25rem;margin-bottom:1rem;border:1px solid transparent;border-radius:.25rem;color:#4093ff;background-color:#b6e4ff;border-color:#4294ff; font-family: 'Product Sans'; font-weight: bold;">{{ message }}</div> {% endfor %} {% endif %} {% endwith %} {# application content needs to be provided in the app_content block #} {% block app_content %}{% endblock %} </div> <footer> <div class="border-light"> <div class="container"> <div class="text-dark"> <hr style="height:1px;border:none;color:#333;background-color:#333;" /> <p align="center" style="font-family: 'Product Sans';">Made with <a href="https://flask.palletsprojects.com/en/2.0.x/"> Flask</a>, <a href="https://www.jdoodle.com/compiler-api/"> JDoodle</a>, <a href="https://codemirror.net/">CodeMirror</a> and 💖 </p> </div></div></div> </footer> </body> </html>
42.099379
263
0.597816
fb46cba25cc2edf05167ed506d743b26300996f4
661
java
Java
app/src/main/java/dev/dworks/apps/anexplorer/directory/MarginDecoration.java
LaudateCorpus1/AnExplorer
e767593c69efa3622c45ba7d0345e89079a8d262
[ "Apache-2.0" ]
1,675
2015-01-19T04:51:31.000Z
2022-03-30T13:48:37.000Z
app/src/main/java/dev/dworks/apps/anexplorer/directory/MarginDecoration.java
LaudateCorpus1/AnExplorer
e767593c69efa3622c45ba7d0345e89079a8d262
[ "Apache-2.0" ]
84
2015-01-04T10:51:30.000Z
2021-12-26T13:19:59.000Z
app/src/main/java/dev/dworks/apps/anexplorer/directory/MarginDecoration.java
LaudateCorpus1/AnExplorer
e767593c69efa3622c45ba7d0345e89079a8d262
[ "Apache-2.0" ]
684
2015-01-22T03:03:55.000Z
2022-03-30T14:08:29.000Z
package dev.dworks.apps.anexplorer.directory; import android.content.Context; import android.graphics.Rect; import androidx.recyclerview.widget.RecyclerView; import android.view.View; import dev.dworks.apps.anexplorer.R; public class MarginDecoration extends RecyclerView.ItemDecoration { private final int margin; public MarginDecoration(Context context) { margin = context.getResources().getDimensionPixelSize(R.dimen.grid_item_padding)/2; } @Override public void getItemOffsets( Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { outRect.set(margin, margin, margin, margin); } }
30.045455
91
0.753404
6e47d2c1b08224ee6576a8739d3d13a1204ab171
15,723
html
HTML
docs/metadata.html
stroeer/tapir
9c2e193f60002f9f3c0644f4d586757599544137
[ "Apache-2.0" ]
6
2020-05-07T11:24:52.000Z
2022-03-21T16:58:30.000Z
docs/metadata.html
stroeer/tapir
9c2e193f60002f9f3c0644f4d586757599544137
[ "Apache-2.0" ]
313
2020-04-23T09:54:26.000Z
2022-03-28T08:37:55.000Z
docs/metadata.html
stroeer/tapir
9c2e193f60002f9f3c0644f4d586757599544137
[ "Apache-2.0" ]
10
2020-04-28T17:46:17.000Z
2021-08-31T07:20:54.000Z
<!DOCTYPE HTML> <html lang="en" class="sidebar-visible no-js light"> <head> <!-- Book generated using mdBook --> <meta charset="UTF-8"> <title>Metadata - tapir</title> <!-- Custom HTML head --> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="theme-color" content="#ffffff" /> <link rel="icon" href="favicon.svg"> <link rel="shortcut icon" href="favicon.png"> <link rel="stylesheet" href="css/variables.css"> <link rel="stylesheet" href="css/general.css"> <link rel="stylesheet" href="css/chrome.css"> <link rel="stylesheet" href="css/print.css" media="print"> <!-- Fonts --> <link rel="stylesheet" href="FontAwesome/css/font-awesome.css"> <link rel="stylesheet" href="fonts/fonts.css"> <!-- Highlight.js Stylesheets --> <link rel="stylesheet" href="highlight.css"> <link rel="stylesheet" href="tomorrow-night.css"> <link rel="stylesheet" href="ayu-highlight.css"> <!-- Custom theme stylesheets --> </head> <body> <!-- Provide site root to javascript --> <script type="text/javascript"> var path_to_root = ""; var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light"; </script> <!-- Work around some values being stored in localStorage wrapped in quotes --> <script type="text/javascript"> try { var theme = localStorage.getItem('mdbook-theme'); var sidebar = localStorage.getItem('mdbook-sidebar'); if (theme.startsWith('"') && theme.endsWith('"')) { localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1)); } if (sidebar.startsWith('"') && sidebar.endsWith('"')) { localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1)); } } catch (e) { } </script> <!-- Set the theme before any content is loaded, prevents flash --> <script type="text/javascript"> var theme; try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { } if (theme === null || theme === undefined) { theme = default_theme; } var html = document.querySelector('html'); html.classList.remove('no-js') html.classList.remove('light') html.classList.add(theme); html.classList.add('js'); </script> <!-- Hide / unhide sidebar before it is displayed --> <script type="text/javascript"> var html = document.querySelector('html'); var sidebar = 'hidden'; if (document.body.clientWidth >= 1080) { try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { } sidebar = sidebar || 'visible'; } html.classList.remove('sidebar-visible'); html.classList.add("sidebar-" + sidebar); </script> <nav id="sidebar" class="sidebar" aria-label="Table of contents"> <div class="sidebar-scrollbox"> <ol class="chapter"><li class="chapter-item expanded "><a href="00_introduction.html"><strong aria-hidden="true">1.</strong> 00 Introduction</a></li><li class="chapter-item expanded "><a href="article.html"><strong aria-hidden="true">2.</strong> Article</a></li><li class="chapter-item expanded "><a href="asset.html"><strong aria-hidden="true">3.</strong> Asset</a></li><li class="chapter-item expanded "><a href="body.html"><strong aria-hidden="true">4.</strong> Body</a></li><li class="chapter-item expanded "><a href="bodynode.html"><strong aria-hidden="true">5.</strong> BodyNode</a></li><li class="chapter-item expanded "><a href="element.html"><strong aria-hidden="true">6.</strong> Element</a></li><li class="chapter-item expanded "><a href="keyword.html"><strong aria-hidden="true">7.</strong> Keyword</a></li><li class="chapter-item expanded "><a href="metadata.html" class="active"><strong aria-hidden="true">8.</strong> Metadata</a></li><li class="chapter-item expanded "><a href="reference.html"><strong aria-hidden="true">9.</strong> Reference</a></li><li class="chapter-item expanded "><a href="stage.html"><strong aria-hidden="true">10.</strong> Stage</a></li><li class="chapter-item expanded "><a href="℠articlepageservice.html"><strong aria-hidden="true">11.</strong> ℠ArticlePageService</a></li><li class="chapter-item expanded "><a href="℠sectionpageservice.html"><strong aria-hidden="true">12.</strong> ℠SectionPageService</a></li><li class="chapter-item expanded "><a href="℠stageservice.html"><strong aria-hidden="true">13.</strong> ℠StageService</a></li></ol> </div> <div id="sidebar-resize-handle" class="sidebar-resize-handle"></div> </nav> <div id="page-wrapper" class="page-wrapper"> <div class="page"> <div id="menu-bar-hover-placeholder"></div> <div id="menu-bar" class="menu-bar sticky bordered"> <div class="left-buttons"> <button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar"> <i class="fa fa-bars"></i> </button> <button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list"> <i class="fa fa-paint-brush"></i> </button> <ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu"> <li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li> <li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li> <li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li> <li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li> <li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li> </ul> <button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar"> <i class="fa fa-search"></i> </button> </div> <h1 class="menu-title">tapir</h1> <div class="right-buttons"> <a href="print.html" title="Print this book" aria-label="Print this book"> <i id="print-button" class="fa fa-print"></i> </a> </div> </div> <div id="search-wrapper" class="hidden"> <form id="searchbar-outer" class="searchbar-outer"> <input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header"> </form> <div id="searchresults-outer" class="searchresults-outer hidden"> <div id="searchresults-header" class="searchresults-header"></div> <ul id="searchresults"> </ul> </div> </div> <!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM --> <script type="text/javascript"> document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible'); document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible'); Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) { link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1); }); </script> <div id="content" class="content"> <main> <h1 id="metadata"><a class="header" href="#metadata">Metadata</a></h1> <pre><code class="language-protobuf">message Metadata {} </code></pre> <p>Article metadata like publication state and technical timestamps. <a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L323-L327">[~]</a></p> <h2 id="state"><a class="header" href="#state"><code>state</code></a></h2> <pre><code class="language-protobuf">State state = 1; </code></pre> <p>State of the article in the content management system. See <a href="#enum-state"><code>enum State</code></a> <a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L330-L335">[~]</a></p> <h2 id="start_time"><a class="header" href="#start_time"><code>start_time</code></a></h2> <pre><code class="language-protobuf">google.protobuf.Timestamp start_time = 2; </code></pre> <p>Manually set editorial timestamp (<em>Gültig von</em>) at which the article is valid to deliver on digital platforms in seconds of UTC time since Unix epoch. <a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L339-L345">[~]</a></p> <h2 id="end_time"><a class="header" href="#end_time"><code>end_time</code></a></h2> <pre><code class="language-protobuf">google.protobuf.Timestamp end_time = 3; </code></pre> <p>Manually set editorial date (<em>Gültig bis</em>) till the article is valid to deliver on digital platforms in seconds of UTC time since Unix epoch. <a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L349-L355">[~]</a></p> <h2 id="publish_time"><a class="header" href="#publish_time"><code>publish_time</code></a></h2> <pre><code class="language-protobuf">google.protobuf.Timestamp publish_time = 4; </code></pre> <p>Editorial date (<em>Publikationsdatum</em>) of the first publication of the article in seconds of UTC time since Unix epoch.</p> <p>This date will be set automatically by the content management system. <a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L359-L367">[~]</a></p> <h2 id="update_time"><a class="header" href="#update_time"><code>update_time</code></a></h2> <pre><code class="language-protobuf">google.protobuf.Timestamp update_time = 5; </code></pre> <p>Editorial date (<em>Aktualisierungsdatum</em>) at which the article was updated in seconds of UTC time since Unix epoch.</p> <p>On first publication this timestamp matches <code>publish_time</code>. Afterwards it's either updated manually in the content management system or automatically if the article content changed significantly. <a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L371-L381">[~]</a></p> <h2 id="transformation_time"><a class="header" href="#transformation_time"><code>transformation_time</code></a></h2> <pre><code class="language-protobuf">google.protobuf.Timestamp transformation_time = 6; </code></pre> <p>Technical timestamp at which the article was transformed in the API layer in seconds of UTC time since Unix epoch. <a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L385-L391">[~]</a></p> <h2 id="transformation_errors"><a class="header" href="#transformation_errors"><code>transformation_errors</code></a></h2> <pre><code class="language-protobuf">int64 transformation_errors = 7; </code></pre> <p>Number of errors occurred while fetching and/or transforming optional article components (e.g. embeds) to an <code>article</code> message. <a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L395-L401">[~]</a></p> <h2 id="enum-state"><a class="header" href="#enum-state"><code>enum State</code></a></h2> <p>State of the item (<a href="article.html"><code>Article</code></a>, <a href="element.html"><code>Element</code></a>) in the content management system. The <code>state</code> in combination with <a href="#start_time">start_time</a> and <a href="#end_time">end_time</a> determines whether or not this item should be rendered; this must be respected by all consumers especially when content is duplicated or cached.</p> <p>The terms <code>deleted</code> (articles) and <code>archived</code> (media lib) are interchangeable/synonyms. This enum combines those two into <code>State.DELETED</code>. An Article is in <code>State.DELETED</code> if it was deleted in the content management system, or if it's <a href="#end_time">end_time</a> has been reached.</p> <p>An Article is in <code>State.DRAFT</code> if it has never been published, or if the <a href="#start_time">start_time</a> lies in the future.</p> <pre><code class="language-protobuf">enum State { STATE_UNSPECIFIED = 0; PUBLISHED = 1; DELETED = 2; DRAFT = 3; } </code></pre> <p><a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L405-L429">[~]</a></p> <p><a href="https://github.com/stroeer/tapir/blob/master/stroeer/core/v1/article.proto#L439-L440">[~]</a></p> </main> <nav class="nav-wrapper" aria-label="Page navigation"> <!-- Mobile navigation buttons --> <a rel="prev" href="keyword.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> <i class="fa fa-angle-left"></i> </a> <a rel="next" href="reference.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> <i class="fa fa-angle-right"></i> </a> <div style="clear: both"></div> </nav> </div> </div> <nav class="nav-wide-wrapper" aria-label="Page navigation"> <a rel="prev" href="keyword.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left"> <i class="fa fa-angle-left"></i> </a> <a rel="next" href="reference.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right"> <i class="fa fa-angle-right"></i> </a> </nav> </div> <script type="text/javascript"> window.playground_copyable = true; </script> <script src="elasticlunr.min.js" type="text/javascript" charset="utf-8"></script> <script src="mark.min.js" type="text/javascript" charset="utf-8"></script> <script src="searcher.js" type="text/javascript" charset="utf-8"></script> <script src="clipboard.min.js" type="text/javascript" charset="utf-8"></script> <script src="highlight.js" type="text/javascript" charset="utf-8"></script> <script src="book.js" type="text/javascript" charset="utf-8"></script> <!-- Custom JS scripts --> </body> </html>
63.399194
1,599
0.607072
70cbf6156dcd7ad56ca08f269f7644960423a798
1,104
cs
C#
ItemPipes/Framework/Nodes/ObjectNodes/FilterPipeNode.cs
sergiomadd/StardewValleyMods
fccf014e56438b4d6ed2f55b228df9c33a736c64
[ "MIT" ]
2
2021-11-03T18:58:54.000Z
2021-11-04T21:34:32.000Z
ItemPipes/Framework/Nodes/ObjectNodes/FilterPipeNode.cs
sergiomadd/StardewValleyMods
fccf014e56438b4d6ed2f55b228df9c33a736c64
[ "MIT" ]
2
2021-11-26T19:05:38.000Z
2021-11-26T19:25:00.000Z
ItemPipes/Framework/Nodes/ObjectNodes/FilterPipeNode.cs
sergiomadd/StardewValleyMods
fccf014e56438b4d6ed2f55b228df9c33a736c64
[ "MIT" ]
null
null
null
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xna.Framework; using StardewValley; using StardewValley.Objects; using ItemPipes.Framework.Util; using ItemPipes.Framework.Items; using StardewValley.Menus; using Netcode; using ItemPipes.Framework.Items.Objects; namespace ItemPipes.Framework.Nodes.ObjectNodes { public class FilterPipeNode : InputPipeNode { public FilterPipeNode() : base() { } public FilterPipeNode(Vector2 position, GameLocation location, StardewValley.Object obj) : base(position, location, obj) { ConnectedContainer = null; Priority = 3; if(obj != null && obj is FilterPipeItem) { Filter = (obj as FilterPipeItem).Filter.items; } ItemTimer = 500; } public override void UpdateFilter() { if (ConnectedContainer != null) { ConnectedContainer.UpdateFilter(Filter); } } } }
24.533333
128
0.625906
01ff2730d411cbfb060205b13c0c94ef972c565f
113
sql
SQL
server/src/main/resources/db/common/V33__alter_member_skills_table.sql
sonndinh/check-ins
ca664c8ec56f3315eae80c99b8890951bae2d68d
[ "Apache-2.0" ]
7
2020-06-10T01:39:18.000Z
2021-06-08T16:17:24.000Z
server/src/main/resources/db/common/V33__alter_member_skills_table.sql
sonndinh/check-ins
ca664c8ec56f3315eae80c99b8890951bae2d68d
[ "Apache-2.0" ]
949
2020-05-19T20:42:58.000Z
2022-01-12T22:15:26.000Z
server/src/main/resources/db/common/V33__alter_member_skills_table.sql
sonndinh/check-ins
ca664c8ec56f3315eae80c99b8890951bae2d68d
[ "Apache-2.0" ]
5
2020-06-24T15:20:34.000Z
2021-11-25T12:14:00.000Z
ALTER TABLE member_skills ADD COLUMN skilllevel varchar; ALTER TABLE member_skills ADD COLUMN lastuseddate date;
22.6
30
0.858407
a641b788ec4de6393f65290a6716b6aa05fa6619
5,025
ps1
PowerShell
scripts/azure-az-create-kusto-cluster.ps1
microsoft/CollectServiceFabricData
9025774cedc5e858dfa3833ae018d518064cae8a
[ "MIT" ]
11
2019-10-11T01:20:38.000Z
2021-09-30T00:14:24.000Z
scripts/azure-az-create-kusto-cluster.ps1
jagilber/CollectServiceFabricData
fa422cb2b01efd7fbe2d3132808985285c29620c
[ "MIT" ]
1
2019-10-31T23:59:06.000Z
2019-11-01T01:29:33.000Z
scripts/azure-az-create-kusto-cluster.ps1
microsoft/CollectServiceFabricData
9025774cedc5e858dfa3833ae018d518064cae8a
[ "MIT" ]
15
2019-10-08T11:29:25.000Z
2021-03-28T20:59:45.000Z
<# create test kusto cluster .\azure-az-create-kusto-cluster.ps1 -resourceGroupName -resourceGroupLocation -appRegistrationId #> param( $resourceGroupName = 'collectsfdataunittest', [Parameter(Mandatory = $true)] $resourceGroupLocation = '', $appRegistrationId, $clusterName = 'collectsfdataunittest', $databaseName = 'collectsfdatadb', $skuName = 'Dev(No SLA)_Standard_E2a_V4', # Dev(No SLA)_Standard_D11_v2 [ValidateSet('basic', 'standard')] $skuTier = 'basic', $databaseKind = 'readwrite', [switch]$force ) $PSModuleAutoLoadingPreference = 2 $ErrorActionPreference = "continue" $error.clear() if (!(get-module -ListAvailable az.kusto)) { install-module az.kusto import-module az.kusto } if (!(get-azresourcegroup)) { connect-azaccount } if (!(Get-AzResourceGroup -Name $resourceGroupName)) { write-warning "resource group does not exist. creating" new-azresourcegroup -Name $resourceGroupName -Location $resourceGroupLocation } $kustoClusters = @(Get-AzKustoCluster) write-host "current clusters" $kustoClusters if (($kustoClusters.Name -imatch $clusterName)) { write-error "cluster exists $clustername" if (!$force) { return } } $availableSkus = Get-AzKustoClusterSku | ? location -ieq $resourceGroupLocation | ? tier -ieq $skuTier write-host "available skus in $resourceGroupLocation" $availableSkus | convertto-json if (!($availableSkus | ? name -ieq $skuName)) { write-error "$skuName unavailable in $resourceGroupLocation" if (!$force) { return } } write-host "New-AzKustoCluster -name $clusterName ` -ResourceGroupName $resourceGroupName ` -Location $resourceGroupLocation ` -SkuName $skuName ` -SkuTier $skuTier ` -EnablePurge " write-host 'creating cluster will take around 15 minutes' $cluster = New-AzKustoCluster -name $clusterName ` -ResourceGroupName $resourceGroupName ` -Location $resourceGroupLocation ` -SkuName $skuName ` -SkuTier $skuTier ` -EnablePurge $cluster | convertto-json write-host "$database = New-AzKustoDatabase -ClusterName $clusterName ` -Name $databaseName ` -ResourceGroupName $resourceGroupName ` -Location $resourceGroupLocation ` -Kind $databaseKind " write-host "creating database" $database = New-AzKustoDatabase -ClusterName $clusterName ` -Name $databaseName ` -ResourceGroupName $resourceGroupName ` -Location $resourceGroupLocation ` -Kind $databaseKind $database | convertto-json <# COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. INPUTOBJECT : Identity Parameter [AttachedDatabaseConfigurationName <String>]: The name of the attached database configuration. [ClusterName <String>]: The name of the Kusto cluster. [DataConnectionName <String>]: The name of the data connection. [DatabaseName <String>]: The name of the database in the Kusto cluster. [Id <String>]: Resource identity path [Location <String>]: Azure location. [PrincipalAssignmentName <String>]: The name of the Kusto principalAssignment. [ResourceGroupName <String>]: The name of the resource group containing the Kusto cluster. [SubscriptionId <String>]: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. VALUE <IDatabasePrincipal[]>: The list of Kusto database principals. Name <String>: Database principal name. Role <DatabasePrincipalRole>: Database principal role. Type <DatabasePrincipalType>: Database principal type. [AppId <String>]: Application id - relevant only for application principal type. [Email <String>]: Database principal email if exists. [Fqn <String>]: Database principal fully qualified name. #> if ($appRegistrationId -and (get-azadapplication -applicationId $appRegistrationId)) { write-host "Add-AzKustoDatabasePrincipal -ClusterName $clusterName ` -DatabaseName $databaseName ` -ResourceGroupName $resourceGroupName ` -Value (@{Name = $appRegistrationId; Role = 'Admin'; Type = 'App'; AppId = $appRegistrationId }) " write-host "adding principal" $principal = Add-AzKustoDatabasePrincipal -ClusterName $clusterName ` -DatabaseName $databaseName ` -ResourceGroupName $resourceGroupName ` -Value (@{Name = $appRegistrationId; Role = 'Admin'; Type = 'App'; AppId = $appRegistrationId }) $principal | convertto-json } <# $assignment = New-AzKustoDatabasePrincipalAssignment -ClusterName $clusterName ` -DatabaseName $databaseName ` -ResourceGroupName $resourceGroupName ` -PrincipalAssignmentName $appRegistrationId ` -PrincipalId $appRegistrationId ` -PrincipalType 'App' ` -Role 'Admin' $assignment | convertto-json #> $global:cluster = $cluster write-host 'finished. object stored in `$global:cluster' write-host "data ingestion uri: $($cluster.DataIngestionUri)/$databaseName"
33.724832
176
0.743085
904114c719b963917e071676f51d6584b7614b04
1,568
go
Go
lab243/lab003/main.go
liguoqinjim/go-labs
3a63e7ac3fe3f3b526a92a319fc07ca2b76ecd61
[ "MIT" ]
10
2017-04-25T12:01:25.000Z
2020-07-02T14:08:39.000Z
lab243/lab003/main.go
liguoqinjim/go-labs
3a63e7ac3fe3f3b526a92a319fc07ca2b76ecd61
[ "MIT" ]
null
null
null
lab243/lab003/main.go
liguoqinjim/go-labs
3a63e7ac3fe3f3b526a92a319fc07ca2b76ecd61
[ "MIT" ]
9
2017-06-13T06:51:02.000Z
2022-02-28T14:42:30.000Z
package main import ( "flag" "fmt" "github.com/spf13/pflag" "github.com/spf13/viper" "gorm.io/driver/mysql" "gorm.io/gorm" "log" ) var ( db *gorm.DB ) var ( host string port string dbName string user string password string ) func init() { log.SetFlags(log.LstdFlags | log.Lshortfile) pflag.StringVarP(&host, "host", "h", "127.0.0.1", "db host") pflag.StringVarP(&port, "port", "p", "3306", "db port") pflag.StringVarP(&dbName, "dbName", "d", "temp", "db name") pflag.StringVarP(&user, "user", "u", "root", "db user") pflag.StringVarP(&password, "password", "P", "", "db port") pflag.CommandLine.AddGoFlagSet(flag.CommandLine) pflag.Parse() viper.BindPFlags(pflag.CommandLine) open() } //连接数据库 func open() { //mysql链接样例:username:password@tcp(host:port)/dbname?charset=utf8&parseTime=True&loc=Local&tls=skip-verify&autocommit=true dsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&parseTime=True&loc=Local", user, password, host, port, dbName) var err error db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{}) if err != nil { log.Fatalf("connnect mysql error:%v", err) } else { log.Println("connect mysql success") } } func main() { updates() } func updates() { var user User if err := db.First(&user).Error; err != nil { log.Fatalf("db.First error:%v", err) } log.Printf("user:%+v", user) //update ups := map[string]interface{}{ "username": "new_name", } if err := db.Model(&user).Updates(ups).Error; err != nil { log.Fatalf("updates error:%v", err) } log.Printf("user:%+v", user) }
20.363636
122
0.647321
64f3b416b334806e6303f763bea95f6f058de0f3
2,219
java
Java
analysis/reverse-engineering/decompile-fitts-20191031-2200/sources/kr/co/popone/fitts/base/extension/KeyboardExtensionKt.java
skkuse-adv/2019Fall_team2
3ea84c6be39855f54634a7f9b1093e80893886eb
[ "Apache-2.0" ]
4
2019-10-07T05:17:21.000Z
2020-11-02T08:29:13.000Z
analysis/reverse-engineering/decompile-fitts-with-gradle-20191031-2200/src/main/java/kr/co/popone/fitts/base/extension/KeyboardExtensionKt.java
skkuse-adv/2019Fall_team2
3ea84c6be39855f54634a7f9b1093e80893886eb
[ "Apache-2.0" ]
38
2019-10-07T02:40:35.000Z
2019-12-12T09:15:24.000Z
analysis/reverse-engineering/decompile-fitts-20191031-2200/sources/kr/co/popone/fitts/base/extension/KeyboardExtensionKt.java
skkuse-adv/2019Fall_team2
3ea84c6be39855f54634a7f9b1093e80893886eb
[ "Apache-2.0" ]
5
2019-10-07T02:41:15.000Z
2020-10-30T01:36:08.000Z
package kr.co.popone.fitts.base.extension; import android.app.Activity; import android.content.Context; import android.view.View; import android.view.inputmethod.InputMethodManager; import kotlin.TypeCastException; import kotlin.jvm.internal.Intrinsics; import org.jetbrains.annotations.NotNull; public final class KeyboardExtensionKt { public static final void showKeyboard(@NotNull Activity activity, @NotNull View view) { Intrinsics.checkParameterIsNotNull(activity, "receiver$0"); Intrinsics.checkParameterIsNotNull(view, "view"); Object systemService = activity.getSystemService("input_method"); if (systemService != null) { InputMethodManager inputMethodManager = (InputMethodManager) systemService; view.requestFocus(); inputMethodManager.showSoftInput(view, 0); return; } throw new TypeCastException("null cannot be cast to non-null type android.view.inputmethod.InputMethodManager"); } public static final void hideKeyboard(@NotNull Activity activity, @NotNull View view) { Intrinsics.checkParameterIsNotNull(activity, "receiver$0"); Intrinsics.checkParameterIsNotNull(view, "view"); Object systemService = activity.getSystemService("input_method"); if (systemService != null) { ((InputMethodManager) systemService).hideSoftInputFromWindow(view.getWindowToken(), 0); return; } throw new TypeCastException("null cannot be cast to non-null type android.view.inputmethod.InputMethodManager"); } public static final void hideKeyboard(@NotNull Context context, @NotNull View view) { Intrinsics.checkParameterIsNotNull(context, "receiver$0"); Intrinsics.checkParameterIsNotNull(view, "view"); Object systemService = context.getSystemService("input_method"); if (systemService != null) { ((InputMethodManager) systemService).hideSoftInputFromWindow(view.getWindowToken(), 0); return; } throw new TypeCastException("null cannot be cast to non-null type android.view.inputmethod.InputMethodManager"); } }
47.212766
121
0.700766
803c3a5cf861c8a03bd32e0cfffd20ba06609f16
1,526
java
Java
src/main/java/me/steven/carrier/mixin/MixinPlayerEntity.java
lucaargolo/Carrier
b9b08501fb81d8b707b0eea8f096e0f88799cbd9
[ "Apache-2.0" ]
5
2020-09-19T12:33:17.000Z
2022-01-17T16:11:08.000Z
src/main/java/me/steven/carrier/mixin/MixinPlayerEntity.java
lucaargolo/Carrier
b9b08501fb81d8b707b0eea8f096e0f88799cbd9
[ "Apache-2.0" ]
42
2020-09-22T11:17:15.000Z
2022-03-08T07:54:13.000Z
src/main/java/me/steven/carrier/mixin/MixinPlayerEntity.java
lucaargolo/Carrier
b9b08501fb81d8b707b0eea8f096e0f88799cbd9
[ "Apache-2.0" ]
9
2020-09-21T20:06:06.000Z
2022-01-27T04:56:19.000Z
package me.steven.carrier.mixin; import me.steven.carrier.Carrier; import me.steven.carrier.api.CarrierComponent; import me.steven.carrier.api.CarryingData; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @Mixin(PlayerEntity.class) public abstract class MixinPlayerEntity extends LivingEntity { protected MixinPlayerEntity(EntityType<? extends LivingEntity> entityType, World world) { super(entityType, world); } @Inject(method = "updateSwimming", at = @At("HEAD"), cancellable = true) private void a(CallbackInfo ci) { CarrierComponent carrier = Carrier.HOLDER.get(this); CarryingData carrying = carrier.getCarryingData(); if (carrying != null) { setSwimming(false); ci.cancel(); } } @Inject(method = "checkFallFlying", at = @At("HEAD"), cancellable = true) private void b(CallbackInfoReturnable<Boolean> cir) { CarrierComponent carrier = Carrier.HOLDER.get(this); CarryingData carrying = carrier.getCarryingData(); if (carrying != null) { cir.setReturnValue(false); } } }
37.219512
93
0.724115
bab532c9baaac0787c9d0b9bbdaf42e6679cd334
4,776
go
Go
pkg/git/wrapper.go
naveego/bosun
6dc2ffab4ba2a08fa619356fd1d7b7916359248e
[ "MIT" ]
6
2018-12-15T15:11:18.000Z
2021-02-20T18:06:53.000Z
pkg/git/wrapper.go
naveego/bosun
6dc2ffab4ba2a08fa619356fd1d7b7916359248e
[ "MIT" ]
89
2019-01-03T18:49:21.000Z
2021-02-26T19:16:22.000Z
pkg/git/wrapper.go
naveego/bosun
6dc2ffab4ba2a08fa619356fd1d7b7916359248e
[ "MIT" ]
1
2019-12-15T17:01:50.000Z
2019-12-15T17:01:50.000Z
package git import ( "github.com/naveego/bosun/pkg/command" "github.com/naveego/bosun/pkg/core" "github.com/pkg/errors" "regexp" "strings" "sync" ) type GitWrapper struct { dir string } func NewGitWrapper(pathHint string) (GitWrapper, error) { dir, err := GetRepoPath(pathHint) if err != nil { return GitWrapper{}, err } return GitWrapper{ dir: dir, }, nil } func (g GitWrapper) Dir() string { return g.dir } func (g GitWrapper) ExecLines(args ...string) ([]string, error) { text, err := g.Exec(args...) if err != nil { return nil, err } if len(text) == 0 { return nil, nil } return strings.Split(text, "\n"), nil } func (g GitWrapper) Exec(args ...string) (string, error) { args = append([]string{"-C", g.dir}, args...) out, err := command.NewShellExe("git", args...).RunOut() if err != nil { return "", errors.Errorf("git %s\nOutput: %s\nError: %s", strings.Join(args, " "), out, err) } return out, err } func (g GitWrapper) ExecVerbose(args ...string) (string, error) { args = append([]string{"-C", g.dir}, args...) out, err := command.NewShellExe("git", args...).RunOutLog() if err != nil { return "", errors.Errorf("git %s\nOutput: %s\nError: %s", strings.Join(args, " "), out, err) } return out, err } func (g GitWrapper) Branch() string { o, _ := command.NewShellExe("git", "-C", g.dir, "rev-parse", "--abbrev-ref", "HEAD").RunOut() return o } func (g GitWrapper) GetCurrentCommit() string { o, _ := command.NewShellExe("git", "-C", g.dir, "log", "--pretty=format:'%h'", "-n", "1").RunOut() return strings.Trim(o, "'") } func (g GitWrapper) Tag() string { o, _ := command.NewShellExe("git", "-C", g.dir, "describe", "--abbrev=0", "--tags").RunOut() return o } func (g GitWrapper) Pull() error { err := command.NewShellExe("git", "-C", g.dir, "pull").RunE() return err } func (g GitWrapper) PullRebase() error { err := command.NewShellExe("git", "-C", g.dir, "pull", "--rebase").RunE() return err } func (g GitWrapper) IsMerged(fromBranch, toBranch string) bool { _, err := g.Exec("merge-base", "--is-ancestor", fromBranch, toBranch) return err == nil } var fetched = map[string]bool{} var fetchedMu = &sync.Mutex{} func (g GitWrapper) Fetch(flags ...string) error { fetchedMu.Lock() defer fetchedMu.Unlock() // don't fetch again if we've already fetched during this run if !fetched[g.dir] { args := append([]string{"-C", g.dir, "fetch"}, flags...) err := command.NewShellExe("git", args...).RunE() if err != nil { return err } fetched[g.dir] = true } return nil } func (g GitWrapper) IsDirty() bool { out, err := command.NewShellExe("git", "-C", g.dir, "diff", "HEAD").RunOut() if len(out) > 0 || err != nil { return true } out, err = command.NewShellExe("git", "-C", g.dir, "status", "--short").RunOut() if len(out) > 0 || err != nil { return true } return false } func (g GitWrapper) Log(args ...string) ([]string, error) { args = append([]string{"-C", g.dir, "log"}, args...) out, err := command.NewShellExe("git", args...).RunOut() lines := strings.Split(out, "\n") return lines, err } func (g GitWrapper) CreateBranch(branch string) error { if list, err := g.Exec("branch", "--list", branch); err == nil && len(list) > 0 { return nil } core.Log.Infof("Creating branch %q.", branch) _, err := g.Exec("checkout", "-B", branch) if err != nil { return errors.Wrap(err, "create branch") } core.Log.WithField("branch", branch).Info("Pushing branch.") err = command.NewShellExe("git", "push", "-u", "origin", branch).RunE() if err != nil { return errors.Wrap(err, "push branch") } return nil } func (g GitWrapper) Push() error { core.Log.Info("Pushing current branch.") _, err := g.Exec("push") return err } func (g GitWrapper) CheckOutBranch(branch string) error { _, err := g.Exec("checkout", branch) return err } func (g GitWrapper) CheckOutOrCreateBranch(branch string) error { _, err := g.Exec("checkout", "-b", branch) if err != nil { _, err = g.Exec("checkout", branch) } return err } func (g GitWrapper) AddAndCommit(message string, files ...string) error { args := append([]string{"add"}, files...) _, err := g.Exec(args...) if err != nil { return err } _, err = g.Exec("commit", "-m", message) return err } func (g GitWrapper) Worktree(branch BranchName) (Worktree, error) { return NewWorktree(g, branch) } func (g GitWrapper) Branches() []string { branches, _ := g.ExecLines("branch", "--list") return branches } var slugRE = regexp.MustCompile(`\W+`) func Slug(in string) string { slug := slugRE.ReplaceAllString(strings.ToLower(in), "-") for len(slug) > 30 { cutoff := strings.LastIndex(slug, "-") if cutoff < 0 || cutoff > 30 { return slug } slug = slug[:cutoff] } return slug }
23.297561
99
0.629397
80aef695af6f9fa2067e1b91cfd2c1ed50fa9ff0
15,629
java
Java
soottocfg/src/main/java/soottocfg/soot/SootRunner.java
peterschrammel/jayhorn
8b1c4f6f186a37c5723a0509451fbbad1a04e7d5
[ "MIT" ]
null
null
null
soottocfg/src/main/java/soottocfg/soot/SootRunner.java
peterschrammel/jayhorn
8b1c4f6f186a37c5723a0509451fbbad1a04e7d5
[ "MIT" ]
null
null
null
soottocfg/src/main/java/soottocfg/soot/SootRunner.java
peterschrammel/jayhorn
8b1c4f6f186a37c5723a0509451fbbad1a04e7d5
[ "MIT" ]
null
null
null
/* * jimple2boogie - Translates Jimple (or Java) Programs to Boogie * Copyright (C) 2013 Martin Schaeaeaef and Stephan Arlt * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package soottocfg.soot; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; import java.util.LinkedList; import java.util.List; import java.util.jar.Attributes; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; import com.google.common.base.Verify; import com.google.common.io.ByteStreams; import com.google.common.io.Files; import com.google.common.reflect.ClassPath; import com.google.common.reflect.ClassPath.ClassInfo; import soot.ArrayType; import soot.BooleanType; import soot.Modifier; import soot.PackManager; import soot.RefType; import soot.Scene; import soot.SootClass; import soot.SootField; import soot.SootMethod; import soot.Type; import soot.VoidType; import soot.jimple.Jimple; import soot.jimple.JimpleBody; import soottocfg.Options; /** * The Soot Runner * * @author schaef * @author Dietsch */ public class SootRunner { private final soot.options.Options sootOpt; // private final List<String> resolvedClassNames; public SootRunner() { this(new ArrayList<String>()); } public SootRunner(List<String> resolvedClassNames) { this.sootOpt = soot.options.Options.v(); } public void run(String input, String classPath) { if (null == input || input.isEmpty()) { return; } if (input.endsWith(".jar")) { // run with JAR file runWithJar(input, classPath); throw new RuntimeException("currently not tested"); } else if (input.endsWith(".apk")) { runWithApk(input, classPath); throw new RuntimeException("currently not tested"); } else { File file = new File(input); if (file.isDirectory()) { runWithPath(input, classPath); } else { throw new RuntimeException("Don't know what to do with: " + input); } } } /** * Runs Soot by using a JAR file * * @param jarFile * JAR file * @param classPath * Optional classpath (may be null) * */ private void runWithJar(String jarFile, String classPath) { try { // extract dependent JARs List<File> jarFiles = new ArrayList<File>(); jarFiles.addAll(extractClassPath(new File(jarFile))); jarFiles.add(new File(jarFile)); // additional classpath available? String cp = buildClassPath(jarFiles); if (classPath != null) { cp += File.pathSeparatorChar + classPath; } // set soot-class-path sootOpt.set_soot_classpath(cp); // finally, run soot loadClassesIntoScene(enumClasses(new File(jarFile))); } catch (Exception e) { throw e; } } private void runWithApk(String apkFile, String androidPlatformPath) { try { sootOpt.set_src_prec(soot.options.Options.src_prec_apk); // https://github.com/Sable/android-platforms if (androidPlatformPath == null) { throw new RuntimeException( "You need to pass the android-platforms folder from https://github.com/Sable/android-platforms"); } sootOpt.set_android_jars(androidPlatformPath); List<String> procdir = new LinkedList<String>(); procdir.add(apkFile); sootOpt.set_process_dir(procdir); // finally, run soot loadClassesIntoScene(enumClasses(new File(apkFile))); } catch (Exception e) { throw e; } } /** * Runs Soot by using a path (e.g., from Joogie) * * @param path * Path * @param classPath Optional classpath (may be null) * @param classPath * Optional classpath (may be null) */ private void runWithPath(String path, String classPath) { try { // dependent JAR files List<File> jarFiles = new ArrayList<File>(); // additional classpath available? String cp = buildClassPath(jarFiles); if (classPath != null) { cp += File.pathSeparatorChar + classPath; } // set soot-class-path sootOpt.set_soot_classpath(cp); sootOpt.set_src_prec(soot.options.Options.src_prec_only_class); List<String> processDirs = new LinkedList<String>(); processDirs.add(path); if (Options.v().useBuiltInSpecs()) { File specDir = new File("spec_stuff/"); writeSpecPackageToDisc(specDir); processDirs.add(specDir.getAbsolutePath()); } if (Options.v().checkMixedJavaClassFiles()) { enforceNoSrcPolicy(processDirs); } sootOpt.set_process_dir(processDirs); // finally, run soot loadClassesIntoScene(new LinkedList<String>()); // now set the main class inferMainMethod(); } catch (Exception e) { throw e; } } private void inferMainMethod() { SootMethod mainMethod = null; SootClass mainClass = null; boolean toManyMains = false; StringBuilder sb = new StringBuilder(); for (SootClass c : Scene.v().getApplicationClasses()) { if (c.declaresMethod("main", Arrays.asList((Type)ArrayType.v(RefType.v("java.lang.String"), 1)), VoidType.v())) { if (mainMethod != null) { toManyMains = true; } mainMethod = c.getMethod("main", Arrays.asList((Type)ArrayType.v(RefType.v("java.lang.String"), 1)), VoidType.v()); mainClass = c; // System.err.println(mainMethod.getSignature()); sb.append(mainMethod.getSignature()); sb.append("\n"); } } Verify.verify(mainClass!=null && mainMethod!=null, "No main method found. Terminating."); Scene.v().setMainClass(mainClass); if (toManyMains) { System.err.println("More than one main found:"); System.err.println(sb.toString()); System.err.println("Picking the last one."); } } /** * Soot only runs properly if there are only class files in the processed * directory. * If there are source files mixed with class files, stange errors happen * because * soot mixes them in the scene. * To avoid these random error, we fail early. * * @param dirs */ private void enforceNoSrcPolicy(List<String> dirs) { for (String dir : dirs) { for (File f : Files.fileTreeTraverser().preOrderTraversal(new File(dir))) { if (f != null && f.isFile() && f.getName().endsWith(".java")) { StringBuilder sb = new StringBuilder(); sb.append("Found mix of source and class files in folder "); sb.append(f.getParent()); sb.append("\nSoot expects a directory tree that only contains class files.\n"); sb.append("Please create a directory, compile your code with javac -d [dir]\n"); sb.append("and pass us this dir. Sorry for the inconvenience."); System.err.println(sb.toString()); throw new UnsupportedOperationException("Bad value for -j argument."); } } } } /** * Run Soot and creates an inter-procedural callgraph that could be loaded * by Soot. * * @param classes * additional classes that need to be loaded (e.g., when * analyzing jars) */ protected void loadClassesIntoScene(List<String> classes) { sootOpt.set_keep_line_number(true); sootOpt.set_prepend_classpath(true); // -pp sootOpt.set_output_format(soot.options.Options.output_format_none); // prevent strange assertion optimization. sootOpt.setPhaseOption("jop.cpf", "enabled:false"); sootOpt.set_allow_phantom_refs(true); for (String s : classes) { Scene.v().addBasicClass(s, SootClass.BODIES); } // TODO: hack for the implicit entry points. Scene.v().addBasicClass("java.lang.System", SootClass.SIGNATURES); Scene.v().addBasicClass("java.lang.Thread", SootClass.SIGNATURES); Scene.v().addBasicClass("java.lang.ThreadGroup", SootClass.SIGNATURES); Scene.v().addBasicClass("java.lang.ClassLoader", SootClass.SIGNATURES); Scene.v().addBasicClass("java.security.PrivilegedActionException", SootClass.SIGNATURES); Scene.v().addBasicClass("java.lang.ref.Finalizer", SootClass.SIGNATURES); try { // redirect soot output into a stream. ByteArrayOutputStream baos = new ByteArrayOutputStream(); soot.G.v().out = new PrintStream(baos, true, "utf-8"); // Now load the soot classes. Scene.v().loadBasicClasses(); // if (resolvedClassNames.isEmpty()) { Scene.v().loadNecessaryClasses(); // } else { // //TODO: Is this reachable? // loadNecessaryClasses(); // } PackManager.v().runPacks(); createAssertionClass(); /* * TODO: apply some preprocessing stuff like: * soot.jimple.toolkits.base or maybe the optimize option from soot. * TODO: NOT SURE IF THE CODE BELOW IS NECESSARY! */ for (SootClass sc : Scene.v().getClasses()) { if (sc.resolvingLevel() < SootClass.SIGNATURES) { sc.setResolvingLevel(SootClass.SIGNATURES); } // if (classes.contains(sc.getName())) { // sc.setApplicationClass(); // } } } catch (UnsupportedEncodingException e) { throw new RuntimeException(e.toString()); } catch (RuntimeException e) { throw e; } } // private void loadNecessaryClasses() { // for (String eachClassname : resolvedClassNames) { // final SootClass theClass = Scene.v().loadClassAndSupport(eachClassname); // theClass.setApplicationClass(); // } // } public static final String assertionClassName = "JayHornAssertions"; public static final String assertionProcedureName = "super_crazy_assertion"; public static final String exceptionGlobalName = "lastExceptionThrown"; /** * TODO */ public static void createAssertionClass() { if (Scene.v().containsClass(assertionClassName)) { throw new RuntimeException("Don't try to call me twice!"); } SootClass sClass = new SootClass(assertionClassName, Modifier.PUBLIC); sClass.setSuperclass(Scene.v().getSootClass("java.lang.Object")); // add a static field to keep track of thrown exceptions. SootClass javaThrowableClass = Scene.v().getSootClass("java.lang.Throwable"); SootField exceptionGlobal = new SootField(exceptionGlobalName, javaThrowableClass.getType(), Modifier.PUBLIC | Modifier.STATIC); sClass.addField(exceptionGlobal); // add a method to model assertions. SootMethod internalAssertMethod = new SootMethod(assertionProcedureName, Arrays.asList(new Type[] { BooleanType.v() }), VoidType.v(), Modifier.PUBLIC | Modifier.STATIC); sClass.addMethod(internalAssertMethod); JimpleBody body = Jimple.v().newBody(internalAssertMethod); internalAssertMethod.setActiveBody(body); body.insertIdentityStmts(); body.getUnits().add(Jimple.v().newReturnVoidStmt()); SootMethod staticInitializer = new SootMethod(SootMethod.staticInitializerName, Arrays.asList(new Type[] {}), VoidType.v(), Modifier.PUBLIC | Modifier.STATIC); body = Jimple.v().newBody(staticInitializer); staticInitializer.setActiveBody(body); body.insertIdentityStmts(); body.getUnits().add(Jimple.v().newReturnVoidStmt()); sClass.addMethod(staticInitializer); Scene.v().addClass(sClass); sClass.setApplicationClass(); } /** * Returns the class path argument for Soot * * @param files * Files in the class path * @return Class path argument for Soot */ protected String buildClassPath(List<File> files) { StringBuilder sb = new StringBuilder(); for (File file : files) { sb.append(file.getPath() + File.pathSeparatorChar); } return sb.toString(); } /** * Extracts dependent JARs from the JAR's manifest * * @param file * JAR file object * @returns jarFiles List of dependent JARs */ protected List<File> extractClassPath(File file) { List<File> jarFiles = new LinkedList<File>(); try { // open JAR file JarFile jarFile = new JarFile(file); // get manifest and their main attributes Manifest manifest = jarFile.getManifest(); if (manifest == null) { jarFile.close(); return jarFiles; } Attributes mainAttributes = manifest.getMainAttributes(); if (mainAttributes == null) { jarFile.close(); return jarFiles; } String classPath = mainAttributes.getValue(Attributes.Name.CLASS_PATH); // close JAR file jarFile.close(); // empty class path? if (null == classPath) return jarFiles; // look for dependent JARs String[] classPathItems = classPath.split(" "); for (String classPathItem : classPathItems) { if (classPathItem.endsWith(".jar")) { // add jar jarFiles.add(new File(file.getParent(), classPathItem)); } } } catch (IOException e) { throw new RuntimeException(e.toString()); } return jarFiles; } /** * Enumerates all classes in a JAR file * * @param file * a Jar file * @returns list of classes in the Jar file. */ protected List<String> enumClasses(File file) { List<String> classes = new LinkedList<String>(); try { // open JAR file JarFile jarFile = new JarFile(file); Enumeration<JarEntry> entries = jarFile.entries(); // iterate JAR entries while (entries.hasMoreElements()) { JarEntry entry = entries.nextElement(); String entryName = entry.getName(); if (entryName.endsWith(".class")) { // get class String className = entryName.substring(0, entryName.length() - ".class".length()); className = className.replace('/', '.'); // add class classes.add(className); } } // close JAR file jarFile.close(); } catch (IOException e) { throw new RuntimeException(e.getMessage()); } return classes; } /* * ======= below deals with writing out the spec classes */ /** * Writes all classes from the soottocfg.spec to targetDir * so that we can use them later when re-writing the bytecode. * * @param targetDir */ protected void writeSpecPackageToDisc(File targetDir) { if (!targetDir.isDirectory()) { if (!targetDir.mkdirs()) { throw new RuntimeException("Can't write to disk"); } } try { ClassLoader cl = this.getClass().getClassLoader(); ClassPath cp = ClassPath.from(cl); for (ClassInfo ci : cp.getTopLevelClassesRecursive("soottocfg.spec")) { StringBuilder sb = new StringBuilder(); sb.append(targetDir.getAbsolutePath()); sb.append(File.separator); sb.append(ci.getPackageName().replace(".", File.separator)); File outFileDir = new File(sb.toString()); if (!outFileDir.exists() && !outFileDir.mkdirs()) { throw new RuntimeException("Couldn't generate dirs for " + sb.toString()); } sb.append(File.separator); sb.append(ci.getSimpleName()); sb.append(".class"); File outFile = new File(sb.toString()); try (InputStream inputStream = cl.getResourceAsStream(ci.getResourceName()); OutputStream outputStream = new FileOutputStream(outFile);) { ByteStreams.copy(inputStream, outputStream); } catch (Throwable e) { e.printStackTrace(); } } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
29.883365
116
0.692175
8c10084d0120d348f3a2b5ed51bffb204981fef6
875
sql
SQL
Tenant.SiteMetadata/private/sql/tables/tb_InformationBarrierMode.sql
joerodgers/Tenant.SiteMetadata
c63de7b6a1b243b87d0255addce31fcd095ff231
[ "MIT" ]
null
null
null
Tenant.SiteMetadata/private/sql/tables/tb_InformationBarrierMode.sql
joerodgers/Tenant.SiteMetadata
c63de7b6a1b243b87d0255addce31fcd095ff231
[ "MIT" ]
null
null
null
Tenant.SiteMetadata/private/sql/tables/tb_InformationBarrierMode.sql
joerodgers/Tenant.SiteMetadata
c63de7b6a1b243b87d0255addce31fcd095ff231
[ "MIT" ]
null
null
null
IF OBJECT_ID('dbo.InformationBarrierMode', 'U') IS NULL BEGIN CREATE TABLE dbo.InformationBarrierMode ( [Id] int NOT NULL, InformationBarrierMode nvarchar(255) NOT NULL, CONSTRAINT [PK_InformationBarrierMode_Id] PRIMARY KEY CLUSTERED (Id ASC) ) INSERT INTO InformationBarrierMode (Id, InformationBarrierMode ) VALUES ( -1, 'Unknown' ) INSERT INTO InformationBarrierMode (Id, InformationBarrierMode ) VALUES ( 1, 'Open' ) INSERT INTO InformationBarrierMode (Id, InformationBarrierMode ) VALUES ( 2, 'Implicit' ) INSERT INTO InformationBarrierMode (Id, InformationBarrierMode ) VALUES ( 3, 'Explicit' ) INSERT INTO InformationBarrierMode (Id, InformationBarrierMode ) VALUES ( 4, 'OwnerModerated' ) INSERT INTO InformationBarrierMode (Id, InformationBarrierMode ) VALUES ( 5, 'Inferred' ) END
58.333333
97
0.717714
05de8597071e489e3ffb3322dc6cfec2dfb0a394
2,495
rb
Ruby
ruby/common/lib/opt/workspace-settings.rb
eocarium/ecosystem
c18a2b84720f61da648dc8cef3f205483ba1fa58
[ "Apache-2.0" ]
null
null
null
ruby/common/lib/opt/workspace-settings.rb
eocarium/ecosystem
c18a2b84720f61da648dc8cef3f205483ba1fa58
[ "Apache-2.0" ]
null
null
null
ruby/common/lib/opt/workspace-settings.rb
eocarium/ecosystem
c18a2b84720f61da648dc8cef3f205483ba1fa58
[ "Apache-2.0" ]
null
null
null
require "json" create_machine_report = true if ARGV.include?('--no_machine_report') switch_index = ARGV.index('--no_machine_report') ARGV.delete_at(switch_index) create_machine_report = false elsif ARGV.include?('-nmr') switch_index = ARGV.index('-nmr') ARGV.delete_at(switch_index) create_machine_report = false end ENV['CREATE_MACHINE_REPORT'] = "#{create_machine_report.inspect}" $WORKSPACE_SETTINGS = {} if $WORKSPACE_SETTINGS.nil? $WORKSPACE_SETTINGS[:workspace_setting] = ENV['WORKSPACE_SETTING'] $WORKSPACE_SETTINGS[:hats] = [] unless ENV['HATS'].nil? $WORKSPACE_SETTINGS[:hats] = ENV['HATS'].split(':').collect{|type| type.to_sym unless type.empty? } end $WORKSPACE_SETTINGS[:hats].uniq! $WORKSPACE_SETTINGS[:hats].compact! $WORKSPACE_SETTINGS[:test_types] = [] unless ENV['TEST_TYPES'].nil? $WORKSPACE_SETTINGS[:test_types] = ENV['TEST_TYPES'].split(':').collect{|type| type.to_sym unless type.empty? } end $WORKSPACE_SETTINGS[:test_types].uniq! $WORKSPACE_SETTINGS[:test_types].compact! workspace_settings = Hash.new { |hash,key| hash[key] = Hash.new(&hash.default_proc) } ENV.each{|name,value| if name.start_with?('PATHS_') or name.start_with?('PROJECT_') or name.start_with?('ECOSYSTEM_') or name.start_with?('VAGRANT_') or name.start_with?('PACKER_') or name.start_with?('ORGANIZATION_') or name.start_with?('COMPANY_') or name.start_with?('GIT_') or name.start_with?('AWS_') eval "workspace_settings[:#{name.downcase.gsub(/_/, '][:')}] = value" # puts "workspace_settings[:#{name.downcase.gsub(/_/, '][:')}] = '#{value}'" end } $WORKSPACE_SETTINGS.deep_merge!(JSON.parse(JSON.generate(workspace_settings),:symbolize_names => true)) $WORKSPACE_SETTINGS.deep_merge!({ delimiter: ENV['DELIMITER'], start_time: Time.now, application_short_version_prefix: ENV['APPLICATION_SHORT_VERSION_PREFIX'], application_long_version_prefix: ENV['APPLICATION_LONG_VERSION_PREFIX'], domain_name: ENV['DOMAIN_NAME'], nexus: { base_coordinates: { artifact_id: ENV['ARTIFACT_ID_BASE'], group_id: ENV['GROUP_ID_BASE'] }, base_url: "https://nexus.#{ENV['DOMAIN_NAME']}", rest_end_point: "https://nexus.#{ENV['DOMAIN_NAME']}/service/local/artifact/maven/redirect", direct_base_path: "https://nexus.#{ENV['DOMAIN_NAME']}:8443/repositories", repos: { file: 'filerepo', release: 'releases' }, credentials: { user_name: ENV['NEXUS_USER_NAME'], password: ENV['NEXUS_PASSWORD'] } }, build_artifact_directory_name: '.build' })
31.987179
284
0.72986
bee663f74c86916787dde7ecdb42e02278dc7807
990
kt
Kotlin
app/src/main/java/com/pgssoft/sleeptracker/ui/nutrition/NutritionRecordViewModel.kt
bstokrockipgs/fit
69591a13f040f4f04228942193b2a0743cfdf8c3
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/pgssoft/sleeptracker/ui/nutrition/NutritionRecordViewModel.kt
bstokrockipgs/fit
69591a13f040f4f04228942193b2a0743cfdf8c3
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/pgssoft/sleeptracker/ui/nutrition/NutritionRecordViewModel.kt
bstokrockipgs/fit
69591a13f040f4f04228942193b2a0743cfdf8c3
[ "Apache-2.0" ]
null
null
null
package com.pgssoft.sleeptracker.ui.nutrition import androidx.lifecycle.MutableLiveData import com.google.android.gms.fitness.FitnessActivities import com.pgssoft.sleeptracker.model.NutritionEntry import com.pgssoft.sleeptracker.model.SleepEntry import org.joda.time.DateTime import org.joda.time.DateTimeConstants import org.joda.time.format.DateTimeFormat class NutritionRecordViewModel(time: Long, fat: Float, sugar: Float, carbs: Float, isSynced: Boolean) { private val dateFormat = DateTimeFormat.forPattern("HH:ss, dd MMM") val timeString = MutableLiveData<String>().apply { postValue(DateTime(time).toString(dateFormat)) } val fat = MutableLiveData<String>().apply { postValue("Fat: %.2f g".format(fat)) } val sugar = MutableLiveData<String>().apply { postValue("Sugar: %.2f g".format(sugar)) } val carbs = MutableLiveData<String>().apply { postValue("Carbs: %.2f g".format(carbs)) } val isSynced = MutableLiveData<Boolean>().apply { postValue(isSynced) } }
55
103
0.766667
6c9b4adb1586f0942594081c9647c630480a84e9
6,513
go
Go
postgres/cloudpostgres/cloudpostgres_test.go
eliben/gocdkx
d96e540c0772971650d4a39516dd16a2f7f52fdd
[ "Apache-2.0" ]
3
2019-03-28T19:19:21.000Z
2019-06-25T12:44:09.000Z
postgres/cloudpostgres/cloudpostgres_test.go
eliben/gocdkx
d96e540c0772971650d4a39516dd16a2f7f52fdd
[ "Apache-2.0" ]
null
null
null
postgres/cloudpostgres/cloudpostgres_test.go
eliben/gocdkx
d96e540c0772971650d4a39516dd16a2f7f52fdd
[ "Apache-2.0" ]
null
null
null
// Copyright 2018 The Go Cloud Development Kit Authors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package cloudpostgres import ( "context" "net/http" "net/url" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" "github.com/eliben/gocdkx/gcp" "github.com/eliben/gocdkx/gcp/cloudsql" "github.com/eliben/gocdkx/internal/testing/terraform" ) func TestOpen(t *testing.T) { // This test will be skipped unless the project is set up with Terraform. // Before running go test, run in this directory: // // terraform init // terraform apply tfOut, err := terraform.ReadOutput(".") if err != nil { t.Skipf("Could not obtain harness info: %v", err) } project, _ := tfOut["project"].Value.(string) region, _ := tfOut["region"].Value.(string) instance, _ := tfOut["instance"].Value.(string) username, _ := tfOut["username"].Value.(string) password, _ := tfOut["password"].Value.(string) databaseName, _ := tfOut["database"].Value.(string) if project == "" || region == "" || instance == "" || username == "" || databaseName == "" { t.Fatalf("Missing one or more required Terraform outputs; got project=%q region=%q instance=%q username=%q database=%q", project, region, instance, username, databaseName) } ctx := context.Background() creds, err := gcp.DefaultCredentials(ctx) if err != nil { t.Fatal(err) } client, err := gcp.NewHTTPClient(http.DefaultTransport, creds.TokenSource) if err != nil { t.Fatal(err) } certSource := cloudsql.NewCertSource(client) db, _, err := Open(ctx, certSource, &Params{ ProjectID: project, Region: region, Instance: instance, Database: databaseName, User: username, Password: password, }) if err != nil { t.Fatal(err) } if err := db.Ping(); err != nil { t.Error("Ping:", err) } if err := db.Close(); err != nil { t.Error("Close:", err) } } func TestOpenBadValue(t *testing.T) { // This test will be skipped unless the project is set up with Terraform. tfOut, err := terraform.ReadOutput(".") if err != nil { t.Skipf("Could not obtain harness info: %v", err) } project, _ := tfOut["project"].Value.(string) region, _ := tfOut["region"].Value.(string) instance, _ := tfOut["instance"].Value.(string) username, _ := tfOut["username"].Value.(string) password, _ := tfOut["password"].Value.(string) databaseName, _ := tfOut["database"].Value.(string) if project == "" || region == "" || instance == "" || username == "" || databaseName == "" { t.Fatalf("Missing one or more required Terraform outputs; got project=%q region=%q instance=%q username=%q database=%q", project, region, instance, username, databaseName) } ctx := context.Background() creds, err := gcp.DefaultCredentials(ctx) if err != nil { t.Fatal(err) } client, err := gcp.NewHTTPClient(http.DefaultTransport, creds.TokenSource) if err != nil { t.Fatal(err) } certSource := cloudsql.NewCertSource(client) tests := []struct { name, value string }{ {"user", "foo"}, {"password", "foo"}, {"dbname", "foo"}, {"host", "localhost"}, {"port", "1234"}, {"sslmode", "require"}, } for _, test := range tests { t.Run(test.name+"="+test.value, func(t *testing.T) { db, _, err := Open(ctx, certSource, &Params{ ProjectID: project, Region: region, Instance: instance, Database: databaseName, User: username, Password: password, Values: url.Values{test.name: {test.value}}, }) if err == nil || !strings.Contains(err.Error(), test.name) { t.Errorf("error = %v; want to contain %q", err, test.name) } if db != nil { db.Close() } }) } } func TestParamsFromURL(t *testing.T) { tests := []struct { name string urlString string want *Params wantErr bool }{ { name: "AllValuesSpecified", urlString: "cloudpostgres://username:password@my-project-id/us-central1/my-instance-id/my-db?foo=bar&baz=quux", want: &Params{ ProjectID: "my-project-id", Region: "us-central1", Instance: "my-instance-id", Database: "my-db", User: "username", Password: "password", Values: url.Values{ "foo": {"bar"}, "baz": {"quux"}, }, }, }, { name: "OptionalValuesOmitted", urlString: "cloudpostgres://my-project-id/us-central1/my-instance-id/my-db", want: &Params{ ProjectID: "my-project-id", Region: "us-central1", Instance: "my-instance-id", Database: "my-db", }, }, { name: "DatabaseNameEmpty", urlString: "cloudpostgres://my-project-id/us-central1/my-instance-id/", wantErr: true, }, { name: "InstanceEmpty", urlString: "cloudpostgres://my-project-id/us-central1//my-db", wantErr: true, }, { name: "RegionEmpty", urlString: "cloudpostgres://my-project-id//my-instance-id/my-db", wantErr: true, }, { name: "ProjectEmpty", urlString: "cloudpostgres:///us-central1/my-instance-id/my-db", wantErr: true, }, { name: "DatabaseNameWithSlashes", urlString: "cloudpostgres://my-project-id/us-central1/my-instance-id/foo/bar/baz", want: &Params{ ProjectID: "my-project-id", Region: "us-central1", Instance: "my-instance-id", Database: "foo/bar/baz", }, }, } for _, test := range tests { t.Run(test.name, func(t *testing.T) { u, err := url.Parse(test.urlString) if err != nil { t.Fatalf("failed to parse URL %q: %v", test.urlString, err) } got, err := paramsFromURL(u) if err != nil { t.Logf("paramsFromURL(url.Parse(%q)): %v", u, err) if !test.wantErr { t.Fail() } return } if test.wantErr { t.Fatalf("paramsFromURL(url.Parse(%q)) = %#v; want error", test.urlString, got) } diff := cmp.Diff(test.want, got, cmpopts.IgnoreFields(Params{}, "TraceOpts"), cmpopts.EquateEmpty()) if diff != "" { t.Errorf("paramsFromURL(url.Parse(%q)) (-want +got):\n%s", test.urlString, diff) } }) } }
28.317391
173
0.632888
c58af4016f477a00f260da1f250b112bb130104c
3,407
hpp
C++
tcpp/minion2/minion/squash.hpp
Behrouz-Babaki/TCPP-chuffed
d832b44690914ef4b73d71bc7e565efb98e42937
[ "MIT" ]
1
2021-09-09T13:03:02.000Z
2021-09-09T13:03:02.000Z
tcpp/minion2/minion/squash.hpp
Behrouz-Babaki/TCPP-chuffed
d832b44690914ef4b73d71bc7e565efb98e42937
[ "MIT" ]
null
null
null
tcpp/minion2/minion/squash.hpp
Behrouz-Babaki/TCPP-chuffed
d832b44690914ef4b73d71bc7e565efb98e42937
[ "MIT" ]
null
null
null
#include <vector> #include <set> #include <numeric> #include <limits> static const DomainInt free_value = std::numeric_limits<SysInt>::max(); typedef std::vector<DomainInt> Vint; template <typename TupleCon> std::pair<std::set<Vint>, std::set<Vint>> squeeze_tuples(const TupleCon& tuples, const std::vector<std::set<DomainInt>>& domains, bool eager_prune) { std::set<Vint> used_tuples; std::set<Vint> ret_tuples; for(typename TupleCon::iterator it = tuples.begin(); it != tuples.end(); ++it) { const std::vector<DomainInt>& tuple = *it; if(!eager_prune || used_tuples.count(tuple) == 0) { for(SysInt i = 0; i < (SysInt)domains.size(); ++i) { if(used_tuples.count(tuple) > 0 && eager_prune) break; if(tuple[i] == free_value) continue; Vint tuple_copy = tuple; bool found = true; for(std::set<DomainInt>::iterator it = domains[i].begin(); it != domains[i].end(); ++it) { DomainInt j = *it; tuple_copy[i] = j; if(tuples.count(tuple_copy) == 0 || (eager_prune && used_tuples.count(tuple_copy) != 0)) { found = false; break; } } if(found) { for(std::set<DomainInt>::iterator it = domains[i].begin(); it != domains[i].end(); ++it) { DomainInt j = *it; tuple_copy[i] = j; used_tuples.insert(tuple_copy); } tuple_copy[i] = free_value; // std::cout << tuple_copy << std::endl; ret_tuples.insert(tuple_copy); } } } } std::set<Vint> filtered_tuples; for(std::set<Vint>::iterator it = tuples.begin(); it != tuples.end(); ++it) { if(used_tuples.count(*it) == 0) filtered_tuples.insert(*it); } return std::make_pair(filtered_tuples, ret_tuples); } template <typename Tuples> std::vector<std::set<DomainInt>> gather_domains(const Tuples& tuples) { if(tuples.size() == 0) return std::vector<std::set<DomainInt>>(); std::vector<std::set<DomainInt>> domains((tuples.begin())->size()); for(std::set<Vint>::iterator it = tuples.begin(); it != tuples.end(); ++it) { for(SysInt i = 0; i < (SysInt)it->size(); ++i) { domains[i].insert((*it)[i]); } } return domains; } inline std::set<Vint> full_squeeze_tuples(std::set<Vint> tuples, const std::vector<std::set<DomainInt>>& domain_max, bool eager) { std::set<Vint> constraint; while(true) { std::pair<std::set<Vint>, std::set<Vint>> pair_ret = squeeze_tuples(tuples, domain_max, eager); for(std::set<Vint>::iterator it = pair_ret.first.begin(); it != pair_ret.first.end(); ++it) constraint.insert(*it); if(pair_ret.second.empty()) return constraint; // exit(0); tuples = pair_ret.second; } } inline std::vector<std::vector<std::pair<SysInt, DomainInt>>> makeShortTupleList(const std::set<Vint>& tuples) { std::vector<std::vector<std::pair<SysInt, DomainInt>>> out; for(std::set<Vint>::const_iterator it = tuples.begin(); it != tuples.end(); ++it) { std::vector<std::pair<SysInt, DomainInt>> short_tup; for(SysInt i = 0; i < (SysInt)it->size(); ++i) { if((*it)[i] != free_value) { short_tup.push_back(std::make_pair(i, (*it)[i])); } } out.push_back(short_tup); } return out; }
33.07767
100
0.584092
03a1285b6e97ed53aa414429bb3474bb32681652
205
sql
SQL
30_booksCatalogs/solution.sql
code-signal/code-signal-arcade-databases
f85efe2ede2dd2721216c89e0c9e765a7f5ca000
[ "MIT" ]
3
2021-03-13T16:16:52.000Z
2021-11-25T01:04:01.000Z
30_booksCatalogs/solution.sql
code-signal/code-signal-arcade-databases
f85efe2ede2dd2721216c89e0c9e765a7f5ca000
[ "MIT" ]
null
null
null
30_booksCatalogs/solution.sql
code-signal/code-signal-arcade-databases
f85efe2ede2dd2721216c89e0c9e765a7f5ca000
[ "MIT" ]
6
2020-05-13T15:42:39.000Z
2022-03-14T19:36:50.000Z
/*Please add ; after each select statement*/ CREATE PROCEDURE booksCatalogs() BEGIN SELECT DISTINCT ExtractValue(xml_doc, '/catalog/book[1]/author') as author FROM catalogs ORDER BY author; END
29.285714
78
0.746341
175f4c199b7b2cc282a3c6774c4f0124c7c9b13e
2,457
html
HTML
catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-view.html
onapdemo/sdc
3f1fee2ca76332b48e6f36662b32f2b5096c25e7
[ "Apache-2.0" ]
null
null
null
catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-view.html
onapdemo/sdc
3f1fee2ca76332b48e6f36662b32f2b5096c25e7
[ "Apache-2.0" ]
null
null
null
catalog-ui/src/app/view-models/forms/property-forms/module-property-modal/module-property-view.html
onapdemo/sdc
3f1fee2ca76332b48e6f36662b32f2b5096c25e7
[ "Apache-2.0" ]
null
null
null
<div class="default-value-section i-sdc-form-item"> <label class="i-sdc-form-label">Default Value</label> <div class="i-sdc-form-item" data-ng-class="{error:(forms.editForm.value.$dirty && forms.editForm.value.$invalid)}"> <input class="i-sdc-form-input" data-tests-id="defaultvalue" ng-if="!((property.simpleType||property.type) == 'boolean')" data-ng-maxlength="maxLength" data-ng-disabled="property.readonly && !isPropertyValueOwner()" maxlength="100" data-ng-model="property.value" type="text" name="value" data-ng-pattern="getValidationPattern(property.type)" data-ng-model-options="{ debounce: 200 }" data-ng-change="onValueChange()" /> <select class="i-sdc-form-select" data-tests-id="booleantype" ng-if="(property.simpleType||property.type) == 'boolean'" data-ng-disabled="property.readonly && !isPropertyValueOwner()" name="value" data-ng-model="property.value"> <option value="true">true</option> <option value="false">false</option> </select> <div class="input-error" data-ng-show="forms.editForm.value.$dirty && forms.editForm.value.$invalid"> <span ng-show="forms.editForm.value.$error.required" translate="VALIDATION_ERROR_REQUIRED" translate-values="{'field': 'Property' }"></span> <span ng-show="forms.editForm.value.$error.maxlength" translate="VALIDATION_ERROR_MAX_LENGTH" translate-values="{'max': '{{maxLength}}' }"></span> <span ng-show="forms.editForm.value.$error.pattern" translate="PROPERTY_EDIT_PATTERN"></span> <span ng-show="forms.editForm.value.$error.minValidation" translate="MIN_VALIDATION_ERROR"></span> <span ng-show="forms.editForm.value.$error.maxValidation" translate="MAX_VALIDATION_ERROR"></span> <span ng-show="forms.editForm.value.$error.minOrMaxValidation" translate="MIN_MAX_VALIDATION"></span> <span ng-show="forms.editForm.value.$error.minValidationVfLevel" translate="MIN_VALIDATION_VF_LEVE_ERROR"></span> <span ng-show="forms.editForm.value.$error.maxValidationVfLevel" translate="MAX_VALIDATION_VF_LEVE_ERROR"></span> </div> </div> </div>
58.5
125
0.613757
6f8bb17025d30a1f735cc8671ecad794c34d6c06
711
swift
Swift
MeetTheTeam/MeetTheTeam/MainAvatarRoundImageView.swift
alexlerikos/MeetTheTeam
f580124e64a18f62179f57ca366f5fb3b751edc7
[ "MIT" ]
null
null
null
MeetTheTeam/MeetTheTeam/MainAvatarRoundImageView.swift
alexlerikos/MeetTheTeam
f580124e64a18f62179f57ca366f5fb3b751edc7
[ "MIT" ]
null
null
null
MeetTheTeam/MeetTheTeam/MainAvatarRoundImageView.swift
alexlerikos/MeetTheTeam
f580124e64a18f62179f57ca366f5fb3b751edc7
[ "MIT" ]
null
null
null
// // MainAvatarRoundImageView.swift // MeetTheTeam // // Created by Alexander Lerikos on 3/4/17. // Copyright © 2017 MeetTheTeam. All rights reserved. // import UIKit import Kingfisher class MainAvatarRoundImageView: UIImageView { var borderColor:CGColor? var fillColor: CGColor? var maskSize: CGFloat? required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.baseValues() } required override init(frame: CGRect) { super.init(frame: frame) self.baseValues() } private func baseValues() { self.maskSize = AvtarMaskSize self.borderColor = UIColor.textColor().cgColor self.fillColor = UIColor.clear.cgColor self.layer.borderColor = self.borderColor! } }
19.216216
54
0.731364
4a51db38df3a73d39dc985393463eb152903679d
228
cs
C#
mcs/errors/cs0122-9.cs
lefb766/mono
4f458a4ff72bc6c5e07f82aec9040d355cbb8f5c
[ "Apache-2.0" ]
469
2019-01-23T12:21:59.000Z
2022-03-10T15:50:42.000Z
mcs/errors/cs0122-9.cs
lefb766/mono
4f458a4ff72bc6c5e07f82aec9040d355cbb8f5c
[ "Apache-2.0" ]
83
2015-07-16T01:31:41.000Z
2016-01-13T02:15:47.000Z
mcs/errors/cs0122-9.cs
lefb766/mono
4f458a4ff72bc6c5e07f82aec9040d355cbb8f5c
[ "Apache-2.0" ]
36
2019-01-23T22:17:09.000Z
2022-01-20T15:41:34.000Z
// CS0122: `X.a.get' is inaccessible due to its protection level // Line: 16 public class X { private int a { get { return 1; } } } internal class Y : X { int D (X x) { if (x.a == 2) return 0; return 0; } }
10.857143
64
0.557018
061a728d864c613ec3fce93a4f06bddee2cbb102
2,053
tab
SQL
CZ-9x9-CMR/8-32-ES-14STATES-80CMR05.tab
bidlom/Mendel2019-ES
24632a8582e2b18bd8367ecb599c9d4b58e7d7da
[ "BSD-3-Clause" ]
null
null
null
CZ-9x9-CMR/8-32-ES-14STATES-80CMR05.tab
bidlom/Mendel2019-ES
24632a8582e2b18bd8367ecb599c9d4b58e7d7da
[ "BSD-3-Clause" ]
null
null
null
CZ-9x9-CMR/8-32-ES-14STATES-80CMR05.tab
bidlom/Mendel2019-ES
24632a8582e2b18bd8367ecb599c9d4b58e7d7da
[ "BSD-3-Clause" ]
null
null
null
2 14 0 0 0 0 10 4 0 0 0 0 11 4 0 0 0 0 12 6 0 0 0 1 11 5 0 0 0 10 0 3 0 0 0 10 11 5 0 0 0 11 0 3 0 0 0 11 1 12 0 0 0 11 11 5 0 0 0 12 0 3 0 0 0 12 1 12 0 0 0 5 12 9 0 0 0 6 3 1 0 0 0 9 12 9 0 0 0 9 3 12 0 0 1 0 0 10 0 0 1 1 0 11 0 0 10 0 12 2 0 0 11 0 3 2 0 0 11 1 1 1 0 0 11 12 2 2 0 0 11 3 0 1 0 0 12 1 1 1 0 0 12 2 1 1 0 0 2 0 2 11 0 0 2 0 3 11 0 0 2 0 7 11 0 0 2 3 0 11 0 0 3 1 0 1 0 0 3 10 0 2 0 0 4 0 0 10 0 0 4 0 10 2 0 0 4 0 2 2 0 0 5 1 1 1 0 0 5 2 1 1 0 0 5 2 2 1 0 0 6 0 1 2 0 0 9 1 1 1 0 1 10 2 0 3 0 1 11 2 1 5 0 10 0 0 0 2 0 10 0 0 11 8 0 11 0 0 0 2 0 11 0 0 10 8 0 11 2 2 2 9 0 12 0 0 2 7 0 12 1 2 1 11 0 12 11 0 5 5 0 2 0 0 4 4 0 2 0 0 5 4 0 2 10 0 12 0 0 2 2 0 12 0 0 2 4 0 0 10 0 2 4 0 2 2 0 2 4 0 5 2 0 2 5 2 2 2 0 2 8 0 10 0 0 2 8 0 5 5 0 3 2 0 0 10 0 4 0 0 4 4 0 4 0 0 5 4 0 4 0 0 8 4 0 5 5 0 7 2 0 5 5 2 2 2 0 5 7 0 2 5 0 5 7 2 2 5 0 5 8 0 5 5 0 5 9 2 2 5 0 6 0 0 11 8 0 8 0 0 9 8 0 8 0 2 2 7 0 9 1 2 11 2 1 0 0 1 0 1 1 0 0 11 0 3 1 0 0 3 0 1 1 0 0 5 0 1 1 0 1 0 0 0 1 0 1 11 0 0 1 0 11 0 0 3 1 0 2 0 0 11 1 0 3 2 2 1 1 0 5 1 1 1 1 0 5 1 3 1 1 0 5 11 0 3 1 0 5 3 1 1 1 0 5 5 0 3 1 1 11 0 0 3 1 1 11 5 1 5 1 1 11 5 2 5 1 1 7 0 0 3 1 11 0 0 0 2 1 3 2 0 0 7 10 11 12 11 2 5 10 2 0 0 0 6 10 2 12 0 3 2 11 0 0 0 0 2 11 0 1 1 0 5 11 0 2 0 0 0 11 11 3 10 0 1 11 2 5 0 3 2 12 0 1 1 1 5 12 3 10 2 0 3 2 1 5 2 1 2 2 11 5 2 2 2 2 2 0 0 10 12 2 2 12 0 10 5 2 2 5 2 3 2 2 2 7 0 10 5 3 0 0 2 0 1 3 0 0 5 0 1 3 0 0 5 1 1 3 0 1 0 0 0 3 0 1 3 0 5 3 0 1 5 0 5 3 0 2 0 0 11 3 0 6 0 0 3 3 1 0 1 0 1 3 1 0 6 0 1 3 3 2 0 0 7 3 3 5 6 0 3 3 3 5 7 0 3 3 3 6 0 0 3 3 3 7 0 0 3 3 3 7 2 0 3 3 3 7 6 0 3 3 5 11 6 2 5 3 5 5 3 0 3 3 5 6 2 6 5 3 5 7 0 0 3 3 6 0 0 0 2 3 6 2 0 0 7 3 7 0 0 0 2 3 7 2 0 0 7 3 7 6 0 0 7 4 2 0 0 10 12 4 2 0 2 2 12 4 2 5 0 2 2 4 3 10 2 0 3 5 0 0 2 0 1 5 0 1 1 1 5 5 0 1 11 0 5 5 0 1 3 1 5 5 0 1 5 0 5 5 0 3 3 0 5 5 1 0 0 0 6 5 1 0 6 0 1 5 1 5 2 1 2 5 12 2 5 2 11 5 3 7 0 0 3 6 0 6 0 0 0 6 2 0 0 0 6 6 6 0 0 0 2 6 7 0 0 0 2 7 11 0 0 0 7 7 2 0 0 0 6 7 3 0 0 0 6 7 3 10 0 0 3 7 3 2 0 0 7 7 6 0 0 0 6 7 7 0 0 0 6 8 5 5 2 2 2 9 12 1 11 1 11
12.518293
15
0.525572
e9562afc17f4e1c14ebe7bac16d93a091c57e772
17,743
swift
Swift
DronelinkDJI/DJIDroneSession+CameraCommand.swift
grassgit/dronelink-dji-ios
ebf119de46c1d2380073f8ac600b65762681d22f
[ "MIT" ]
null
null
null
DronelinkDJI/DJIDroneSession+CameraCommand.swift
grassgit/dronelink-dji-ios
ebf119de46c1d2380073f8ac600b65762681d22f
[ "MIT" ]
null
null
null
DronelinkDJI/DJIDroneSession+CameraCommand.swift
grassgit/dronelink-dji-ios
ebf119de46c1d2380073f8ac600b65762681d22f
[ "MIT" ]
null
null
null
// // DJIDroneSession+CameraCommand.swift // DronelinkDJI // // Created by Jim McAndrew on 10/28/19. // Copyright © 2019 Dronelink. All rights reserved. // import DronelinkCore import DJISDK import os extension DJIDroneSession { func execute(cameraCommand: MissionCameraCommand, finished: @escaping CommandFinished) -> Error? { guard let camera = adapter.drone.camera(channel: cameraCommand.channel), let state = cameraState(channel: cameraCommand.channel)?.value as? DJICameraStateAdapter else { return "MissionDisengageReason.drone.camera.unavailable.title".localized } if let command = cameraCommand as? Mission.AEBCountCameraCommand { camera.getPhotoAEBCount { (current, error) in Command.conditionallyExecute(current != command.aebCount.djiValue, error: error, finished: finished) { camera.setPhotoAEBCount(command.aebCount.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.ApertureCameraCommand { Command.conditionallyExecute(state.exposureSettings?.aperture != command.aperture.djiValue, finished: finished) { camera.setAperture(command.aperture.djiValue, withCompletion: finished) } return nil } if let command = cameraCommand as? Mission.AutoExposureLockCameraCommand { camera.getAELock { (current, error) in Command.conditionallyExecute(current != command.enabled, error: error, finished: finished) { camera.setAELock(command.enabled, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.AutoLockGimbalCameraCommand { camera.getAutoLockGimbalEnabled { (current, error) in Command.conditionallyExecute(current != command.enabled, error: error, finished: finished) { camera.setAutoLockGimbalEnabled(command.enabled, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.ColorCameraCommand { camera.getColorWithCompletion { (current, error) in Command.conditionallyExecute(current != command.color.djiValue, error: error, finished: finished) { camera.setColor(command.color.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.ContrastCameraCommand { camera.getContrastWithCompletion { (current, error) in Command.conditionallyExecute(current != command.contrast, error: error, finished: finished) { camera.setContrast(command.contrast, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.ExposureCompensationCameraCommand { Command.conditionallyExecute(state.exposureSettings?.exposureCompensation != command.exposureCompensation.djiValue, finished: finished) { camera.setExposureCompensation(command.exposureCompensation.djiValue, withCompletion: finished) } return nil } if let command = cameraCommand as? Mission.ExposureCompensationStepCameraCommand { let exposureCompensation = state.missionExposureCompensation.offset(steps: command.exposureCompensationSteps).djiValue Command.conditionallyExecute(state.exposureSettings?.exposureCompensation != exposureCompensation, finished: finished) { camera.setExposureCompensation(exposureCompensation, withCompletion: finished) } return nil } if let command = cameraCommand as? Mission.ExposureModeCameraCommand { camera.getExposureMode { (current, error) in Command.conditionallyExecute(current != command.exposureMode.djiValue, error: error, finished: finished) { camera.setExposureMode(command.exposureMode.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.FileIndexModeCameraCommand { camera.getFileIndexMode { (current, error) in Command.conditionallyExecute(current != command.fileIndexMode.djiValue, error: error, finished: finished) { camera.setFileIndexMode(command.fileIndexMode.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.FocusCameraCommand { camera.setFocusTarget(command.focusTarget.cgPoint, withCompletion: finished) return nil } if let command = cameraCommand as? Mission.FocusModeCameraCommand { camera.getFocusMode { (current, error) in Command.conditionallyExecute(current != command.focusMode.djiValue, error: error, finished: finished) { camera.setFocusMode(command.focusMode.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.ISOCameraCommand { Command.conditionallyExecute(state.exposureSettings?.ISO != command.iso.djiValue.rawValue, finished: finished) { camera.setISO(command.iso.djiValue, withCompletion: finished) } return nil } if let command = cameraCommand as? Mission.MechanicalShutterCameraCommand { camera.getMechanicalShutterEnabled { (current, error) in Command.conditionallyExecute(current != command.enabled, error: error, finished: finished) { camera.setMechanicalShutterEnabled(command.enabled, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.MeteringModeCameraCommand { camera.getMeteringMode { (current, error) in Command.conditionallyExecute(current != command.meteringMode.djiValue, error: error, finished: finished) { camera.setMeteringMode(command.meteringMode.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.ModeCameraCommand { Command.conditionallyExecute(command.mode != state.missionMode, finished: finished) { camera.setMode(command.mode.djiValue, withCompletion: finished) } return nil } if let command = cameraCommand as? Mission.PhotoAspectRatioCameraCommand { camera.getPhotoAspectRatio { (current, error) in Command.conditionallyExecute(current != command.photoAspectRatio.djiValue, error: error, finished: finished) { camera.setPhotoAspectRatio(command.photoAspectRatio.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.PhotoFileFormatCameraCommand { camera.getPhotoFileFormat { (current, error) in Command.conditionallyExecute(current != command.photoFileFormat.djiValue, error: error, finished: finished) { camera.setPhotoFileFormat(command.photoFileFormat.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.PhotoIntervalCameraCommand { camera.getPhotoTimeIntervalSettings { (current, error) in let target = DJICameraPhotoTimeIntervalSettings(captureCount: 255, timeIntervalInSeconds: UInt16(command.photoInterval)) Command.conditionallyExecute(current.captureCount != target.captureCount || current.timeIntervalInSeconds != target.timeIntervalInSeconds, error: error, finished: finished) { camera.setPhotoTimeIntervalSettings(target, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.PhotoModeCameraCommand { camera.getShootPhotoMode { (current, error) in Command.conditionallyExecute(current != command.photoMode.djiValue, error: error, finished: finished) { camera.setShootPhotoMode(command.photoMode.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.SaturationCameraCommand { camera.getSaturationWithCompletion { (current, error) in Command.conditionallyExecute(current != command.saturation, error: error, finished: finished) { camera.setSaturation(command.saturation, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.SharpnessCameraCommand { camera.getSharpnessWithCompletion { (current, error) in Command.conditionallyExecute(current != command.sharpness, error: error, finished: finished) { camera.setSharpness(command.sharpness, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.ShutterSpeedCameraCommand { Command.conditionallyExecute(state.exposureSettings?.shutterSpeed != command.shutterSpeed.djiValue, finished: finished) { camera.setShutterSpeed(command.shutterSpeed.djiValue, withCompletion: finished) } return nil } if let command = cameraCommand as? Mission.SpotMeteringTargetCameraCommand { let rowIndex = UInt8(round(command.spotMeteringTarget.y * 7)) let columnIndex = UInt8(round(command.spotMeteringTarget.x * 11)) camera.setSpotMeteringTargetRowIndex(rowIndex, columnIndex: columnIndex, withCompletion: finished) return nil } if cameraCommand is Mission.StartCaptureCameraCommand { switch state.missionMode { case .photo: if state.isCapturingPhotoInterval { os_log(.debug, log: log, "Camera start capture skipped, already shooting interval photos") finished(nil) } else { os_log(.debug, log: log, "Camera start capture photo") camera.startShootPhoto { error in DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { finished(error) } } } break case .video: if state.isCapturingVideo { os_log(.debug, log: log, "Camera start capture skipped, already recording video") finished(nil) } else { os_log(.debug, log: log, "Camera start capture video") camera.startRecordVideo { error in DispatchQueue.global().asyncAfter(deadline: .now() + 1.0) { finished(error) } } } break default: os_log(.info, log: log, "Camera start capture invalid mode: %d", state.missionMode.djiValue.rawValue) return "MissionDisengageReason.drone.camera.mode.invalid.title".localized } return nil } if cameraCommand is Mission.StopCaptureCameraCommand { switch state.missionMode { case .photo: if state.isCapturingPhotoInterval { os_log(.debug, log: log, "Camera stop capture interval photo") camera.stopShootPhoto(completion: finished) } else { os_log(.debug, log: log, "Camera stop capture skipped, not shooting interval photos") finished(nil) } break case .video: if state.isCapturingVideo { os_log(.debug, log: log, "Camera stop capture video") camera.stopRecordVideo { error in DispatchQueue.global().asyncAfter(deadline: .now() + 2.0) { finished(error) } } } else { os_log(.debug, log: log, "Camera stop capture skipped, not recording video") finished(nil) } break default: os_log(.info, log: log, "Camera stop capture skipped, invalid mode: %d", state.missionMode.djiValue.rawValue) finished(nil) break } return nil } if let command = cameraCommand as? Mission.StorageLocationCameraCommand { camera.getStorageLocation { (current, error) in Command.conditionallyExecute(current != command.storageLocation.djiValue, error: error, finished: finished) { camera.setStorageLocation(command.storageLocation.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.VideoCaptionCameraCommand { camera.getVideoCaptionEnabled { (current, error) in Command.conditionallyExecute(current != command.enabled, error: error, finished: finished) { camera.setVideoCaptionEnabled(command.enabled, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.VideoFileCompressionStandardCameraCommand { camera.getVideoFileCompressionStandard { (current, error) in Command.conditionallyExecute(current != command.videoFileCompressionStandard.djiValue, error: error, finished: finished) { camera.setVideoFileCompressionStandard(command.videoFileCompressionStandard.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.VideoFileFormatCameraCommand { camera.getVideoFileFormat { (current, error) in Command.conditionallyExecute(current != command.videoFileFormat.djiValue, error: error, finished: finished) { camera.setVideoFileFormat(command.videoFileFormat.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.VideoResolutionFrameRateCameraCommand { camera.getVideoResolutionAndFrameRate { (current, error) in let target = DJICameraVideoResolutionAndFrameRate(resolution: command.videoResolution.djiValue, frameRate: command.videoFrameRate.djiValue, fov: command.videoFieldOfView.djiValue) Command.conditionallyExecute(current?.resolution != target.resolution || current?.frameRate != target.frameRate || current?.fov != target.fov, error: error, finished: finished) { camera.setVideoResolutionAndFrameRate(target, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.VideoStandardCameraCommand { camera.getVideoStandard { (current, error) in Command.conditionallyExecute(current != command.videoStandard.djiValue, error: error, finished: finished) { camera.setVideoStandard(command.videoStandard.djiValue, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.WhiteBalanceCustomCameraCommand { camera.getWhiteBalance { (current, error) in let target = DJICameraWhiteBalance(customColorTemperature: UInt8(floor(Float(command.whiteBalanceCustom) / 100)))! Command.conditionallyExecute(current?.preset != target.preset || current?.colorTemperature != target.colorTemperature, error: error, finished: finished) { camera.setWhiteBalance(target, withCompletion: finished) } } return nil } if let command = cameraCommand as? Mission.WhiteBalancePresetCameraCommand { camera.getWhiteBalance { (current, error) in let target = DJICameraWhiteBalance(preset: command.whiteBalancePreset.djiValue)! Command.conditionallyExecute(current?.preset != target.preset, error: error, finished: finished) { camera.setWhiteBalance(target, withCompletion: finished) } } return nil } return "MissionDisengageReason.command.type.unhandled".localized } }
47.314667
195
0.594375
4307064e4fd7327d4c43295fe7fd03cb646249a9
6,734
lua
Lua
ui/widget/SidebarStringReplacementList.lua
RageLeague/ReplaceHesh
cf4c21136d548ba5657cf456c0835fc9c03f9115
[ "MIT" ]
1
2021-06-06T20:50:24.000Z
2021-06-06T20:50:24.000Z
ui/widget/SidebarStringReplacementList.lua
RageLeague/ReplaceHesh
cf4c21136d548ba5657cf456c0835fc9c03f9115
[ "MIT" ]
null
null
null
ui/widget/SidebarStringReplacementList.lua
RageLeague/ReplaceHesh
cf4c21136d548ba5657cf456c0835fc9c03f9115
[ "MIT" ]
null
null
null
local MODID = CURRENT_MOD_ID local SidebarStringReplacementList = class("Widget.SidebarStringReplacementList", Widget.SidebarBlock) function SidebarStringReplacementList:init( width, override_data ) SidebarStringReplacementList._base.init(self, width) -- self.on_select_fn = on_select_fn local mod_data = Content.GetModSetting(MODID, "string_replacement_map") or {} self.replacement_data = override_data or mod_data[TheGame:GetLanguage()] or {} end function SidebarStringReplacementList:OnAdded() self:OnControlModeChange( TheGame:FE():GetControlMode(), TheGame:FE():GetControlDeviceID() ) end function SidebarStringReplacementList:OnControlModeChange( cm, device_id ) SidebarStringReplacementList._base.OnControlModeChange( self, cm, device_id ) if cm == CONTROL_MODE.TOUCH then self.info_text = "[L] Long press on an entry to delete it." else self.info_text = "" end end function SidebarStringReplacementList:OnDeleteSlot( slot ) TheGame:FE():PushScreen( Screen.YesNoPopup( "[L] Remove Entry?", "[L] This will delete a replacement map. Are you sure you want to do this?" ) ) :SetFn( function(v) if v == Screen.YesNoPopup.YES then local pos = table.findif( self.replacement_data, function(data) return data[1] == slot.old_string end ) assert(pos) table.remove( self.replacement_data, pos ) slot.enabled = false AUDIO:PlayEvent( "event:/ui/save_slot_menu/save_file_deleted" ) local idx = self.scrolling_contents:IndexOf( slot ) slot:Reparent( self ) local pos_x, pos_y = slot:GetPos() slot:MoveTo( pos_x-40, pos_y, 0.15, easing.outQuad ) slot:AlphaTo( 0, 0.15, easing.outQuad, function() slot:Remove() -- Re-layout remaining buttons for k, w in ipairs( self.scrolling_contents.children ) do local p_x, p_y = w:GetPos() w.old_x = p_x w.old_y = p_y end self.scrolling_contents:StackChildren( SPACING.M1 ) self.scroll_panel:RefreshView() for k, w in ipairs( self.scrolling_contents.children ) do local p_x, p_y = w:GetPos() w.new_x = p_x w.new_y = p_y w:SetPos( w.old_x, w.old_y ) w:MoveTo( w.new_x, w.new_y, 0.08, easing.outQuad ) end if idx and TheGame:FE():GetControlMode() == CONTROL_MODE.GAMEPAD then local focus = self.scrolling_contents.children[ idx ] or self.scrolling_contents.children[ idx - 1 ] if focus then focus:SetFocus() end end end ) end end ) end function SidebarStringReplacementList:Refresh() -- SidebarStringReplacementList._base.Refresh( self, character_data ) -- Set text self.title:SetText( "[L] Replacements" ):SetGlyphColour( UICOLOURS.SUBTITLE ) self.subtitle:Hide()--:SetText( character_data:GetLocalizedTitle() ):SetGlyphColour( UICOLOURS.TITLE ) self.text:Hide() self.info:SetText( self.info_text or "" ) -- Remove old save files self.scrolling_contents:DestroyAllChildren() -- Add new run options -- self.scrolling_contents:AddChild( Widget.Label( "title", FONT_SIZE.BODY_TEXT, LOC"UI.NEW_GAME_SCREEN.SIDEBAR_MAIN_NEW_RUN" ) ) -- :SetGlyphColour( UICOLOURS.SUBTITLE ) -- :SetAutoSize( self.sidebar_width ) -- :SetWordWrap( true ) -- :Bloom( 0.05 ) -- for k, act in ipairs( self.character_data.acts ) do -- if act.data.game_type ~= GAME_TYPE.DAILY then -- local widget = Widget.NewActButton( self.sidebar_width+150, act:GetLocalizedName() ) -- :SetOnClickFn( function() self.on_select_fn(act, false) end ) -- :SetFocusDelta( 10 ) -- :ShowArrow() -- :Refresh( self.character_data, act ) -- self.scrolling_contents:AddChild(widget) -- if act.data.story_mode then -- local widget = Widget.NewActButton( self.sidebar_width+150, act:GetLocalizedName() ) -- :SetOnClickFn( function() self.on_select_fn(act, true) end ) -- :SetFocusDelta( 10 ) -- :ShowArrow() -- :Refresh( self.character_data, act, true ) -- self.scrolling_contents:AddChild(widget) -- end -- end -- end -- List this act's save files if self.replacement_data then -- local savefiles_title for k, save_data in ipairs( self.replacement_data ) do -- Add a title if there isn't one yet -- if not savefiles_title then -- savefiles_title = self.scrolling_contents:AddChild( Widget.Label( "title", FONT_SIZE.BODY_TEXT, LOC"UI.NEW_GAME_SCREEN.SIDEBAR_MAIN_CONTINUE_RUN" ) ) -- :SetGlyphColour( UICOLOURS.SUBTITLE ) -- :SetAutoSize( self.sidebar_width ) -- :SetWordWrap( true ) -- :Bloom( 0.05 ) -- end -- Add this savefile local slot = self.scrolling_contents:AddChild( Widget.StringReplacementEntry( self.sidebar_width - 24, 70, save_data[1], save_data[2] ) ) :LayoutBounds( "left", "below" ) :Offset( 0, -10 ) slot:SetDeleteFn( function() self:OnDeleteSlot( slot ) end ) end end -- Layout self:Layout() return self end function SidebarStringReplacementList:Layout() -- Layout the savefiles self.scrolling_contents:StackChildren( SPACING.M1 ) SidebarStringReplacementList._base.Layout( self ) return self end function SidebarStringReplacementList:OnScreenModeChange( sm ) SidebarStringReplacementList._base.OnScreenModeChange( self, sm ) return self end function SidebarStringReplacementList:GetDefaultFocus() return self.scrolling_contents and self.scrolling_contents.children and self.scrolling_contents.children[2] end --[[ Test: t = t:AddChild(Widget.SidebarStringReplacementList(300, {{"Hesh", "Christ"}, {"Admiralty", "Coppers"}})):Show():Refresh():LayoutBounds("center", "center"):Offset( 0, 200 ) t:PrepareAnimateIn() t:AnimateIn() ]]
41.312883
171
0.595931