text
stringlengths 2
100k
| meta
dict |
---|---|
/*
* Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
* Zheng Yang <[email protected]>
* Yakir Yang <[email protected]>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/irq.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/hdmi.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/of_device.h>
#include <drm/drm_of.h>
#include <drm/drmP.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_edid.h>
#include "rockchip_drm_drv.h"
#include "rockchip_drm_vop.h"
#include "inno_hdmi.h"
#define to_inno_hdmi(x) container_of(x, struct inno_hdmi, x)
struct hdmi_data_info {
int vic;
bool sink_is_hdmi;
bool sink_has_audio;
unsigned int enc_in_format;
unsigned int enc_out_format;
unsigned int colorimetry;
};
struct inno_hdmi_i2c {
struct i2c_adapter adap;
u8 ddc_addr;
u8 segment_addr;
struct mutex lock;
struct completion cmp;
};
struct inno_hdmi {
struct device *dev;
struct drm_device *drm_dev;
int irq;
struct clk *pclk;
void __iomem *regs;
struct drm_connector connector;
struct drm_encoder encoder;
struct inno_hdmi_i2c *i2c;
struct i2c_adapter *ddc;
unsigned int tmds_rate;
struct hdmi_data_info hdmi_data;
struct drm_display_mode previous_mode;
};
enum {
CSC_ITU601_16_235_TO_RGB_0_255_8BIT,
CSC_ITU601_0_255_TO_RGB_0_255_8BIT,
CSC_ITU709_16_235_TO_RGB_0_255_8BIT,
CSC_RGB_0_255_TO_ITU601_16_235_8BIT,
CSC_RGB_0_255_TO_ITU709_16_235_8BIT,
CSC_RGB_0_255_TO_RGB_16_235_8BIT,
};
static const char coeff_csc[][24] = {
/*
* YUV2RGB:601 SD mode(Y[16:235], UV[16:240], RGB[0:255]):
* R = 1.164*Y + 1.596*V - 204
* G = 1.164*Y - 0.391*U - 0.813*V + 154
* B = 1.164*Y + 2.018*U - 258
*/
{
0x04, 0xa7, 0x00, 0x00, 0x06, 0x62, 0x02, 0xcc,
0x04, 0xa7, 0x11, 0x90, 0x13, 0x40, 0x00, 0x9a,
0x04, 0xa7, 0x08, 0x12, 0x00, 0x00, 0x03, 0x02
},
/*
* YUV2RGB:601 SD mode(YUV[0:255],RGB[0:255]):
* R = Y + 1.402*V - 248
* G = Y - 0.344*U - 0.714*V + 135
* B = Y + 1.772*U - 227
*/
{
0x04, 0x00, 0x00, 0x00, 0x05, 0x9b, 0x02, 0xf8,
0x04, 0x00, 0x11, 0x60, 0x12, 0xdb, 0x00, 0x87,
0x04, 0x00, 0x07, 0x16, 0x00, 0x00, 0x02, 0xe3
},
/*
* YUV2RGB:709 HD mode(Y[16:235],UV[16:240],RGB[0:255]):
* R = 1.164*Y + 1.793*V - 248
* G = 1.164*Y - 0.213*U - 0.534*V + 77
* B = 1.164*Y + 2.115*U - 289
*/
{
0x04, 0xa7, 0x00, 0x00, 0x07, 0x2c, 0x02, 0xf8,
0x04, 0xa7, 0x10, 0xda, 0x12, 0x22, 0x00, 0x4d,
0x04, 0xa7, 0x08, 0x74, 0x00, 0x00, 0x03, 0x21
},
/*
* RGB2YUV:601 SD mode:
* Cb = -0.291G - 0.148R + 0.439B + 128
* Y = 0.504G + 0.257R + 0.098B + 16
* Cr = -0.368G + 0.439R - 0.071B + 128
*/
{
0x11, 0x5f, 0x01, 0x82, 0x10, 0x23, 0x00, 0x80,
0x02, 0x1c, 0x00, 0xa1, 0x00, 0x36, 0x00, 0x1e,
0x11, 0x29, 0x10, 0x59, 0x01, 0x82, 0x00, 0x80
},
/*
* RGB2YUV:709 HD mode:
* Cb = - 0.338G - 0.101R + 0.439B + 128
* Y = 0.614G + 0.183R + 0.062B + 16
* Cr = - 0.399G + 0.439R - 0.040B + 128
*/
{
0x11, 0x98, 0x01, 0xc1, 0x10, 0x28, 0x00, 0x80,
0x02, 0x74, 0x00, 0xbb, 0x00, 0x3f, 0x00, 0x10,
0x11, 0x5a, 0x10, 0x67, 0x01, 0xc1, 0x00, 0x80
},
/*
* RGB[0:255]2RGB[16:235]:
* R' = R x (235-16)/255 + 16;
* G' = G x (235-16)/255 + 16;
* B' = B x (235-16)/255 + 16;
*/
{
0x00, 0x00, 0x03, 0x6F, 0x00, 0x00, 0x00, 0x10,
0x03, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
0x00, 0x00, 0x00, 0x00, 0x03, 0x6F, 0x00, 0x10
},
};
static inline u8 hdmi_readb(struct inno_hdmi *hdmi, u16 offset)
{
return readl_relaxed(hdmi->regs + (offset) * 0x04);
}
static inline void hdmi_writeb(struct inno_hdmi *hdmi, u16 offset, u32 val)
{
writel_relaxed(val, hdmi->regs + (offset) * 0x04);
}
static inline void hdmi_modb(struct inno_hdmi *hdmi, u16 offset,
u32 msk, u32 val)
{
u8 temp = hdmi_readb(hdmi, offset) & ~msk;
temp |= val & msk;
hdmi_writeb(hdmi, offset, temp);
}
static void inno_hdmi_i2c_init(struct inno_hdmi *hdmi)
{
int ddc_bus_freq;
ddc_bus_freq = (hdmi->tmds_rate >> 2) / HDMI_SCL_RATE;
hdmi_writeb(hdmi, DDC_BUS_FREQ_L, ddc_bus_freq & 0xFF);
hdmi_writeb(hdmi, DDC_BUS_FREQ_H, (ddc_bus_freq >> 8) & 0xFF);
/* Clear the EDID interrupt flag and mute the interrupt */
hdmi_writeb(hdmi, HDMI_INTERRUPT_MASK1, 0);
hdmi_writeb(hdmi, HDMI_INTERRUPT_STATUS1, m_INT_EDID_READY);
}
static void inno_hdmi_sys_power(struct inno_hdmi *hdmi, bool enable)
{
if (enable)
hdmi_modb(hdmi, HDMI_SYS_CTRL, m_POWER, v_PWR_ON);
else
hdmi_modb(hdmi, HDMI_SYS_CTRL, m_POWER, v_PWR_OFF);
}
static void inno_hdmi_set_pwr_mode(struct inno_hdmi *hdmi, int mode)
{
switch (mode) {
case NORMAL:
inno_hdmi_sys_power(hdmi, false);
hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, 0x6f);
hdmi_writeb(hdmi, HDMI_PHY_DRIVER, 0xbb);
hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x15);
hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x14);
hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x10);
hdmi_writeb(hdmi, HDMI_PHY_CHG_PWR, 0x0f);
hdmi_writeb(hdmi, HDMI_PHY_SYNC, 0x00);
hdmi_writeb(hdmi, HDMI_PHY_SYNC, 0x01);
inno_hdmi_sys_power(hdmi, true);
break;
case LOWER_PWR:
inno_hdmi_sys_power(hdmi, false);
hdmi_writeb(hdmi, HDMI_PHY_DRIVER, 0x00);
hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, 0x00);
hdmi_writeb(hdmi, HDMI_PHY_CHG_PWR, 0x00);
hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x15);
break;
default:
DRM_DEV_ERROR(hdmi->dev, "Unknown power mode %d\n", mode);
}
}
static void inno_hdmi_reset(struct inno_hdmi *hdmi)
{
u32 val;
u32 msk;
hdmi_modb(hdmi, HDMI_SYS_CTRL, m_RST_DIGITAL, v_NOT_RST_DIGITAL);
udelay(100);
hdmi_modb(hdmi, HDMI_SYS_CTRL, m_RST_ANALOG, v_NOT_RST_ANALOG);
udelay(100);
msk = m_REG_CLK_INV | m_REG_CLK_SOURCE | m_POWER | m_INT_POL;
val = v_REG_CLK_INV | v_REG_CLK_SOURCE_SYS | v_PWR_ON | v_INT_POL_HIGH;
hdmi_modb(hdmi, HDMI_SYS_CTRL, msk, val);
inno_hdmi_set_pwr_mode(hdmi, NORMAL);
}
static int inno_hdmi_upload_frame(struct inno_hdmi *hdmi, int setup_rc,
union hdmi_infoframe *frame, u32 frame_index,
u32 mask, u32 disable, u32 enable)
{
if (mask)
hdmi_modb(hdmi, HDMI_PACKET_SEND_AUTO, mask, disable);
hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_BUF_INDEX, frame_index);
if (setup_rc >= 0) {
u8 packed_frame[HDMI_MAXIMUM_INFO_FRAME_SIZE];
ssize_t rc, i;
rc = hdmi_infoframe_pack(frame, packed_frame,
sizeof(packed_frame));
if (rc < 0)
return rc;
for (i = 0; i < rc; i++)
hdmi_writeb(hdmi, HDMI_CONTROL_PACKET_ADDR + i,
packed_frame[i]);
if (mask)
hdmi_modb(hdmi, HDMI_PACKET_SEND_AUTO, mask, enable);
}
return setup_rc;
}
static int inno_hdmi_config_video_vsi(struct inno_hdmi *hdmi,
struct drm_display_mode *mode)
{
union hdmi_infoframe frame;
int rc;
rc = drm_hdmi_vendor_infoframe_from_display_mode(&frame.vendor.hdmi,
&hdmi->connector,
mode);
return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_VSI,
m_PACKET_VSI_EN, v_PACKET_VSI_EN(0), v_PACKET_VSI_EN(1));
}
static int inno_hdmi_config_video_avi(struct inno_hdmi *hdmi,
struct drm_display_mode *mode)
{
union hdmi_infoframe frame;
int rc;
rc = drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, mode, false);
if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV444)
frame.avi.colorspace = HDMI_COLORSPACE_YUV444;
else if (hdmi->hdmi_data.enc_out_format == HDMI_COLORSPACE_YUV422)
frame.avi.colorspace = HDMI_COLORSPACE_YUV422;
else
frame.avi.colorspace = HDMI_COLORSPACE_RGB;
return inno_hdmi_upload_frame(hdmi, rc, &frame, INFOFRAME_AVI, 0, 0, 0);
}
static int inno_hdmi_config_video_csc(struct inno_hdmi *hdmi)
{
struct hdmi_data_info *data = &hdmi->hdmi_data;
int c0_c2_change = 0;
int csc_enable = 0;
int csc_mode = 0;
int auto_csc = 0;
int value;
int i;
/* Input video mode is SDR RGB24bit, data enable signal from external */
hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL1, v_DE_EXTERNAL |
v_VIDEO_INPUT_FORMAT(VIDEO_INPUT_SDR_RGB444));
/* Input color hardcode to RGB, and output color hardcode to RGB888 */
value = v_VIDEO_INPUT_BITS(VIDEO_INPUT_8BITS) |
v_VIDEO_OUTPUT_COLOR(0) |
v_VIDEO_INPUT_CSP(0);
hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL2, value);
if (data->enc_in_format == data->enc_out_format) {
if ((data->enc_in_format == HDMI_COLORSPACE_RGB) ||
(data->enc_in_format >= HDMI_COLORSPACE_YUV444)) {
value = v_SOF_DISABLE | v_COLOR_DEPTH_NOT_INDICATED(1);
hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL3, value);
hdmi_modb(hdmi, HDMI_VIDEO_CONTRL,
m_VIDEO_AUTO_CSC | m_VIDEO_C0_C2_SWAP,
v_VIDEO_AUTO_CSC(AUTO_CSC_DISABLE) |
v_VIDEO_C0_C2_SWAP(C0_C2_CHANGE_DISABLE));
return 0;
}
}
if (data->colorimetry == HDMI_COLORIMETRY_ITU_601) {
if ((data->enc_in_format == HDMI_COLORSPACE_RGB) &&
(data->enc_out_format == HDMI_COLORSPACE_YUV444)) {
csc_mode = CSC_RGB_0_255_TO_ITU601_16_235_8BIT;
auto_csc = AUTO_CSC_DISABLE;
c0_c2_change = C0_C2_CHANGE_DISABLE;
csc_enable = v_CSC_ENABLE;
} else if ((data->enc_in_format == HDMI_COLORSPACE_YUV444) &&
(data->enc_out_format == HDMI_COLORSPACE_RGB)) {
csc_mode = CSC_ITU601_16_235_TO_RGB_0_255_8BIT;
auto_csc = AUTO_CSC_ENABLE;
c0_c2_change = C0_C2_CHANGE_DISABLE;
csc_enable = v_CSC_DISABLE;
}
} else {
if ((data->enc_in_format == HDMI_COLORSPACE_RGB) &&
(data->enc_out_format == HDMI_COLORSPACE_YUV444)) {
csc_mode = CSC_RGB_0_255_TO_ITU709_16_235_8BIT;
auto_csc = AUTO_CSC_DISABLE;
c0_c2_change = C0_C2_CHANGE_DISABLE;
csc_enable = v_CSC_ENABLE;
} else if ((data->enc_in_format == HDMI_COLORSPACE_YUV444) &&
(data->enc_out_format == HDMI_COLORSPACE_RGB)) {
csc_mode = CSC_ITU709_16_235_TO_RGB_0_255_8BIT;
auto_csc = AUTO_CSC_ENABLE;
c0_c2_change = C0_C2_CHANGE_DISABLE;
csc_enable = v_CSC_DISABLE;
}
}
for (i = 0; i < 24; i++)
hdmi_writeb(hdmi, HDMI_VIDEO_CSC_COEF + i,
coeff_csc[csc_mode][i]);
value = v_SOF_DISABLE | csc_enable | v_COLOR_DEPTH_NOT_INDICATED(1);
hdmi_writeb(hdmi, HDMI_VIDEO_CONTRL3, value);
hdmi_modb(hdmi, HDMI_VIDEO_CONTRL, m_VIDEO_AUTO_CSC |
m_VIDEO_C0_C2_SWAP, v_VIDEO_AUTO_CSC(auto_csc) |
v_VIDEO_C0_C2_SWAP(c0_c2_change));
return 0;
}
static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi,
struct drm_display_mode *mode)
{
int value;
/* Set detail external video timing polarity and interlace mode */
value = v_EXTERANL_VIDEO(1);
value |= mode->flags & DRM_MODE_FLAG_PHSYNC ?
v_HSYNC_POLARITY(1) : v_HSYNC_POLARITY(0);
value |= mode->flags & DRM_MODE_FLAG_PVSYNC ?
v_VSYNC_POLARITY(1) : v_VSYNC_POLARITY(0);
value |= mode->flags & DRM_MODE_FLAG_INTERLACE ?
v_INETLACE(1) : v_INETLACE(0);
hdmi_writeb(hdmi, HDMI_VIDEO_TIMING_CTL, value);
/* Set detail external video timing */
value = mode->htotal;
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HTOTAL_L, value & 0xFF);
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HTOTAL_H, (value >> 8) & 0xFF);
value = mode->htotal - mode->hdisplay;
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HBLANK_L, value & 0xFF);
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HBLANK_H, (value >> 8) & 0xFF);
value = mode->hsync_start - mode->hdisplay;
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HDELAY_L, value & 0xFF);
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HDELAY_H, (value >> 8) & 0xFF);
value = mode->hsync_end - mode->hsync_start;
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HDURATION_L, value & 0xFF);
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_HDURATION_H, (value >> 8) & 0xFF);
value = mode->vtotal;
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_VTOTAL_L, value & 0xFF);
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_VTOTAL_H, (value >> 8) & 0xFF);
value = mode->vtotal - mode->vdisplay;
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_VBLANK, value & 0xFF);
value = mode->vsync_start - mode->vdisplay;
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_VDELAY, value & 0xFF);
value = mode->vsync_end - mode->vsync_start;
hdmi_writeb(hdmi, HDMI_VIDEO_EXT_VDURATION, value & 0xFF);
hdmi_writeb(hdmi, HDMI_PHY_PRE_DIV_RATIO, 0x1e);
hdmi_writeb(hdmi, HDMI_PHY_FEEDBACK_DIV_RATIO_LOW, 0x2c);
hdmi_writeb(hdmi, HDMI_PHY_FEEDBACK_DIV_RATIO_HIGH, 0x01);
return 0;
}
static int inno_hdmi_setup(struct inno_hdmi *hdmi,
struct drm_display_mode *mode)
{
hdmi->hdmi_data.vic = drm_match_cea_mode(mode);
hdmi->hdmi_data.enc_in_format = HDMI_COLORSPACE_RGB;
hdmi->hdmi_data.enc_out_format = HDMI_COLORSPACE_RGB;
if ((hdmi->hdmi_data.vic == 6) || (hdmi->hdmi_data.vic == 7) ||
(hdmi->hdmi_data.vic == 21) || (hdmi->hdmi_data.vic == 22) ||
(hdmi->hdmi_data.vic == 2) || (hdmi->hdmi_data.vic == 3) ||
(hdmi->hdmi_data.vic == 17) || (hdmi->hdmi_data.vic == 18))
hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_601;
else
hdmi->hdmi_data.colorimetry = HDMI_COLORIMETRY_ITU_709;
/* Mute video and audio output */
hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK,
v_AUDIO_MUTE(1) | v_VIDEO_MUTE(1));
/* Set HDMI Mode */
hdmi_writeb(hdmi, HDMI_HDCP_CTRL,
v_HDMI_DVI(hdmi->hdmi_data.sink_is_hdmi));
inno_hdmi_config_video_timing(hdmi, mode);
inno_hdmi_config_video_csc(hdmi);
if (hdmi->hdmi_data.sink_is_hdmi) {
inno_hdmi_config_video_avi(hdmi, mode);
inno_hdmi_config_video_vsi(hdmi, mode);
}
/*
* When IP controller have configured to an accurate video
* timing, then the TMDS clock source would be switched to
* DCLK_LCDC, so we need to init the TMDS rate to mode pixel
* clock rate, and reconfigure the DDC clock.
*/
hdmi->tmds_rate = mode->clock * 1000;
inno_hdmi_i2c_init(hdmi);
/* Unmute video and audio output */
hdmi_modb(hdmi, HDMI_AV_MUTE, m_AUDIO_MUTE | m_VIDEO_BLACK,
v_AUDIO_MUTE(0) | v_VIDEO_MUTE(0));
return 0;
}
static void inno_hdmi_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adj_mode)
{
struct inno_hdmi *hdmi = to_inno_hdmi(encoder);
inno_hdmi_setup(hdmi, adj_mode);
/* Store the display mode for plugin/DPMS poweron events */
memcpy(&hdmi->previous_mode, adj_mode, sizeof(hdmi->previous_mode));
}
static void inno_hdmi_encoder_enable(struct drm_encoder *encoder)
{
struct inno_hdmi *hdmi = to_inno_hdmi(encoder);
inno_hdmi_set_pwr_mode(hdmi, NORMAL);
}
static void inno_hdmi_encoder_disable(struct drm_encoder *encoder)
{
struct inno_hdmi *hdmi = to_inno_hdmi(encoder);
inno_hdmi_set_pwr_mode(hdmi, LOWER_PWR);
}
static bool inno_hdmi_encoder_mode_fixup(struct drm_encoder *encoder,
const struct drm_display_mode *mode,
struct drm_display_mode *adj_mode)
{
return true;
}
static int
inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{
struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
s->output_mode = ROCKCHIP_OUT_MODE_P888;
s->output_type = DRM_MODE_CONNECTOR_HDMIA;
return 0;
}
static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
.enable = inno_hdmi_encoder_enable,
.disable = inno_hdmi_encoder_disable,
.mode_fixup = inno_hdmi_encoder_mode_fixup,
.mode_set = inno_hdmi_encoder_mode_set,
.atomic_check = inno_hdmi_encoder_atomic_check,
};
static struct drm_encoder_funcs inno_hdmi_encoder_funcs = {
.destroy = drm_encoder_cleanup,
};
static enum drm_connector_status
inno_hdmi_connector_detect(struct drm_connector *connector, bool force)
{
struct inno_hdmi *hdmi = to_inno_hdmi(connector);
return (hdmi_readb(hdmi, HDMI_STATUS) & m_HOTPLUG) ?
connector_status_connected : connector_status_disconnected;
}
static int inno_hdmi_connector_get_modes(struct drm_connector *connector)
{
struct inno_hdmi *hdmi = to_inno_hdmi(connector);
struct edid *edid;
int ret = 0;
if (!hdmi->ddc)
return 0;
edid = drm_get_edid(connector, hdmi->ddc);
if (edid) {
hdmi->hdmi_data.sink_is_hdmi = drm_detect_hdmi_monitor(edid);
hdmi->hdmi_data.sink_has_audio = drm_detect_monitor_audio(edid);
drm_connector_update_edid_property(connector, edid);
ret = drm_add_edid_modes(connector, edid);
kfree(edid);
}
return ret;
}
static enum drm_mode_status
inno_hdmi_connector_mode_valid(struct drm_connector *connector,
struct drm_display_mode *mode)
{
return MODE_OK;
}
static int
inno_hdmi_probe_single_connector_modes(struct drm_connector *connector,
uint32_t maxX, uint32_t maxY)
{
return drm_helper_probe_single_connector_modes(connector, 1920, 1080);
}
static void inno_hdmi_connector_destroy(struct drm_connector *connector)
{
drm_connector_unregister(connector);
drm_connector_cleanup(connector);
}
static const struct drm_connector_funcs inno_hdmi_connector_funcs = {
.fill_modes = inno_hdmi_probe_single_connector_modes,
.detect = inno_hdmi_connector_detect,
.destroy = inno_hdmi_connector_destroy,
.reset = drm_atomic_helper_connector_reset,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static struct drm_connector_helper_funcs inno_hdmi_connector_helper_funcs = {
.get_modes = inno_hdmi_connector_get_modes,
.mode_valid = inno_hdmi_connector_mode_valid,
};
static int inno_hdmi_register(struct drm_device *drm, struct inno_hdmi *hdmi)
{
struct drm_encoder *encoder = &hdmi->encoder;
struct device *dev = hdmi->dev;
encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
/*
* If we failed to find the CRTC(s) which this encoder is
* supposed to be connected to, it's because the CRTC has
* not been registered yet. Defer probing, and hope that
* the required CRTC is added later.
*/
if (encoder->possible_crtcs == 0)
return -EPROBE_DEFER;
drm_encoder_helper_add(encoder, &inno_hdmi_encoder_helper_funcs);
drm_encoder_init(drm, encoder, &inno_hdmi_encoder_funcs,
DRM_MODE_ENCODER_TMDS, NULL);
hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD;
drm_connector_helper_add(&hdmi->connector,
&inno_hdmi_connector_helper_funcs);
drm_connector_init(drm, &hdmi->connector, &inno_hdmi_connector_funcs,
DRM_MODE_CONNECTOR_HDMIA);
drm_connector_attach_encoder(&hdmi->connector, encoder);
return 0;
}
static irqreturn_t inno_hdmi_i2c_irq(struct inno_hdmi *hdmi)
{
struct inno_hdmi_i2c *i2c = hdmi->i2c;
u8 stat;
stat = hdmi_readb(hdmi, HDMI_INTERRUPT_STATUS1);
if (!(stat & m_INT_EDID_READY))
return IRQ_NONE;
/* Clear HDMI EDID interrupt flag */
hdmi_writeb(hdmi, HDMI_INTERRUPT_STATUS1, m_INT_EDID_READY);
complete(&i2c->cmp);
return IRQ_HANDLED;
}
static irqreturn_t inno_hdmi_hardirq(int irq, void *dev_id)
{
struct inno_hdmi *hdmi = dev_id;
irqreturn_t ret = IRQ_NONE;
u8 interrupt;
if (hdmi->i2c)
ret = inno_hdmi_i2c_irq(hdmi);
interrupt = hdmi_readb(hdmi, HDMI_STATUS);
if (interrupt & m_INT_HOTPLUG) {
hdmi_modb(hdmi, HDMI_STATUS, m_INT_HOTPLUG, m_INT_HOTPLUG);
ret = IRQ_WAKE_THREAD;
}
return ret;
}
static irqreturn_t inno_hdmi_irq(int irq, void *dev_id)
{
struct inno_hdmi *hdmi = dev_id;
drm_helper_hpd_irq_event(hdmi->connector.dev);
return IRQ_HANDLED;
}
static int inno_hdmi_i2c_read(struct inno_hdmi *hdmi, struct i2c_msg *msgs)
{
int length = msgs->len;
u8 *buf = msgs->buf;
int ret;
ret = wait_for_completion_timeout(&hdmi->i2c->cmp, HZ / 10);
if (!ret)
return -EAGAIN;
while (length--)
*buf++ = hdmi_readb(hdmi, HDMI_EDID_FIFO_ADDR);
return 0;
}
static int inno_hdmi_i2c_write(struct inno_hdmi *hdmi, struct i2c_msg *msgs)
{
/*
* The DDC module only support read EDID message, so
* we assume that each word write to this i2c adapter
* should be the offset of EDID word address.
*/
if ((msgs->len != 1) ||
((msgs->addr != DDC_ADDR) && (msgs->addr != DDC_SEGMENT_ADDR)))
return -EINVAL;
reinit_completion(&hdmi->i2c->cmp);
if (msgs->addr == DDC_SEGMENT_ADDR)
hdmi->i2c->segment_addr = msgs->buf[0];
if (msgs->addr == DDC_ADDR)
hdmi->i2c->ddc_addr = msgs->buf[0];
/* Set edid fifo first addr */
hdmi_writeb(hdmi, HDMI_EDID_FIFO_OFFSET, 0x00);
/* Set edid word address 0x00/0x80 */
hdmi_writeb(hdmi, HDMI_EDID_WORD_ADDR, hdmi->i2c->ddc_addr);
/* Set edid segment pointer */
hdmi_writeb(hdmi, HDMI_EDID_SEGMENT_POINTER, hdmi->i2c->segment_addr);
return 0;
}
static int inno_hdmi_i2c_xfer(struct i2c_adapter *adap,
struct i2c_msg *msgs, int num)
{
struct inno_hdmi *hdmi = i2c_get_adapdata(adap);
struct inno_hdmi_i2c *i2c = hdmi->i2c;
int i, ret = 0;
mutex_lock(&i2c->lock);
/* Clear the EDID interrupt flag and unmute the interrupt */
hdmi_writeb(hdmi, HDMI_INTERRUPT_MASK1, m_INT_EDID_READY);
hdmi_writeb(hdmi, HDMI_INTERRUPT_STATUS1, m_INT_EDID_READY);
for (i = 0; i < num; i++) {
DRM_DEV_DEBUG(hdmi->dev,
"xfer: num: %d/%d, len: %d, flags: %#x\n",
i + 1, num, msgs[i].len, msgs[i].flags);
if (msgs[i].flags & I2C_M_RD)
ret = inno_hdmi_i2c_read(hdmi, &msgs[i]);
else
ret = inno_hdmi_i2c_write(hdmi, &msgs[i]);
if (ret < 0)
break;
}
if (!ret)
ret = num;
/* Mute HDMI EDID interrupt */
hdmi_writeb(hdmi, HDMI_INTERRUPT_MASK1, 0);
mutex_unlock(&i2c->lock);
return ret;
}
static u32 inno_hdmi_i2c_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
}
static const struct i2c_algorithm inno_hdmi_algorithm = {
.master_xfer = inno_hdmi_i2c_xfer,
.functionality = inno_hdmi_i2c_func,
};
static struct i2c_adapter *inno_hdmi_i2c_adapter(struct inno_hdmi *hdmi)
{
struct i2c_adapter *adap;
struct inno_hdmi_i2c *i2c;
int ret;
i2c = devm_kzalloc(hdmi->dev, sizeof(*i2c), GFP_KERNEL);
if (!i2c)
return ERR_PTR(-ENOMEM);
mutex_init(&i2c->lock);
init_completion(&i2c->cmp);
adap = &i2c->adap;
adap->class = I2C_CLASS_DDC;
adap->owner = THIS_MODULE;
adap->dev.parent = hdmi->dev;
adap->dev.of_node = hdmi->dev->of_node;
adap->algo = &inno_hdmi_algorithm;
strlcpy(adap->name, "Inno HDMI", sizeof(adap->name));
i2c_set_adapdata(adap, hdmi);
ret = i2c_add_adapter(adap);
if (ret) {
dev_warn(hdmi->dev, "cannot add %s I2C adapter\n", adap->name);
devm_kfree(hdmi->dev, i2c);
return ERR_PTR(ret);
}
hdmi->i2c = i2c;
DRM_DEV_INFO(hdmi->dev, "registered %s I2C bus driver\n", adap->name);
return adap;
}
static int inno_hdmi_bind(struct device *dev, struct device *master,
void *data)
{
struct platform_device *pdev = to_platform_device(dev);
struct drm_device *drm = data;
struct inno_hdmi *hdmi;
struct resource *iores;
int irq;
int ret;
hdmi = devm_kzalloc(dev, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi)
return -ENOMEM;
hdmi->dev = dev;
hdmi->drm_dev = drm;
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hdmi->regs = devm_ioremap_resource(dev, iores);
if (IS_ERR(hdmi->regs))
return PTR_ERR(hdmi->regs);
hdmi->pclk = devm_clk_get(hdmi->dev, "pclk");
if (IS_ERR(hdmi->pclk)) {
DRM_DEV_ERROR(hdmi->dev, "Unable to get HDMI pclk clk\n");
return PTR_ERR(hdmi->pclk);
}
ret = clk_prepare_enable(hdmi->pclk);
if (ret) {
DRM_DEV_ERROR(hdmi->dev,
"Cannot enable HDMI pclk clock: %d\n", ret);
return ret;
}
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
ret = irq;
goto err_disable_clk;
}
inno_hdmi_reset(hdmi);
hdmi->ddc = inno_hdmi_i2c_adapter(hdmi);
if (IS_ERR(hdmi->ddc)) {
ret = PTR_ERR(hdmi->ddc);
hdmi->ddc = NULL;
goto err_disable_clk;
}
/*
* When IP controller haven't configured to an accurate video
* timing, then the TMDS clock source would be switched to
* PCLK_HDMI, so we need to init the TMDS rate to PCLK rate,
* and reconfigure the DDC clock.
*/
hdmi->tmds_rate = clk_get_rate(hdmi->pclk);
inno_hdmi_i2c_init(hdmi);
ret = inno_hdmi_register(drm, hdmi);
if (ret)
goto err_put_adapter;
dev_set_drvdata(dev, hdmi);
/* Unmute hotplug interrupt */
hdmi_modb(hdmi, HDMI_STATUS, m_MASK_INT_HOTPLUG, v_MASK_INT_HOTPLUG(1));
ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
inno_hdmi_irq, IRQF_SHARED,
dev_name(dev), hdmi);
if (ret < 0)
goto err_cleanup_hdmi;
return 0;
err_cleanup_hdmi:
hdmi->connector.funcs->destroy(&hdmi->connector);
hdmi->encoder.funcs->destroy(&hdmi->encoder);
err_put_adapter:
i2c_put_adapter(hdmi->ddc);
err_disable_clk:
clk_disable_unprepare(hdmi->pclk);
return ret;
}
static void inno_hdmi_unbind(struct device *dev, struct device *master,
void *data)
{
struct inno_hdmi *hdmi = dev_get_drvdata(dev);
hdmi->connector.funcs->destroy(&hdmi->connector);
hdmi->encoder.funcs->destroy(&hdmi->encoder);
i2c_put_adapter(hdmi->ddc);
clk_disable_unprepare(hdmi->pclk);
}
static const struct component_ops inno_hdmi_ops = {
.bind = inno_hdmi_bind,
.unbind = inno_hdmi_unbind,
};
static int inno_hdmi_probe(struct platform_device *pdev)
{
return component_add(&pdev->dev, &inno_hdmi_ops);
}
static int inno_hdmi_remove(struct platform_device *pdev)
{
component_del(&pdev->dev, &inno_hdmi_ops);
return 0;
}
static const struct of_device_id inno_hdmi_dt_ids[] = {
{ .compatible = "rockchip,rk3036-inno-hdmi",
},
{},
};
MODULE_DEVICE_TABLE(of, inno_hdmi_dt_ids);
struct platform_driver inno_hdmi_driver = {
.probe = inno_hdmi_probe,
.remove = inno_hdmi_remove,
.driver = {
.name = "innohdmi-rockchip",
.of_match_table = inno_hdmi_dt_ids,
},
};
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2011 Davis E. King ([email protected])
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_MAX_COST_ASSIgNMENT_Hh_
#define DLIB_MAX_COST_ASSIgNMENT_Hh_
#include "max_cost_assignment_abstract.h"
#include "../matrix.h"
#include <vector>
#include <deque>
namespace dlib
{
// ----------------------------------------------------------------------------------------
template <typename EXP>
typename EXP::type assignment_cost (
const matrix_exp<EXP>& cost,
const std::vector<long>& assignment
)
{
DLIB_ASSERT(cost.nr() == cost.nc(),
"\t type assignment_cost(cost,assignment)"
<< "\n\t cost.nr(): " << cost.nr()
<< "\n\t cost.nc(): " << cost.nc()
);
#ifdef ENABLE_ASSERTS
// can't call max on an empty vector. So put an if here to guard against it.
if (assignment.size() > 0)
{
DLIB_ASSERT(0 <= min(mat(assignment)) && max(mat(assignment)) < cost.nr(),
"\t type assignment_cost(cost,assignment)"
<< "\n\t cost.nr(): " << cost.nr()
<< "\n\t cost.nc(): " << cost.nc()
<< "\n\t min(assignment): " << min(mat(assignment))
<< "\n\t max(assignment): " << max(mat(assignment))
);
}
#endif
typename EXP::type temp = 0;
for (unsigned long i = 0; i < assignment.size(); ++i)
{
temp += cost(i, assignment[i]);
}
return temp;
}
// ----------------------------------------------------------------------------------------
namespace impl
{
template <typename EXP>
inline void compute_slack(
const long x,
std::vector<typename EXP::type>& slack,
std::vector<long>& slackx,
const matrix_exp<EXP>& cost,
const std::vector<typename EXP::type>& lx,
const std::vector<typename EXP::type>& ly
)
{
for (long y = 0; y < cost.nc(); ++y)
{
if (lx[x] + ly[y] - cost(x,y) < slack[y])
{
slack[y] = lx[x] + ly[y] - cost(x,y);
slackx[y] = x;
}
}
}
}
// ----------------------------------------------------------------------------------------
template <typename EXP>
std::vector<long> max_cost_assignment (
const matrix_exp<EXP>& cost_
)
{
const_temp_matrix<EXP> cost(cost_);
typedef typename EXP::type type;
// This algorithm only works if the elements of the cost matrix can be reliably
// compared using operator==. However, comparing for equality with floating point
// numbers is not a stable operation. So you need to use an integer cost matrix.
COMPILE_TIME_ASSERT(std::numeric_limits<type>::is_integer);
DLIB_ASSERT(cost.nr() == cost.nc(),
"\t std::vector<long> max_cost_assignment(cost)"
<< "\n\t cost.nr(): " << cost.nr()
<< "\n\t cost.nc(): " << cost.nc()
);
using namespace dlib::impl;
/*
I based the implementation of this algorithm on the description of the
Hungarian algorithm on the following websites:
http://www.math.uwo.ca/~mdawes/courses/344/kuhn-munkres.pdf
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=hungarianAlgorithm
Note that this is the fast O(n^3) version of the algorithm.
*/
if (cost.size() == 0)
return std::vector<long>();
std::vector<type> lx, ly;
std::vector<long> xy;
std::vector<long> yx;
std::vector<char> S, T;
std::vector<type> slack;
std::vector<long> slackx;
std::vector<long> aug_path;
// Initially, nothing is matched.
xy.assign(cost.nc(), -1);
yx.assign(cost.nc(), -1);
/*
We maintain the following invariant:
Vertex x is matched to vertex xy[x] and
vertex y is matched to vertex yx[y].
A value of -1 means a vertex isn't matched to anything. Moreover,
x corresponds to rows of the cost matrix and y corresponds to the
columns of the cost matrix. So we are matching X to Y.
*/
// Create an initial feasible labeling. Moreover, in the following
// code we will always have:
// for all valid x and y: lx[x] + ly[y] >= cost(x,y)
lx.resize(cost.nc());
ly.assign(cost.nc(),0);
for (long x = 0; x < cost.nr(); ++x)
lx[x] = max(rowm(cost,x));
// Now grow the match set by picking edges from the equality subgraph until
// we have a complete matching.
for (long match_size = 0; match_size < cost.nc(); ++match_size)
{
std::deque<long> q;
// Empty out the S and T sets
S.assign(cost.nc(), false);
T.assign(cost.nc(), false);
// clear out old slack values
slack.assign(cost.nc(), std::numeric_limits<type>::max());
slackx.resize(cost.nc());
/*
slack and slackx are maintained such that we always
have the following (once they get initialized by compute_slack() below):
- for all y:
- let x == slackx[y]
- slack[y] == lx[x] + ly[y] - cost(x,y)
*/
aug_path.assign(cost.nc(), -1);
for (long x = 0; x < cost.nc(); ++x)
{
// If x is not matched to anything
if (xy[x] == -1)
{
q.push_back(x);
S[x] = true;
compute_slack(x, slack, slackx, cost, lx, ly);
break;
}
}
long x_start = 0;
long y_start = 0;
// Find an augmenting path.
bool found_augmenting_path = false;
while (!found_augmenting_path)
{
while (q.size() > 0 && !found_augmenting_path)
{
const long x = q.front();
q.pop_front();
for (long y = 0; y < cost.nc(); ++y)
{
if (cost(x,y) == lx[x] + ly[y] && !T[y])
{
// if vertex y isn't matched with anything
if (yx[y] == -1)
{
y_start = y;
x_start = x;
found_augmenting_path = true;
break;
}
T[y] = true;
q.push_back(yx[y]);
aug_path[yx[y]] = x;
S[yx[y]] = true;
compute_slack(yx[y], slack, slackx, cost, lx, ly);
}
}
}
if (found_augmenting_path)
break;
// Since we didn't find an augmenting path we need to improve the
// feasible labeling stored in lx and ly. We also need to keep the
// slack updated accordingly.
type delta = std::numeric_limits<type>::max();
for (unsigned long i = 0; i < T.size(); ++i)
{
if (!T[i])
delta = std::min(delta, slack[i]);
}
for (unsigned long i = 0; i < T.size(); ++i)
{
if (S[i])
lx[i] -= delta;
if (T[i])
ly[i] += delta;
else
slack[i] -= delta;
}
q.clear();
for (long y = 0; y < cost.nc(); ++y)
{
if (!T[y] && slack[y] == 0)
{
// if vertex y isn't matched with anything
if (yx[y] == -1)
{
x_start = slackx[y];
y_start = y;
found_augmenting_path = true;
break;
}
else
{
T[y] = true;
if (!S[yx[y]])
{
q.push_back(yx[y]);
aug_path[yx[y]] = slackx[y];
S[yx[y]] = true;
compute_slack(yx[y], slack, slackx, cost, lx, ly);
}
}
}
}
} // end while (!found_augmenting_path)
// Flip the edges along the augmenting path. This means we will add one more
// item to our matching.
for (long cx = x_start, cy = y_start, ty;
cx != -1;
cx = aug_path[cx], cy = ty)
{
ty = xy[cx];
yx[cy] = cx;
xy[cx] = cy;
}
}
return xy;
}
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_MAX_COST_ASSIgNMENT_Hh_
| {
"pile_set_name": "Github"
} |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("groovy", function(config) {
function words(str) {
var obj = {}, words = str.split(" ");
for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
return obj;
}
var keywords = words(
"abstract as assert boolean break byte case catch char class const continue def default " +
"do double else enum extends final finally float for goto if implements import in " +
"instanceof int interface long native new package private protected public return " +
"short static strictfp super switch synchronized threadsafe throw throws transient " +
"try void volatile while");
var blockKeywords = words("catch class do else finally for if switch try while enum interface def");
var atoms = words("null true false this");
var curPunc;
function tokenBase(stream, state) {
var ch = stream.next();
if (ch == '"' || ch == "'") {
return startString(ch, stream, state);
}
if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
curPunc = ch;
return null;
}
if (/\d/.test(ch)) {
stream.eatWhile(/[\w\.]/);
if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); }
return "number";
}
if (ch == "/") {
if (stream.eat("*")) {
state.tokenize.push(tokenComment);
return tokenComment(stream, state);
}
if (stream.eat("/")) {
stream.skipToEnd();
return "comment";
}
if (expectExpression(state.lastToken)) {
return startString(ch, stream, state);
}
}
if (ch == "-" && stream.eat(">")) {
curPunc = "->";
return null;
}
if (/[+\-*&%=<>!?|\/~]/.test(ch)) {
stream.eatWhile(/[+\-*&%=<>|~]/);
return "operator";
}
stream.eatWhile(/[\w\$_]/);
if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; }
if (state.lastToken == ".") return "property";
if (stream.eat(":")) { curPunc = "proplabel"; return "property"; }
var cur = stream.current();
if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
if (keywords.propertyIsEnumerable(cur)) {
if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
return "keyword";
}
return "variable";
}
tokenBase.isBase = true;
function startString(quote, stream, state) {
var tripleQuoted = false;
if (quote != "/" && stream.eat(quote)) {
if (stream.eat(quote)) tripleQuoted = true;
else return "string";
}
function t(stream, state) {
var escaped = false, next, end = !tripleQuoted;
while ((next = stream.next()) != null) {
if (next == quote && !escaped) {
if (!tripleQuoted) { break; }
if (stream.match(quote + quote)) { end = true; break; }
}
if (quote == '"' && next == "$" && !escaped && stream.eat("{")) {
state.tokenize.push(tokenBaseUntilBrace());
return "string";
}
escaped = !escaped && next == "\\";
}
if (end) state.tokenize.pop();
return "string";
}
state.tokenize.push(t);
return t(stream, state);
}
function tokenBaseUntilBrace() {
var depth = 1;
function t(stream, state) {
if (stream.peek() == "}") {
depth--;
if (depth == 0) {
state.tokenize.pop();
return state.tokenize[state.tokenize.length-1](stream, state);
}
} else if (stream.peek() == "{") {
depth++;
}
return tokenBase(stream, state);
}
t.isBase = true;
return t;
}
function tokenComment(stream, state) {
var maybeEnd = false, ch;
while (ch = stream.next()) {
if (ch == "/" && maybeEnd) {
state.tokenize.pop();
break;
}
maybeEnd = (ch == "*");
}
return "comment";
}
function expectExpression(last) {
return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
last == "newstatement" || last == "keyword" || last == "proplabel";
}
function Context(indented, column, type, align, prev) {
this.indented = indented;
this.column = column;
this.type = type;
this.align = align;
this.prev = prev;
}
function pushContext(state, col, type) {
return state.context = new Context(state.indented, col, type, null, state.context);
}
function popContext(state) {
var t = state.context.type;
if (t == ")" || t == "]" || t == "}")
state.indented = state.context.indented;
return state.context = state.context.prev;
}
// Interface
return {
startState: function(basecolumn) {
return {
tokenize: [tokenBase],
context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
indented: 0,
startOfLine: true,
lastToken: null
};
},
token: function(stream, state) {
var ctx = state.context;
if (stream.sol()) {
if (ctx.align == null) ctx.align = false;
state.indented = stream.indentation();
state.startOfLine = true;
// Automatic semicolon insertion
if (ctx.type == "statement" && !expectExpression(state.lastToken)) {
popContext(state); ctx = state.context;
}
}
if (stream.eatSpace()) return null;
curPunc = null;
var style = state.tokenize[state.tokenize.length-1](stream, state);
if (style == "comment") return style;
if (ctx.align == null) ctx.align = true;
if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
// Handle indentation for {x -> \n ... }
else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
popContext(state);
state.context.align = false;
}
else if (curPunc == "{") pushContext(state, stream.column(), "}");
else if (curPunc == "[") pushContext(state, stream.column(), "]");
else if (curPunc == "(") pushContext(state, stream.column(), ")");
else if (curPunc == "}") {
while (ctx.type == "statement") ctx = popContext(state);
if (ctx.type == "}") ctx = popContext(state);
while (ctx.type == "statement") ctx = popContext(state);
}
else if (curPunc == ctx.type) popContext(state);
else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
pushContext(state, stream.column(), "statement");
state.startOfLine = false;
state.lastToken = curPunc || style;
return style;
},
indent: function(state, textAfter) {
if (!state.tokenize[state.tokenize.length-1].isBase) return 0;
var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
if (ctx.type == "statement" && !expectExpression(state.lastToken)) ctx = ctx.prev;
var closing = firstChar == ctx.type;
if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
else if (ctx.align) return ctx.column + (closing ? 0 : 1);
else return ctx.indented + (closing ? 0 : config.indentUnit);
},
electricChars: "{}",
fold: "brace"
};
});
CodeMirror.defineMIME("text/x-groovy", "groovy");
});
| {
"pile_set_name": "Github"
} |
# Create a Raspbian image with already installed Kalliope
This documentation aims at explaining how to creta a Raspbian image with pre installed Kalliope.
Install a fresh [image of Raspbian](http://downloads.raspberrypi.org/raspbian/images/) as usual on your raspberry Pi.
Once deployed, follow manual steps bellow.
>**Note:** From here I suppose that the Rpi has received a valid IP from your LAN DHCP server and can access to the internet.
## Prepare the image
Login to your Rpi.
Enable SSH
```bash
sudo systemctl enable ssh
sudo systemctl start ssh
```
You now have a SSH connection, you can connect remotely to your Pi to perform next steps from a console.
>**Note:** The SSH server is listening on the default SSH port with the default Rasbpian credentials. This can be a security issue.
It is recommended to check that the Rpi is not directly accessible from the internet.
Install Kalliope from the script
```bash
curl -s https://raw.githubusercontent.com/kalliope-project/kalliope/master/install/rpi_install_kalliope.sh | bash
```
If you want to install a particular branch you can specify it with an argument following the syntax bellow
```
curl -s https://raw.githubusercontent.com/kalliope-project/kalliope/master/install/rpi_install_kalliope.sh | bash -s <branch_name>
```
E.g
```bash
curl -s https://raw.githubusercontent.com/kalliope-project/kalliope/master/install/rpi_install_kalliope.sh | bash -s dev
```
Check Kalliope is installed
```bash
kalliope --version
```
Configure locales
```
locale-gen en_US.UTF-8
```
```
sudo dpkg-reconfigure locales
```
Edit `~/.bashrc` and add those line at the end of the file
```
export LC_ALL="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"
```
Try to run the default config
```
kalliope start
```
Cleanup installation files
```bash
rm -rf get-pip.py
sudo rm -rf kalliope
```
Clone some starter kit
```bash
git clone https://github.com/kalliope-project/kalliope_starter_fr.git
git clone https://github.com/kalliope-project/kalliope_starter_en.git
git clone https://github.com/kalliope-project/kalliope_starter_de.git
```
Change the hostname
```bash
sudo hostnamectl set-hostname kalliope
sudo sed -i 's/raspberrypi/kalliope/g' /etc/hosts
```
Clear the command line history
```bash
cat /dev/null > /home/pi/.bash_history && history -c
```
Shutdown the Rpi
```bash
sudo shutdown -h now
```
## Create the image
Next commands have been tested on Ubuntu 16.04.
In the next part we create an image an shrink it in order to take less storage space.
>**Note:** Raspbian operating system comes with a tool to resize the filesystem to the largest size the SD card will support (sudo raspi-config, then select Expend Filesystem). You wont lose space by shrinking the image because you can expand it back again.
>**Note:** Be sure of what you doing in next steps. Writing disk image on the wrong disk will destroy all your computer data.
Remove the SD card from your Rpi and connect it into a Linux distrib via an external USB card reader.
Check where the card is mounted
```bash
df -h
```
The output should looks like this
```bash
df -h
Filesystem Size Used Avail Use% Mounted on
--- TRUNCKATED ---
/dev/sdb2 15G 1.3G 13G 10% /media/nico/f2100b2f-ed84-4647-b5ae-089280112716
/dev/sdb1 41M 21M 21M 51% /media/nico/boot
```
The SD card is on **/dev/sdb device**. It has two partition, **/dev/sdb1** and **/dev/sdb2**.
>**Note:** Your system might mount the card somewhere else depending on the number of disk you already have like /dev/sdc or /dev/sde.
Note down the path where your SD is.
Unmount the two partitions. Keep the SD card in the reader and connected to the system.
```bash
sudo umount /dev/sdb1 /dev/sdb2
```
Make the image with **dcfldd**. This program is a replacement for the old dd disk utility program that show the progression of a copy.
Install the tool
```bash
sudo apt-get install dcfldd
```
Create the image following this syntax.
```
sudo dcfldd if=<my_sd_card_disk_path> of=<target_path>/kalliope.img
```
E.g
```bash
sudo dcfldd if=/dev/sdb of=kalliope.img
```
>**Note:** Be sure you have enough space available in the target path
It will take a couple minutes to create the image depending of the size of your SD card.
Once it's done, give the ownership back to your current user. (the image belong to root as we created it with sudo)
```bash
sudo chown ${USER}:${USER} kalliope.img
```
Now we have a file that can already be used to instantiate a Rpi. But the file is big as the SD card itself.
To reduce the size of the image we need `gparted`. Install it
```bash
sudo apt-get install gparted
```
Gparted is only able to edit physical device, so we need to create a virtual device from the image before using it.
As we saw when we have identified our disk, Raspbian has two partitions. The fist one, boot, is already tiny and does not need to be shrank.
The second partition is where everything is stored. It contains a lot of free space.
Show partition info from the image
```bash
sudo fdisk -l kalliope.img
```
The output should looks like this
```
Device Boot Start End Sectors Size Id Type
kalliope.img1 8192 92159 83968 41M c W95 FAT32 (LBA)
kalliope.img2 92160 31116287 31024128 14.8G 83 Linux
```
Export the START sector of the second partition. The variable will be used in next commands.
```bash
export START=92160
```
Check the env variable is set correctly
```bash
echo ${START}
```
Create the virtual drive with only the second patition
```bash
sudo losetup /dev/loop0 kalliope.img -o $((START*512))
```
Now read the loopback device with gparted
```bash
sudo gparted /dev/loop0
```
Gparted will show you the state of the partition. Click the `/dev/loop0` partition and select **Resize/Move** from the menu.
change the value of "New Size" so that it is slighty abose the "Minimum Size".
Note down the new size! In this example the new size is **2000 MB**.
Then apply the resizing and exit gparted.
Remove the loopback device and create a new one with the whole image this time.
```bash
sudo losetup -d /dev/loop0
sudo losetup /dev/loop0 kalliope.img
```
Now, we use **fdisk** to edit the partition table in order to resize it to the new size.
```bash
sudo fdisk /dev/loop0
```
You should now see the **fdisk** prompt.
- Enter **d 2** to delete the table entry for the second partition
- Enter n p 2 to create a new second partition entry
- Enter the START sector number that you used earlier.
- Enter `+NEWSIZE` as the new size. Don't forget the "+" at the start. For example `+2000M`
- Enter w to write the new partition
Output example
```
Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (2048-31116287, default 2048): 92160
Last sector, +sectors or +size{K,M,G,T,P} (92160-31116287, default 31116287): +2000M
Created a new partition 2 of type 'Linux' and of size 2 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
```
Let's take a look to the partition table again
```
sudo fdisk -l /dev/loop0
Device Boot Start End Sectors Size Id Type
/dev/loop0p1 8192 92159 83968 41M c W95 FAT32 (LBA)
/dev/loop0p2 92160 4188159 4096000 2G 83 Linux
```
Note down the ED sector of the second partition
```bash
export END=4188159
```
Destroy the loopback
```bash
sudo losetup -d /dev/loop0
```
Now, trim the file to the new length.
```
truncate -s $(((END+1)*512)) kalliope.img
```
Check the new size of the image
```bash
du -hs kalliope.img
2.0G kalliope.img
```
You can now compress it to reduce a little more the size
```bash
zip kalliope.img.zip kalliope.img
```
Final size
```bash
du -hs kalliope.img.zip
727M kalliope.img.zip
```
| {
"pile_set_name": "Github"
} |
var Component = require('@yoda/bolero').Component
class Bar extends Component {
constructor (runtime) {
super(runtime)
this.word = 'bar'
}
hello () {
return this.component.foo.hello() + this.word
}
}
module.exports = Bar
| {
"pile_set_name": "Github"
} |
FreezeGun is a library that allows your python tests to travel
through time by mocking the datetime module.
| {
"pile_set_name": "Github"
} |
package chapter01.section10.thread_1_10_1.project_1_t18;
public class MyThread2 extends Thread {
@Override
public void run() {
System.out.println("MyThread2 run priority=" + this.getPriority());
}
}
| {
"pile_set_name": "Github"
} |
const createServer = require("fs-remote/createServer");
// createServer returns a net.Server
const server = createServer();
server.listen(3000, () => {
console.log("fs-remote server is listening on port 3000");
});
| {
"pile_set_name": "Github"
} |
VTH264EncHW="Codificator hardware H264 Apple VT"
VTH264EncSW="Codificator software H264 Apple VT"
VTEncoder="Codificator VideoToolbox"
Bitrate="Rată de biți"
UseMaxBitrate="Limitează rata de biți"
MaxBitrate="Rată de biți maximă"
MaxBitrateWindow="Fereastră de rată de biți maximă (secunde)"
KeyframeIntervalSec="Interval de cadre cheie (secunde, 0=auto)"
Profile="Profil"
None="(Niciunul)"
DefaultEncoder="(Codificator implicit)"
UseBFrames="Folosește B-frames"
| {
"pile_set_name": "Github"
} |
# 5s concurrent inverval
INTERVAL_SIZE = 5000000
# when to count the start time of an interval for an operating unit
INTERVAL_START = -2500000
# The size between to inverval segments
INTERVAL_SEGMENT = 1000000
# The added small bias when calculating the interference ratio
RATIO_DIVISION_EPSILON = 0.1
| {
"pile_set_name": "Github"
} |
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef __mitkToFImageGrabber_h
#define __mitkToFImageGrabber_h
#include <MitkToFHardwareExports.h>
#include <mitkCommon.h>
#include <mitkToFImageSource.h>
#include <mitkToFCameraDevice.h>
#include <itkObject.h>
#include <itkObjectFactory.h>
namespace mitk
{
/**Documentation
* \brief Image source providing ToF images. Interface for filters provided in ToFProcessing module
*
* This class internally holds a ToFCameraDevice to access the images acquired by a ToF camera.
*
* Provided images include: distance image (output 0), amplitude image (output 1), intensity image (output 2)
*
* \ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFImageGrabber : public mitk::ToFImageSource
{
public:
mitkClassMacro( ToFImageGrabber , ImageSource );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
void ShowDebugImage(float* distances);
/*!
\brief Establish a connection to the ToF camera
*/
virtual bool ConnectCamera();
/*!
\brief Disconnects the ToF camera
*/
virtual bool DisconnectCamera();
/*!
\brief Starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
virtual void StartCamera();
/*!
\brief Stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief Returns true if the camera is connected and started
*/
virtual bool IsCameraActive();
/*!
\brief Returns true if the camera is connected
*/
virtual bool IsCameraConnected();
/*!
\brief Sets the ToF device, the image grabber is grabbing the images from
\param aToFCameraDevice device internally used for grabbing the images from the camera
*/
void SetCameraDevice(ToFCameraDevice* aToFCameraDevice);
/*!
\brief Get the currently set ToF camera device
\return device currently used for grabbing images from the camera
*/
ToFCameraDevice* GetCameraDevice();
/*!
\brief Set the modulation frequency used by the ToF camera.
For default values see the corresponding device classes
\param modulationFrequency modulation frequency in Hz
*/
int SetModulationFrequency(int modulationFrequency);
/*!
\brief Get the modulation frequency used by the ToF camera.
\return modulation frequency in MHz
*/
int GetModulationFrequency();
/*!
\brief Set the integration time used by the ToF camera.
For default values see the corresponding device classes
\param integrationTime integration time in ms
*/
int SetIntegrationTime(int integrationTime);
/*!
\brief Get the integration time in used by the ToF camera.
\return integration time in ms
*/
int GetIntegrationTime();
/*!
\brief Get the dimension in x direction of the ToF image
\return width of the image
*/
int GetCaptureWidth();
/*!
\brief Get the dimension in y direction of the ToF image
\return height of the image
*/
int GetCaptureHeight();
/*!
\brief Get the number of pixel in the ToF image
\return number of pixel
*/
int GetPixelNumber();
/*!
\brief Get the dimension in x direction of the ToF image
\return width of the image
*/
int GetRGBImageWidth();
/*!
\brief Get the dimension in y direction of the ToF image
\return height of the image
*/
int GetRGBImageHeight();
/*!
\brief Get the number of pixel in the ToF image
\return number of pixel
*/
int GetRGBPixelNumber();
// properties
void SetBoolProperty( const char* propertyKey, bool boolValue );
void SetIntProperty( const char* propertyKey, int intValue );
void SetFloatProperty( const char* propertyKey, float floatValue );
void SetStringProperty( const char* propertyKey, const char* stringValue );
void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
bool GetBoolProperty( const char* propertyKey);
int GetIntProperty( const char* propertyKey);
float GetFloatProperty( const char* propertyKey);
const char* GetStringProperty( const char* propertyKey);
BaseProperty* GetProperty( const char *propertyKey);
protected:
///
/// called when the ToFCameraDevice was modified
///
void OnToFCameraDeviceModified();
/*!
\brief clean up memory allocated for the image arrays m_IntensityArray, m_DistanceArray, m_AmplitudeArray and m_SourceDataArray
*/
virtual void CleanUpImageArrays();
/*!
\brief Allocate memory for the image arrays m_IntensityArray, m_DistanceArray, m_AmplitudeArray and m_SourceDataArray
*/
virtual void AllocateImageArrays();
/**
* @brief InitializeImages Initialze the geometries of the images according to the device properties.
*/
void InitializeImages();
ToFCameraDevice::Pointer m_ToFCameraDevice; ///< Device allowing access to ToF image data
int m_CaptureWidth; ///< Width of the captured ToF image
int m_CaptureHeight; ///< Height of the captured ToF image
int m_PixelNumber; ///< Number of pixels in the image
int m_RGBImageWidth; ///< Width of the captured RGB image
int m_RGBImageHeight; ///< Height of the captured RGB image
int m_RGBPixelNumber; ///< Number of pixels in the RGB image
int m_ImageSequence; ///< counter for currently acquired images
int m_SourceDataSize; ///< size of the source data in bytes
float* m_IntensityArray; ///< member holding the current intensity array
float* m_DistanceArray; ///< member holding the current distance array
float* m_AmplitudeArray; ///< member holding the current amplitude array
char* m_SourceDataArray;///< member holding the current source data array
unsigned char* m_RgbDataArray; ///< member holding the current rgb data array
unsigned long m_DeviceObserverTag; ///< tag of the observer for the ToFCameraDevice
ToFImageGrabber();
~ToFImageGrabber() override;
/*!
\brief Method generating the outputs of this filter. Called in the updated process of the pipeline.
0: distance image
1: amplitude image
2: intensity image
3: RGB image
*/
void GenerateData() override;
private:
};
} //END mitk namespace
#endif
| {
"pile_set_name": "Github"
} |
/**
* The OWASP CSRFGuard Project, BSD License
* Eric Sheridan ([email protected]), Copyright (c) 2011
* 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.
* 3. Neither the name of OWASP nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.owasp.csrfguard.action;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.owasp.csrfguard.CsrfGuard;
import org.owasp.csrfguard.CsrfGuardException;
import org.owasp.csrfguard.util.RandomGenerator;
public class Rotate extends AbstractAction {
private static final long serialVersionUID = -3164557586544451406L;
@Override
public void execute(HttpServletRequest request, HttpServletResponse response, CsrfGuardException csrfe, CsrfGuard csrfGuard) throws CsrfGuardException {
HttpSession session = request.getSession(false);
if (session != null) {
updateSessionToken(session, csrfGuard);
if (csrfGuard.isTokenPerPageEnabled()) {
updatePageTokens(session, csrfGuard);
}
}
}
private void updateSessionToken(HttpSession session, CsrfGuard csrfGuard) throws CsrfGuardException {
String token;
try {
token = RandomGenerator.generateRandomId(csrfGuard.getPrng(),
csrfGuard.getTokenLength());
} catch (Exception e) {
throw new CsrfGuardException(String.format("unable to generate the random token - %s", e.getLocalizedMessage()), e);
}
session.setAttribute(csrfGuard.getSessionKey(), token);
}
private void updatePageTokens(HttpSession session, CsrfGuard csrfGuard) throws CsrfGuardException {
@SuppressWarnings("unchecked")
Map<String, String> pageTokens = (Map<String, String>) session.getAttribute(CsrfGuard.PAGE_TOKENS_KEY);
List<String> pages = new ArrayList<String>();
if(pageTokens != null) {
pages.addAll(pageTokens.keySet());
}
for (String page : pages) {
String token;
try {
token = RandomGenerator.generateRandomId(csrfGuard.getPrng(), csrfGuard.getTokenLength());
} catch (Exception e) {
throw new CsrfGuardException(String.format("unable to generate the random token - %s", e.getLocalizedMessage()), e);
}
pageTokens.put(page, token);
}
}
}
| {
"pile_set_name": "Github"
} |
{
"title":"Shared Array Buffer",
"description":"Type of ArrayBuffer that can be shared across Workers.",
"spec":"https://tc39.github.io/ecmascript_sharedmem/shmem.html",
"status":"other",
"links":[
{
"url":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer",
"title":"MDN article"
}
],
"bugs":[
],
"categories":[
"JS"
],
"stats":{
"ie":{
"5.5":"n",
"6":"n",
"7":"n",
"8":"n",
"9":"n",
"10":"n",
"11":"n"
},
"edge":{
"12":"n",
"13":"n",
"14":"n",
"15":"n",
"16":"n d #1",
"17":"n d #1",
"18":"n d #1",
"76":"y"
},
"firefox":{
"2":"n",
"3":"n",
"3.5":"n",
"3.6":"n",
"4":"n",
"5":"n",
"6":"n",
"7":"n",
"8":"n",
"9":"n",
"10":"n",
"11":"n",
"12":"n",
"13":"n",
"14":"n",
"15":"n",
"16":"n",
"17":"n",
"18":"n",
"19":"n",
"20":"n",
"21":"n",
"22":"n",
"23":"n",
"24":"n",
"25":"n",
"26":"n",
"27":"n",
"28":"n",
"29":"n",
"30":"n",
"31":"n",
"32":"n",
"33":"n",
"34":"n",
"35":"n",
"36":"n",
"37":"n",
"38":"n",
"39":"n",
"40":"n",
"41":"n",
"42":"n",
"43":"n",
"44":"n",
"45":"n",
"46":"n",
"47":"n",
"48":"n",
"49":"n",
"50":"n",
"51":"n",
"52":"n",
"53":"n",
"54":"n",
"55":"n",
"56":"n",
"57":"n d #1",
"58":"n d #1",
"59":"n d #1",
"60":"n d #1",
"61":"n d #1",
"62":"n d #1",
"63":"n d #1",
"64":"n d #1",
"65":"n d #1",
"66":"n d #1",
"67":"n d #1",
"68":"n d #1",
"69":"n d #1",
"70":"n d #1"
},
"chrome":{
"4":"n",
"5":"n",
"6":"n",
"7":"n",
"8":"n",
"9":"n",
"10":"n",
"11":"n",
"12":"n",
"13":"n",
"14":"n",
"15":"n",
"16":"n",
"17":"n",
"18":"n",
"19":"n",
"20":"n",
"21":"n",
"22":"n",
"23":"n",
"24":"n",
"25":"n",
"26":"n",
"27":"n",
"28":"n",
"29":"n",
"30":"n",
"31":"n",
"32":"n",
"33":"n",
"34":"n",
"35":"n",
"36":"n",
"37":"n",
"38":"n",
"39":"n",
"40":"n",
"41":"n",
"42":"n",
"43":"n",
"44":"n",
"45":"n",
"46":"n",
"47":"n",
"48":"n",
"49":"n",
"50":"n",
"51":"n",
"52":"n",
"53":"n",
"54":"n",
"55":"n",
"56":"n",
"57":"n",
"58":"n",
"59":"n",
"60":"n d #1",
"61":"n d #1",
"62":"n d #1",
"63":"n d #1",
"64":"n d #1",
"65":"n d #1",
"66":"n d #1",
"67":"n d #1",
"68":"y",
"69":"y",
"70":"y",
"71":"y",
"72":"y",
"73":"y",
"74":"y",
"75":"y",
"76":"y",
"77":"y",
"78":"y",
"79":"y"
},
"safari":{
"3.1":"n",
"3.2":"n",
"4":"n",
"5":"n",
"5.1":"n",
"6":"n",
"6.1":"n",
"7":"n",
"7.1":"n",
"8":"n",
"9":"n",
"9.1":"n",
"10":"n",
"10.1":"n d #1",
"11":"n d #1",
"11.1":"n d #1",
"12":"n d #1",
"12.1":"n d #1",
"13":"n d #1",
"TP":"n d #1"
},
"opera":{
"9":"n",
"9.5-9.6":"n",
"10.0-10.1":"n",
"10.5":"n",
"10.6":"n",
"11":"n",
"11.1":"n",
"11.5":"n",
"11.6":"n",
"12":"n",
"12.1":"n",
"15":"n",
"16":"n",
"17":"n",
"18":"n",
"19":"n",
"20":"n",
"21":"n",
"22":"n",
"23":"n",
"24":"n",
"25":"n",
"26":"n",
"27":"n",
"28":"n",
"29":"n",
"30":"n",
"31":"n",
"32":"n",
"33":"n",
"34":"n",
"35":"n",
"36":"n",
"37":"n",
"38":"n",
"39":"n",
"40":"n",
"41":"n",
"42":"n",
"43":"n",
"44":"n",
"45":"n",
"46":"n",
"47":"n d #1",
"48":"n d #1",
"49":"n d #1",
"50":"n d #1",
"51":"n d #1",
"52":"n d #1",
"53":"n d #1",
"54":"n d #1",
"55":"n d #1",
"56":"n d #1",
"57":"n d #1",
"58":"n d #1",
"60":"n d #1",
"62":"n d #1"
},
"ios_saf":{
"3.2":"n",
"4.0-4.1":"n",
"4.2-4.3":"n",
"5.0-5.1":"n",
"6.0-6.1":"n",
"7.0-7.1":"n",
"8":"n",
"8.1-8.4":"n",
"9.0-9.2":"n",
"9.3":"n",
"10.0-10.2":"n",
"10.3":"n d #1",
"11.0-11.2":"n d #1",
"11.3-11.4":"n d #1",
"12.0-12.1":"n d #1",
"12.2-12.3":"n d #1",
"13":"n d #1"
},
"op_mini":{
"all":"n"
},
"android":{
"2.1":"n",
"2.2":"n",
"2.3":"n",
"3":"n",
"4":"n",
"4.1":"n",
"4.2-4.3":"n",
"4.4":"n",
"4.4.3-4.4.4":"n",
"67":"u"
},
"bb":{
"7":"n",
"10":"n"
},
"op_mob":{
"10":"n",
"11":"n",
"11.1":"n",
"11.5":"n",
"12":"n",
"12.1":"n",
"46":"n"
},
"and_chr":{
"75":"n d #1"
},
"and_ff":{
"67":"n d #1"
},
"ie_mob":{
"10":"n",
"11":"n"
},
"and_uc":{
"12.12":"y"
},
"samsung":{
"4":"n",
"5.0-5.4":"n",
"6.2-6.4":"n",
"7.2-7.4":"n",
"8.2":"n",
"9.2":"n"
},
"and_qq":{
"1.2":"n"
},
"baidu":{
"7.12":"n"
},
"kaios":{
"2.5":"n"
}
},
"notes":"",
"notes_by_num":{
"1":"Has support, but was disabled across browsers in January 2018 due to Spectre & Meltdown vulnerabilities."
},
"usage_perc_y":30.41,
"usage_perc_a":0,
"ucprefix":false,
"parent":"",
"keywords":"",
"ie_id":"",
"chrome_id":"4570991992766464",
"firefox_id":"shared-array-buffer",
"webkit_id":"",
"shown":true
}
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests\Extension\Core\Type;
use Symfony\Component\Form\Extension\Core\View\ChoiceView;
class LanguageTypeTest extends LocalizedTestCase
{
public function testCountriesAreSelectable()
{
\Locale::setDefault('de_AT');
$form = $this->factory->create('language');
$view = $form->createView();
$choices = $view->vars['choices'];
$this->assertContains(new ChoiceView('en', 'en', 'Englisch'), $choices, '', false, false);
$this->assertContains(new ChoiceView('en_GB', 'en_GB', 'Britisches Englisch'), $choices, '', false, false);
$this->assertContains(new ChoiceView('en_US', 'en_US', 'Amerikanisches Englisch'), $choices, '', false, false);
$this->assertContains(new ChoiceView('fr', 'fr', 'Französisch'), $choices, '', false, false);
$this->assertContains(new ChoiceView('my', 'my', 'Birmanisch'), $choices, '', false, false);
}
public function testMultipleLanguagesIsNotIncluded()
{
$form = $this->factory->create('language', 'language');
$view = $form->createView();
$choices = $view->vars['choices'];
$this->assertNotContains(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices, '', false, false);
}
}
| {
"pile_set_name": "Github"
} |
# Changelog for Highstock v2.1.7 (2015-06-26)
- Most changes listed under Highcharts 4.1.7 above also apply to Highstock 2.1.7.
## Bug fixes
- Fixed #3013, top X axis was not considered when placing range selector.
- Fixed #4226, individual line color on candlestick up-points didn't take effect.
- Fixed #4229, errors on scrolling on an axis containing breaks with breakSize.
- Fixed #4244, data labels on area range broke on JS error when labels were outside viewable area.
- Fixed #4285, a regression causing flags to be shaped like squares in some cases.
- Fixed #4314, running Axis.update caused label alignment to shift.
- Fixed #4317, X axis update affected the selected range. | {
"pile_set_name": "Github"
} |
paasta\_tools.dump\_locally\_running\_services module
=====================================================
.. automodule:: paasta_tools.dump_locally_running_services
:members:
:undoc-members:
:show-inheritance:
| {
"pile_set_name": "Github"
} |
var convert = require('./convert'),
func = convert('set', require('../set'));
func.placeholder = require('./placeholder');
module.exports = func;
| {
"pile_set_name": "Github"
} |
# Copyright (C) 2019 The ESPResSo project
#
# This file is part of ESPResSo.
#
# ESPResSo is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# ESPResSo is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
import os
import io
import sys
import ast
import tokenize
import unittest
import importlib
import espressomd
from unittest.mock import MagicMock
def _id(x):
return x
# global variable: if one import failed, all subsequent imports will be skipped,
# see skip_future_imports_dependency()
skip_future_imports = False
def configure_and_import(filepath,
gpu=False,
substitutions=lambda x: x,
cmd_arguments=None,
script_suffix=None,
move_to_script_dir=True,
random_seeds=False,
mock_visualizers=True,
**parameters):
"""
Copy a Python script to a new location and alter some lines of code:
- change global variables and local variables (up to 1 indentation level)
- pass command line arguments during import to emulate shell execution
- disable the OpenGL/Mayavi modules if they are not compiled
- disable the matplotlib GUI using a text-based backend
- use random seeds for the RNG in NumPy
- temporarily move to the directory where the script is located
Parameters
----------
filepath : str
python script to import
gpu : bool
whether GPU is necessary or not
substitutions : function
custom text replacement operation (useful to edit out calls to the
OpenGL or Mayavi visualizers' ``run()`` method)
cmd_arguments : list
command line arguments, i.e. sys.argv without the script path
script_suffix : str
suffix to append to the configured script (useful when a single
module is being tested by multiple tests in parallel)
random_seeds : bool
if ``True``, use random seeds in RNGs
mock_visualizers : bool
if ``True``, substitute ES visualizers with `Mock()` classes in case
of `ImportError()` (use ``False`` if an `ImportError()` is relevant
to your test)
move_to_script_dir : bool
if ``True``, move to the script's directory (useful when the script
needs to load files hardcoded as relative paths, or when files are
generated and need cleanup); this is enabled by default
\*\*parameters :
global variables to replace
"""
if skip_future_imports:
module = MagicMock()
skipIfMissingImport = skip_future_imports_dependency(filepath)
return module, skipIfMissingImport
if gpu and not espressomd.gpu_available():
skip_future_imports_dependency(filepath)
skipIfMissingGPU = unittest.skip("gpu not available, skipping test!")
module = MagicMock()
return module, skipIfMissingGPU
filepath = os.path.abspath(filepath)
# load original script
# read in binary mode, then decode as UTF-8 to avoid this python3.5 error:
# UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 915:
# ordinal not in range(128)
with open(filepath, "rb") as f:
code = f.read().decode(encoding="utf-8")
# custom substitutions
code = substitutions(code)
assert code.strip()
# substitute global variables
code = substitute_variable_values(code, **parameters)
# substitute command line arguments
if cmd_arguments is not None:
code, old_sys_argv = set_cmd(code, filepath, cmd_arguments)
# disable matplotlib GUI using the Agg backend
code = disable_matplotlib_gui(code)
# disable OpenGL/Mayavi GUI using MagicMock()
if mock_visualizers:
code = mock_es_visualization(code)
# use random seeds for NumPy RNG
if random_seeds:
code = set_random_seeds(code)
# save changes to a new file
if script_suffix:
if script_suffix[0] != "_":
script_suffix = "_" + script_suffix
else:
script_suffix = ""
script_suffix += "_processed.py"
output_filepath = os.path.splitext(filepath)[0] + script_suffix
assert os.path.isfile(output_filepath) is False, \
"File {} already processed, cannot overwrite".format(output_filepath)
with open(output_filepath, "wb") as f:
f.write(code.encode(encoding="utf-8"))
# import
dirname, basename = os.path.split(output_filepath)
if move_to_script_dir:
os.chdir(dirname)
sys.path.insert(0, dirname)
module_name = os.path.splitext(basename)[0]
try:
module = importlib.import_module(module_name)
except espressomd.FeaturesError as err:
skip_future_imports_dependency(filepath)
skipIfMissingFeatures = unittest.skip(str(err) + ", skipping test!")
module = MagicMock()
else:
skipIfMissingFeatures = _id
if cmd_arguments is not None:
# restore original command line arguments
sys.argv = old_sys_argv
return module, skipIfMissingFeatures
class GetSysArgparseImports(ast.NodeVisitor):
"""
Find all line numbers where ``sys`` or ``argparse`` is imported.
"""
def __init__(self):
self.linenos = []
def visit_Import(self, node):
for child in node.names:
if child.name.split(".")[0] in ("sys", "argparse"):
self.linenos.append(node.lineno)
def visit_ImportFrom(self, node):
if node.module.split(".")[0] in ("sys", "argparse"):
self.linenos.append(node.lineno)
def set_cmd(code, filepath, cmd_arguments):
"""
Set the ``sys.argv`` in the imported module while checkpointing
the current ``sys.argv`` value.
"""
assert isinstance(cmd_arguments, (list, tuple))
sys_argv = list(map(str, cmd_arguments))
sys_argv.insert(0, os.path.basename(filepath))
visitor = GetSysArgparseImports()
visitor.visit(ast.parse(protect_ipython_magics(code)))
assert visitor.linenos, "module sys (or argparse) is not imported"
lines = code.split("\n")
mapping = delimit_statements(code)
lineno = mapping[min(visitor.linenos)]
line = lines[lineno - 1]
indentation = line[:len(line) - len(line.lstrip())]
lines[lineno - 1] = indentation + "import sys;sys.argv = " + \
str(sys_argv) + ";" + line.lstrip()
code = "\n".join(lines)
old_sys_argv = list(sys.argv)
return code, old_sys_argv
class GetVariableAssignments(ast.NodeVisitor):
"""
Find all assignments in the global namespace.
"""
def __init__(self, variable_names):
self.variables = {x: [] for x in variable_names}
def visit_Assign(self, node):
for target in node.targets:
if hasattr(target, "id"):
varname = target.id
if varname in self.variables:
assert len(node.targets) == 1, \
"Cannot substitute multiple assignments (variable " \
"'{}' at line {})".format(varname, node.lineno)
self.variables[varname].append(node.lineno)
def visit_ClassDef(self, node):
pass # skip class scopes
def visit_FunctionDef(self, node):
pass # skip function scopes
def visit_AsyncFunctionDef(self, node):
pass # skip function scopes
def substitute_variable_values(code, strings_as_is=False, keep_original=True,
**parameters):
"""
Substitute values of global variables.
Parameters
----------
code : str
Source code to edit.
strings_as_is : bool
If ``True``, consider all values in \*\*parameters are strings and
substitute them in-place without formatting by ``repr()``.
keep_original : bool
Keep the original value (e.g. ``N = 10; _N__original = 1000``), helps
with debugging.
\*\*parameters :
Variable names and their new value.
"""
tree = ast.parse(protect_ipython_magics(code))
visitor = GetVariableAssignments(parameters.keys())
visitor.visit(tree)
# split lines
lines = code.split("\n")
mapping = delimit_statements(code)
# substitute values
for varname, new_value in parameters.items():
linenos = visitor.variables[varname]
assert linenos, "variable {} has no assignment".format(varname)
new_value = strings_as_is and new_value or repr(new_value)
for lineno in linenos:
identation, old_value = lines[lineno - 1].split(varname, 1)
lines[lineno - 1] = identation + varname + " = " + new_value
if keep_original:
lines[lineno - 1] += "; _" + varname + "__original" + old_value
else:
for lineno in range(lineno + 1, mapping[lineno]):
lines[lineno - 1] = ""
return "\n".join(lines)
class GetPrngSeedEspressomdSystem(ast.NodeVisitor):
"""
Find all assignments of :class:`espressomd.system.System` in the global
namespace. Assignments made in classes or function raise an error. Detect
random seed setup of the numpy PRNG.
"""
def __init__(self):
self.numpy_random_aliases = set()
self.es_system_aliases = set()
self.variable_system_aliases = set()
self.numpy_seeds = []
self.abort_message = None
self.error_msg_multi_assign = "Cannot parse {} in a multiple assignment (line {})"
def visit_Import(self, node):
# get system aliases
for child in node.names:
if child.name == "espressomd.system.System":
name = (child.asname or child.name)
self.es_system_aliases.add(name)
elif child.name == "espressomd.system":
name = (child.asname or child.name)
self.es_system_aliases.add(name + ".System")
elif child.name == "espressomd.System":
name = (child.asname or child.name)
self.es_system_aliases.add(name)
elif child.name == "espressomd":
name = (child.asname or "espressomd")
self.es_system_aliases.add(name + ".system.System")
self.es_system_aliases.add(name + ".System")
elif child.name == "numpy.random":
name = (child.asname or child.name)
self.numpy_random_aliases.add(name)
elif child.name == "numpy":
name = (child.asname or "numpy")
self.numpy_random_aliases.add(name + ".random")
def visit_ImportFrom(self, node):
# get system aliases
for child in node.names:
if node.module == "espressomd" and child.name == "system":
name = (child.asname or child.name)
self.es_system_aliases.add(name + ".System")
elif node.module == "espressomd" and child.name == "System":
self.es_system_aliases.add(child.asname or child.name)
elif node.module == "espressomd.system" and child.name == "System":
self.es_system_aliases.add(child.asname or child.name)
elif node.module == "numpy" and child.name == "random":
self.numpy_random_aliases.add(child.asname or child.name)
elif node.module == "numpy.random":
self.numpy_random_aliases.add(child.asname or child.name)
def is_es_system(self, child):
if hasattr(child, "value"):
if hasattr(child.value, "value") and hasattr(
child.value.value, "id"):
if (child.value.value.id + "." + child.value.attr +
"." + child.attr) in self.es_system_aliases:
return True
else:
if hasattr(child.value, "id") and (child.value.id + "." +
child.attr) in self.es_system_aliases:
return True
elif isinstance(child, ast.Call):
if hasattr(child, "id") and child.func.id in self.es_system_aliases:
return True
elif hasattr(child, "func") and hasattr(child.func, "value") and (
hasattr(child.func.value, "value") and
(child.func.value.value.id + "." +
child.func.value.attr + "." + child.func.attr)
or (child.func.value.id + "." + child.func.attr)) in self.es_system_aliases:
return True
elif hasattr(child, "func") and hasattr(child.func, "id") and child.func.id in self.es_system_aliases:
return True
elif hasattr(child, "id") and child.id in self.es_system_aliases:
return True
return False
def detect_es_system_instances(self, node):
varname = None
for target in node.targets:
if isinstance(target, ast.Name):
if hasattr(target, "id") and hasattr(node.value, "func") and \
self.is_es_system(node.value.func):
varname = target.id
elif isinstance(target, ast.Tuple):
value = node.value
if (isinstance(value, ast.Tuple) or isinstance(value, ast.List)) \
and any(map(self.is_es_system, node.value.elts)):
raise AssertionError(self.error_msg_multi_assign.format(
"espressomd.System", node.lineno))
if varname is not None:
assert len(node.targets) == 1, self.error_msg_multi_assign.format(
"espressomd.System", node.lineno)
assert self.abort_message is None, \
"Cannot process espressomd.System assignments in " + self.abort_message
self.variable_system_aliases.add(varname)
def detect_np_random_expr_seed(self, node):
if hasattr(node.value, "func") and hasattr(node.value.func, "value") \
and (hasattr(node.value.func.value, "id") and node.value.func.value.id in self.numpy_random_aliases
or hasattr(node.value.func.value, "value")
and hasattr(node.value.func.value.value, "id")
and hasattr(node.value.func.value, "attr")
and (node.value.func.value.value.id + "." +
node.value.func.value.attr) in self.numpy_random_aliases
) and node.value.func.attr == "seed":
self.numpy_seeds.append(node.lineno)
def visit_Assign(self, node):
self.detect_es_system_instances(node)
def visit_Expr(self, node):
self.detect_np_random_expr_seed(node)
def visit_ClassDef(self, node):
self.abort_message = "class definitions"
ast.NodeVisitor.generic_visit(self, node)
self.abort_message = None
def visit_FunctionDef(self, node):
self.abort_message = "function definitions"
ast.NodeVisitor.generic_visit(self, node)
self.abort_message = None
def visit_AsyncFunctionDef(self, node):
self.abort_message = "function definitions"
ast.NodeVisitor.generic_visit(self, node)
self.abort_message = None
def set_random_seeds(code):
"""
Remove numpy random number generator seeds, such that
the sample/tutorial always starts with different random seeds.
"""
code = protect_ipython_magics(code)
tree = ast.parse(code)
visitor = GetPrngSeedEspressomdSystem()
visitor.visit(tree)
lines = code.split("\n")
# delete explicit NumPy seed
for lineno in visitor.numpy_seeds:
old_stmt = ".seed"
new_stmt = ".seed;_random_seed_np = (lambda *args, **kwargs: None)"
lines[lineno - 1] = lines[lineno - 1].replace(old_stmt, new_stmt, 1)
code = "\n".join(lines)
code = deprotect_ipython_magics(code)
return code
def delimit_statements(code):
"""
For every Python statement, map the line number where it starts to the
line number where it ends.
"""
statements = []
statement_start = None
for tok in tokenize.tokenize(io.BytesIO(code.encode("utf-8")).readline):
if tok.exact_type == tokenize.ENDMARKER:
break
elif tok.exact_type == tokenize.ENCODING:
pass
elif tok.start == tok.end:
pass
elif tok.exact_type == tokenize.NEWLINE or tok.exact_type == tokenize.NL and prev_tok.exact_type == tokenize.COMMENT:
statements.append((statement_start, tok.start[0]))
statement_start = None
elif tok.exact_type == tokenize.NL:
pass
elif statement_start is None:
statement_start = tok.start[0]
prev_tok = tok
return dict(statements)
def protect_ipython_magics(code):
"""
Replace all IPython magic commands (e.g. ``%matplotlib notebook``) by a
formatted comment. This is necessary whenever the code must be parsed
through ``ast``, because magic commands are not valid Python statements.
"""
return re.sub("^(%+)(?=[a-z])", "#_IPYTHON_MAGIC_\g<1>", code, flags=re.M)
def deprotect_ipython_magics(code):
"""
Reverse the action of :func:`protect_ipython_magics`.
"""
return re.sub("^#_IPYTHON_MAGIC_(%+)(?=[a-z])", "\g<1>", code, flags=re.M)
class GetMatplotlibPyplot(ast.NodeVisitor):
"""
Find all line numbers where ``matplotlib`` and ``pyplot`` are imported
and store their alias. Find line numbers where the matplotlib backend
is set, where the pyplot interactive mode is activated and where IPython
magic commands (in the processed form ``get_ipython().func(args)``) are
set.
"""
def __init__(self):
self.matplotlib_first = None
self.matplotlib_aliases = []
self.pyplot_aliases = []
self.pyplot_paths = set()
self.pyplot_interactive_linenos = []
self.matplotlib_backend_linenos = []
self.ipython_magic_linenos = []
def make_pyplot_paths(self):
self.pyplot_paths = set(tuple(x.split("."))
for x in self.pyplot_aliases)
def visit_Import(self, node):
# get line number of the first matplotlib import
for child in node.names:
if child.name.split(".")[0] == "matplotlib":
self.matplotlib_first = self.matplotlib_first or node.lineno
# get matplotlib aliases
for child in node.names:
if child.name == "matplotlib":
self.matplotlib_aliases.append(child.asname or child.name)
# get pyplot aliases
for child in node.names:
if child.name == "matplotlib.pyplot":
self.pyplot_aliases.append(child.asname or child.name)
elif child.name == "matplotlib":
name = (child.asname or "matplotlib") + ".pyplot"
self.pyplot_aliases.append(name)
self.make_pyplot_paths()
def visit_ImportFrom(self, node):
# get line number of the first matplotlib import
if node.module.split(".")[0] == "matplotlib":
self.matplotlib_first = self.matplotlib_first or node.lineno
# get pyplot aliases
for child in node.names:
if node.module == "matplotlib" and child.name == "pyplot":
self.pyplot_aliases.append(child.asname or child.name)
self.make_pyplot_paths()
def visit_Expr(self, node):
# get matplotlib custom options that need to be turned off
if hasattr(node.value, "func") and hasattr(node.value.func, "value"):
value = node.value.func.value
# detect pyplot interactive mode
if node.value.func.attr == "ion":
if hasattr(value, "id") and (value.id,) in self.pyplot_paths or hasattr(
value.value, "id") and (value.value.id, value.attr) in self.pyplot_paths:
self.pyplot_interactive_linenos.append(node.lineno)
# detect matplotlib custom backends
if node.value.func.attr == "use":
if hasattr(
value, "id") and value.id in self.matplotlib_aliases:
self.matplotlib_backend_linenos.append(node.lineno)
# detect IPython magic functions: ``%matplotlib ...`` statements are
# converted to ``get_ipython().run_line_magic('matplotlib', '...')``
if hasattr(node.value, "func") and hasattr(node.value.func, "value") \
and hasattr(node.value.func.value, "func") \
and hasattr(node.value.func.value.func, "id") \
and node.value.func.value.func.id == "get_ipython":
self.ipython_magic_linenos.append(node.lineno)
def disable_matplotlib_gui(code):
"""
Use the matplotlib Agg backend (no GUI).
"""
# remove magic functions that use the percent sign syntax
code = protect_ipython_magics(code)
tree = ast.parse(code)
visitor = GetMatplotlibPyplot()
visitor.visit(tree)
first_mpl_import = visitor.matplotlib_first
# split lines
lines = code.split("\n")
mapping = delimit_statements(code)
# list of lines to comment out
lines_comment_out = []
# remove magic functions
lines_comment_out += visitor.ipython_magic_linenos
# remove interactive mode
lines_comment_out += visitor.pyplot_interactive_linenos
# remove any custom backend
lines_comment_out += visitor.matplotlib_backend_linenos
# use the Agg backend
if first_mpl_import:
line = lines[first_mpl_import - 1]
indentation = line[:len(line) - len(line.lstrip())]
lines[first_mpl_import - 1] = indentation + \
"import matplotlib as _mpl;_mpl.use('Agg');" + line.lstrip()
# comment out lines
for lineno_start in lines_comment_out:
lineno_end = mapping[lineno_start]
for lineno in range(lineno_start, lineno_end + 1):
lines[lineno - 1] = "#" + lines[lineno - 1]
code = "\n".join(lines)
return code
class GetEspressomdVisualizerImports(ast.NodeVisitor):
"""
Find line numbers and aliases of imported ESPResSo visualizers.
"""
def __init__(self):
self.visualizers = {
"visualization",
"visualization_opengl",
"visualization_mayavi"}
self.namespace_visualizers = {
"espressomd." + x for x in self.visualizers}
self.visu_items = {}
def register_import(self, lineno, from_str, module_str, alias):
if lineno not in self.visu_items:
self.visu_items[lineno] = []
if from_str:
line = "from {} import {}".format(from_str, module_str)
else:
line = "import {}".format(module_str)
if alias:
line += " as {}".format(alias)
self.visu_items[lineno].append(line)
def visit_Import(self, node):
# get visualizer alias
for child in node.names:
if child.name in self.namespace_visualizers:
self.register_import(
node.lineno, None, child.name, child.asname)
def visit_ImportFrom(self, node):
if node.module in self.namespace_visualizers:
for child in node.names:
if child.name == "*":
raise ValueError("cannot use MagicMock() on a wildcard "
"import at line {}".format(node.lineno))
self.register_import(
node.lineno, node.module, child.name, child.asname)
# get visualizer alias
if node.module == "espressomd":
for child in node.names:
if child.name in self.visualizers:
self.register_import(
node.lineno, node.module, child.name, child.asname)
def mock_es_visualization(code):
"""
Replace ``import espressomd.visualization_<backend>`` by a ``MagicMock()``
when the visualization module is unavailable, by catching the
``ImportError()`` exception. Please note that ``espressomd.visualization``
is deferring the exception, thus requiring additional checks.
Import aliases are supported, however please don't use
``from espressomd.visualization import *`` because it hides the namespace
of classes to be mocked.
"""
# replacement template
r_es_vis_mock = r"""
try:
{0}{1}
except ImportError:
from unittest.mock import MagicMock
import espressomd
{2} = MagicMock()
""".lstrip()
def check_for_deferred_ImportError(line, alias):
if "_opengl" not in line and "_mayavi" not in line:
if "openGLLive" in line or "mayaviLive" in line:
return """
if hasattr({0}, 'deferred_ImportError'):
raise {0}.deferred_ImportError""".format(alias)
else:
return """
if hasattr({0}.mayaviLive, 'deferred_ImportError') or \\
hasattr({0}.openGLLive, 'deferred_ImportError'):
raise ImportError()""".format(alias)
else:
return ""
visitor = GetEspressomdVisualizerImports()
visitor.visit(ast.parse(protect_ipython_magics(code)))
lines = code.split("\n")
for lineno, imports in visitor.visu_items.items():
line = lines[lineno - 1]
indentation = line[:len(line) - len(line.lstrip())]
lines[lineno - 1] = ""
for import_str in imports:
alias = import_str.split()[-1]
checks = check_for_deferred_ImportError(import_str, alias)
import_str_new = "\n".join(indentation + x for x in
r_es_vis_mock.format(import_str, checks, alias).split("\n"))
lines[lineno - 1] += import_str_new
return "\n".join(lines)
def skip_future_imports_dependency(filepath):
"""
If an import failed, all subsequent imports will be skipped. The
fixture message provides the name of the module that failed.
"""
global skip_future_imports
if not skip_future_imports:
module_name = os.path.splitext(os.path.basename(filepath))[0]
assert module_name != ""
skip_future_imports = module_name
return unittest.skip("failed to import {}, skipping test!"
.format(skip_future_imports))
| {
"pile_set_name": "Github"
} |
include ../../../GDALmake.opt
OBJ = ogrodbcdatasource.o ogrodbclayer.o ogrodbcdriver.o \
ogrodbctablelayer.o ogrodbcselectlayer.o
CPPFLAGS := $(GDAL_INCLUDE) -I.. -I../.. $(CPPFLAGS)
default: $(O_OBJ:.o=.$(OBJ_EXT))
clean:
rm -f *.o $(O_OBJ)
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.IO;
namespace AutoFixture.Kernel
{
/// <summary>
/// Trace writer that will write out a trace of object requests and created objects
/// in the <see cref="ISpecimenBuilder" /> pipeline.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "The main responsibility of this class isn't to be a 'collection' (which, by the way, it isn't - it's just an Iterator).")]
public class TraceWriter : ISpecimenBuilderNode
{
private readonly TextWriter writer;
private Action<TextWriter, object, int> writeRequest;
private Action<TextWriter, object, int> writeSpecimen;
/// <summary>
/// Initializes a new instance of the <see cref="TraceWriter"/> class.
/// </summary>
/// <param name="writer">The output stream for the trace.</param>
/// <param name="tracer">The <see cref="ISpecimenBuilder"/> to decorate.</param>
public TraceWriter(TextWriter writer, TracingBuilder tracer)
{
if (writer == null) throw new ArgumentNullException(nameof(writer));
if (tracer == null) throw new ArgumentNullException(nameof(tracer));
this.Tracer = tracer;
this.Tracer.SpecimenRequested += (sender, e) => this.writeRequest(writer, e.Request, e.Depth);
this.Tracer.SpecimenCreated += (sender, e) => this.writeSpecimen(writer, e.Specimen, e.Depth);
this.writer = writer;
this.TraceRequestFormatter = (tw, r, i) => tw.WriteLine(new string(' ', i * 2) + "Requested: " + r);
this.TraceSpecimenFormatter = (tw, r, i) => tw.WriteLine(new string(' ', i * 2) + "Created: " + r);
}
/// <summary>
/// Gets the <see cref="TracingBuilder"/> decorated by this instance.
/// </summary>
public TracingBuilder Tracer { get; }
/// <summary>
/// Gets or sets the formatter for tracing a request.
/// </summary>
/// <value>The request trace formatter.</value>
public Action<TextWriter, object, int> TraceRequestFormatter
{
get => this.writeRequest;
set => this.writeRequest = value ?? throw new ArgumentNullException(nameof(value));
}
/// <summary>
/// Gets or sets the formatter for tracing a created specimen.
/// </summary>
/// <value>The created specimen trace formatter.</value>
public Action<TextWriter, object, int> TraceSpecimenFormatter
{
get => this.writeSpecimen;
set => this.writeSpecimen = value ?? throw new ArgumentNullException(nameof(value));
}
/// <summary>
/// Creates a new specimen based on a request by delegating to its decorated builder.
/// </summary>
/// <param name="request">The request that describes what to create.</param>
/// <param name="context">A context that can be used to create other specimens.</param>
/// <returns>
/// The requested specimen if possible; otherwise a <see cref="NoSpecimen"/> instance.
/// </returns>
public object Create(object request, ISpecimenContext context)
{
return this.Tracer.Create(request, context);
}
/// <summary>Composes the supplied builders.</summary>
/// <param name="builders">The builders to compose.</param>
/// <returns>
/// A new <see cref="ISpecimenBuilderNode" /> instance containing
/// <paramref name="builders" /> as child nodes.
/// </returns>
public virtual ISpecimenBuilderNode Compose(IEnumerable<ISpecimenBuilder> builders)
{
if (builders == null) throw new ArgumentNullException(nameof(builders));
var builder = CompositeSpecimenBuilder.ComposeIfMultiple(builders);
return new TraceWriter(
this.writer,
new TracingBuilder(
builder));
}
/// <summary>
/// Returns an enumerator that iterates through the collection.
/// </summary>
/// <returns>
/// A <see cref="IEnumerator{ISpecimenBuilder}" /> that can be used to
/// iterate through the collection.
/// </returns>
public IEnumerator<ISpecimenBuilder> GetEnumerator()
{
yield return this.Tracer.Builder;
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this.GetEnumerator();
}
}
} | {
"pile_set_name": "Github"
} |
// removeSubsets
// Given an array of nodes, remove any member that is contained by another.
exports.removeSubsets = function(nodes) {
var idx = nodes.length, node, ancestor, replace;
// Check if each node (or one of its ancestors) is already contained in the
// array.
while (--idx > -1) {
node = ancestor = nodes[idx];
// Temporarily remove the node under consideration
nodes[idx] = null;
replace = true;
while (ancestor) {
if (nodes.indexOf(ancestor) > -1) {
replace = false;
nodes.splice(idx, 1);
break;
}
ancestor = ancestor.parent;
}
// If the node has been found to be unique, re-insert it.
if (replace) {
nodes[idx] = node;
}
}
return nodes;
};
// Source: http://dom.spec.whatwg.org/#dom-node-comparedocumentposition
var POSITION = {
DISCONNECTED: 1,
PRECEDING: 2,
FOLLOWING: 4,
CONTAINS: 8,
CONTAINED_BY: 16
};
// Compare the position of one node against another node in any other document.
// The return value is a bitmask with the following values:
//
// document order:
// > There is an ordering, document order, defined on all the nodes in the
// > document corresponding to the order in which the first character of the
// > XML representation of each node occurs in the XML representation of the
// > document after expansion of general entities. Thus, the document element
// > node will be the first node. Element nodes occur before their children.
// > Thus, document order orders element nodes in order of the occurrence of
// > their start-tag in the XML (after expansion of entities). The attribute
// > nodes of an element occur after the element and before its children. The
// > relative order of attribute nodes is implementation-dependent./
// Source:
// http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
//
// @argument {Node} nodaA The first node to use in the comparison
// @argument {Node} nodeB The second node to use in the comparison
//
// @return {Number} A bitmask describing the input nodes' relative position.
// See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
// a description of these values.
var comparePos = exports.compareDocumentPosition = function(nodeA, nodeB) {
var aParents = [];
var bParents = [];
var current, sharedParent, siblings, aSibling, bSibling, idx;
if (nodeA === nodeB) {
return 0;
}
current = nodeA;
while (current) {
aParents.unshift(current);
current = current.parent;
}
current = nodeB;
while (current) {
bParents.unshift(current);
current = current.parent;
}
idx = 0;
while (aParents[idx] === bParents[idx]) {
idx++;
}
if (idx === 0) {
return POSITION.DISCONNECTED;
}
sharedParent = aParents[idx - 1];
siblings = sharedParent.children;
aSibling = aParents[idx];
bSibling = bParents[idx];
if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
if (sharedParent === nodeB) {
return POSITION.FOLLOWING | POSITION.CONTAINED_BY;
}
return POSITION.FOLLOWING;
} else {
if (sharedParent === nodeA) {
return POSITION.PRECEDING | POSITION.CONTAINS;
}
return POSITION.PRECEDING;
}
};
// Sort an array of nodes based on their relative position in the document and
// remove any duplicate nodes. If the array contains nodes that do not belong
// to the same document, sort order is unspecified.
//
// @argument {Array} nodes Array of DOM nodes
//
// @returns {Array} collection of unique nodes, sorted in document order
exports.uniqueSort = function(nodes) {
var idx = nodes.length, node, position;
nodes = nodes.slice();
while (--idx > -1) {
node = nodes[idx];
position = nodes.indexOf(node);
if (position > -1 && position < idx) {
nodes.splice(idx, 1);
}
}
nodes.sort(function(a, b) {
var relative = comparePos(a, b);
if (relative & POSITION.PRECEDING) {
return -1;
} else if (relative & POSITION.FOLLOWING) {
return 1;
}
return 0;
});
return nodes;
};
| {
"pile_set_name": "Github"
} |
# This source code refers to The Go Authors for copyright purposes.
# The master list of authors is in the main Go distribution,
# visible at http://tip.golang.org/AUTHORS.
| {
"pile_set_name": "Github"
} |
using Microsoft.AspNetCore.Http;
using System.Diagnostics;
using System.Threading.Tasks;
namespace ClassifiedAds.Infrastructure.Web.Middleware
{
public class DebuggingMiddleware
{
private readonly RequestDelegate _next;
public DebuggingMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task InvokeAsync(HttpContext context)
{
var stopwatch = Stopwatch.StartNew();
await _next(context);
var elapsedTime = stopwatch.Elapsed;
// inspect the context here
// if (context.Request.Path.HasValue && context.Request.Path.Value.Contains("oidc"))
// {
// }
}
}
}
| {
"pile_set_name": "Github"
} |
//===-- SparcMCCodeEmitter.cpp - Convert Sparc code to machine code -------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file implements the SparcMCCodeEmitter class.
//
//===----------------------------------------------------------------------===//
#include "MCTargetDesc/SparcFixupKinds.h"
#include "SparcMCExpr.h"
#include "SparcMCTargetDesc.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <cstdint>
using namespace llvm;
#define DEBUG_TYPE "mccodeemitter"
STATISTIC(MCNumEmitted, "Number of MC instructions emitted");
namespace {
class SparcMCCodeEmitter : public MCCodeEmitter {
const MCInstrInfo &MCII;
MCContext &Ctx;
public:
SparcMCCodeEmitter(const MCInstrInfo &mcii, MCContext &ctx)
: MCII(mcii), Ctx(ctx) {}
SparcMCCodeEmitter(const SparcMCCodeEmitter &) = delete;
SparcMCCodeEmitter &operator=(const SparcMCCodeEmitter &) = delete;
~SparcMCCodeEmitter() override = default;
void encodeInstruction(const MCInst &MI, raw_ostream &OS,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const override;
// getBinaryCodeForInstr - TableGen'erated function for getting the
// binary encoding for an instruction.
uint64_t getBinaryCodeForInstr(const MCInst &MI,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
/// getMachineOpValue - Return binary encoding of operand. If the machine
/// operand requires relocation, record the relocation and return zero.
unsigned getMachineOpValue(const MCInst &MI, const MCOperand &MO,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
unsigned getCallTargetOpValue(const MCInst &MI, unsigned OpNo,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
unsigned getBranchTargetOpValue(const MCInst &MI, unsigned OpNo,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
unsigned getBranchPredTargetOpValue(const MCInst &MI, unsigned OpNo,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
unsigned getBranchOnRegTargetOpValue(const MCInst &MI, unsigned OpNo,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const;
private:
FeatureBitset computeAvailableFeatures(const FeatureBitset &FB) const;
void
verifyInstructionPredicates(const MCInst &MI,
const FeatureBitset &AvailableFeatures) const;
};
} // end anonymous namespace
void SparcMCCodeEmitter::encodeInstruction(const MCInst &MI, raw_ostream &OS,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
verifyInstructionPredicates(MI,
computeAvailableFeatures(STI.getFeatureBits()));
unsigned Bits = getBinaryCodeForInstr(MI, Fixups, STI);
support::endian::write(OS, Bits,
Ctx.getAsmInfo()->isLittleEndian() ? support::little
: support::big);
unsigned tlsOpNo = 0;
switch (MI.getOpcode()) {
default: break;
case SP::TLS_CALL: tlsOpNo = 1; break;
case SP::TLS_ADDrr:
case SP::TLS_ADDXrr:
case SP::TLS_LDrr:
case SP::TLS_LDXrr: tlsOpNo = 3; break;
}
if (tlsOpNo != 0) {
const MCOperand &MO = MI.getOperand(tlsOpNo);
uint64_t op = getMachineOpValue(MI, MO, Fixups, STI);
assert(op == 0 && "Unexpected operand value!");
(void)op; // suppress warning.
}
++MCNumEmitted; // Keep track of the # of mi's emitted.
}
unsigned SparcMCCodeEmitter::
getMachineOpValue(const MCInst &MI, const MCOperand &MO,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
if (MO.isReg())
return Ctx.getRegisterInfo()->getEncodingValue(MO.getReg());
if (MO.isImm())
return MO.getImm();
assert(MO.isExpr());
const MCExpr *Expr = MO.getExpr();
if (const SparcMCExpr *SExpr = dyn_cast<SparcMCExpr>(Expr)) {
MCFixupKind Kind = (MCFixupKind)SExpr->getFixupKind();
Fixups.push_back(MCFixup::create(0, Expr, Kind));
return 0;
}
int64_t Res;
if (Expr->evaluateAsAbsolute(Res))
return Res;
llvm_unreachable("Unhandled expression!");
return 0;
}
unsigned SparcMCCodeEmitter::
getCallTargetOpValue(const MCInst &MI, unsigned OpNo,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
const MCOperand &MO = MI.getOperand(OpNo);
if (MO.isReg() || MO.isImm())
return getMachineOpValue(MI, MO, Fixups, STI);
if (MI.getOpcode() == SP::TLS_CALL) {
// No fixups for __tls_get_addr. Will emit for fixups for tls_symbol in
// encodeInstruction.
#ifndef NDEBUG
// Verify that the callee is actually __tls_get_addr.
const SparcMCExpr *SExpr = dyn_cast<SparcMCExpr>(MO.getExpr());
assert(SExpr && SExpr->getSubExpr()->getKind() == MCExpr::SymbolRef &&
"Unexpected expression in TLS_CALL");
const MCSymbolRefExpr *SymExpr = cast<MCSymbolRefExpr>(SExpr->getSubExpr());
assert(SymExpr->getSymbol().getName() == "__tls_get_addr" &&
"Unexpected function for TLS_CALL");
#endif
return 0;
}
MCFixupKind fixupKind = (MCFixupKind)Sparc::fixup_sparc_call30;
if (const SparcMCExpr *SExpr = dyn_cast<SparcMCExpr>(MO.getExpr())) {
if (SExpr->getKind() == SparcMCExpr::VK_Sparc_WPLT30)
fixupKind = (MCFixupKind)Sparc::fixup_sparc_wplt30;
}
Fixups.push_back(MCFixup::create(0, MO.getExpr(), fixupKind));
return 0;
}
unsigned SparcMCCodeEmitter::
getBranchTargetOpValue(const MCInst &MI, unsigned OpNo,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
const MCOperand &MO = MI.getOperand(OpNo);
if (MO.isReg() || MO.isImm())
return getMachineOpValue(MI, MO, Fixups, STI);
Fixups.push_back(MCFixup::create(0, MO.getExpr(),
(MCFixupKind)Sparc::fixup_sparc_br22));
return 0;
}
unsigned SparcMCCodeEmitter::
getBranchPredTargetOpValue(const MCInst &MI, unsigned OpNo,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
const MCOperand &MO = MI.getOperand(OpNo);
if (MO.isReg() || MO.isImm())
return getMachineOpValue(MI, MO, Fixups, STI);
Fixups.push_back(MCFixup::create(0, MO.getExpr(),
(MCFixupKind)Sparc::fixup_sparc_br19));
return 0;
}
unsigned SparcMCCodeEmitter::
getBranchOnRegTargetOpValue(const MCInst &MI, unsigned OpNo,
SmallVectorImpl<MCFixup> &Fixups,
const MCSubtargetInfo &STI) const {
const MCOperand &MO = MI.getOperand(OpNo);
if (MO.isReg() || MO.isImm())
return getMachineOpValue(MI, MO, Fixups, STI);
Fixups.push_back(MCFixup::create(0, MO.getExpr(),
(MCFixupKind)Sparc::fixup_sparc_br16_2));
Fixups.push_back(MCFixup::create(0, MO.getExpr(),
(MCFixupKind)Sparc::fixup_sparc_br16_14));
return 0;
}
#define ENABLE_INSTR_PREDICATE_VERIFIER
#include "SparcGenMCCodeEmitter.inc"
MCCodeEmitter *llvm::createSparcMCCodeEmitter(const MCInstrInfo &MCII,
const MCRegisterInfo &MRI,
MCContext &Ctx) {
return new SparcMCCodeEmitter(MCII, Ctx);
}
| {
"pile_set_name": "Github"
} |
/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
/* global child_process$ChildProcess */
import type {ServerID} from './utils';
import {spawn} from 'child_process';
import {makeUniqServerId} from './utils';
import path from 'path';
import {INITIALIZE_MESSAGE, JSONRPC_EVENT_NAME} from './constants';
import {IPC} from 'node-ipc';
import {serializeRequest, parseResponse} from './jsonrpc';
type SpawnFn = ({serverID: ServerID}) => child_process$ChildProcess;
type SpawnNode = {|
useBabel?: boolean,
initFile: string,
|};
type ConstructorOptions =
| {|
spawn: SpawnFn,
|}
| {|spawnNode: SpawnNode|};
export default class RPCProcess<Methods> {
_ipc: IPC;
server: Object;
serverID: ServerID;
isAlive: boolean;
_spawn: SpawnFn;
remote: Methods;
_socket: any;
_pendingRequests: {[string]: {resolve: Function, reject: Function}};
_subprocess: child_process$ChildProcess;
constructor(options: ConstructorOptions) {
this.serverID = makeUniqServerId();
this.isAlive = false;
this._ipc = new IPC();
this._spawn = options.spawnNode
? makeSpawnNodeFn(this.serverID, options.spawnNode)
: options.spawn;
this.remote = this.initializeRemote();
this._pendingRequests = {};
}
initializeRemote(): Methods {
throw new Error('not implemented');
}
async start(): Promise<void> {
this._ipc.config.id = this.serverID;
this._ipc.config.retry = 1500;
this._ipc.config.silent = true;
this._subprocess = this._spawn({serverID: this.serverID});
const socket = await new Promise(async resolve => {
this._ipc.serve(() => {
this._ipc.server.on(INITIALIZE_MESSAGE, (message, socket) => {
this.server = this._ipc.server;
this.isAlive = true;
resolve(socket);
});
this._ipc.server.on(JSONRPC_EVENT_NAME, json => {
this.handleJsonRPCResponse(json);
});
});
this._ipc.server.start();
});
this._socket = socket;
}
stop() {
this.server && this.server.stop();
if (this._subprocess && this.isAlive) {
try {
process.kill(-this._subprocess.pid, 'SIGKILL');
// eslint-disable-next-line no-empty
} catch (e) {}
}
this._subprocess.kill('SIGKILL');
delete this.server;
this.isAlive = false;
}
async jsonRPCCall(method: string, ...args: Array<any>) {
this._ensureServerStarted();
return new Promise((resolve, reject) => {
const {id, json} = serializeRequest(method, [...args]);
this.server.emit(this._socket, JSONRPC_EVENT_NAME, json);
this._pendingRequests[id] = {
resolve: data => {
delete this._pendingRequests[id];
resolve(data);
},
reject: error => {
delete this._pendingRequests[id];
reject(new Error(`${error.code}:${error.message}\n${error.data}`));
},
};
});
}
handleJsonRPCResponse(json: string) {
const response = parseResponse(json);
const {id, result, error} = response;
if (error) {
this._pendingRequests[id].reject(error);
} else {
this._pendingRequests[id].resolve(result);
}
}
_ensureServerStarted() {
if (!this.server) {
throw new Error(`
RPCProcess need to be started before making any RPC calls.
e.g.:
--------
const rpcProcess = new MyRPCProcess(options);
await rpcProcess.start();
const result = rpcProcess.remote.doSomething();
`);
}
}
}
const getBabelNodeBin = () =>
path.resolve(__dirname, '../../../node_modules/.bin/babel-node');
const makeSpawnNodeFn = (serverID, {initFile, useBabel}): SpawnFn => {
return () => {
const bin = useBabel ? getBabelNodeBin() : 'node';
return spawn(bin, [initFile], {
stdio: ['inherit', process.stderr, 'inherit'],
env: {
...process.env,
JEST_SERVER_ID: serverID,
},
detached: true,
});
};
};
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of the `liip/LiipImagineBundle` project.
*
* (c) https://github.com/liip/LiipImagineBundle/graphs/contributors
*
* For the full copyright and license information, please view the LICENSE.md
* file that was distributed with this source code.
*/
namespace Liip\ImagineBundle\Controller;
use Imagine\Exception\RuntimeException;
use Liip\ImagineBundle\Config\Controller\ControllerConfig;
use Liip\ImagineBundle\Exception\Binary\Loader\NotLoadableException;
use Liip\ImagineBundle\Exception\Imagine\Filter\NonExistingFilterException;
use Liip\ImagineBundle\Imagine\Cache\Helper\PathHelper;
use Liip\ImagineBundle\Imagine\Cache\SignerInterface;
use Liip\ImagineBundle\Imagine\Data\DataManager;
use Liip\ImagineBundle\Service\FilterService;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class ImagineController
{
/**
* @var FilterService
*/
private $filterService;
/**
* @var DataManager
*/
private $dataManager;
/**
* @var SignerInterface
*/
private $signer;
/**
* @var ControllerConfig
*/
private $controllerConfig;
/**
* @param FilterService $filterService
* @param DataManager $dataManager
* @param SignerInterface $signer
* @param ControllerConfig|null $controllerConfig
*/
public function __construct(FilterService $filterService, DataManager $dataManager, SignerInterface $signer, ?ControllerConfig $controllerConfig = null)
{
$this->filterService = $filterService;
$this->dataManager = $dataManager;
$this->signer = $signer;
if (null === $controllerConfig) {
@trigger_error(sprintf(
'Instantiating "%s" without a forth argument of type "%s" is deprecated since 2.2.0 and will be required in 3.0.', self::class, ControllerConfig::class
), E_USER_DEPRECATED);
}
$this->controllerConfig = $controllerConfig ?? new ControllerConfig(301);
}
/**
* This action applies a given filter to a given image, saves the image and redirects the browser to the stored
* image.
*
* The resulting image is cached so subsequent requests will redirect to the cached image instead applying the
* filter and storing the image again.
*
* @param Request $request
* @param string $path
* @param string $filter
*
* @throws RuntimeException
* @throws NotFoundHttpException
*
* @return RedirectResponse
*/
public function filterAction(Request $request, $path, $filter)
{
$path = PathHelper::urlPathToFilePath($path);
$resolver = $request->get('resolver');
return $this->createRedirectResponse(function () use ($path, $filter, $resolver) {
return $this->filterService->getUrlOfFilteredImage($path, $filter, $resolver);
}, $path, $filter);
}
/**
* This action applies a given filter -merged with additional runtime filters- to a given image, saves the image and
* redirects the browser to the stored image.
*
* The resulting image is cached so subsequent requests will redirect to the cached image instead applying the
* filter and storing the image again.
*
* @param Request $request
* @param string $hash
* @param string $path
* @param string $filter
*
* @throws RuntimeException
* @throws BadRequestHttpException
* @throws NotFoundHttpException
*
* @return RedirectResponse
*/
public function filterRuntimeAction(Request $request, $hash, $path, $filter)
{
$resolver = $request->get('resolver');
$path = PathHelper::urlPathToFilePath($path);
$runtimeConfig = $request->query->get('filters', []);
if (!\is_array($runtimeConfig)) {
throw new NotFoundHttpException(sprintf('Filters must be an array. Value was "%s"', $runtimeConfig));
}
if (true !== $this->signer->check($hash, $path, $runtimeConfig)) {
throw new BadRequestHttpException(sprintf(
'Signed url does not pass the sign check for path "%s" and filter "%s" and runtime config %s',
$path,
$filter,
json_encode($runtimeConfig)
));
}
return $this->createRedirectResponse(function () use ($path, $filter, $runtimeConfig, $resolver) {
return $this->filterService->getUrlOfFilteredImageWithRuntimeFilters($path, $filter, $runtimeConfig, $resolver);
}, $path, $filter, $hash);
}
private function createRedirectResponse(\Closure $url, string $path, string $filter, ?string $hash = null): RedirectResponse
{
try {
return new RedirectResponse($url(), $this->controllerConfig->getRedirectResponseCode());
} catch (NotLoadableException $exception) {
if (null !== $this->dataManager->getDefaultImageUrl($filter)) {
return new RedirectResponse($this->dataManager->getDefaultImageUrl($filter));
}
throw new NotFoundHttpException(sprintf('Source image for path "%s" could not be found', $path), $exception);
} catch (NonExistingFilterException $exception) {
throw new NotFoundHttpException(sprintf('Requested non-existing filter "%s"', $filter), $exception);
} catch (RuntimeException $exception) {
throw new \RuntimeException(vsprintf('Unable to create image for path "%s" and filter "%s". Message was "%s"', [
$hash ? sprintf('%s/%s', $hash, $path) : $path,
$filter,
$exception->getMessage(),
]), 0, $exception);
}
}
}
| {
"pile_set_name": "Github"
} |
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}/Pods
| {
"pile_set_name": "Github"
} |
# REQUIRES: hexagon
# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %s -o %t.o
# RUN: llvm-mc -filetype=obj -triple=hexagon-unknown-elf %S/Inputs/hexagon-shared.s -o %t2.o
# RUN: ld.lld -shared %t2.o -soname=so -o %t2.so
# RUN: ld.lld -shared %t.o %t2.so -o %t3.so
# RUN: llvm-objdump --print-imm-hex -d -j .text %t3.so | FileCheck --check-prefix=TEXT %s
.global foo
foo:
.Lpc:
# R_HEX_GOTREL_LO16
r0.l = #LO(.Lpc@GOTREL)
# R_HEX_GOTREL_HI16
r0.h = #HI(.Lpc@GOTREL)
# R_HEX_GOTREL_11_X
r0 = memw(r1+##.Lpc@GOTREL)
# R_HEX_GOTREL_32_6_X and R_HEX_GOTREL_16_X
r0 = ##(.Lpc@GOTREL)
# TEXT: r0.l = #0xffa8 }
# TEXT: r0.h = #0xfffd }
# TEXT: immext(#0xfffdff80)
# TEXT: r0 = memw(r1+##-0x20058) }
# TEXT: immext(#0xfffdff80)
# TEXT: r0 = ##-0x20058 }
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GanttBarStartEndType (MPXJ 8.2.0 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="GanttBarStartEndType (MPXJ 8.2.0 API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":9,"i2":10,"i3":10,"i4":10,"i5":9,"i6":9};
var tabs = {65535:["t0","All Methods"],1:["t1","Static Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/GanttBarStartEndType.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndShape.html" title="enum in net.sf.mpxj.mpp"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../net/sf/mpxj/mpp/GanttBarStyle.html" title="class in net.sf.mpxj.mpp"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?net/sf/mpxj/mpp/GanttBarStartEndType.html" target="_top">Frames</a></li>
<li><a href="GanttBarStartEndType.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#enum.constant.summary">Enum Constants</a> | </li>
<li>Field | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#enum.constant.detail">Enum Constants</a> | </li>
<li>Field | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">net.sf.mpxj.mpp</div>
<h2 title="Enum GanttBarStartEndType" class="title">Enum GanttBarStartEndType</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">java.lang.Enum</a><<a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a>></li>
<li>
<ul class="inheritance">
<li>net.sf.mpxj.mpp.GanttBarStartEndType</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="http://docs.oracle.com/javase/7/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a><<a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a>>, <a href="../../../../net/sf/mpxj/MpxjEnum.html" title="interface in net.sf.mpxj">MpxjEnum</a></dd>
</dl>
<hr>
<br>
<pre>public enum <span class="typeNameLabel">GanttBarStartEndType</span>
extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</a><<a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a>>
implements <a href="../../../../net/sf/mpxj/MpxjEnum.html" title="interface in net.sf.mpxj">MpxjEnum</a></pre>
<div class="block">Represents the style of the start and end sections of a Gantt bar.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== ENUM CONSTANT SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="enum.constant.summary">
<!-- -->
</a>
<h3>Enum Constant Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Constant Summary table, listing enum constants, and an explanation">
<caption><span>Enum Constants</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Enum Constant and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#DASHED">DASHED</a></span></code> </td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#FRAMED">FRAMED</a></span></code> </td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#SOLID">SOLID</a></span></code> </td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method.summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code>static <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#getInstance-int-">getInstance</a></span>(int type)</code>
<div class="block">Retrieve an instance of the enum based on its int value.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#getInstance-java.lang.Number-">getInstance</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> type)</code>
<div class="block">Retrieve an instance of the enum based on its int value.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#getName--">getName</a></span>()</code>
<div class="block">Retrieve the line style name.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#getValue--">getValue</a></span>()</code>
<div class="block">Accessor method used to retrieve the numeric representation of the enum.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#toString--">toString</a></span>()</code>
<div class="block">Retrieve the String representation of this line style.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>static <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#valueOf-java.lang.String-">valueOf</a></span>(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name)</code>
<div class="block">Returns the enum constant of this type with the specified name.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>static <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a>[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html#values--">values</a></span>()</code>
<div class="block">Returns an array containing the constants of this enum type, in
the order they are declared.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Enum">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</a></h3>
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#compareTo-E-" title="class or interface in java.lang">compareTo</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#getDeclaringClass--" title="class or interface in java.lang">getDeclaringClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#name--" title="class or interface in java.lang">name</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#ordinal--" title="class or interface in java.lang">ordinal</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#valueOf-java.lang.Class-java.lang.String-" title="class or interface in java.lang">valueOf</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ ENUM CONSTANT DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="enum.constant.detail">
<!-- -->
</a>
<h3>Enum Constant Detail</h3>
<a name="SOLID">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>SOLID</h4>
<pre>public static final <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a> SOLID</pre>
</li>
</ul>
<a name="FRAMED">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>FRAMED</h4>
<pre>public static final <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a> FRAMED</pre>
</li>
</ul>
<a name="DASHED">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>DASHED</h4>
<pre>public static final <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a> DASHED</pre>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="values--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>values</h4>
<pre>public static <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a>[] values()</pre>
<div class="block">Returns an array containing the constants of this enum type, in
the order they are declared. This method may be used to iterate
over the constants as follows:
<pre>
for (GanttBarStartEndType c : GanttBarStartEndType.values())
System.out.println(c);
</pre></div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>an array containing the constants of this enum type, in the order they are declared</dd>
</dl>
</li>
</ul>
<a name="valueOf-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>valueOf</h4>
<pre>public static <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a> valueOf(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> name)</pre>
<div class="block">Returns the enum constant of this type with the specified name.
The string must match <i>exactly</i> an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are
not permitted.)</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>name</code> - the name of the enum constant to be returned.</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the enum constant with the specified name</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</a></code> - if this enum type has no constant with the specified name</dd>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</a></code> - if the argument is null</dd>
</dl>
</li>
</ul>
<a name="getInstance-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInstance</h4>
<pre>public static <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a> getInstance(int type)</pre>
<div class="block">Retrieve an instance of the enum based on its int value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>type</code> - int type</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>enum instance</dd>
</dl>
</li>
</ul>
<a name="getInstance-java.lang.Number-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getInstance</h4>
<pre>public static <a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a> getInstance(<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</a> type)</pre>
<div class="block">Retrieve an instance of the enum based on its int value.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>type</code> - int type</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>enum instance</dd>
</dl>
</li>
</ul>
<a name="getValue--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getValue</h4>
<pre>public int getValue()</pre>
<div class="block">Accessor method used to retrieve the numeric representation of the enum.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../net/sf/mpxj/MpxjEnum.html#getValue--">getValue</a></code> in interface <code><a href="../../../../net/sf/mpxj/MpxjEnum.html" title="interface in net.sf.mpxj">MpxjEnum</a></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>int representation of the enum</dd>
</dl>
</li>
</ul>
<a name="getName--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getName</h4>
<pre>public <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> getName()</pre>
<div class="block">Retrieve the line style name. Currently this is not localised.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>style name</dd>
</dl>
</li>
</ul>
<a name="toString--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>toString</h4>
<pre>public <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> toString()</pre>
<div class="block">Retrieve the String representation of this line style.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true#toString--" title="class or interface in java.lang">toString</a></code> in class <code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Enum.html?is-external=true" title="class or interface in java.lang">Enum</a><<a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndType.html" title="enum in net.sf.mpxj.mpp">GanttBarStartEndType</a>></code></dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>String representation of this line style</dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/GanttBarStartEndType.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../net/sf/mpxj/mpp/GanttBarStartEndShape.html" title="enum in net.sf.mpxj.mpp"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../net/sf/mpxj/mpp/GanttBarStyle.html" title="class in net.sf.mpxj.mpp"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?net/sf/mpxj/mpp/GanttBarStartEndType.html" target="_top">Frames</a></li>
<li><a href="GanttBarStartEndType.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li><a href="#enum.constant.summary">Enum Constants</a> | </li>
<li>Field | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li><a href="#enum.constant.detail">Enum Constants</a> | </li>
<li>Field | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright © 2000–2020 <a href="http://mpxj.org">Packwood Software</a>. All rights reserved.</small></p>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>WatchDemo.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>2</integer>
</dict>
</dict>
</dict>
</plist>
| {
"pile_set_name": "Github"
} |
// ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.requests.extensions;
import com.microsoft.graph.models.extensions.OnlineMeeting;
import com.microsoft.graph.concurrency.ICallback;
import com.microsoft.graph.core.ClientException;
import com.microsoft.graph.http.IHttpRequest;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The interface for the Online Meeting Request.
*/
public interface IOnlineMeetingRequest extends IHttpRequest {
/**
* Gets the OnlineMeeting from the service
*
* @param callback the callback to be called after success or failure
*/
void get(final ICallback<? super OnlineMeeting> callback);
/**
* Gets the OnlineMeeting from the service
*
* @return the OnlineMeeting from the request
* @throws ClientException this exception occurs if the request was unable to complete for any reason
*/
OnlineMeeting get() throws ClientException;
/**
* Delete this item from the service
*
* @param callback the callback when the deletion action has completed
*/
void delete(final ICallback<? super OnlineMeeting> callback);
/**
* Delete this item from the service
*
* @throws ClientException if there was an exception during the delete operation
*/
void delete() throws ClientException;
/**
* Patches this OnlineMeeting with a source
*
* @param sourceOnlineMeeting the source object with updates
* @param callback the callback to be called after success or failure
*/
void patch(final OnlineMeeting sourceOnlineMeeting, final ICallback<? super OnlineMeeting> callback);
/**
* Patches this OnlineMeeting with a source
*
* @param sourceOnlineMeeting the source object with updates
* @return the updated OnlineMeeting
* @throws ClientException this exception occurs if the request was unable to complete for any reason
*/
OnlineMeeting patch(final OnlineMeeting sourceOnlineMeeting) throws ClientException;
/**
* Posts a OnlineMeeting with a new object
*
* @param newOnlineMeeting the new object to create
* @param callback the callback to be called after success or failure
*/
void post(final OnlineMeeting newOnlineMeeting, final ICallback<? super OnlineMeeting> callback);
/**
* Posts a OnlineMeeting with a new object
*
* @param newOnlineMeeting the new object to create
* @return the created OnlineMeeting
* @throws ClientException this exception occurs if the request was unable to complete for any reason
*/
OnlineMeeting post(final OnlineMeeting newOnlineMeeting) throws ClientException;
/**
* Posts a OnlineMeeting with a new object
*
* @param newOnlineMeeting the object to create/update
* @param callback the callback to be called after success or failure
*/
void put(final OnlineMeeting newOnlineMeeting, final ICallback<? super OnlineMeeting> callback);
/**
* Posts a OnlineMeeting with a new object
*
* @param newOnlineMeeting the object to create/update
* @return the created OnlineMeeting
* @throws ClientException this exception occurs if the request was unable to complete for any reason
*/
OnlineMeeting put(final OnlineMeeting newOnlineMeeting) throws ClientException;
/**
* Sets the select clause for the request
*
* @param value the select clause
* @return the updated request
*/
IOnlineMeetingRequest select(final String value);
/**
* Sets the expand clause for the request
*
* @param value the expand clause
* @return the updated request
*/
IOnlineMeetingRequest expand(final String value);
}
| {
"pile_set_name": "Github"
} |
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
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.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1beta1
| {
"pile_set_name": "Github"
} |
#include <errno.h>
#include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
static int
do_test (void)
{
char tmpl[] = "/tmp/tst-fdopendir2-XXXXXX";
int fd = mkstemp (tmpl);
if (fd == -1)
{
puts ("cannot open temp file");
return 1;
}
errno = 0;
DIR *d = fdopendir (fd);
int e = errno;
close (fd);
unlink (tmpl);
if (d != NULL)
{
puts ("fdopendir with normal file descriptor did not fail");
return 1;
}
if (e != ENOTDIR)
{
printf ("fdopendir set errno to %d, not %d as expected\n", e, ENOTDIR);
return 1;
}
return 0;
}
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
| {
"pile_set_name": "Github"
} |
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
*
* Copyright 2015 Mozilla Foundation
*
* 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.
*/
#ifndef wasmbinarytoast_h
#define wasmbinarytoast_h
#include "ds/LifoAlloc.h"
#include "wasm/WasmAST.h"
#include "wasm/WasmTypes.h"
namespace js {
namespace wasm {
bool
BinaryToAst(JSContext* cx, const uint8_t* bytes, uint32_t length, LifoAlloc& lifo,
AstModule** module);
} // end wasm namespace
} // end js namespace
#endif // namespace wasmbinarytoast_h
| {
"pile_set_name": "Github"
} |
install:
- gradle -Prelease=true -p lib/java/ clean install
| {
"pile_set_name": "Github"
} |
{% extends '@CoreUpdater/layout.twig' %}
{% block content %}
<div class="header">
<h1>{{ 'CoreUpdater_UpdateSuccessTitle'|translate }}</h1>
</div>
<div class="content">
<h2>
{{ 'CoreUpdater_ThankYouUpdatePiwik'|translate }}
</h2>
<p>
{{ 'CoreUpdater_PostUpdateMessage'|translate }}
</p>
<h2>
{{ 'CoreUpdater_PostUpdateSupport'|translate }}
</h2>
<div class="row">
<div class="col s5 offset-s1">
<a href="https://matomo.org/support-plans/?pk_medium=Update_Success_button&pk_source=Matomo_App&pk_campaign=App_Updated" class="btn btn-block">{{ 'CoreUpdater_ServicesSupport'|translate }}</a>
</div>
<div class="col s5">
<a href="https://matomo.org/hosting/?pk_medium=App_Cloud_button&pk_source=Matomo_App&pk_campaign=App_Updated" class="btn btn-block">{{ 'CoreUpdater_CloudHosting'|translate }}</a>
</div>
</div>
{% if feedbackMessages is defined and feedbackMessages is not empty %}
<h2>{{ 'CoreUpdater_UpdateLog'|translate }}</h2>
<div class="row">
<div class="col s12">
<pre style="margin-top: 0;"><code>
{%- for message in feedbackMessages %}
✓ {{ message }}
{% endfor -%}
</code></pre>
</div>
</div>
{% endif %}
</div>
<div class="footer">
<a href="index.php">{{ 'General_ContinueToPiwik'|translate }}</a>
</div>
{% endblock %}
| {
"pile_set_name": "Github"
} |
// Copyright 2015 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package etcdhttp
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/http/httptest"
"path"
"sort"
"testing"
"github.com/coreos/etcd/etcdserver/membership"
"github.com/coreos/etcd/pkg/testutil"
"github.com/coreos/etcd/pkg/types"
"github.com/coreos/etcd/rafthttp"
"github.com/coreos/go-semver/semver"
)
type fakeCluster struct {
id uint64
clientURLs []string
members map[uint64]*membership.Member
}
func (c *fakeCluster) ID() types.ID { return types.ID(c.id) }
func (c *fakeCluster) ClientURLs() []string { return c.clientURLs }
func (c *fakeCluster) Members() []*membership.Member {
var ms membership.MembersByID
for _, m := range c.members {
ms = append(ms, m)
}
sort.Sort(ms)
return []*membership.Member(ms)
}
func (c *fakeCluster) Member(id types.ID) *membership.Member { return c.members[uint64(id)] }
func (c *fakeCluster) IsIDRemoved(id types.ID) bool { return false }
func (c *fakeCluster) Version() *semver.Version { return nil }
// TestNewPeerHandlerOnRaftPrefix tests that NewPeerHandler returns a handler that
// handles raft-prefix requests well.
func TestNewPeerHandlerOnRaftPrefix(t *testing.T) {
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("test data"))
})
ph := newPeerHandler(&fakeCluster{}, h, nil)
srv := httptest.NewServer(ph)
defer srv.Close()
tests := []string{
rafthttp.RaftPrefix,
rafthttp.RaftPrefix + "/hello",
}
for i, tt := range tests {
resp, err := http.Get(srv.URL + tt)
if err != nil {
t.Fatalf("unexpected http.Get error: %v", err)
}
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
t.Fatalf("unexpected ioutil.ReadAll error: %v", err)
}
if w := "test data"; string(body) != w {
t.Errorf("#%d: body = %s, want %s", i, body, w)
}
}
}
func TestServeMembersFails(t *testing.T) {
tests := []struct {
method string
wcode int
}{
{
"POST",
http.StatusMethodNotAllowed,
},
{
"DELETE",
http.StatusMethodNotAllowed,
},
{
"BAD",
http.StatusMethodNotAllowed,
},
}
for i, tt := range tests {
rw := httptest.NewRecorder()
h := &peerMembersHandler{cluster: nil}
h.ServeHTTP(rw, &http.Request{Method: tt.method})
if rw.Code != tt.wcode {
t.Errorf("#%d: code=%d, want %d", i, rw.Code, tt.wcode)
}
}
}
func TestServeMembersGet(t *testing.T) {
memb1 := membership.Member{ID: 1, Attributes: membership.Attributes{ClientURLs: []string{"http://localhost:8080"}}}
memb2 := membership.Member{ID: 2, Attributes: membership.Attributes{ClientURLs: []string{"http://localhost:8081"}}}
cluster := &fakeCluster{
id: 1,
members: map[uint64]*membership.Member{1: &memb1, 2: &memb2},
}
h := &peerMembersHandler{cluster: cluster}
msb, err := json.Marshal([]membership.Member{memb1, memb2})
if err != nil {
t.Fatal(err)
}
wms := string(msb) + "\n"
tests := []struct {
path string
wcode int
wct string
wbody string
}{
{peerMembersPrefix, http.StatusOK, "application/json", wms},
{path.Join(peerMembersPrefix, "bad"), http.StatusBadRequest, "text/plain; charset=utf-8", "bad path\n"},
}
for i, tt := range tests {
req, err := http.NewRequest("GET", testutil.MustNewURL(t, tt.path).String(), nil)
if err != nil {
t.Fatal(err)
}
rw := httptest.NewRecorder()
h.ServeHTTP(rw, req)
if rw.Code != tt.wcode {
t.Errorf("#%d: code=%d, want %d", i, rw.Code, tt.wcode)
}
if gct := rw.Header().Get("Content-Type"); gct != tt.wct {
t.Errorf("#%d: content-type = %s, want %s", i, gct, tt.wct)
}
if rw.Body.String() != tt.wbody {
t.Errorf("#%d: body = %s, want %s", i, rw.Body.String(), tt.wbody)
}
gcid := rw.Header().Get("X-Etcd-Cluster-ID")
wcid := cluster.ID().String()
if gcid != wcid {
t.Errorf("#%d: cid = %s, want %s", i, gcid, wcid)
}
}
}
| {
"pile_set_name": "Github"
} |
import os
def configuration(parent_package='', top_path=None):
import numpy
from numpy.distutils.misc_util import Configuration
config = Configuration('neighbors', parent_package, top_path)
libraries = []
if os.name == 'posix':
libraries.append('m')
config.add_extension('_ball_tree',
sources=['_ball_tree.pyx'],
include_dirs=[numpy.get_include()],
libraries=libraries)
config.add_extension('_kd_tree',
sources=['_kd_tree.pyx'],
include_dirs=[numpy.get_include()],
libraries=libraries)
config.add_extension('_dist_metrics',
sources=['_dist_metrics.pyx'],
include_dirs=[numpy.get_include(),
os.path.join(numpy.get_include(),
'numpy')],
libraries=libraries)
config.add_extension('_typedefs',
sources=['_typedefs.pyx'],
include_dirs=[numpy.get_include()],
libraries=libraries)
config.add_extension("_quad_tree",
sources=["_quad_tree.pyx"],
include_dirs=[numpy.get_include()],
libraries=libraries)
config.add_subpackage('tests')
return config
| {
"pile_set_name": "Github"
} |
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package compiler
import (
"fmt"
"gopkg.in/yaml.v2"
"regexp"
"sort"
"strconv"
)
// compiler helper functions, usually called from generated code
// UnpackMap gets a yaml.MapSlice if possible.
func UnpackMap(in interface{}) (yaml.MapSlice, bool) {
m, ok := in.(yaml.MapSlice)
if ok {
return m, true
}
// do we have an empty array?
a, ok := in.([]interface{})
if ok && len(a) == 0 {
// if so, return an empty map
return yaml.MapSlice{}, true
}
return nil, false
}
// SortedKeysForMap returns the sorted keys of a yaml.MapSlice.
func SortedKeysForMap(m yaml.MapSlice) []string {
keys := make([]string, 0)
for _, item := range m {
keys = append(keys, item.Key.(string))
}
sort.Strings(keys)
return keys
}
// MapHasKey returns true if a yaml.MapSlice contains a specified key.
func MapHasKey(m yaml.MapSlice, key string) bool {
for _, item := range m {
itemKey, ok := item.Key.(string)
if ok && key == itemKey {
return true
}
}
return false
}
// MapValueForKey gets the value of a map value for a specified key.
func MapValueForKey(m yaml.MapSlice, key string) interface{} {
for _, item := range m {
itemKey, ok := item.Key.(string)
if ok && key == itemKey {
return item.Value
}
}
return nil
}
// ConvertInterfaceArrayToStringArray converts an array of interfaces to an array of strings, if possible.
func ConvertInterfaceArrayToStringArray(interfaceArray []interface{}) []string {
stringArray := make([]string, 0)
for _, item := range interfaceArray {
v, ok := item.(string)
if ok {
stringArray = append(stringArray, v)
}
}
return stringArray
}
// MissingKeysInMap identifies which keys from a list of required keys are not in a map.
func MissingKeysInMap(m yaml.MapSlice, requiredKeys []string) []string {
missingKeys := make([]string, 0)
for _, k := range requiredKeys {
if !MapHasKey(m, k) {
missingKeys = append(missingKeys, k)
}
}
return missingKeys
}
// InvalidKeysInMap returns keys in a map that don't match a list of allowed keys and patterns.
func InvalidKeysInMap(m yaml.MapSlice, allowedKeys []string, allowedPatterns []*regexp.Regexp) []string {
invalidKeys := make([]string, 0)
for _, item := range m {
itemKey, ok := item.Key.(string)
if ok {
key := itemKey
found := false
// does the key match an allowed key?
for _, allowedKey := range allowedKeys {
if key == allowedKey {
found = true
break
}
}
if !found {
// does the key match an allowed pattern?
for _, allowedPattern := range allowedPatterns {
if allowedPattern.MatchString(key) {
found = true
break
}
}
if !found {
invalidKeys = append(invalidKeys, key)
}
}
}
}
return invalidKeys
}
// DescribeMap describes a map (for debugging purposes).
func DescribeMap(in interface{}, indent string) string {
description := ""
m, ok := in.(map[string]interface{})
if ok {
keys := make([]string, 0)
for k := range m {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
v := m[k]
description += fmt.Sprintf("%s%s:\n", indent, k)
description += DescribeMap(v, indent+" ")
}
return description
}
a, ok := in.([]interface{})
if ok {
for i, v := range a {
description += fmt.Sprintf("%s%d:\n", indent, i)
description += DescribeMap(v, indent+" ")
}
return description
}
description += fmt.Sprintf("%s%+v\n", indent, in)
return description
}
// PluralProperties returns the string "properties" pluralized.
func PluralProperties(count int) string {
if count == 1 {
return "property"
}
return "properties"
}
// StringArrayContainsValue returns true if a string array contains a specified value.
func StringArrayContainsValue(array []string, value string) bool {
for _, item := range array {
if item == value {
return true
}
}
return false
}
// StringArrayContainsValues returns true if a string array contains all of a list of specified values.
func StringArrayContainsValues(array []string, values []string) bool {
for _, value := range values {
if !StringArrayContainsValue(array, value) {
return false
}
}
return true
}
// StringValue returns the string value of an item.
func StringValue(item interface{}) (value string, ok bool) {
value, ok = item.(string)
if ok {
return value, ok
}
intValue, ok := item.(int)
if ok {
return strconv.Itoa(intValue), true
}
return "", false
}
| {
"pile_set_name": "Github"
} |
pipelineConfig:
env:
- name: FRUIT
value: BANANA
- name: GIT_AUTHOR_NAME
value: somebodyelse
- name: _JAVA_OPTIONS
value: something else
pipelines:
release:
promote:
steps:
- sh: echo "FRUIT is ${FRUIT}"
| {
"pile_set_name": "Github"
} |
Decoupling FindBugs from BCEL
Document history:
DHH 7/3/2006: Created
Goals:
- eliminate tight coupling between FindBugs and BCEL
- Allow other bytecode frameworks (such as ASM and maybe Soot) to
be used by detectors
*** Detectors could even do their own scanning on the raw classfile
data, without any bytecode framework
(on either stream or byte array)
- Allow visitor-based detectors to use information from
dataflow analysis framework.
Issues:
- We are reliant on BCEL's Constants and Visitor classes
- The bytecode analysis (ba) package makes heavy use of
BCEL tree-based reprentation (generic package) and also
the BCEL Repository and type classes (both of which have
significant shortcomings). The detectors which use
the bytecode analysis package are also tightly coupled
to these classes.
Strategy:
- Change the basic visitation strategy to remove dependence
on the BCEL Repository and JavaClass classes.
*** We should develop our own CodeBase and Repository abstractions
- The visitor classes and detectors will probably be the easiest
to convert. We can develop our own Visitor/DismantleBytecode
interfaces, which can be concretely implemented using ASM,
(or any other bytecode framework). Obviously the detectors
should not be aware which bytecode framework is being used.
We will probably need to add our own equivalent of the
BCEL Constants interface. We will need some kind of
general classfile representation package (to hide framework-specific
details).
- After visitor-based detectors are working using new visitor framework,
start work on developing new classes/APIs for more sophisticated
(e.g., dataflow) analysis. We should try to separate WHAT information
is computed (types, values, nullness, etc.) from HOW the
information is computed. Clients (Detectors) should only be coupled
to the classes representing WHAT is computed.
Notes:
- We should standardize on VM (slashed) type descriptors in all places
where a JVM type is being referred to. Dotted classnames should
go away except when displaying such types to the user.
*** This is how ASM represents types -> efficient
*** We should probably develop a richer type abstraction eventually
for the dataflow-based detectors, etc.
| {
"pile_set_name": "Github"
} |
---
machine_translated: true
machine_translated_rev: 72537a2d527c63c07aa5d2361a8829f3895cf2bd
toc_folder_title: "Op\xE9rations"
toc_priority: 41
toc_title: Introduction
---
# Opérations {#operations}
Le manuel d'exploitation de ClickHouse comprend les principales sections suivantes:
- [Exigence](requirements.md)
- [Surveiller](monitoring.md)
- [Dépannage](troubleshooting.md)
- [Recommandations D'Utilisation](tips.md)
- [Procédure De Mise À Jour](update.md)
- [Les Droits D'Accès](access-rights.md)
- [La Sauvegarde Des Données](backup.md)
- [Fichiers De Configuration](configuration-files.md)
- [Quota](quotas.md)
- [Les Tables Système](system-tables.md)
- [Paramètres De Configuration Du Serveur](server-configuration-parameters/index.md)
- [Comment Tester Votre Matériel Avec ClickHouse](performance-test.md)
- [Paramètre](settings/index.md)
- [Utilitaire](utilities/index.md)
{## [Article Original](https://clickhouse.tech/docs/en/operations/) ##}
| {
"pile_set_name": "Github"
} |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Aws.Ec2.Inputs
{
public sealed class SpotFleetRequestLaunchSpecificationEbsBlockDeviceArgs : Pulumi.ResourceArgs
{
[Input("deleteOnTermination")]
public Input<bool>? DeleteOnTermination { get; set; }
[Input("deviceName", required: true)]
public Input<string> DeviceName { get; set; } = null!;
[Input("encrypted")]
public Input<bool>? Encrypted { get; set; }
[Input("iops")]
public Input<int>? Iops { get; set; }
[Input("kmsKeyId")]
public Input<string>? KmsKeyId { get; set; }
[Input("snapshotId")]
public Input<string>? SnapshotId { get; set; }
[Input("volumeSize")]
public Input<int>? VolumeSize { get; set; }
[Input("volumeType")]
public Input<string>? VolumeType { get; set; }
public SpotFleetRequestLaunchSpecificationEbsBlockDeviceArgs()
{
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1F1EDFB9-8305-46AD-B427-DDD92A87969E}</ProjectGuid>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>Microcharts.Samples.macOS</RootNamespace>
<AssemblyName>Microcharts.Sample.macOS</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnableCodeSigning>false</EnableCodeSigning>
<CodeSigningKey>Mac Developer</CodeSigningKey>
<CreatePackage>false</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<UseSGen>true</UseSGen>
<UseRefCounting>true</UseRefCounting>
<HttpClientHandler>HttpClientHandler</HttpClientHandler>
<LinkMode>None</LinkMode>
<XamMacArch>x86_64</XamMacArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<DefineConstants>
</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>true</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>true</IncludeMonoRuntime>
<UseSGen>true</UseSGen>
<UseRefCounting>true</UseRefCounting>
<LinkMode>SdkOnly</LinkMode>
<HttpClientHandler>HttpClientHandler</HttpClientHandler>
<XamMacArch>
</XamMacArch>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-128%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-16%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-256%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-32%402x.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512.png" />
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\AppIcon-512%402x.png" />
<ImageAsset Include="Assets.xcassets\Contents.json" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="ViewController.cs" />
<Compile Include="ViewController.designer.cs">
<DependentUpon>ViewController.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Main.storyboard" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="2.80.1" />
<PackageReference Include="SkiaSharp.Views" Version="2.80.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microcharts.Samples\Microcharts.Samples.csproj">
<Project>{6fbe798d-bb43-4bb5-9c61-d6dd5b0e623a}</Project>
<Name>Microcharts.Samples</Name>
</ProjectReference>
<ProjectReference Include="..\Microcharts\Microcharts.csproj">
<Project>{D07D3E94-E645-4035-A142-5F933A15D585}</Project>
<Name>Microcharts</Name>
</ProjectReference>
<ProjectReference Include="..\Microcharts.macOS\Microcharts.macOS.csproj">
<Project>{5F02212C-95CB-42A3-850F-C076267BB5DC}</Project>
<Name>Microcharts.macOS</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>
| {
"pile_set_name": "Github"
} |
##
# StandardError ISO Test
assert('StandardError', '15.2.23') do
assert_equal Class, StandardError.class
end
| {
"pile_set_name": "Github"
} |
/* ========================================
* PurestSquish - PurestSquish.h
* Created 8/12/11 by SPIAdmin
* Copyright (c) 2011 __MyCompanyName__, All rights reserved
* ======================================== */
#ifndef __PurestSquish_H
#define __PurestSquish_H
#ifndef __audioeffect__
#include "audioeffectx.h"
#endif
#include <set>
#include <string>
#include <math.h>
enum {
kParamA = 0,
kParamB = 1,
kParamC = 2,
kParamD = 3,
kNumParameters = 4
}; //
const int kNumPrograms = 0;
const int kNumInputs = 2;
const int kNumOutputs = 2;
const unsigned long kUniqueId = 'pusq'; //Change this to what the AU identity is!
class PurestSquish :
public AudioEffectX
{
public:
PurestSquish(audioMasterCallback audioMaster);
~PurestSquish();
virtual bool getEffectName(char* name); // The plug-in name
virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in
virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
virtual bool getVendorString(char* text); // Vendor info
virtual VstInt32 getVendorVersion(); // Version number
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
virtual void getProgramName(char *name); // read the name from the host
virtual void setProgramName(char *name); // changes the name of the preset displayed in the host
virtual VstInt32 getChunk (void** data, bool isPreset);
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
virtual float getParameter(VstInt32 index); // get the parameter value at the specified index
virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value
virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
virtual void getParameterName(VstInt32 index, char *text); // name of the parameter
virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
virtual VstInt32 canDo(char *text);
private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
uint32_t fpd;
//default stuff
float A;
float B;
float C;
float D;
double muVaryL;
double muAttackL;
double muNewSpeedL;
double muSpeedAL;
double muSpeedBL;
double muSpeedCL;
double muSpeedDL;
double muSpeedEL;
double muCoefficientAL;
double muCoefficientBL;
double muCoefficientCL;
double muCoefficientDL;
double muCoefficientEL;
double iirSampleAL;
double iirSampleBL;
double iirSampleCL;
double iirSampleDL;
double iirSampleEL;
double lastCoefficientAL;
double lastCoefficientBL;
double lastCoefficientCL;
double lastCoefficientDL;
double mergedCoefficientsL;
double muVaryR;
double muAttackR;
double muNewSpeedR;
double muSpeedAR;
double muSpeedBR;
double muSpeedCR;
double muSpeedDR;
double muSpeedER;
double muCoefficientAR;
double muCoefficientBR;
double muCoefficientCR;
double muCoefficientDR;
double muCoefficientER;
double iirSampleAR;
double iirSampleBR;
double iirSampleCR;
double iirSampleDR;
double iirSampleER;
double lastCoefficientAR;
double lastCoefficientBR;
double lastCoefficientCR;
double lastCoefficientDR;
double mergedCoefficientsR;
int count;
bool fpFlip;
};
#endif
| {
"pile_set_name": "Github"
} |
Description: Patch deletes or comments out all unused variables.
Author: Sergei Golovan
Last-Modified: Wed, 09 Jul 2014 19:18:23 +0400
--- a/generic/bltTree.c
+++ b/generic/bltTree.c
@@ -1234,7 +1234,7 @@
int
Blt_TreeRelabelNode(TreeClient *clientPtr, Node *nodePtr, CONST char *string)
{
- int result, inode;
+ int result;
if ((result=NotifyClients(clientPtr, clientPtr->treeObject, nodePtr,
TREE_NOTIFY_RELABEL)) != TCL_OK) {
return result;
@@ -1245,7 +1245,6 @@
* been created.
*/
SetModified(nodePtr);
- inode = nodePtr->inode;
result = NotifyClients(clientPtr, clientPtr->treeObject, nodePtr,
TREE_NOTIFY_RELABELPOST);
return result;
--- a/generic/bltTreeCmd.c
+++ b/generic/bltTreeCmd.c
@@ -2078,10 +2078,8 @@
SetValues(TreeCmd *cmdPtr, Blt_TreeNode node, int objc, Tcl_Obj *CONST *objv)
{
register int i;
- int inode;
char *string;
- inode = node->inode;
for (i = 0; i < objc; i += 2) {
string = Tcl_GetString(objv[i]);
if ((i + 1) == objc) {
@@ -2108,11 +2106,10 @@
{
register int i;
char *string;
- int result = TCL_OK, inode;
+ int result = TCL_OK;
Tcl_DString dStr;
Tcl_Interp *interp = cmdPtr->interp;
- inode = node->inode;
if (objc % 2) {
Tcl_AppendResult(interp, "odd # values", (char *)NULL);
return TCL_ERROR;
@@ -4552,7 +4549,7 @@
Blt_TreeNode parent = NULL, child = NULL;
int cnt = 0, i, n, m, vobjc, tobjc, dobjc, pobjc, optInd, iPos = -1, incr = 0;
int hasoffs = 0, seqlabel = 0, seqVal = 0, hasstart = 0, start;
- int fixed = 0, hasnum = 0, hcnt = 0;
+ int fixed = 0, hcnt = 0;
char *prefix = NULL, *string;
Tcl_Obj **vobjv = NULL;
Tcl_Obj **tobjv = NULL;
@@ -4628,7 +4625,6 @@
if (Tcl_GetIntFromObj(interp, objv[3], &cnt) != TCL_OK) {
return TCL_ERROR;
}
- hasnum = 1;
hcnt++;
if (cnt<0 || cnt>10000000) {
Tcl_AppendResult(interp, "count must be >= 0 and <= 10M", (char *)NULL);
@@ -4982,13 +4978,13 @@
Tcl_Obj *listObjPtr, *objPtr;
register int i;
int isNew, len;
- char *string;
+ /*char *string;*/
TagSearch tagIter = {0};
Blt_InitHashTableWithPool(&keyTable, BLT_ONE_WORD_KEYS);
listObjPtr = Tcl_NewListObj(0, (Tcl_Obj **) NULL);
for (i = 2; i < objc; i++) {
- string = Tcl_GetStringFromObj(objv[i],&len);
+ /*string =*/ Tcl_GetStringFromObj(objv[i],&len);
if (len == 0) continue;
if (FindTaggedNodes(interp, cmdPtr, objv[i], &tagIter) != TCL_OK) {
Blt_DeleteHashTable(&keyTable);
@@ -6525,7 +6521,7 @@
Blt_TreeNode node;
char *string;
Tcl_Obj *valuePtr;
- int i, result = TCL_OK, inode;
+ int i, result = TCL_OK;
Tcl_DString dStr;
if (GetNode(cmdPtr, objv[2], &node) != TCL_OK) {
@@ -6540,7 +6536,6 @@
cmdPtr->updTyp = 0;
}
Tcl_DStringInit(&dStr);
- inode = node->inode;
for (i=3; i<objc; i+=2) {
string = Tcl_GetString(objv[i]);
if (Blt_TreeGetValue(interp, cmdPtr->tree, node, string,
@@ -6599,11 +6594,11 @@
Tcl_Obj *CONST *objv)
{
Blt_TreeNode node;
- char *string;
+ /*char *string;*/
int count = 0, len;
TagSearch cursor = {0};
- string = Tcl_GetStringFromObj(objv[2],&len);
+ /*string =*/ Tcl_GetStringFromObj(objv[2],&len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
return TCL_OK;
@@ -6834,7 +6829,7 @@
Tcl_Obj *CONST *objv)
{
Blt_TreeNode node;
- char *string;
+ /*char *string;*/
int count = 0, result = TCL_OK, len;
Tcl_DString dStr;
TagSearch cursor = {0};
@@ -6844,7 +6839,7 @@
return TCL_ERROR;
}
if (objc<=3) return TCL_OK;
- string = Tcl_GetStringFromObj(objv[2], &len);
+ /*string =*/ Tcl_GetStringFromObj(objv[2], &len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
return TCL_OK;
@@ -7169,7 +7164,6 @@
Blt_TreeNode node;
Tcl_Obj *listObjPtr;
Tcl_Obj *objPtr;
- char *string;
int isNew;
register int i;
@@ -7177,7 +7171,6 @@
for (i = 3; i < objc; i++) {
TagSearch tcursor = {0};
- string = Tcl_GetString(objv[i]);
if (FindTaggedNodes(interp, cmdPtr, objv[i], &tcursor) != TCL_OK) {
Tcl_ResetResult(interp);
DoneTaggedNodes(&tcursor);
@@ -7756,12 +7749,9 @@
Tcl_Obj *CONST *objv)
{
Blt_TreeNode node;
- char *string;
int count = 0;
TagSearch cursor = {0};
- string = Tcl_GetString(objv[2]);
-
if (FindTaggedNodes(interp, cmdPtr, objv[2], &cursor) != TCL_OK) {
return TCL_ERROR;
}
@@ -8084,7 +8074,7 @@
Tcl_Obj *valuePtr, *varObj, *nullObj = NULL, *nodeObj = NULL;
Tcl_Obj *hashObj = NULL, *starObj = NULL;
Blt_TreeKeySearch keyIter;
- int vobjc, kobjc, i, result = TCL_OK, len, cnt = 0, isar;
+ int vobjc, kobjc, i, result = TCL_OK, len, cnt = 0/*, isar */;
int nobreak = 0, noupdate = 0, unset = 0, init = 0, aLen;
char *var, *string, *aName = NULL, *aPat = NULL;
int klen, kl, j;
@@ -8251,7 +8241,7 @@
}
}
- isar = 0;
+ /* isar = 0; */
if (arrName != NULL) {
kl = strlen(aName);
@@ -8526,7 +8516,7 @@
{
Blt_TreeNode node;
int len, result;
- char *var, *string;
+ char *var/*, *string*/;
TagSearch cursor = {0};
var = Tcl_GetString(objv[2]);
@@ -8535,7 +8525,7 @@
Tcl_AppendResult(interp, "wrong number of args ", 0);
return TCL_ERROR;
}
- string = Tcl_GetStringFromObj(objv[3],&len);
+ /*string =*/ Tcl_GetStringFromObj(objv[3],&len);
if (len == 0) {
Tcl_SetObjResult(interp, Tcl_NewIntObj(0));
return TCL_OK;
@@ -8894,6 +8884,7 @@
* Obj Callback for sqlload.
*
*/
+#if 0
static int SqlCallbackObj(SqlData *sqlPtr, int argc, Tcl_Obj **objv, Tcl_Obj **azColName)
{
int i, j, rid, lid, n, tcid, vobjc, tobjc;
@@ -9122,6 +9113,7 @@
return 1;
}
#endif
+#endif
#ifndef OMIT_SQLITE3_LOAD
/* #include <sqlite3.h> */
--- a/generic/bltInit.c
+++ b/generic/bltInit.c
@@ -438,9 +438,9 @@
{
Tcl_DString dString;
CONST char *value;
+#ifndef TCL_ONLY
static int tkisinit = 0;
-#ifndef TCL_ONLY
if (!tkisinit) {
struct TileHandlers *thPtr;
@@ -510,7 +510,9 @@
Tcl_Interp *interp; /* Interpreter to add extra commands */
{
int flags;
+#ifdef USE_BLT_STUBS
int dostub = 0;
+#endif
flags = (int)Tcl_GetAssocData(interp, BLT_THREAD_KEY, NULL);
if ((flags & BLT_TCL_CMDS) == 0) {
--- a/generic/bltColor.c
+++ b/generic/bltColor.c
@@ -77,7 +77,7 @@
#define NCOLORS 256
-
+#if 0
static void
GetPaletteSizes(nColors, nRedsPtr, nGreensPtr, nBluesPtr)
int nColors; /* Number of colors requested. */
@@ -129,6 +129,7 @@
}
}
+#endif
/*
*----------------------------------------------------------------------
@@ -200,6 +201,7 @@
return numAvail;
}
+#if 0
static void
FindClosestColor(colorPtr, mapColors, numMapColors)
ColorInfo *colorPtr;
@@ -342,6 +344,7 @@
colorTabPtr->nPixels = nImageColors;
return 1;
}
+#endif
ColorTable
Blt_CreateColorTable(tkwin)
@@ -510,6 +513,7 @@
return colorTabPtr;
}
+#if 0
/*
* First attempt:
* Allocate colors all the colors in the image (up to NCOLORS). Bail out
@@ -548,6 +552,7 @@
Blt_DeleteHashTable(&colorTable);
return nColors;
}
+#endif
#define Blt_DefaultColormap(tkwin) \
DefaultColormap(Tk_Display(tkwin), Tk_ScreenNumber(tkwin))
@@ -563,11 +568,11 @@
int keepColors = 0;
register int i;
XColor usedColors[NCOLORS];
- int nFreeColors, nUsedColors;
+ int nUsedColors;
Colormap colorMap;
int inUse[NCOLORS];
XColor *colorPtr;
- XColor *imageColors;
+ /* XColor *imageColors; */
/*
* Create a private colormap if one doesn't already exist for the
@@ -582,7 +587,7 @@
XFreeColors(colorTabPtr->display, colorTabPtr->colorMap,
colorTabPtr->pixelValues, colorTabPtr->nPixels, 0);
}
- nFreeColors = QueryColormap(colorTabPtr->display, colorMap, usedColors,
+ QueryColormap(colorTabPtr->display, colorMap, usedColors,
&nUsedColors);
memset((char *)inUse, 0, sizeof(int) * NCOLORS);
if ((nUsedColors == 0) && (keepColors > 0)) {
@@ -592,7 +597,7 @@
* have been used in the default colormap.
*/
- nFreeColors = QueryColormap(colorTabPtr->display,
+ QueryColormap(colorTabPtr->display,
Blt_DefaultColormap(tkwin), usedColors, &nUsedColors);
/*
@@ -622,7 +627,7 @@
* image as we can fit. If necessary, we'll cheat and reduce the number
* of colors by quantizing.
*/
- imageColors = usedColors + nUsedColors;
+ /* imageColors = usedColors + nUsedColors; */
Tk_SetWindowColormap(tkwin, colorMap);
}
--- a/generic/bltTabset.c
+++ b/generic/bltTabset.c
@@ -3916,12 +3916,9 @@
{
int x, y; /* Screen coordinates of the test point. */
Tab *tabPtr;
- int dw, dh;
char coords[200];
coords[0] = 0;
- dw = Tk_Width(setPtr->tkwin);
- dh = Tk_Height(setPtr->tkwin);
tabPtr = NULL;
if ((Tk_GetPixels(interp, setPtr->tkwin, argv[2], &x) != TCL_OK) ||
(Tk_GetPixels(interp, setPtr->tkwin, argv[3], &y) != TCL_OK)) {
@@ -5247,18 +5244,14 @@
Tab *startPtr, *nextPtr;
Blt_ChainLink *linkPtr;
register Tab *tabPtr;
- int x, maxWidth, sImg, eImg;
+ int x, maxWidth, sImg;
int vert = (setPtr->side & SIDE_VERTICAL);
sImg = 0;
- eImg = 0;
if (setPtr->startImage) {
sImg = (vert?setPtr->startImage->height:setPtr->startImage->width);
}
- if (setPtr->endImage) {
- eImg = (vert?setPtr->endImage->height:setPtr->endImage->width);
- }
tabsPerTier = (nTabs + (setPtr->nTiers - 1)) / setPtr->nTiers;
x = sImg;
--- a/generic/bltTile.c
+++ b/generic/bltTile.c
@@ -1176,10 +1176,7 @@
}
if (clientPtr->tilePtr->mask != None) {
Pixmap mask;
- int xm, ym;
- xm = clientPtr->xOrigin;
- ym = clientPtr->yOrigin;
mask = RectangleMask(display, drawable, x, y, width, height,
tilePtr->mask, clientPtr->xOrigin, clientPtr->yOrigin);
XSetClipMask(display, tilePtr->gc, mask);
--- a/generic/bltTreeView.c
+++ b/generic/bltTreeView.c
@@ -5042,7 +5042,7 @@
&& strlen(Tcl_GetString(tvPtr->imageCmd))) {
Tcl_DString cmdString;
char *string;
- int result, rcnt;
+ int /*result,*/ rcnt;
Tcl_Interp *interp = tvPtr->interp;
string = Blt_GetHashKey(&tvPtr->iconTable, icon->hashPtr);
@@ -5052,7 +5052,7 @@
if (entryPtr) Tcl_Preserve(entryPtr);
if (columnPtr) Tcl_Preserve(columnPtr);
Blt_TreeViewPercentSubst(tvPtr, entryPtr, columnPtr, Tcl_GetString(tvPtr->imageCmd), string, &cmdString);
- result = Tcl_GlobalEval(interp, Tcl_DStringValue(&cmdString));
+ /* result = */ Tcl_GlobalEval(interp, Tcl_DStringValue(&cmdString));
rcnt = icon->refCount;
Blt_TreeViewFreeIcon(tvPtr, icon);
if ((tvPtr->flags & TV_DELETED)
@@ -5286,10 +5286,10 @@
TreeViewIcon *icons;
TreeViewIcon icon;
- int isActive, hasFocus;
+ int isActive/*, hasFocus*/;
isActive = (entryPtr == tvPtr->activePtr);
- hasFocus = (entryPtr == tvPtr->focusPtr);
+ /*hasFocus = (entryPtr == tvPtr->focusPtr);*/
icons = NULL;
if (tvPtr->flags & TV_HIDE_ICONS) {
return NULL;
@@ -5879,9 +5879,9 @@
int x0, cx, xOffset;
TreeViewStyle *sPtr;
TreeViewIcon icon;
- int mw, mh;
+ int mw/*, mh*/;
mw = Tk_Width(tvPtr->tkwin) - tvPtr->padX;
- mh = Tk_Height(tvPtr->tkwin) - tvPtr->padY;
+ /* mh = Tk_Height(tvPtr->tkwin) - tvPtr->padY; */
if (tvPtr->titleHeight < 1) {
return;
--- a/generic/bltTreeViewCmd.c
+++ b/generic/bltTreeViewCmd.c
@@ -668,10 +668,8 @@
hPtr = Blt_FirstHashEntry(tablePtr, &infoPtr->cursor);
if (hPtr != NULL) {
Blt_TreeNode node;
- int inode;
node = Blt_GetHashValue(hPtr);
- inode = node->inode;
infoPtr->entryPtr = Blt_NodeToEntry(tvPtr, node);
if (infoPtr->entryPtr == NULL && cnt++ == 0) {
/* fprintf(stderr, "Dangling node: %d\n", node->inode); */
@@ -1689,13 +1687,11 @@
TreeViewEntry *entryPtr;
TreeViewColumn *columnPtr;
int n, result;
- Blt_TreeNode node;
char *left, *string;
if (GetEntryFromObj(tvPtr, objv[3], &entryPtr) != TCL_OK) {
return TCL_ERROR;
}
- node = entryPtr->node;
string = Tcl_GetString(objv[4]);
if (Blt_TreeViewGetColumnKey(interp, tvPtr, objv[4], &columnPtr, &left)
!= TCL_OK || columnPtr == NULL) {
@@ -1777,7 +1773,6 @@
{
TreeViewEntry *entryPtr;
TreeViewColumn *columnPtr;
- Blt_TreeNode node;
double dVal, dIncr = 1.0;
int iVal, iIncr = 1, isInt = 0;
Tcl_Obj *objPtr, *valueObjPtr;
@@ -1786,7 +1781,6 @@
if (GetEntryFromObj(tvPtr, objv[3], &entryPtr) != TCL_OK) {
return TCL_ERROR;
}
- node = entryPtr->node;
string = Tcl_GetString(objv[4]);
if (Blt_TreeViewGetColumnKey(interp, tvPtr, objv[4], &columnPtr, &left)
!= TCL_OK || columnPtr == NULL) {
@@ -1841,7 +1835,6 @@
Tcl_Obj *CONST *objv;
{
TreeViewEntry *entryPtr;
- Blt_TreeNode node;
char *key;
Tcl_Obj *objPtr;
@@ -1877,7 +1870,6 @@
return TCL_OK;
}
key = Tcl_GetString(objv[4]);
- node = entryPtr->node;
Tcl_Release(entryPtr);
if (Blt_TreeGetValue(tvPtr->interp, tvPtr->tree, entryPtr->node,
key, &objPtr) != TCL_OK) {
@@ -2656,7 +2648,7 @@
TreeViewEntry *entryPtr;
char *string;
int isRoot, isTest;
- int x, y, wx, wy;
+ int x, y;
int rootX, rootY;
Tk_GetRootCoords(tvPtr->tkwin, &rootX, &rootY);
@@ -2693,8 +2685,6 @@
(Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK)) {
return TCL_ERROR;
}
- wx = x;
- wy = y;
if (isRoot) {
x -= rootX;
y -= rootY;
@@ -3768,7 +3758,7 @@
int nMatches, maxMatches, result, length, ocnt, useformat,userow, isvis;
int depth, maxdepth, mindepth, mask, istree, isleaf, invis, ismap, uselabel;
int isopen, isclosed, notop, nocase, isfull, cmdLen, docount, optInd, reldepth;
- int isnull, retLabel, isret, cmdValue;
+ int isnull, retLabel, isret;
char *colStr, *keysub;
Tcl_Obj *cmdObj, *cmdArgs;
Tcl_Obj **aobjv;
@@ -3815,7 +3805,6 @@
reldepth = notop = 0;
nocase = 0, isfull = 0, useformat = 0;
keysub = colStr = NULL;
- cmdValue = 0;
curValue = NULL;
cmdObj = NULL;
cmdArgs = NULL;
@@ -4663,7 +4652,7 @@
register int i;
int length, depth = -1, maxdepth = -1, mindepth = -1, noArgs, usefull = 0;
int result, nocase, uselabel = 0, optInd, ocnt;
- char *pattern, *curValue;
+ char *curValue;
Blt_List options;
TreeViewEntry *entryPtr;
register Blt_ListNode node;
@@ -4918,7 +4907,6 @@
!= TCL_OK) {
goto error; /* This shouldn't happen. */
}
- pattern = Blt_ListGetValue(node);
objPtr = Tcl_GetObjResult(interp);
result = (*compareProc)(interp, Tcl_GetString(objPtr), kPtr, nocase);
if (result == invertMatch) {
@@ -5192,10 +5180,10 @@
TreeViewColumn *columnPtr;
TreeViewEntry *entryPtr;
Tcl_DString dStr;
- int optSkips, i, m, start, nOptions, inode;
+ int optSkips, i, m, start, nOptions/*, inode*/;
useid = -1;
- inode = -1;
+ /*inode = -1;*/
optSkips = 0;
sobjc = 0;
tobjc = 0;
@@ -5289,7 +5277,7 @@
}
addpath:
node = NULL;
- inode = -1;
+ /*inode = -1;*/
if (oLen == 5
&& (tvPtr->pathSep == SEPARATOR_NONE || tvPtr->pathSep == NULL)
&& path[0] == '#' && strcmp(path, "#auto") == 0) {
@@ -5420,7 +5408,7 @@
goto error;
}
makeent:
- inode = node->inode;
+ /*inode = node->inode;*/
if (Blt_TreeViewCreateEntry(tvPtr, node, 0, options, BLT_CONFIG_OBJV_ONLY) != TCL_OK) {
goto opterror;
}
--- a/generic/bltTreeViewColumn.c
+++ b/generic/bltTreeViewColumn.c
@@ -413,7 +413,6 @@
char *string;
int objc;
register int i;
- Blt_TreeNode node;
TreeView *tvPtr;
string = Tcl_GetString(objPtr);
@@ -431,7 +430,6 @@
"\" must be in even name-value pairs", (char *)NULL);
return TCL_ERROR;
}
- node = entryPtr->node;
tvPtr = entryPtr->tvPtr;
for (i = 0; i < objc; i += 2) {
int result;
@@ -709,11 +707,9 @@
{
int n = 0;
Blt_ChainLink *linkPtr;
- TreeViewColumn *columnPtr;
for (linkPtr = Blt_ChainFirstLink(tvPtr->colChainPtr); linkPtr != NULL;
linkPtr = Blt_ChainNextLink(linkPtr)) {
- columnPtr = Blt_ChainGetValue(linkPtr);
n++;
}
return n;
@@ -2477,7 +2473,7 @@
Tcl_Obj *CONST *objv;
{
TreeViewColumn *colPtr;
- int width, height;
+ int width;
Tk_Anchor anchor;
int left, right;
char *string;
@@ -2508,7 +2504,6 @@
return TCL_OK;
}
width = VPORTWIDTH(tvPtr);
- height = VPORTHEIGHT(tvPtr);
left = tvPtr->xOffset;
right = tvPtr->xOffset + width;
@@ -3342,11 +3337,11 @@
Tcl_IncrRefCount(entryPtr->dataObjPtr);
}
} else {
- Blt_TreeKey key;
+ /*Blt_TreeKey key;*/
Tcl_Obj *objPtr;
int isFmt;
- key = tvPtr->sortColumnPtr->key;
+ /*key = tvPtr->sortColumnPtr->key;*/
isFmt = Blt_TreeViewStyleIsFmt(tvPtr, tvPtr->sortColumnPtr->stylePtr);
for(p = tvPtr->flatArr; *p != NULL; p++) {
TreeViewValue *valuePtr;
--- a/generic/bltTreeViewStyle.c
+++ b/generic/bltTreeViewStyle.c
@@ -1600,15 +1600,13 @@
int textX, textY, textHeight;
int gap, columnWidth, ttlWidth;
int bool;
- int borderWidth, relief;
+ /* int borderWidth, relief; */
TextLayout *textPtr;
int boxX, boxY, boxWidth, boxHeight;
TreeViewStyle *csPtr, sRec = *stylePtr;
int valWidth = (valuePtr->textPtr?valuePtr->width:(icon?TreeViewIconWidth(icon):0));
- TextLayout *layPtr;
int showValue;
- layPtr = (tvPtr->hideStyleText?NULL:valuePtr->textPtr);
showValue = (tvPtr->hideStyleText ? 0 : cbPtr->showValue);
columnPtr = valuePtr->columnPtr;
@@ -1617,13 +1615,13 @@
drawTextBox(tvPtr, drawable, entryPtr, valuePtr, stylePtr, icon, x, y, &sRec);
gc = sRec.gc;
- if (gc != stylePtr->activeGC) {
+ /* if (gc != stylePtr->activeGC) {
borderWidth = 0;
relief = TK_RELIEF_FLAT;
} else {
borderWidth = 1;
relief = TK_RELIEF_RAISED;
- }
+ } */
columnWidth = columnPtr->width - PADDING(columnPtr->pad);
if (!valuePtr->string) {
@@ -2629,15 +2627,10 @@
TreeViewStyle *csPtr, sRec = *stylePtr;
int valWidth = (valuePtr->textPtr?valuePtr->width:(icon?TreeViewIconWidth(icon):0));
double curValue;
- char *string;
TextStyle ts;
XColor *color;
- TextLayout *layPtr;
int showValue = (tvPtr->hideStyleText ? 0 : cbPtr->showValue);
- layPtr = (tvPtr->hideStyleText?NULL:valuePtr->textPtr);
-
- string = NULL;
textPtr = NULL;
columnPtr = valuePtr->columnPtr;
csPtr = columnPtr->stylePtr;
@@ -3417,7 +3410,6 @@
{
TreeViewColumn *columnPtr;
TreeViewWindowBox *tbPtr = (TreeViewWindowBox *)stylePtr;
- Tk_Window tkwin;
int width, height, diff;
WindowCell *wcPtr;
TreeViewStyle sRec = *stylePtr;
@@ -3438,7 +3430,6 @@
int columnWidth = columnPtr->width -
(2 * columnPtr->borderWidth + PADDING(columnPtr->pad));
- tkwin = wcPtr->tkwin;
width = columnWidth;
height = entryPtr->height-1;
if ((diff = (y-tvPtr->titleHeight- tvPtr->insetY))<0) {
--- a/generic/bltUnixDnd.c
+++ b/generic/bltUnixDnd.c
@@ -1459,6 +1459,7 @@
*
* ------------------------------------------------------------------------
*/
+#if 0
static void
MorphToken(dndPtr)
Dnd *dndPtr; /* Drag-and-drop manager (source). */
@@ -1511,6 +1512,7 @@
}
RaiseToken(dndPtr);
}
+#endif
static void
GetTokenPosition(dndPtr, x, y)
--- a/generic/bltWinop.c
+++ b/generic/bltWinop.c
@@ -913,7 +913,7 @@
Tk_PhotoHandle srcPhoto;
Tk_PhotoImageBlock src;
Blt_ColorImage srcImage;
- int top, x, y, isalph, iscnt, isNew, cnt;
+ int x, y, isalph, iscnt, isNew, cnt;
int i, rng[4], from = 0;
register Pix32 *srcPtr;
Tcl_Obj *listPtr;
@@ -922,7 +922,6 @@
Blt_HashTable hTbl;
Blt_HashSearch cursor;
- top = 0;
isalph = 0;
iscnt = 0;
while (argc > 3) {
@@ -1524,7 +1523,7 @@
{
double range[3];
double left[3];
- int x, y, width;
+ int x, width;
double t;
XColor C;
XColor *leftPtr, *rightPtr;
@@ -1554,7 +1553,6 @@
range[1] = (double)((rightPtr->green - leftPtr->green) / 257.0);
range[2] = (double)((rightPtr->blue - leftPtr->blue) / 257.0);
- y =0;
for (x = 0; x < width; x++) {
char cbuf[100];
t = ((double)( sin(M_PI_2 * (double)x / (double)width)));
@@ -1574,7 +1572,7 @@
XColor *leftPtr, *rightPtr;
double range[3];
double left[3];
- int x, y, width;
+ int x, width;
double t;
XColor **destPtr, C;
@@ -1587,7 +1585,6 @@
range[1] = (double)((rightPtr->green - leftPtr->green) / 257.0);
range[2] = (double)((rightPtr->blue - leftPtr->blue) / 257.0);
- y =0;
width = gradPtr->width;
if (gradPtr->grads) {
Blt_FreeGradient(gradPtr);
--- a/generic/tkButton.c
+++ b/generic/tkButton.c
@@ -352,11 +352,9 @@
char *string, char *widgRec, int offset, char *strList[], char *label )
{
int *namePtr = (int *)(widgRec + offset);
- char c;
int i;
for (i=0; strList[i]; i++) {
- c = string[0];
if (strcmp(string, strList[i]) == 0) {
*namePtr = i;
return TCL_OK;
@@ -898,11 +896,10 @@
{
Button *butPtr = (Button*)widgRec;;
int argc = 0;
- int result, i;
+ int i;
char **argv;
Tk_Image imgs[9], image;
- result = TCL_OK;
if (string && Tcl_SplitList(interp, string, &argc, &argv) != TCL_OK) {
return TCL_ERROR;
}
@@ -1703,7 +1700,7 @@
Tk_Image image;
char *oldTextVar = NULL, *oldSelVar = NULL;
Blt_Tree oldTree;
- int oldNode, result = TCL_OK;
+ int result = TCL_OK;
char * oldABdStr = butPtr->activeBdImageString;
char * oldDBStr = butPtr->disabledBdImageString;
char * oldBDStr = butPtr->bdImageString;
@@ -1712,7 +1709,6 @@
winPtr = (Tk_FakeWin *) (butPtr->tkwin);
oldTree = butPtr->tree;
- oldNode = butPtr->node;
if (oldTree == NULL) {
oldTextVar = (butPtr->textVarName?strdup(butPtr->textVarName):NULL);
@@ -2219,7 +2215,7 @@
* the text to make the button appear to
* move up and down as the relief changes. */
Blt_Tile tile, bgTile, inTile;
- int borderWidth, drawBorder;
+ int drawBorder;
int textXOffset, textYOffset;
int haveImage = 0, haveText = 0;
int imageWidth, imageHeight;
@@ -2305,7 +2301,6 @@
bgTile = TILECHOOSE(bgTile,butPtr->innerTile);
}
border = butPtr->normalBorder;
- borderWidth = butPtr->borderWidth;
gc = butPtr->normalTextGC;
--- a/generic/bltScrollbar.c
+++ b/generic/bltScrollbar.c
@@ -1017,7 +1017,9 @@
{
register Scrollbar *scrollPtr = clientData;
register Tk_Window tkwin = scrollPtr->tkwin;
+#ifdef notdef
XPoint points[7];
+#endif
Tk_3DBorder border;
int relief, width, elementBorderWidth;
Pixmap pixmap;
--- a/generic/bltTed.c
+++ b/generic/bltTed.c
@@ -306,10 +306,14 @@
static void DisplayTed _ANSI_ARGS_((ClientData clientData));
static void DestroyTed _ANSI_ARGS_((DestroyData destroyData));
static void DisplayEntry _ANSI_ARGS_((ClientData clientData));
+#if 0
static void DestroyEntry _ANSI_ARGS_((DestroyData destoryData));
+#endif
static Tcl_CmdProc TedCmd;
+#if 0
static Tk_EventProc EntryEventProc;
+#endif
static Tk_EventProc TedEventProc;
/*
@@ -360,6 +364,7 @@
*
*----------------------------------------------------------------------
*/
+#if 0
static void
EventuallyRedrawEntry(repPtr)
EntryRep *repPtr; /* Information about editor. */
@@ -369,6 +374,7 @@
Tcl_DoWhenIdle(DisplayEntry, repPtr);
}
}
+#endif
/*
* --------------------------------------------------------------
@@ -387,6 +393,7 @@
*
* --------------------------------------------------------------
*/
+#if 0
static void
EntryEventProc(clientData, eventPtr)
ClientData clientData; /* Information about window. */
@@ -408,6 +415,7 @@
Tcl_EventuallyFree(repPtr, DestroyEntry);
}
}
+#endif
/*
* --------------------------------------------------------------
@@ -548,6 +556,7 @@
*
* ----------------------------------------------------------------------------
*/
+#if 0
static int
CreateEntry(tedPtr, entryPtr)
Ted *tedPtr;
@@ -614,6 +623,7 @@
}
}
}
+#endif
/*
* ----------------------------------------------------------------------------
| {
"pile_set_name": "Github"
} |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
gTestfile = 'expression-019.js';
/**
File Name: expression-019.js
Corresponds To: 11.2.2-7-n.js
ECMA Section: 11.2.2. The new operator
Description:
Author: [email protected]
Date: 12 november 1997
*/
var SECTION = "expression-019";
var VERSION = "JS1_4";
var TITLE = "The new operator";
var BUGNUMBER= "327765";
startTest();
writeHeaderToLog( SECTION + " "+ TITLE);
var result = "Failed";
var exception = "No exception thrown";
var expect = "Passed";
try {
var STRING = new String("hi");
result = new STRING();
} catch ( e ) {
result = expect;
exception = e.toString();
}
new TestCase(
SECTION,
"var STRING = new String(\"hi\"); result = new STRING();" +
" (threw " + exception + ")",
expect,
result );
test();
| {
"pile_set_name": "Github"
} |
{
"kind": "webfonts#webfont",
"family": "Baloo Chettan 2",
"category": "display",
"variants": ["regular", "500", "600", "700", "800"],
"subsets": ["latin", "latin-ext", "malayalam", "vietnamese"],
"version": "v1",
"lastModified": "2020-03-06",
"files": {
"500": "http://fonts.gstatic.com/s/baloochettan2/v1/vm8rdRbmXEva26PK-NtuX4ynWEznFNRfMr0fn5bhCA.ttf",
"600": "http://fonts.gstatic.com/s/baloochettan2/v1/vm8rdRbmXEva26PK-NtuX4ynWEznONNfMr0fn5bhCA.ttf",
"700": "http://fonts.gstatic.com/s/baloochettan2/v1/vm8rdRbmXEva26PK-NtuX4ynWEznXNJfMr0fn5bhCA.ttf",
"800": "http://fonts.gstatic.com/s/baloochettan2/v1/vm8rdRbmXEva26PK-NtuX4ynWEznQNFfMr0fn5bhCA.ttf",
"regular": "http://fonts.gstatic.com/s/baloochettan2/v1/vm8udRbmXEva26PK-NtuX4ynWEzf4P17OpYDlg.ttf"
}
}
| {
"pile_set_name": "Github"
} |
/*
* Solution to Project Euler problem 112
* Copyright (c) Project Nayuki. All rights reserved.
*
* https://www.nayuki.io/page/project-euler-solutions
* https://github.com/nayuki/Project-Euler-solutions
*/
public final class p112 implements EulerSolution {
public static void main(String[] args) {
System.out.println(new p112().run());
}
public String run() {
int bouncy = 0;
for (int i = 1; ; i++) {
if (isBouncy(i))
bouncy++;
if (bouncy * 100 == i * 99)
return Integer.toString(i);
}
}
private static boolean isBouncy(int x) {
if (x < 100)
return false;
else {
boolean nonincreasing = true;
boolean nondecreasing = true;
int lastDigit = x % 10;
x /= 10;
while (x != 0) {
int digit = x % 10;
if (digit > lastDigit)
nondecreasing = false;
else if (digit < lastDigit)
nonincreasing = false;
lastDigit = digit;
x /= 10;
}
return !nonincreasing && !nondecreasing;
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
// http://github.com/gogo/protobuf/gogoproto
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package proto
import (
"encoding/json"
"strconv"
)
func MarshalJSONEnum(m map[int32]string, value int32) ([]byte, error) {
s, ok := m[value]
if !ok {
s = strconv.Itoa(int(value))
}
return json.Marshal(s)
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env node
require('grunt').cli();
| {
"pile_set_name": "Github"
} |
{
"actions": [
{
"verb": "createSPList",
"listName": "Manager on Duty",
"templateType": 100,
"subactions": [
{
"verb": "setDescription",
"description": "A list to keep track of which staff are on duty for a particular day"
},
{
"verb": "addSPFieldXml",
"schemaXml": "<Field ID=\"{fa564e0f-0c70-4ab9-b863-0177e6ddd247}\" Type=\"Text\" Name=\"Title\" DisplayName=\"Title\" Required=\"FALSE\" Hidden=\"TRUE\" SourceID=\"http://schemas.microsoft.com/sharepoint/v3\" StaticName=\"Title\" FromBaseType=\"TRUE\" CustomFormatter=\"\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" MaxLength=\"255\" />"
},
{
"verb": "addSPFieldXml",
"schemaXml": "<Field Name=\"Shift1\" FromBaseType=\"FALSE\" Type=\"MultiChoice\" DisplayName=\"Shift 1\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" FillInChoice=\"TRUE\" ID=\"{78d998e1-0c4b-4f5a-a27c-86c131c95145}\" StaticName=\"Shift1\"><CHOICES><CHOICE>Adam</CHOICE><CHOICE>Joe</CHOICE><CHOICE>Sarah</CHOICE><CHOICE>Debbie</CHOICE><CHOICE>Roy</CHOICE></CHOICES></Field>"
},
{
"verb": "addSPFieldXml",
"schemaXml": "<Field Name=\"Shift2\" FromBaseType=\"FALSE\" Type=\"MultiChoice\" DisplayName=\"Shift 2\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" FillInChoice=\"TRUE\" ID=\"{e9dd3147-bbf9-4a1b-a1d2-d714eb221d92}\" StaticName=\"Shift2\"><CHOICES><CHOICE>Adam</CHOICE><CHOICE>Joe</CHOICE><CHOICE>Sarah</CHOICE><CHOICE>Debbie</CHOICE><CHOICE>Roy</CHOICE></CHOICES></Field>"
},
{
"verb": "addSPFieldXml",
"schemaXml": "<Field Name=\"Shift3\" FromBaseType=\"FALSE\" Type=\"MultiChoice\" DisplayName=\"Shift 3\" Required=\"FALSE\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" FillInChoice=\"TRUE\" ID=\"{81e1510b-3bc8-498f-b004-c063ef8adfec}\" StaticName=\"Shift3\"><CHOICES><CHOICE>Adam</CHOICE><CHOICE>Joe</CHOICE><CHOICE>Sarah</CHOICE><CHOICE>Debbie</CHOICE><CHOICE>Roy</CHOICE></CHOICES></Field>"
},
{
"verb": "addSPFieldXml",
"schemaXml": "<Field DisplayName=\"Date\" FriendlyDisplayFormat=\"Disabled\" Format=\"DateOnly\" Title=\"Date\" Type=\"DateTime\" StaticName=\"Date\" Name=\"Date\" ID=\"{67489fdc-a11a-4fc3-b0a8-afaab27049d4}\" />"
},
{
"verb": "addSPFieldXml",
"schemaXml": "<Field Type=\"Calculated\" DisplayName=\"Day\" EnforceUniqueValues=\"FALSE\" Indexed=\"FALSE\" Format=\"DateOnly\" LCID=\"2057\" ResultType=\"Text\" ReadOnly=\"TRUE\" StaticName=\"Day\" Name=\"Day\" CustomFormatter=\"\" Required=\"FALSE\" ID=\"{aae5ca32-0d2f-4c15-82ae-e24a42739f1c}\"><Formula>=TEXT(Date,\"DDDD\")</Formula></Field>"
},
{
"verb": "addSPView",
"name": "All Items",
"viewFields": [
"LinkTitle",
"Shift1",
"Shift2",
"Shift3",
"Date",
"Day"
],
"query": "<OrderBy><FieldRef Name=\"Date\" /></OrderBy>",
"rowLimit": 30,
"isPaged": true
},
{
"verb": "addSPView",
"name": "All Upcoming",
"viewFields": [
"Date",
"Day",
"Shift1",
"Shift2",
"Shift3"
],
"query": "<Where><Geq><FieldRef Name=\"Date\" /><Value Type=\"DateTime\"><Today /></Value></Geq></Where><OrderBy><FieldRef Name=\"Date\" Ascending=\"TRUE\" /></OrderBy>",
"rowLimit": 30,
"isPaged": true,
"makeDefault": true
},
{
"verb": "addSPView",
"name": "Todays Shifts",
"viewFields": [
"Date",
"Day",
"Shift1",
"Shift2",
"Shift3"
],
"query": "<OrderBy><FieldRef Name=\"ID\" /></OrderBy><Where><Eq><FieldRef Name=\"Date\" /><Value Type=\"DateTime\"><Today /></Value></Eq></Where>",
"rowLimit": 30,
"isPaged": true
}
]
}
]
}
| {
"pile_set_name": "Github"
} |
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2007 Julien Pommier
// Copyright (C) 2009 Gael Guennebaud <[email protected]>
// Copyright (C) 2016 Konstantinos Margaritis <[email protected]>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_MATH_FUNCTIONS_ALTIVEC_H
#define EIGEN_MATH_FUNCTIONS_ALTIVEC_H
namespace Eigen {
namespace internal {
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet4f plog<Packet4f>(const Packet4f& _x)
{
return plog_float(_x);
}
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet4f pexp<Packet4f>(const Packet4f& _x)
{
return pexp_float(_x);
}
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet4f psin<Packet4f>(const Packet4f& _x)
{
return psin_float(_x);
}
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet4f pcos<Packet4f>(const Packet4f& _x)
{
return pcos_float(_x);
}
#ifndef EIGEN_COMP_CLANG
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet4f prsqrt<Packet4f>(const Packet4f& x)
{
return vec_rsqrt(x);
}
#endif
#ifdef __VSX__
#ifndef EIGEN_COMP_CLANG
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet2d prsqrt<Packet2d>(const Packet2d& x)
{
return vec_rsqrt(x);
}
#endif
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet4f psqrt<Packet4f>(const Packet4f& x)
{
return vec_sqrt(x);
}
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet2d psqrt<Packet2d>(const Packet2d& x)
{
return vec_sqrt(x);
}
template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED
Packet2d pexp<Packet2d>(const Packet2d& _x)
{
return pexp_double(_x);
}
#endif
// Hyperbolic Tangent function.
template <>
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f
ptanh<Packet4f>(const Packet4f& x) {
return internal::generic_fast_tanh_float(x);
}
} // end namespace internal
} // end namespace Eigen
#endif // EIGEN_MATH_FUNCTIONS_ALTIVEC_H
| {
"pile_set_name": "Github"
} |
# XI9 - (unknown title - INI file autogenerated from vWii system menu list of titles without 16:9 support)
[Video_Settings]
SuggestedAspectRatio = 2
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of the Panther project.
*
* (c) Kévin Dunglas <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Symfony\Component\Panther\Tests\DomCrawler\Field;
use Symfony\Component\DomCrawler\Field\ChoiceFormField;
use Symfony\Component\Panther\Client as PantherClient;
use Symfony\Component\Panther\Tests\TestCase;
/**
* @author Robert Freigang <[email protected]>
*/
class ChoiceFormFieldTest extends TestCase
{
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromSelectIfOneIsSelected(callable $clientFactory)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['select_selected_one'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
$this->assertSame('20', $field->getValue());
}
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromSelectIfNoneIsSelected(callable $clientFactory)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['select_selected_none'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
$this->assertSame('', $field->getValue());
}
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromSelectMultipleIfOneIsSelected(callable $clientFactory)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['select_multiple_selected_one'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
$this->assertSame(['20'], $field->getValue());
}
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromSelectMultipleIfMultipleIsSelected(callable $clientFactory)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['select_multiple_selected_multiple'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
$this->assertSame(['20', '30'], $field->getValue());
}
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromSelectMultipleIfNoneIsSelected(callable $clientFactory)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['select_multiple_selected_none'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
$this->assertSame([], $field->getValue());
}
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromRadioIfSelected(callable $clientFactory)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['radio_checked'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
$this->assertSame('i_am_checked', $field->getValue());
}
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromRadioIfNoneIsChecked(callable $clientFactory)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['radio_non_checked'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
$this->assertNull($field->getValue());
}
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromCheckboxIfChecked(callable $clientFactory)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['checkbox_checked'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
$this->assertSame('i_am_checked', $field->getValue());
}
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromCheckboxIfMultipleAreChecked(callable $clientFactory, string $type)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['checkbox_multiple_checked'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
// https://github.com/symfony/symfony/issues/26827
if (PantherClient::class !== $type) {
$this->markTestSkipped('The DomCrawler component doesn\'t support multiple fields with the same name');
}
$this->assertSame(['checked_one', 'checked_two'], $field->getValue());
}
/**
* @dataProvider clientFactoryProvider
*/
public function testGetValueFromCheckboxIfNoneIsChecked(callable $clientFactory)
{
$crawler = $this->request($clientFactory, '/choice-form-field.html');
$form = $crawler->filter('form')->form();
/** @var ChoiceFormField $field */
$field = $form['checkbox_non_checked'];
$this->assertInstanceOf(ChoiceFormField::class, $field);
$this->assertNull($field->getValue());
}
}
| {
"pile_set_name": "Github"
} |
/*-----------------------------------------------------------------------------+
Copyright (c) 2008-2009: Joachim Faulhaber
+------------------------------------------------------------------------------+
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENCE.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
+-----------------------------------------------------------------------------*/
#ifndef BOOST_ICL_TYPE_TRAITS_IS_SET_HPP_JOFA_081004
#define BOOST_ICL_TYPE_TRAITS_IS_SET_HPP_JOFA_081004
#include <boost/config.hpp>
#include <boost/icl/type_traits/is_container.hpp>
namespace boost{ namespace icl
{
template <class Type> struct is_set
{
typedef is_set<Type> type;
BOOST_STATIC_CONSTANT(bool, value = is_std_set<Type>::value);
};
}} // namespace boost icl
#endif
| {
"pile_set_name": "Github"
} |
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
/**
* The "template" collection of methods.
* Typical usage is:
* <code>
* $fusiontablesService = new Google_Service_Fusiontables(...);
* $template = $fusiontablesService->template;
* </code>
*/
class Google_Service_Fusiontables_Resource_Template extends Google_Service_Resource
{
/**
* Deletes a template (template.delete)
*
* @param string $tableId Table from which the template is being deleted
* @param int $templateId Identifier for the template which is being deleted
* @param array $optParams Optional parameters.
*/
public function delete($tableId, $templateId, $optParams = array())
{
$params = array('tableId' => $tableId, 'templateId' => $templateId);
$params = array_merge($params, $optParams);
return $this->call('delete', array($params));
}
/**
* Retrieves a specific template by its id (template.get)
*
* @param string $tableId Table to which the template belongs
* @param int $templateId Identifier for the template that is being requested
* @param array $optParams Optional parameters.
* @return Google_Service_Fusiontables_Template
*/
public function get($tableId, $templateId, $optParams = array())
{
$params = array('tableId' => $tableId, 'templateId' => $templateId);
$params = array_merge($params, $optParams);
return $this->call('get', array($params), "Google_Service_Fusiontables_Template");
}
/**
* Creates a new template for the table. (template.insert)
*
* @param string $tableId Table for which a new template is being created
* @param Google_Service_Fusiontables_Template $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Fusiontables_Template
*/
public function insert($tableId, Google_Service_Fusiontables_Template $postBody, $optParams = array())
{
$params = array('tableId' => $tableId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('insert', array($params), "Google_Service_Fusiontables_Template");
}
/**
* Retrieves a list of templates. (template.listTemplate)
*
* @param string $tableId Identifier for the table whose templates are being
* requested
* @param array $optParams Optional parameters.
*
* @opt_param string maxResults Maximum number of templates to return. Optional.
* Default is 5.
* @opt_param string pageToken Continuation token specifying which results page
* to return. Optional.
* @return Google_Service_Fusiontables_TemplateList
*/
public function listTemplate($tableId, $optParams = array())
{
$params = array('tableId' => $tableId);
$params = array_merge($params, $optParams);
return $this->call('list', array($params), "Google_Service_Fusiontables_TemplateList");
}
/**
* Updates an existing template. This method supports patch semantics.
* (template.patch)
*
* @param string $tableId Table to which the updated template belongs
* @param int $templateId Identifier for the template that is being updated
* @param Google_Service_Fusiontables_Template $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Fusiontables_Template
*/
public function patch($tableId, $templateId, Google_Service_Fusiontables_Template $postBody, $optParams = array())
{
$params = array('tableId' => $tableId, 'templateId' => $templateId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('patch', array($params), "Google_Service_Fusiontables_Template");
}
/**
* Updates an existing template (template.update)
*
* @param string $tableId Table to which the updated template belongs
* @param int $templateId Identifier for the template that is being updated
* @param Google_Service_Fusiontables_Template $postBody
* @param array $optParams Optional parameters.
* @return Google_Service_Fusiontables_Template
*/
public function update($tableId, $templateId, Google_Service_Fusiontables_Template $postBody, $optParams = array())
{
$params = array('tableId' => $tableId, 'templateId' => $templateId, 'postBody' => $postBody);
$params = array_merge($params, $optParams);
return $this->call('update', array($params), "Google_Service_Fusiontables_Template");
}
}
| {
"pile_set_name": "Github"
} |
##bic_advsimd_reg_execute
CheckFPAdvSIMDEnabled64();
bits(datasize) operand1 = V[n];
bits(datasize) operand2 = V[m];
bits(datasize) result;
if invert then operand2 = NOT(operand2);
case op of
when LogicalOp_AND
result = operand1 AND operand2;
end
when LogicalOp_ORR
result = operand1 OR operand2;
end
V[d] = result;
@@
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 929a813e205b2284fbb80ebe3442b3e9
timeCreated: 1457507442
licenseType: Pro
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 4
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 1
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 128
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -1
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- buildTarget: DefaultTexturePlatform
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
using NzbDrone.Common.Exceptions;
namespace NzbDrone.Core.Exceptions
{
public class MovieNotFoundException : NzbDroneException
{
public int TmdbMovieId { get; set; }
public MovieNotFoundException(int tmdbMovieId)
: base(string.Format("Movie with tmdbId {0} was not found, it may have been removed from TMDb.", tmdbMovieId))
{
TmdbMovieId = tmdbMovieId;
}
public MovieNotFoundException(string imdbId)
: base(string.Format("Movie with IMDBId {0} was not found, it may have been removed from TMDb.", imdbId))
{
TmdbMovieId = 0;
}
public MovieNotFoundException(int tmdbMovieId, string message, params object[] args)
: base(message, args)
{
TmdbMovieId = tmdbMovieId;
}
public MovieNotFoundException(int tmdbMovieId, string message)
: base(message)
{
TmdbMovieId = tmdbMovieId;
}
}
}
| {
"pile_set_name": "Github"
} |
################################################################################
#
# perl-path-tiny
#
################################################################################
PERL_PATH_TINY_VERSION = 0.108
PERL_PATH_TINY_SOURCE = Path-Tiny-$(PERL_PATH_TINY_VERSION).tar.gz
PERL_PATH_TINY_SITE = $(BR2_CPAN_MIRROR)/authors/id/D/DA/DAGOLDEN
PERL_PATH_TINY_LICENSE = Apache-2.0
PERL_PATH_TINY_LICENSE_FILES = LICENSE
PERL_PATH_TINY_DISTNAME = Path-Tiny
$(eval $(perl-package))
| {
"pile_set_name": "Github"
} |
<?php
/*{{{LICENSE
+-----------------------------------------------------------------------+
| SlightPHP Framework |
+-----------------------------------------------------------------------+
| This program is free software; you can redistribute it and/or modify |
| it under the terms of the GNU General Public License as published by |
| the Free Software Foundation. You should have received a copy of the |
| GNU General Public License along with this program. If not, see |
| http://www.gnu.org/licenses/. |
| Copyright (C) 2008-2009. All Rights Reserved. |
+-----------------------------------------------------------------------+
| Supports: http://www.slightphp.com |
+-----------------------------------------------------------------------+
}}}*/
/**
* @package SlightPHP
*/
class SRoute{
private static $_RouteConfigFile;
private static $_Routes=array();
static function setConfigFile($file){
self::$_RouteConfigFile= $file;
self::$_Routes = array_merge(self::$_Routes,parse_ini_file(self::$_RouteConfigFile,true));
self::parse();
}
static function getConfigFile(){
return self::$_RouteConfigFile;
}
static function set(array $route){
self::$_Routes[] = $route;
self::parse();
}
private static function parse(){
$splitFlag = SlightPHP::getSplitFlag();
$splitFlag = $splitFlag{0};
foreach(self::$_Routes as $route){
$pattern = $route['pattern'];
foreach($route as $k=>$v){
if(preg_match("/:\w+/",$k)){
$pattern = str_replace("$k","($v)",$pattern);
}
}
if(preg_match_all("/$pattern/sm",!empty($_SERVER['PATH_INFO'])?$_SERVER['PATH_INFO']:$_SERVER['REQUEST_URI'],$_m)){
array_shift($_m);
$params = array();
if(!empty($_m)){
foreach($_m as $_m2){
$params[]=$_m2[0];
}
}
$params=implode($splitFlag,$params);
$zone = empty($route['zone']) ? SlightPHP::getDefaultZone() : $route['zone'];
$page = empty($route['page']) ? SlightPHP::getDefaultPage() : $route['page'];
$entry = empty($route['entry']) ? SlightPHP::getDefaultEntry() : $route['entry'];
$PATH_INFO = "{$zone}{$splitFlag}{$page}{$splitFlag}{$entry}{$splitFlag}{$params}";
SlightPHP::setPathInfo($PATH_INFO);
break;
}
}
}
}
| {
"pile_set_name": "Github"
} |
<?php if(!defined('IN_GS')){ die('you cannot load this page directly.'); }
/****************************************************
*
* @File: template.php
* @Package: GetSimple
* @Action: Cardinal theme for GetSimple CMS
*
*****************************************************/
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- Site Title -->
<title><?php get_page_clean_title(); ?> < <?php get_site_name(); ?></title>
<?php get_header(); ?>
<link rel="stylesheet" type="text/css" href="<?php get_theme_url(); ?>/style.css" media="all" />
</head>
<body id="<?php get_page_slug(); ?>" >
<div id="wrapper">
<div id="header">
<ul id="nav">
<?php get_navigation(return_page_slug()); ?>
</ul>
<span class="logo2"><?php get_site_name(); ?></span>
<a class="logo" href="<?php get_site_url(); ?>"><?php get_site_name(); ?></a>
</div><!-- end header -->
<div id="content">
<h1><?php get_page_title(); ?></h1>
<div id="page-content">
<div class="page-text">
<?php get_page_content(); ?>
<p class="page-meta">Published on <span><?php get_page_date('F jS, Y'); ?></span></p>
</div>
</div>
</div>
<div id="sidebar">
<div class="section">
<?php get_component('sidebar'); ?>
<?php // get_snippet('sidebar'); ?>
</div>
<div class="section credits">
<p><?php echo date('Y'); ?> - <strong><?php get_site_name(); ?></strong></p>
<p>
Cardinal Theme by <a href="http://www.cagintranet.com" >Cagintranet</a><br />
<?php get_site_credits(); ?>
</p>
</div>
</div>
<div class="clear"></div>
<?php get_footer(); ?>
</div><!-- end wrapper -->
</body>
</html>
| {
"pile_set_name": "Github"
} |
//=====================================================
// File : action_syr2.hh
// Author : L. Plagne <[email protected])>
// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002
//=====================================================
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#ifndef ACTION_SYR2
#define ACTION_SYR2
#include "utilities.h"
#include "STL_interface.hh"
#include <string>
#include "init/init_function.hh"
#include "init/init_vector.hh"
#include "init/init_matrix.hh"
using namespace std;
template<class Interface>
class Action_syr2 {
public :
// Ctor
BTL_DONT_INLINE Action_syr2( int size ):_size(size)
{
// STL matrix and vector initialization
typename Interface::stl_matrix tmp;
init_matrix<pseudo_random>(A_stl,_size);
init_vector<pseudo_random>(B_stl,_size);
init_vector<pseudo_random>(X_stl,_size);
init_vector<null_function>(resu_stl,_size);
// generic matrix and vector initialization
Interface::matrix_from_stl(A_ref,A_stl);
Interface::matrix_from_stl(A,A_stl);
Interface::vector_from_stl(B_ref,B_stl);
Interface::vector_from_stl(B,B_stl);
Interface::vector_from_stl(X_ref,X_stl);
Interface::vector_from_stl(X,X_stl);
}
// invalidate copy ctor
Action_syr2( const Action_syr2 & )
{
INFOS("illegal call to Action_syr2 Copy Ctor");
exit(1);
}
// Dtor
BTL_DONT_INLINE ~Action_syr2( void ){
Interface::free_matrix(A,_size);
Interface::free_vector(B);
Interface::free_vector(X);
Interface::free_matrix(A_ref,_size);
Interface::free_vector(B_ref);
Interface::free_vector(X_ref);
}
// action name
static inline std::string name( void )
{
return "syr2_" + Interface::name();
}
double nb_op_base( void ){
return 2.0*_size*_size;
}
BTL_DONT_INLINE void initialize( void ){
Interface::copy_matrix(A_ref,A,_size);
Interface::copy_vector(B_ref,B,_size);
Interface::copy_vector(X_ref,X,_size);
}
BTL_DONT_INLINE void calculate( void ) {
BTL_ASM_COMMENT("#begin syr2");
Interface::syr2(A,B,X,_size);
BTL_ASM_COMMENT("end syr2");
}
BTL_DONT_INLINE void check_result( void ){
// calculation check
Interface::vector_to_stl(X,resu_stl);
STL_interface<typename Interface::real_type>::syr2(A_stl,B_stl,X_stl,_size);
typename Interface::real_type error=
STL_interface<typename Interface::real_type>::norm_diff(X_stl,resu_stl);
if (error>1.e-3){
INFOS("WRONG CALCULATION...residual=" << error);
// exit(0);
}
}
private :
typename Interface::stl_matrix A_stl;
typename Interface::stl_vector B_stl;
typename Interface::stl_vector X_stl;
typename Interface::stl_vector resu_stl;
typename Interface::gene_matrix A_ref;
typename Interface::gene_vector B_ref;
typename Interface::gene_vector X_ref;
typename Interface::gene_matrix A;
typename Interface::gene_vector B;
typename Interface::gene_vector X;
int _size;
};
#endif
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="ISO-8859-1"?>
<mzML xmlns="http://psi.hupo.org/ms/mzml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://psi.hupo.org/ms/mzml http://psidev.info/files/ms/mzML/xsd/mzML1.1.0.xsd" accession="" version="1.1.0">
<cvList count="2">
<cv id="MS" fullName="Proteomics Standards Initiative Mass Spectrometry Ontology" URI="http://psidev.cvs.sourceforge.net/*checkout*/psidev/psi/psi-ms/mzML/controlledVocabulary/psi-ms.obo"/>
<cv id="UO" fullName="Unit Ontology" URI="http://obo.cvs.sourceforge.net/obo/obo/ontology/phenotype/unit.obo"/>
</cvList>
<fileDescription>
<fileContent>
<cvParam cvRef="MS" accession="MS:1000294" name="mass spectrum" />
</fileContent>
</fileDescription>
<sampleList count="1">
<sample id="sa_0" name="">
<cvParam cvRef="MS" accession="MS:1000004" name="sample mass" value="0" unitAccession="UO:0000021" unitName="gram" unitCvRef="UO" />
<cvParam cvRef="MS" accession="MS:1000005" name="sample volume" value="0" unitAccession="UO:0000098" unitName="milliliter" unitCvRef="UO" />
<cvParam cvRef="MS" accession="MS:1000006" name="sample concentration" value="0" unitAccession="UO:0000175" unitName="gram per liter" unitCvRef="UO" />
</sample>
</sampleList>
<softwareList count="3">
<software id="so_in_0" version="" >
<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
</software>
<software id="so_default" version="" >
<cvParam cvRef="MS" accession="MS:1000799" name="custom unreleased software tool" value="" />
</software>
</softwareList>
<instrumentConfigurationList count="1">
<instrumentConfiguration id="ic_0">
<cvParam cvRef="MS" accession="MS:1000031" name="instrument model" />
<softwareRef ref="so_in_0" />
</instrumentConfiguration>
</instrumentConfigurationList>
<dataProcessingList count="1">
<dataProcessing id="dp_sp_0">
<processingMethod order="0" softwareRef="so_default">
<cvParam cvRef="MS" accession="MS:1000544" name="Conversion to mzML" />
<userParam name="warning" type="xsd:string" value="fictional processing method used to fulfill format requirements" />
</processingMethod>
</dataProcessing>
</dataProcessingList>
<run id="ru_0" defaultInstrumentConfigurationRef="ic_0" sampleRef="sa_0">
<spectrumList count="1" defaultDataProcessingRef="dp_sp_0">
<spectrum id="spectrum=0" index="0" defaultArrayLength="116" dataProcessingRef="dp_sp_0">
<cvParam cvRef="MS" accession="MS:1000525" name="spectrum representation" />
<cvParam cvRef="MS" accession="MS:1000511" name="ms level" value="2" />
<cvParam cvRef="MS" accession="MS:1000294" name="mass spectrum" />
<scanList count="1">
<cvParam cvRef="MS" accession="MS:1000795" name="no combination" />
<scan>
<cvParam cvRef="MS" accession="MS:1000016" name="scan start time" value="-1" unitAccession="UO:0000010" unitName="second" unitCvRef="UO" />
</scan>
</scanList>
<precursorList count="1">
<precursor>
<isolationWindow>
<cvParam cvRef="MS" accession="MS:1000827" name="isolation window target m/z" value="509.751" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
<cvParam cvRef="MS" accession="MS:1000828" name="isolation window lower offset" value="0" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
<cvParam cvRef="MS" accession="MS:1000829" name="isolation window upper offset" value="0" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
</isolationWindow>
<selectedIonList count="1">
<selectedIon>
<cvParam cvRef="MS" accession="MS:1000744" name="selected ion m/z" value="509.751" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
<cvParam cvRef="MS" accession="MS:1000041" name="charge state" value="2" />
<cvParam cvRef="MS" accession="MS:1000042" name="peak intensity" value="0" unitAccession="MS:1000132" unitName="percent of base peak" unitCvRef="MS" />
</selectedIon>
</selectedIonList>
<activation>
<cvParam cvRef="MS" accession="MS:1000509" name="activation energy" value="0" unitAccession="UO:0000266" unitName="electronvolt" unitCvRef="UO" />
<cvParam cvRef="MS" accession="MS:1000044" name="dissociation method" />
</activation>
</precursor>
</precursorList>
<binaryDataArrayList count="2">
<binaryDataArray encodedLength="1240">
<cvParam cvRef="MS" accession="MS:1000514" name="m/z array" unitAccession="MS:1000040" unitName="m/z" unitCvRef="MS" />
<cvParam cvRef="MS" accession="MS:1000523" name="64-bit float" />
<cvParam cvRef="MS" accession="MS:1000576" name="no compression" />
<binary>YakLxAPCWEBhqQvEA8JYQBH8jNuwQl1AiVTX0j6DXUCZm2e6XmNgQJmbZ7peY2BAexbv4hujYEB7Fu/iG6NgQEc7UPf0wmNARztQ9/TCY0D3bNF0zuNlQDOZdnAVBGZAYrkfOvKibkBiuR868qJuQHBhTdNdQnBAcGFN011CcEDgHpFnPGJwQOAekWc8YnBAXDHwYqRxcEB6x8Lgx4FwQHL1oWpq4nFAcvWhamricUBHscHxKPJxQEexwfEo8nFAHkqCsJUCc0A84FQuuRJzQLpLpr210nNAukumvbXSc0ArCepRlPJzQCsJ6lGU8nNAbc34O1FidUBtzfg7UWJ1QL3f+lTCcnVAvd/6VMJydUCSmxrcgIJ1QJKbGtyAgnVAGSLZgXyCdkA3uKv/n5J2QGk025rtknZAh8qtGBGjdkBRIFiSZfN6QFEgWJJl83pAwd2bJkQTe0DB3ZsmRBN7QJvEcY+pc3xAm8Rxj6lzfEBUtKwpcpN8QFS0rClyk3xAKHDMsDCjfEAocMywMKN8QEcZUtXUk31AZa8kU/ijfUAACY1vnbN9QB6fX+3Aw31A1A35lv1jf0DUDfmW/WN/QEXLPCvcg39ARcs8K9yDf0APWQnKIHKAQA9ZCcogcoBA69AmFwWCgEDr0CYXBYKAQNautlrkiYBA1q62WuSJgEBlg/lsNgKBQHTO4itICoFAQfsWuhoSgUBQRgB5LBqBQIECOfWqOoNAgQI59ao6g0A54Vo/mkqDQDnhWj+aSoNAWkNitHgChEBaQ2K0eAKEQEQh8vdXCoRARCHy91cKhECCTONAsQqEQIJM40CxCoRAbCpzhJAShEBsKnOEkBKEQLBtUleOkoRAv7g7FqCahEDYdtPjxpqEQOfBvKLYooRAf7iOqaTKhUB/uI6ppMqFQGqWHu2D0oVAapYe7YPShUDgeq0EF0OGQOB6rQQXQ4ZAl1nPTgZThkCXWc9OBlOGQNXifky6WoZA5C1oC8xihkDhxFdQHROHQOHEV1AdE4dAyqLnk/wah0DKoueT/BqHQDfvR/Myo4dARjoxskSrh0BRgpvk+9KJQFGCm+T70olAO2ArKNvaiUA7YCso29qJQKesi4cRY4pAtvd0RiNrikDZ9EUho9uKQNn0RSGj24pAktNna5LrikCS02drkuuKQNo+8Gypq4tA2j7wbKmri0DFHICwiLOLQMUcgLCIs4tAMGngD787jEA/tMnO0EOMQA==</binary>
</binaryDataArray>
<binaryDataArray encodedLength="620">
<cvParam cvRef="MS" accession="MS:1000515" name="intensity array" unitAccession="MS:1000131" unitName="number of detector counts" unitCvRef="MS"/>
<cvParam cvRef="MS" accession="MS:1000521" name="32-bit float" />
<cvParam cvRef="MS" accession="MS:1000576" name="no compression" />
<binary>92LDPVmdljtJF3Q/cIs+PU70vz3nh807W43APRr3wzsn+709VxrtOwmXbD+7R5s93wGyPXFXVjxJKjg8hMe1PW7gMzy/ULY9G2ReP5VvBj6/p0o81XezPWhURjxAArQ9DzdgP4dH/j33B1k8zquxPT7vVDzlLrI9T+GNPHlUqT0xs2o8Z3avPbP6rz3NkGY8PI5TPxHHMT6gNls/fiUTPuI/izzU/Kk99F+JPNB0qj1iCaA9rA2zPDpXkzz+9qc9WnKRPDZwqD1K80c/1zJgPtPZUT+1mDg+fI+fPO7opD3XWaU91cudPGcWxTwzh5s9ZQGjPaAtpzyNc6M9/2SlPOtRQj9TuHY+ZKhLP3BeUT4vFZw9dd7CPO1JwTxSepw9ypuVPQrE3Dzv+5U9eUPbPH+yyTwtYJo9ABnIPI3Gmj1h7To/PSWKPnvhQD8Uenw+idCSPQ7x5zy8fuY8Hi2TPUu33Tz6XpU910TcPJe7lT0acDc/yx+RPvv44zyOzpM9ZCyUPaKB4jxZrTg/TqWOPozJjD2CBgA9rB6NPYO4/jwF6S8/9i2gPlH8ij34oAM9fEyLPaIAAz1joYk91FYGPbvyiT0jtAU9qPcrP7AQqD4=</binary>
</binaryDataArray>
</binaryDataArrayList>
</spectrum>
</spectrumList>
</run>
</mzML>
| {
"pile_set_name": "Github"
} |
// Copyright Joyent, Inc. and other Node contributors.
//
// 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.
var assert = require('assert');
var common = require('../common.js');
var util = require('util');
var repl = require('repl');
// A stream to push an array into a REPL
function ArrayStream() {
this.run = function(data) {
var self = this;
data.forEach(function(line) {
self.emit('data', line + '\n');
});
}
}
util.inherits(ArrayStream, require('stream').Stream);
ArrayStream.prototype.readable = true;
ArrayStream.prototype.writable = true;
ArrayStream.prototype.resume = function() {};
ArrayStream.prototype.write = function() {};
var putIn = new ArrayStream();
var testMe = repl.start('', putIn);
putIn.write = function(data) {
// Don't use assert for this because the domain might catch it, and
// give a false negative. Don't throw, just print and exit.
if (data === 'OK\n') {
console.log('ok');
}
else {
console.error(data);
process.exit(1);
}
};
putIn.run([
'require("domain").create().on("error", function () { console.log("OK") })'
+ '.run(function () { throw new Error("threw") })'
]);
| {
"pile_set_name": "Github"
} |
package de.fhg.iais.roberta.util.test.expedition;
import org.junit.Assert;
import de.fhg.iais.roberta.components.expedition.ExpeditionConfiguration;
import de.fhg.iais.roberta.factory.ExpeditionFactory;
import de.fhg.iais.roberta.mode.action.Language;
import de.fhg.iais.roberta.transformer.Jaxb2ProgramAst;
import de.fhg.iais.roberta.util.PluginProperties;
import de.fhg.iais.roberta.util.Util1;
import de.fhg.iais.roberta.util.test.AbstractHelperForXmlTest;
import de.fhg.iais.roberta.visitor.codegen.ExpeditionPythonVisitor;
public class HelperExpeditionForXmlTest extends AbstractHelperForXmlTest {
public HelperExpeditionForXmlTest() {
super(
new ExpeditionFactory(new PluginProperties("expedition", "", "", Util1.loadProperties("classpath:/expedition.properties"))),
new ExpeditionConfiguration.Builder().build());
}
/**
* Generate java code as string from a given program fragment. Do not prepend and append wrappings.
*
* @param pathToProgramXml path to a XML file, usable for {@link Class#getResourceAsStream(String)}
* @return the code fragment as string
* @throws Exception
*/
private String generateStringWithoutWrapping(String pathToProgramXml) throws Exception {
Jaxb2ProgramAst<Void> transformer = generateTransformer(pathToProgramXml);
String javaCode = ExpeditionPythonVisitor.generate((ExpeditionConfiguration) getRobotConfiguration(), transformer.getTree(), false, Language.ENGLISH);
return javaCode;
}
/**
* Assert that Java code generated from Blockly XML program is correct.<br>
* All white space are ignored!
*
* @param correctJavaCode correct java code
* @param fileName of the program we want to generate java code
* @throws Exception
*/
public void assertCodeIsOk(String correctJavaCode, String fileName) throws Exception {
Assert.assertEquals(correctJavaCode.replaceAll("\\s+", ""), generateStringWithoutWrapping(fileName).replaceAll("\\s+", ""));
}
/**
* this.robotConfiguration Generate python code as string from a given program . Prepend and append wrappings.
*
* @param pathToProgramXml path to a XML file, usable for {@link Class#getResourceAsStream(String)}
* @return the code as string
* @throws Exception
*/
public String generatePython(String pathToProgramXml, ExpeditionConfiguration brickConfiguration) throws Exception {
Jaxb2ProgramAst<Void> transformer = generateTransformer(pathToProgramXml);
String code = ExpeditionPythonVisitor.generate(brickConfiguration, transformer.getTree(), true, Language.ENGLISH);
// System.out.println(code); // only needed for EXTREME debugging
return code;
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<title>XMLHttpRequest: open() in document that is not fully active (but may be active) should throw</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method">
</head>
<body>
<div id="log"></div>
<script>
var test = async_test(),
client,
count = 0,
win = window.open("resources/init.htm");
test.add_cleanup(function() { win.close(); });
function init() {
test.step(function() {
if(0 == count) {
var doc = win.document;
var ifr = document.createElement("iframe");
ifr.onload = function() {
// Again, do things async so we're not doing loads from inside
// load events.
test.step_timeout(function() {
client = new ifr.contentWindow.XMLHttpRequest();
count++;
// Important to do a normal navigation, not a reload.
win.location.href = "resources/init.htm?avoid-replace";
}, 0);
}
doc.body.appendChild(ifr);
} else if(1 == count) {
assert_throws_dom("InvalidStateError", function() { client.open("GET", "...") })
test.done()
}
})
}
</script>
</body>
</html>
| {
"pile_set_name": "Github"
} |
**`BODY`**가 출력됩니다.
```html run
<script>
let body = document.body;
body.innerHTML = "<!--" + body.tagName + "-->";
alert( body.firstChild.data ); // BODY
</script>
```
차근차근 설명해보겠습니다.
1. `<body>`의 콘텐츠가 `<!--BODY-->`로 대체됩니다. `body.tagName`은 `"BODY"`이기 때문입니다. `tagName`은 항상 대문자라는 점을 잊지 마세요.
2. `<body>`의 콘텐츠가 교체되면서 주석이 유일한 자식 노드가 됩니다. 따라서 `body.firstChild`을 사용해 주석을 얻을 수 있게 됩니다.
3. 주석 노드의 `data` 프로퍼티엔 주석 내용(`<!--...-->` 안쪽의 내용)이 저장됩니다. 따라서 `data` 프로퍼티의 값은 `"BODY"`입니다.
| {
"pile_set_name": "Github"
} |
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Gives you a module suite with
two modules, one providing a
pluggable view and the other
plugging a subtab into it.
</body>
</html>
| {
"pile_set_name": "Github"
} |
//---------------------------------------------------------------------
// <copyright file="SpatialClientModelGenerator.cs" company="Microsoft">
// Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------
namespace Microsoft.Test.Taupo.Astoria.EntityModel
{
using System.Globalization;
using Microsoft.Test.Taupo.Astoria.Contracts;
using Microsoft.Test.Taupo.Astoria.Contracts.EntityModel;
using Microsoft.Test.Taupo.Astoria.Contracts.Http;
using Microsoft.Test.Taupo.Common;
using Microsoft.Test.Taupo.Contracts;
using Microsoft.Test.Taupo.Contracts.DataGeneration;
using Microsoft.Test.Taupo.Contracts.EntityModel;
using Microsoft.Test.Taupo.Contracts.EntityModel.Edm;
using Microsoft.Test.Taupo.Contracts.Types;
using Microsoft.Test.Taupo.EntityModel;
using Microsoft.Test.Taupo.Execution;
using Microsoft.Test.Taupo.Query.Common;
using Microsoft.Test.Taupo.Spatial.Contracts;
/// <summary>
/// Model aimed at covering interesting shapes specific to spatial types for client tests
/// </summary>
[ImplementationName(typeof(IModelGenerator), "SpatialClient", HelpText = "Model for spatial client tests")]
public class SpatialClientModelGenerator : IModelGenerator
{
/// <summary>
/// Generate the model.
/// </summary>
/// <returns> Valid <see cref="EntityModelSchema"/>.</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1809:AvoidExcessiveLocals", Justification = "Model declaration")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Model declaration")]
public EntityModelSchema GenerateModel()
{
var model = new EntityModelSchema()
{
new EntityType("Store")
{
IsAbstract = true,
Properties =
{
new MemberProperty("StoreId", DataTypes.Integer) { IsPrimaryKey = true },
new MemberProperty("Name", DataTypes.String.Nullable(false)),
new MemberProperty("Location", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("ConcurrencyToken", DataTypes.String.Nullable(true).WithMaxLength(4)) { Annotations = { new ConcurrencyTokenAnnotation() } },
},
NavigationProperties =
{
new NavigationProperty("FavoriteOf", "Person_FavoriteStore", "Store", "Person"),
}
},
new EntityType("CoffeeShop")
{
BaseType = "Store",
Properties =
{
new MemberProperty("Entrance", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("EmergencyExit", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
},
NavigationProperties =
{
new NavigationProperty("Flavors", "CoffeeShop_Flavors", "CoffeeShop", "Flavor"),
}
},
new EntityType("Pizzeria")
{
BaseType = "Store",
Properties =
{
new MemberProperty("DeliveryAreas", EdmDataTypes.GeographyMultiPolygon.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("DeliveryRoutes", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyLineString.NotNullable().WithSrid(SpatialConstants.VariableSrid))),
new MemberProperty("ReceptionDesk", EdmDataTypes.GeometryPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("Oven", EdmDataTypes.GeometryPoint.WithSrid(SpatialConstants.VariableSrid)),
},
NavigationProperties =
{
new NavigationProperty("Logo", "Pizzeria_Logo", "Pizzeria", "Logo"),
}
},
new EntityType("CoffeeFlavor")
{
new MemberProperty("Name", DataTypes.String.Nullable(false)) { IsPrimaryKey = true },
new MemberProperty("Description", DataTypes.String.Nullable(true)),
new MemberProperty("ConcurrencyToken", DataTypes.String.Nullable(true).WithMaxLength(4)) { Annotations = { new ConcurrencyTokenAnnotation() } },
new MemberProperty("Grown", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))),
new NavigationProperty("StoresSoldAt", "CoffeeShop_Flavors", "Flavor", "CoffeeShop"),
new NavigationProperty("FavoriteOf", "Person_FavoriteFlavor", "Flavor", "Person"),
},
new EntityType("Person")
{
new MemberProperty("FirstName", DataTypes.String.Nullable(false)) { IsPrimaryKey = true },
new MemberProperty("LastName", DataTypes.String.Nullable(false)) { IsPrimaryKey = true },
new MemberProperty("CurrentAddress", DataTypes.ComplexType.WithName("Address")),
new MemberProperty("PastAddresses", DataTypes.CollectionOfComplex("Address")),
new MemberProperty("RecentLocations", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))),
new NavigationProperty("FavoriteStore", "Person_FavoriteStore", "Person", "Store"),
new NavigationProperty("FavoriteCoffeeFlavor", "Person_FavoriteFlavor", "Person", "Flavor"),
new NavigationProperty("Photos", "Person_Photos", "Person", "Photo"),
new NavigationProperty("FavoritePhoto", "Person_FavoritePhoto", "Person", "Photo"),
},
new EntityType("Photo")
{
new HasStreamAnnotation(),
new MemberProperty("StoreId", DataTypes.Integer) { IsPrimaryKey = true },
new MemberProperty("WhereTaken", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
new NavigationProperty("Owner", "Person_Photos", "Photo", "Person"),
new NavigationProperty("Pizzeria", "Pizzeria_Logo", "Logo", "Pizzeria"),
},
// TODO: Fix streams on derived types for spatial client tests
////new EntityType("PhotoWithThumbnail")
////{
//// BaseType = "Photo",
//// Properties =
//// {
//// new MemberProperty("Thumbnail", DataTypes.Stream),
//// },
////},
new EntityType("HikingTrail")
{
new MemberProperty("Name", DataTypes.String) { IsPrimaryKey = true },
},
new EntityType("HikingTrailWithCoordinates")
{
BaseType = "HikingTrail",
Properties =
{
new MemberProperty("MainPath", EdmDataTypes.GeographyLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("AlternatePaths", EdmDataTypes.GeographyMultiLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("TrailHead", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
},
},
new EntityType("AllSpatialTypes")
{
new MemberProperty("Id", EdmDataTypes.Int32) { IsPrimaryKey = true },
new MemberProperty("Geog", EdmDataTypes.Geography.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogPoint", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogLine", EdmDataTypes.GeographyLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogPolygon", EdmDataTypes.GeographyPolygon.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogCollection", EdmDataTypes.GeographyCollection.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogMultiPoint", EdmDataTypes.GeographyMultiPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogMultiLine", EdmDataTypes.GeographyMultiLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogMultiPolygon", EdmDataTypes.GeographyMultiPolygon.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("Geom", EdmDataTypes.Geometry.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomPoint", EdmDataTypes.GeometryPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomLine", EdmDataTypes.GeometryLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomPolygon", EdmDataTypes.GeometryPolygon.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomCollection", EdmDataTypes.GeometryCollection.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomMultiPoint", EdmDataTypes.GeometryMultiPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomMultiLine", EdmDataTypes.GeometryMultiLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomMultiPolygon", EdmDataTypes.GeometryMultiPolygon.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("Complex", DataTypes.ComplexType.WithName("AllSpatialTypesComplex")),
},
new EntityType("AllSpatialCollectionTypes")
{
IsAbstract = true,
Properties =
{
new MemberProperty("Id", EdmDataTypes.Int32) { IsPrimaryKey = true },
}
},
new EntityType("AllSpatialCollectionTypes_Simple")
{
BaseType = "AllSpatialCollectionTypes",
Properties =
{
new MemberProperty("ManyGeogPoint", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogLine", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyLineString.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogPolygon", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyPolygon.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomPoint", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomLine", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryLineString.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomPolygon", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryPolygon.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
},
},
new EntityType("AllSpatialCollectionTypes_Intermediate")
{
BaseType = "AllSpatialCollectionTypes",
Properties =
{
new MemberProperty("ManyGeog", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Geography.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogCollection", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyCollection.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeom", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Geometry.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomCollection", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryCollection.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
},
},
new EntityType("AllSpatialCollectionTypes_MultiPoint")
{
BaseType = "AllSpatialCollectionTypes",
Properties =
{
new MemberProperty("ManyGeogMultiPoint", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyMultiPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomMultiPoint", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryMultiPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
},
},
new EntityType("AllSpatialCollectionTypes_MultiLine")
{
BaseType = "AllSpatialCollectionTypes",
Properties =
{
new MemberProperty("ManyGeogMultiLine", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyMultiLineString.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomMultiLine", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryMultiLineString.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
},
},
new EntityType("AllSpatialCollectionTypes_MultiPolygon")
{
BaseType = "AllSpatialCollectionTypes",
Properties =
{
new MemberProperty("ManyGeogMultiPolygon", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyMultiPolygon.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomMultiPolygon", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryMultiPolygon.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
},
},
new EntityType("AllSpatialCollectionTypes_Complex1")
{
BaseType = "AllSpatialCollectionTypes",
Properties =
{
new MemberProperty("ManyComplex", DataTypes.CollectionOfComplex("AllSpatialTypesComplex")).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
},
},
new EntityType("AllSpatialCollectionTypes_Complex2")
{
BaseType = "AllSpatialCollectionTypes",
Properties =
{
new MemberProperty("ManyCollectionComplex", DataTypes.ComplexType.WithName("AllSpatialCollectionTypesComplex")),
},
},
new EntityType("ApplicationWindow")
{
new MemberProperty("Id", EdmDataTypes.Int32) { IsPrimaryKey = true },
new MemberProperty("Origin", EdmDataTypes.GeometryPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("Border", EdmDataTypes.GeometryPolygon.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("MultiTouchPoints", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))),
new NavigationProperty("Controls", "Window_Controls", "Window", "Control"),
},
new EntityType("ApplicationControl")
{
new MemberProperty("Id", EdmDataTypes.Int32) { IsPrimaryKey = true },
new MemberProperty("Origin", EdmDataTypes.GeometryPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("Border", EdmDataTypes.GeometryPolygon.WithSrid(SpatialConstants.VariableSrid)),
new NavigationProperty("Window", "Window_Controls", "Control", "Window"),
},
new EntityType("Shape")
{
IsAbstract = true,
Properties =
{
new MemberProperty("Id", EdmDataTypes.Int32) { IsPrimaryKey = true },
},
},
new EntityType("Point")
{
BaseType = "Shape",
Properties =
{
new MemberProperty("PointValue", EdmDataTypes.GeometryPoint.WithSrid(SpatialConstants.VariableSrid)),
}
},
new EntityType("Line")
{
BaseType = "Shape",
Properties =
{
new MemberProperty("LineValue", EdmDataTypes.GeometryLineString.WithSrid(SpatialConstants.VariableSrid)),
}
},
new EntityType("Polygon")
{
BaseType = "Shape",
Properties =
{
new MemberProperty("Value", EdmDataTypes.GeometryPolygon.WithSrid(SpatialConstants.VariableSrid)),
}
},
new ComplexType("Address")
{
new MemberProperty("Location", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
},
new ComplexType("AllSpatialTypesComplex")
{
new MemberProperty("Geog", EdmDataTypes.Geography.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogPoint", EdmDataTypes.GeographyPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogLine", EdmDataTypes.GeographyLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogPolygon", EdmDataTypes.GeographyPolygon.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogCollection", EdmDataTypes.GeographyCollection.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogMultiPoint", EdmDataTypes.GeographyMultiPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogMultiLine", EdmDataTypes.GeographyMultiLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeogMultiPolygon", EdmDataTypes.GeographyMultiPolygon.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("Geom", EdmDataTypes.Geometry.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomPoint", EdmDataTypes.GeometryPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomLine", EdmDataTypes.GeometryLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomPolygon", EdmDataTypes.GeometryPolygon.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomCollection", EdmDataTypes.GeometryCollection.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomMultiPoint", EdmDataTypes.GeometryMultiPoint.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomMultiLine", EdmDataTypes.GeometryMultiLineString.WithSrid(SpatialConstants.VariableSrid)),
new MemberProperty("GeomMultiPolygon", EdmDataTypes.GeometryMultiPolygon.WithSrid(SpatialConstants.VariableSrid)),
},
new ComplexType("AllSpatialCollectionTypesComplex")
{
new MemberProperty("ManyGeog", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Geography.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogPoint", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogLine", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyLineString.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogPolygon", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyPolygon.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogCollection", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyCollection.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogMultiPoint", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyMultiPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogMultiLine", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyMultiLineString.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeogMultiPolygon", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeographyMultiPolygon.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeom", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.Geometry.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomPoint", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomLine", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryLineString.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomPolygon", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryPolygon.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomCollection", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryCollection.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomMultiPoint", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryMultiPoint.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomMultiLine", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryMultiLineString.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
new MemberProperty("ManyGeomMultiPolygon", DataTypes.CollectionType.WithElementDataType(EdmDataTypes.GeometryMultiPolygon.NotNullable().WithSrid(SpatialConstants.VariableSrid))).WithDataGenerationHints(DataGenerationHints.MaxCount(2)),
},
new AssociationType("CoffeeShop_Flavors")
{
new AssociationEnd("CoffeeShop", "CoffeeShop", EndMultiplicity.Many),
new AssociationEnd("Flavor", "CoffeeFlavor", EndMultiplicity.Many),
},
new AssociationType("Person_FavoriteStore")
{
new AssociationEnd("Person", "Person", EndMultiplicity.Many),
new AssociationEnd("Store", "Store", EndMultiplicity.ZeroOne),
},
new AssociationType("Pizzeria_Logo")
{
new AssociationEnd("Logo", "Photo", EndMultiplicity.One),
new AssociationEnd("Pizzeria", "Pizzeria", EndMultiplicity.ZeroOne),
},
new AssociationType("Person_FavoriteFlavor")
{
new AssociationEnd("Person", "Person", EndMultiplicity.Many),
new AssociationEnd("Flavor", "CoffeeFlavor", EndMultiplicity.ZeroOne),
},
new AssociationType("Person_Photos")
{
new AssociationEnd("Person", "Person", EndMultiplicity.ZeroOne),
new AssociationEnd("Photo", "Photo", EndMultiplicity.Many),
},
new AssociationType("Person_FavoritePhoto")
{
new AssociationEnd("Person", "Person", EndMultiplicity.Many),
new AssociationEnd("Photo", "Photo", EndMultiplicity.ZeroOne),
},
new AssociationType("Window_Controls")
{
new AssociationEnd("Window", "ApplicationWindow", EndMultiplicity.ZeroOne),
new AssociationEnd("Control", "ApplicationControl", EndMultiplicity.Many),
},
new EntityContainer("SpatialContainer")
{
new DataServiceConfigurationAnnotation()
{
UseVerboseErrors = true,
},
new DataServiceBehaviorAnnotation()
{
AcceptSpatialLiteralsInQuery = true,
MaxProtocolVersion = DataServiceProtocolVersion.V4,
},
new EntitySet("Stores", "Store")
{
new PageSizeAnnotation() { PageSize = 3 },
},
new EntitySet("Flavors", "CoffeeFlavor"),
new EntitySet("People", "Person"),
new EntitySet("Photos", "Photo")
{
new PageSizeAnnotation() { PageSize = 5 },
},
new EntitySet("Trails", "HikingTrail"),
new EntitySet("AllTypesSet", "AllSpatialTypes")
{
new PageSizeAnnotation() { PageSize = 2 },
},
new EntitySet("AllCollectionTypesSet", "AllSpatialCollectionTypes"),
new EntitySet("ApplicationWindows", "ApplicationWindow")
{
new PageSizeAnnotation() { PageSize = 4 },
},
new EntitySet("ApplicationControls", "ApplicationControl"),
new EntitySet("Shapes", "Shape"),
new AssociationSet("Stores_Flavors", "CoffeeShop_Flavors")
{
new AssociationSetEnd("CoffeeShop", "Stores"),
new AssociationSetEnd("Flavor", "Flavors"),
},
new AssociationSet("People_Stores", "Person_FavoriteStore")
{
new AssociationSetEnd("Person", "People"),
new AssociationSetEnd("Store", "Stores"),
},
new AssociationSet("People_Flavors", "Person_FavoriteFlavor")
{
new AssociationSetEnd("Person", "People"),
new AssociationSetEnd("Flavor", "Flavors"),
},
new AssociationSet("People_Photos", "Person_Photos")
{
new AssociationSetEnd("Person", "People"),
new AssociationSetEnd("Photo", "Photos"),
},
new AssociationSet("People_FavoritePhotos", "Person_FavoritePhoto")
{
new AssociationSetEnd("Person", "People"),
new AssociationSetEnd("Photo", "Photos"),
},
new AssociationSet("Pizzeria_Logo", "Pizzeria_Logo")
{
new AssociationSetEnd("Logo", "Photos"),
new AssociationSetEnd("Pizzeria", "Stores"),
},
new AssociationSet("Windows_Controls", "Window_Controls")
{
new AssociationSetEnd("Window", "ApplicationWindows"),
new AssociationSetEnd("Control", "ApplicationControls"),
},
}
};
new ResolveReferencesFixup().Fixup(model);
new ApplyDefaultNamespaceFixup("Spatial").Fixup(model);
return model;
}
}
}
| {
"pile_set_name": "Github"
} |
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="13.5"
android:viewportHeight="13.5">
<path
android:fillColor="@color/map_marker_own_background"
android:pathData="M6.75,6.751m-6.75,0a6.75,6.75 0,1 1,13.5 0a6.75,6.75 0,1 1,-13.5 0" />
<path
android:fillColor="@color/map_marker_own_foreground"
android:pathData="M2.593,5.355c0,-2.296 1.861,-4.157 4.157,-4.157c2.295,0 4.157,1.861 4.157,4.157v5.081c0,0.51 -0.413,0.924 -0.922,0.924c-0.512,0 -0.925,-0.414 -0.925,-0.924c0,-0.381 -0.311,-0.691 -0.694,-0.691c-0.383,0 -0.692,0.311 -0.692,0.691c0,0.51 -0.414,0.924 -0.924,0.924s-0.924,-0.414 -0.924,-0.924c0,-0.381 -0.312,-0.691 -0.692,-0.691c-0.384,0 -0.694,0.311 -0.694,0.691c0,0.51 -0.413,0.924 -0.925,0.924c-0.509,0 -0.922,-0.414 -0.922,-0.924L2.593,5.355zM5.134,5.817c0.381,0 0.692,-0.311 0.692,-0.693c0,-0.382 -0.312,-0.691 -0.692,-0.691c-0.384,0 -0.694,0.31 -0.694,0.691C4.439,5.507 4.75,5.817 5.134,5.817zM8.366,5.817c0.384,0 0.694,-0.311 0.694,-0.693c0,-0.382 -0.311,-0.691 -0.694,-0.691c-0.383,0 -0.692,0.31 -0.692,0.691C7.674,5.507 7.983,5.817 8.366,5.817z" />
</vector>
| {
"pile_set_name": "Github"
} |
import { connect } from 'react-redux';
import { doRemoveUnreadSubscription } from 'redux/actions/subscriptions';
import { doSetContentHistoryItem } from 'redux/actions/content';
import {
doFetchFileInfo,
makeSelectFileInfoForUri,
makeSelectMetadataForUri,
makeSelectChannelForClaimUri,
makeSelectClaimIsNsfw,
} from 'lbry-redux';
import { makeSelectCostInfoForUri, doFetchCostInfoForUri } from 'lbryinc';
import { selectShowMatureContent } from 'redux/selectors/settings';
import { makeSelectIsSubscribed } from 'redux/selectors/subscriptions';
import { makeSelectFileRenderModeForUri } from 'redux/selectors/content';
import FilePage from './view';
const select = (state, props) => ({
costInfo: makeSelectCostInfoForUri(props.uri)(state),
metadata: makeSelectMetadataForUri(props.uri)(state),
obscureNsfw: !selectShowMatureContent(state),
isMature: makeSelectClaimIsNsfw(props.uri)(state),
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
isSubscribed: makeSelectIsSubscribed(props.uri)(state),
channelUri: makeSelectChannelForClaimUri(props.uri, true)(state),
renderMode: makeSelectFileRenderModeForUri(props.uri)(state),
});
const perform = dispatch => ({
fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)),
fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)),
setViewed: uri => dispatch(doSetContentHistoryItem(uri)),
markSubscriptionRead: (channel, uri) => dispatch(doRemoveUnreadSubscription(channel, uri)),
});
export default connect(select, perform)(FilePage);
| {
"pile_set_name": "Github"
} |
// Copyright 2005-2009 Daniel James.
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP)
#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP
#include <boost/config.hpp>
#if defined(BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <boost/config/no_tr1/cmath.hpp>
// Set BOOST_HASH_CONFORMANT_FLOATS to 1 for libraries known to have
// sufficiently good floating point support to not require any
// workarounds.
//
// When set to 0, the library tries to automatically
// use the best available implementation. This normally works well, but
// breaks when ambiguities are created by odd namespacing of the functions.
//
// Note that if this is set to 0, the library should still take full
// advantage of the platform's floating point support.
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(__LIBCOMO__)
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
// Rogue Wave library:
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(_LIBCPP_VERSION)
// libc++
# define BOOST_HASH_CONFORMANT_FLOATS 1
#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
// GNU libstdc++ 3
# if defined(__GNUC__) && __GNUC__ >= 4
# define BOOST_HASH_CONFORMANT_FLOATS 1
# else
# define BOOST_HASH_CONFORMANT_FLOATS 0
# endif
#elif defined(__STL_CONFIG_H)
// generic SGI STL
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(__MSL_CPP__)
// MSL standard lib:
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(__IBMCPP__)
// VACPP std lib (probably conformant for much earlier version).
# if __IBMCPP__ >= 1210
# define BOOST_HASH_CONFORMANT_FLOATS 1
# else
# define BOOST_HASH_CONFORMANT_FLOATS 0
# endif
#elif defined(MSIPL_COMPILE_H)
// Modena C++ standard library
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
// Dinkumware Library (this has to appear after any possible replacement libraries):
# if _CPPLIB_VER >= 405
# define BOOST_HASH_CONFORMANT_FLOATS 1
# else
# define BOOST_HASH_CONFORMANT_FLOATS 0
# endif
#else
# define BOOST_HASH_CONFORMANT_FLOATS 0
#endif
#if BOOST_HASH_CONFORMANT_FLOATS
// The standard library is known to be compliant, so don't use the
// configuration mechanism.
namespace boost {
namespace hash_detail {
template <typename Float>
struct call_ldexp {
typedef Float float_type;
inline Float operator()(Float x, int y) const {
return std::ldexp(x, y);
}
};
template <typename Float>
struct call_frexp {
typedef Float float_type;
inline Float operator()(Float x, int* y) const {
return std::frexp(x, y);
}
};
template <typename Float>
struct select_hash_type
{
typedef Float type;
};
}
}
#else // BOOST_HASH_CONFORMANT_FLOATS == 0
// The C++ standard requires that the C float functions are overloarded
// for float, double and long double in the std namespace, but some of the older
// library implementations don't support this. On some that don't, the C99
// float functions (frexpf, frexpl, etc.) are available.
//
// The following tries to automatically detect which are available.
namespace boost {
namespace hash_detail {
// Returned by dummy versions of the float functions.
struct not_found {
// Implicitly convertible to float and long double in order to avoid
// a compile error when the dummy float functions are used.
inline operator float() const { return 0; }
inline operator long double() const { return 0; }
};
// A type for detecting the return type of functions.
template <typename T> struct is;
template <> struct is<float> { char x[10]; };
template <> struct is<double> { char x[20]; };
template <> struct is<long double> { char x[30]; };
template <> struct is<boost::hash_detail::not_found> { char x[40]; };
// Used to convert the return type of a function to a type for sizeof.
template <typename T> is<T> float_type(T);
// call_ldexp
//
// This will get specialized for float and long double
template <typename Float> struct call_ldexp
{
typedef double float_type;
inline double operator()(double a, int b) const
{
using namespace std;
return ldexp(a, b);
}
};
// call_frexp
//
// This will get specialized for float and long double
template <typename Float> struct call_frexp
{
typedef double float_type;
inline double operator()(double a, int* b) const
{
using namespace std;
return frexp(a, b);
}
};
}
}
// A namespace for dummy functions to detect when the actual function we want
// isn't available. ldexpl, ldexpf etc. might be added tby the macros below.
//
// AFAICT these have to be outside of the boost namespace, as if they're in
// the boost namespace they'll always be preferable to any other function
// (since the arguments are built in types, ADL can't be used).
namespace boost_hash_detect_float_functions {
template <class Float> boost::hash_detail::not_found ldexp(Float, int);
template <class Float> boost::hash_detail::not_found frexp(Float, int*);
}
// Macros for generating specializations of call_ldexp and call_frexp.
//
// check_cpp and check_c99 check if the C++ or C99 functions are available.
//
// Then the call_* functions select an appropriate implementation.
//
// I used c99_func in a few places just to get a unique name.
//
// Important: when using 'using namespace' at namespace level, include as
// little as possible in that namespace, as Visual C++ has an odd bug which
// can cause the namespace to be imported at the global level. This seems to
// happen mainly when there's a template in the same namesapce.
#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \
namespace boost_hash_detect_float_functions { \
template <class Float> \
boost::hash_detail::not_found c99_func(Float, type2); \
} \
\
namespace boost { \
namespace hash_detail { \
namespace c99_func##_detect { \
using namespace std; \
using namespace boost_hash_detect_float_functions; \
\
struct check { \
static type1 x; \
static type2 y; \
BOOST_STATIC_CONSTANT(bool, cpp = \
sizeof(float_type(cpp_func(x,y))) \
== sizeof(is<type1>)); \
BOOST_STATIC_CONSTANT(bool, c99 = \
sizeof(float_type(c99_func(x,y))) \
== sizeof(is<type1>)); \
}; \
} \
\
template <bool x> \
struct call_c99_##c99_func : \
boost::hash_detail::call_##cpp_func<double> {}; \
\
template <> \
struct call_c99_##c99_func<true> { \
typedef type1 float_type; \
\
template <typename T> \
inline type1 operator()(type1 a, T b) const \
{ \
using namespace std; \
return c99_func(a, b); \
} \
}; \
\
template <bool x> \
struct call_cpp_##c99_func : \
call_c99_##c99_func< \
::boost::hash_detail::c99_func##_detect::check::c99 \
> {}; \
\
template <> \
struct call_cpp_##c99_func<true> { \
typedef type1 float_type; \
\
template <typename T> \
inline type1 operator()(type1 a, T b) const \
{ \
using namespace std; \
return cpp_func(a, b); \
} \
}; \
\
template <> \
struct call_##cpp_func<type1> : \
call_cpp_##c99_func< \
::boost::hash_detail::c99_func##_detect::check::cpp \
> {}; \
} \
}
#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2) \
namespace boost { \
namespace hash_detail { \
\
template <> \
struct call_##cpp_func<type1> { \
typedef type1 float_type; \
inline type1 operator()(type1 x, type2 y) const { \
return c99_func(x, y); \
} \
}; \
} \
}
#if defined(ldexpf)
BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int)
#else
BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int)
#endif
#if defined(ldexpl)
BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int)
#else
BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int)
#endif
#if defined(frexpf)
BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*)
#else
BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*)
#endif
#if defined(frexpl)
BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*)
#else
BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*)
#endif
#undef BOOST_HASH_CALL_FLOAT_MACRO
#undef BOOST_HASH_CALL_FLOAT_FUNC
namespace boost
{
namespace hash_detail
{
template <typename Float1, typename Float2>
struct select_hash_type_impl {
typedef double type;
};
template <>
struct select_hash_type_impl<float, float> {
typedef float type;
};
template <>
struct select_hash_type_impl<long double, long double> {
typedef long double type;
};
// select_hash_type
//
// If there is support for a particular floating point type, use that
// otherwise use double (there's always support for double).
template <typename Float>
struct select_hash_type : select_hash_type_impl<
BOOST_DEDUCED_TYPENAME call_ldexp<Float>::float_type,
BOOST_DEDUCED_TYPENAME call_frexp<Float>::float_type
> {};
}
}
#endif // BOOST_HASH_CONFORMANT_FLOATS
#endif
| {
"pile_set_name": "Github"
} |
// WARNING: DO NOT EDIT THIS FILE. THIS FILE IS MANAGED BY SPRING ROO.
// You may push code into the target .java compilation unit if you wish to edit any member(s).
package nl.bzk.brp.model.data.kern;
import nl.bzk.brp.model.data.kern.HisPersids;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
privileged aspect HisPersids_Roo_ToString {
public String HisPersids.toString() {
return ReflectionToStringBuilder.toString(this, ToStringStyle.SHORT_PREFIX_STYLE);
}
}
| {
"pile_set_name": "Github"
} |
declare var a: any;
export function consoleTestResultHandler(testResult: any): boolean {
// needed to get colors to show up when passing through Grunt
void a;
for (const q of a) {
void a;
/* eslint-disable no-console */
if (a) {
} else {
}
/* eslint-enable no-console */
}
return true;
} | {
"pile_set_name": "Github"
} |
// -*- C++ -*-
// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the terms
// of the GNU General Public License as published by the Free Software
// Foundation; either version 3, or (at your option) any later
// version.
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
// Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL.
// Permission to use, copy, modify, sell, and distribute this software
// is hereby granted without fee, provided that the above copyright
// notice appears in all copies, and that both that copyright notice
// and this permission notice appear in supporting documentation. None
// of the above authors, nor IBM Haifa Research Laboratories, make any
// representation about the suitability of this software for any
// purpose. It is provided "as is" without express or implied
// warranty.
/**
* @file sample_trie_node_update.hpp
* Contains a samle node update functor.
*/
#ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
#define PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
// A sample node updator.
template<typename Const_Node_Iterator,
class Node_Iterator,
class E_Access_Traits,
class Allocator
>
class sample_trie_node_update
{
public:
// Metadata type.
typedef size_t metadata_type;
protected:
// Default constructor.
sample_trie_node_update();
// Updates the rank of a node through a node_iterator node_it; end_nd_it is the end node iterator.
inline void
operator()(node_iterator node_it, const_node_iterator end_nd_it) const;
};
#endif // #ifndef PB_DS_SAMPLE_TRIE_NODE_UPDATOR_HPP
| {
"pile_set_name": "Github"
} |
{
"name": "Time",
"description": "Time keeping library",
"keywords": "Time, date, hour, minute, second, day, week, month, year, RTC",
"authors": [
{
"name": "Michael Margolis"
},
{
"name": "Paul Stoffregen",
"email": "[email protected]",
"url": "http://www.pjrc.com",
"maintainer": true
}
],
"repository": {
"type": "git",
"url": "https://github.com/PaulStoffregen/Time"
},
"version": "1.6",
"homepage": "http://playground.arduino.cc/Code/Time",
"frameworks": "Arduino",
"examples": [
"examples/*/*.ino"
]
}
| {
"pile_set_name": "Github"
} |
using System.Collections.Generic;
using System.Linq;
using LightBDD.Core.Notification;
namespace LightBDD.Framework.Notification.Implementation
{
internal class ScenarioProgressNotifierComposer
{
private readonly List<IScenarioProgressNotifierProvider> _providers;
public ScenarioProgressNotifierComposer() : this(new List<IScenarioProgressNotifierProvider>())
{
}
private ScenarioProgressNotifierComposer(List<IScenarioProgressNotifierProvider> providers)
{
_providers = providers;
}
public ScenarioProgressNotifierComposer Clone()
{
return new ScenarioProgressNotifierComposer(new List<IScenarioProgressNotifierProvider>(_providers));
}
public IScenarioProgressNotifier Compose(object fixture)
{
return DelegatingScenarioProgressNotifier.Compose(_providers.Select(p => p.Provide(fixture)));
}
public void Append(IScenarioProgressNotifierProvider provider)
{
_providers.Add(provider);
}
public void Set(IScenarioProgressNotifierProvider provider)
{
Clear();
Append(provider);
}
public void Clear()
{
_providers.Clear();
}
}
} | {
"pile_set_name": "Github"
} |
import ballerina/io;
import wso2/utils;
function testAcceptNothingButReturnString() returns handle {
return utils:getString();
}
public function main() {
io:println(testAcceptNothingButReturnString());
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.chiclaim.sample"
xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.chiclaim.sample.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest> | {
"pile_set_name": "Github"
} |
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/download/quarantine/quarantine.h"
#include "build/build_config.h"
#if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_LINUX)
namespace download {
QuarantineFileResult QuarantineFile(const base::FilePath& file,
const GURL& source_url,
const GURL& referrer_url,
const std::string& client_guid) {
return QuarantineFileResult::OK;
}
bool IsFileQuarantined(const base::FilePath& file,
const GURL& source_url,
const GURL& referrer_url) {
return false;
}
} // namespace download
#endif // !WIN && !MAC && !LINUX
| {
"pile_set_name": "Github"
} |
define(function(require, exports, module) {
"use strict";
var assert = require("./assert");
var hasOwnProp = Object.hasOwnProperty;
// extend
// Borrowed from Underscore.js
function extend(object) {
var argsIndex, argsLength, iteratee, key;
if (!object) {
return object;
}
argsLength = arguments.length;
for (argsIndex = 1; argsIndex < argsLength; argsIndex++) {
iteratee = arguments[argsIndex];
if (iteratee) {
for (key in iteratee) {
object[key] = iteratee[key];
}
}
}
return object;
}
/**
* Call the {@Chart#initialize} method up the inheritance chain, starting with
* the base class and continuing "downward".
*
* @private
*/
var initCascade = function(instance, args) {
var ctor = this.constructor;
var sup = ctor.__super__;
if (sup) {
initCascade.call(sup, instance, args);
}
// Do not invoke the `initialize` method on classes further up the
// prototype chain (again).
if (hasOwnProp.call(ctor.prototype, "initialize")) {
this.initialize.apply(instance, args);
}
};
/**
* Call the `transform` method down the inheritance chain, starting with the
* instance and continuing "upward". The result of each transformation should
* be supplied as input to the next.
*
* @private
*/
var transformCascade = function(instance, data) {
var ctor = this.constructor;
var sup = ctor.__super__;
// Unlike `initialize`, the `transform` method has significance when
// attached directly to a chart instance. Ensure that this transform takes
// first but is not invoked on later recursions.
if (this === instance && hasOwnProp.call(this, "transform")) {
data = this.transform(data);
}
// Do not invoke the `transform` method on classes further up the prototype
// chain (yet).
if (hasOwnProp.call(ctor.prototype, "transform")) {
data = ctor.prototype.transform.call(instance, data);
}
if (sup) {
data = transformCascade.call(sup, instance, data);
}
return data;
};
/**
* Create a d3.chart
*
* @constructor
* @externalExample {runnable} chart
*
* @param {d3.selection} selection The chart's "base" DOM node. This should
* contain any nodes that the chart generates.
* @param {mixed} chartOptions A value for controlling how the chart should be
* created. This value will be forwarded to {@link Chart#initialize}, so
* charts may define additional properties for consumers to modify their
* behavior during initialization. The following attributes will be
* copied onto the chart instance (if present):
* @param {Function} [chartOptions.transform] - A data transformation function
* unique to the Chart instance being created. If specified, this
* function will be invoked after all inherited implementations as part
* of the `Chart#draw` operation.
* @param {Function} [chartOptions.demux] - A data filtering function for
* attachment charts. If specified, this function will be invoked with
* every {@link Chart#draw|draw} operation and provided with two
* arguments: the attachment name (see {@link Chart#attach}) and the
* data.
*
* @constructor
*/
var Chart = function(selection, chartOptions) {
this.base = selection;
this._layers = {};
this._attached = {};
this._events = {};
if (chartOptions && chartOptions.transform) {
this.transform = chartOptions.transform;
}
initCascade.call(this, this, [chartOptions]);
};
/**
* Set up a chart instance. This method is intended to be overridden by Charts
* authored with this library. It will be invoked with a single argument: the
* `options` value supplied to the {@link Chart|constructor}.
*
* For charts that are defined as extensions of other charts using
* `Chart.extend`, each chart's `initilize` method will be invoked starting
* with the "oldest" ancestor (see the private {@link initCascade} function for
* more details).
*/
Chart.prototype.initialize = function() {};
/**
* Remove a layer from the chart.
*
* @externalExample chart-unlayer
*
* @param {String} name The name of the layer to remove.
*
* @returns {Layer} The layer removed by this operation.
*/
Chart.prototype.unlayer = function(name) {
var layer = this.layer(name);
delete this._layers[name];
delete layer._chart;
return layer;
};
/**
* Interact with the chart's {@link Layer|layers}.
*
* If only a `name` is provided, simply return the layer registered to that
* name (if any).
*
* If a `name` and `selection` are provided, treat the `selection` as a
* previously-created layer and attach it to the chart with the specified
* `name`.
*
* If all three arguments are specified, initialize a new {@link Layer} using
* the specified `selection` as a base passing along the specified `options`.
*
* The {@link Layer.draw} method of attached layers will be invoked
* whenever this chart's {@link Chart#draw} is invoked and will receive the
* data (optionally modified by the chart's {@link Chart#transform} method.
*
* @externalExample chart-layer
*
* @param {String} name Name of the layer to attach or retrieve.
* @param {d3.selection|Layer} [selection] The layer's base or a
* previously-created {@link Layer}.
* @param {Object} [options] Options to be forwarded to {@link Layer|the Layer
* constructor}
*
* @returns {Layer}
*/
Chart.prototype.layer = function(name, selection, options) {
var layer;
if (arguments.length === 1) {
return this._layers[name];
}
// we are reattaching a previous layer, which the
// selection argument is now set to.
if (arguments.length === 2) {
if (typeof selection.draw === "function") {
selection._chart = this;
this._layers[name] = selection;
return this._layers[name];
} else {
assert(false, "When reattaching a layer, the second argument " +
"must be a d3.chart layer");
}
}
layer = selection.layer(options);
this._layers[name] = layer;
selection._chart = this;
return layer;
};
/**
* Register or retrieve an "attachment" Chart. The "attachment" chart's `draw`
* method will be invoked whenever the containing chart's `draw` method is
* invoked.
*
* @externalExample chart-attach
*
* @param {String} attachmentName Name of the attachment
* @param {Chart} [chart] d3.chart to register as a mix in of this chart. When
* unspecified, this method will return the attachment previously
* registered with the specified `attachmentName` (if any).
*
* @returns {Chart} Reference to this chart (chainable).
*/
Chart.prototype.attach = function(attachmentName, chart) {
if (arguments.length === 1) {
return this._attached[attachmentName];
}
this._attached[attachmentName] = chart;
return chart;
};
/**
* A "hook" method that you may define to modify input data before it is used
* to draw the chart's layers and attachments. This method will be used by all
* sub-classes (see {@link transformCascade} for details).
*
* Note you will most likely never call this method directly, but rather
* include it as part of a chart definition, and then rely on d3.chart to
* invoke it when you draw the chart with {@link Chart#draw}.
*
* @externalExample {runnable} chart-transform
*
* @param {Array} data Input data provided to @link Chart#draw}.
*
* @returns {mixed} Data to be used in drawing the chart's layers and
* attachments.
*/
Chart.prototype.transform = function(data) {
return data;
};
/**
* Update the chart's representation in the DOM, drawing all of its layers and
* any "attachment" charts (as attached via {@link Chart#attach}).
*
* @externalExample chart-draw
*
* @param {Object} data Data to pass to the {@link Layer#draw|draw method} of
* this cart's {@link Layer|layers} (if any) and the {@link
* Chart#draw|draw method} of this chart's attachments (if any).
*/
Chart.prototype.draw = function(data) {
var layerName, attachmentName, attachmentData;
data = transformCascade.call(this, this, data);
for (layerName in this._layers) {
this._layers[layerName].draw(data);
}
for (attachmentName in this._attached) {
if (this.demux) {
attachmentData = this.demux(attachmentName, data);
} else {
attachmentData = data;
}
this._attached[attachmentName].draw(attachmentData);
}
};
/**
* Function invoked with the context specified when the handler was bound (via
* {@link Chart#on} {@link Chart#once}).
*
* @callback ChartEventHandler
* @param {...*} arguments Invoked with the arguments passed to {@link
* Chart#trigger}
*/
/**
* Subscribe a callback function to an event triggered on the chart. See {@link
* Chart#once} to subscribe a callback function to an event for one occurence.
*
* @externalExample {runnable} chart-on
*
* @param {String} name Name of the event
* @param {ChartEventHandler} callback Function to be invoked when the event
* occurs
* @param {Object} [context] Value to set as `this` when invoking the
* `callback`. Defaults to the chart instance.
*
* @returns {Chart} A reference to this chart (chainable).
*/
Chart.prototype.on = function(name, callback, context) {
var events = this._events[name] || (this._events[name] = []);
events.push({
callback: callback,
context: context || this,
_chart: this
});
return this;
};
/**
* Subscribe a callback function to an event triggered on the chart. This
* function will be invoked at the next occurance of the event and immediately
* unsubscribed. See {@link Chart#on} to subscribe a callback function to an
* event indefinitely.
*
* @externalExample {runnable} chart-once
*
* @param {String} name Name of the event
* @param {ChartEventHandler} callback Function to be invoked when the event
* occurs
* @param {Object} [context] Value to set as `this` when invoking the
* `callback`. Defaults to the chart instance
*
* @returns {Chart} A reference to this chart (chainable)
*/
Chart.prototype.once = function(name, callback, context) {
var self = this;
var once = function() {
self.off(name, once);
callback.apply(this, arguments);
};
return this.on(name, once, context);
};
/**
* Unsubscribe one or more callback functions from an event triggered on the
* chart. When no arguments are specified, *all* handlers will be unsubscribed.
* When only a `name` is specified, all handlers subscribed to that event will
* be unsubscribed. When a `name` and `callback` are specified, only that
* function will be unsubscribed from that event. When a `name` and `context`
* are specified (but `callback` is omitted), all events bound to the given
* event with the given context will be unsubscribed.
*
* @externalExample {runnable} chart-off
*
* @param {String} [name] Name of the event to be unsubscribed
* @param {ChartEventHandler} [callback] Function to be unsubscribed
* @param {Object} [context] Contexts to be unsubscribe
*
* @returns {Chart} A reference to this chart (chainable).
*/
Chart.prototype.off = function(name, callback, context) {
var names, n, events, event, i, j;
// remove all events
if (arguments.length === 0) {
for (name in this._events) {
this._events[name].length = 0;
}
return this;
}
// remove all events for a specific name
if (arguments.length === 1) {
events = this._events[name];
if (events) {
events.length = 0;
}
return this;
}
// remove all events that match whatever combination of name, context
// and callback.
names = name ? [name] : Object.keys(this._events);
for (i = 0; i < names.length; i++) {
n = names[i];
events = this._events[n];
j = events.length;
while (j--) {
event = events[j];
if ((callback && callback === event.callback) ||
(context && context === event.context)) {
events.splice(j, 1);
}
}
}
return this;
};
/**
* Publish an event on this chart with the given `name`.
*
* @externalExample {runnable} chart-trigger
*
* @param {String} name Name of the event to publish
* @param {...*} arguments Values with which to invoke the registered
* callbacks.
*
* @returns {Chart} A reference to this chart (chainable).
*/
Chart.prototype.trigger = function(name) {
var args = Array.prototype.slice.call(arguments, 1);
var events = this._events[name];
var i, ev;
if (events !== undefined) {
for (i = 0; i < events.length; i++) {
ev = events[i];
ev.callback.apply(ev.context, args);
}
}
return this;
};
/**
* Create a new {@link Chart} constructor with the provided options acting as
* "overrides" for the default chart instance methods. Allows for basic
* inheritance so that new chart constructors may be defined in terms of
* existing chart constructors. Based on the `extend` function defined by
* [Backbone.js](http://backbonejs.org/).
*
* @static
* @externalExample {runnable} chart-extend
*
* @param {String} name Identifier for the new Chart constructor.
* @param {Object} protoProps Properties to set on the new chart's prototype.
* @param {Object} staticProps Properties to set on the chart constructor
* itself.
*
* @returns {Function} A new Chart constructor
*/
Chart.extend = function(name, protoProps, staticProps) {
var parent = this;
var child;
// The constructor function for the new subclass is either defined by
// you (the "constructor" property in your `extend` definition), or
// defaulted by us to simply call the parent's constructor.
if (protoProps && hasOwnProp.call(protoProps, "constructor")) {
child = protoProps.constructor;
} else {
child = function(){ return parent.apply(this, arguments); };
}
// Add static properties to the constructor function, if supplied.
extend(child, parent, staticProps);
// Set the prototype chain to inherit from `parent`, without calling
// `parent`'s constructor function.
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate();
// Add prototype properties (instance properties) to the subclass, if
// supplied.
if (protoProps) { extend(child.prototype, protoProps); }
// Set a convenience property in case the parent's prototype is needed
// later.
child.__super__ = parent.prototype;
Chart[name] = child;
return child;
};
module.exports = Chart;
});
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>订单列表</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="../../css/index.css" />
<link rel="stylesheet" href="../../js/lib/layui/css/layui.css" />
</head>
<body>
<div class="tab-body">
<p class="page-tab">
<span class="layui-breadcrumb" lay-separator=">"><a href="">首页</a><a><cite>订单列表</cite></a></span></p>
<div class="handle-box">
<ul>
<li class="handle-item"><span class="layui-form-label">输入用户名:</span>
<div class="layui-input-inline"><input type="text" autocomplete="off" placeholder="请输入搜索条件" class="layui-input"></div><button class="layui-btn mgl-20">查询</button><button class="layui-btn mgl-20" id="refresh">刷新</button><span class="fr"><a class="layui-btn layui-btn-danger radius btn-delect" id="btn-delect-all"><i class="linyer icon-delect"></i> 批量删除</a><a class="layui-btn btn-add btn-default" id="btn-adduser"><i class="linyer icon-add"></i> 添加订单</a></span></li>
</ul>
</div>
<div class="layui-clear">
<div class="tableTools fr"></div>
</div>
<table class="table-box table-sort" id="orderTable">
<thead>
<tr>
<th><input type="checkbox" class="btn-checkall fly-checkbox"></th>
<th>订单号</th>
<th>用户名</th>
<th>性别</th>
<th>手机</th>
<th>身份证号码</th>
<th>邮箱</th>
<th>地址</th>
<th>加入时间</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<th><input type="checkbox" class="btn-checkall fly-checkbox"></th>
<th>订单号</th>
<th>用户名</th>
<th>性别</th>
<th>手机</th>
<th>身份证号码</th>
<th>邮箱</th>
<th>地址</th>
<th>加入时间</th>
<th>状态</th>
<th>操作</th>
</tr>
</tfoot>
</table>
</div>
<script src="../../js/lib/layui/layui.js"></script>
<script src="../../js/define/common.js"></script>
<script src="../../js/define/order.js"></script>
</body>
</html> | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ProjectOpt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_optx.xsd">
<SchemaVersion>1.0</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Extensions>
<cExt>*.c</cExt>
<aExt>*.s*; *.src; *.a*</aExt>
<oExt>*.obj</oExt>
<lExt>*.lib</lExt>
<tExt>*.txt; *.h; *.inc</tExt>
<pExt>*.plm</pExt>
<CppX>*.cpp</CppX>
<nMigrate>0</nMigrate>
</Extensions>
<DaveTm>
<dwLowDateTime>0</dwLowDateTime>
<dwHighDateTime>0</dwHighDateTime>
</DaveTm>
<Target>
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<TargetOption>
<CLKADS>8000000</CLKADS>
<OPTTT>
<gFlags>1</gFlags>
<BeepAtEnd>1</BeepAtEnd>
<RunSim>0</RunSim>
<RunTarget>1</RunTarget>
<RunAbUc>0</RunAbUc>
</OPTTT>
<OPTHX>
<HexSelection>1</HexSelection>
<FlashByte>65535</FlashByte>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
</OPTHX>
<OPTLEX>
<PageWidth>79</PageWidth>
<PageLength>66</PageLength>
<TabStop>8</TabStop>
<ListingPath>.\Listings\</ListingPath>
</OPTLEX>
<ListingPage>
<CreateCListing>1</CreateCListing>
<CreateAListing>1</CreateAListing>
<CreateLListing>1</CreateLListing>
<CreateIListing>0</CreateIListing>
<AsmCond>1</AsmCond>
<AsmSymb>1</AsmSymb>
<AsmXref>0</AsmXref>
<CCond>1</CCond>
<CCode>0</CCode>
<CListInc>0</CListInc>
<CSymb>0</CSymb>
<LinkerCodeListing>0</LinkerCodeListing>
</ListingPage>
<OPTXL>
<LMap>1</LMap>
<LComments>1</LComments>
<LGenerateSymbols>1</LGenerateSymbols>
<LLibSym>1</LLibSym>
<LLines>1</LLines>
<LLocSym>1</LLocSym>
<LPubSym>1</LPubSym>
<LXref>0</LXref>
<LExpSel>0</LExpSel>
</OPTXL>
<OPTFL>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<IsCurrentTarget>1</IsCurrentTarget>
</OPTFL>
<CpuCode>18</CpuCode>
<DebugOpt>
<uSim>0</uSim>
<uTrg>1</uTrg>
<sLdApp>1</sLdApp>
<sGomain>1</sGomain>
<sRbreak>1</sRbreak>
<sRwatch>1</sRwatch>
<sRmem>1</sRmem>
<sRfunc>1</sRfunc>
<sRbox>1</sRbox>
<tLdApp>1</tLdApp>
<tGomain>1</tGomain>
<tRbreak>1</tRbreak>
<tRwatch>1</tRwatch>
<tRmem>1</tRmem>
<tRfunc>0</tRfunc>
<tRbox>1</tRbox>
<tRtrace>1</tRtrace>
<sRSysVw>1</sRSysVw>
<tRSysVw>1</tRSysVw>
<sRunDeb>0</sRunDeb>
<sLrtime>0</sLrtime>
<bEvRecOn>1</bEvRecOn>
<nTsel>5</nTsel>
<sDll></sDll>
<sDllPa></sDllPa>
<sDlgDll></sDlgDll>
<sDlgPa></sDlgPa>
<sIfile></sIfile>
<tDll></tDll>
<tDllPa></tDllPa>
<tDlgDll></tDlgDll>
<tDlgPa></tDlgPa>
<tIfile></tIfile>
<pMon>STLink\ST-LINKIII-KEIL_SWO.dll</pMon>
</DebugOpt>
<TargetDriverDllRegistry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMRTXEVENTFLAGS</Key>
<Name>-L70 -Z18 -C0 -M0 -T1</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGTARM</Key>
<Name>(1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ARMDBGFLAGS</Key>
<Name></Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>DLGUARM</Key>
<Name>(105=-1,-1,-1,-1,0)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>ST-LINKIII-KEIL_SWO</Key>
<Name>-U48FF6B065165485547221487 -O8303 -S1 -C0 -A0 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
</SetRegEntry>
<SetRegEntry>
<Number>0</Number>
<Key>UL2CM3</Key>
<Name>-U -O47 -S0 -C0 -P00 -TO18 -TC10000000 -TP21 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407VGTx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
</SetRegEntry>
</TargetDriverDllRegistry>
<Breakpoint/>
<Tracepoint>
<THDelay>0</THDelay>
</Tracepoint>
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
<aPa>0</aPa>
<viewmode>1</viewmode>
<vrSel>0</vrSel>
<aSym>0</aSym>
<aTbox>0</aTbox>
<AscS1>0</AscS1>
<AscS2>0</AscS2>
<AscS3>0</AscS3>
<aSer3>0</aSer3>
<eProf>0</eProf>
<aLa>0</aLa>
<aPa1>0</aPa1>
<AscS4>0</AscS4>
<aSer4>0</aSer4>
<StkLoc>0</StkLoc>
<TrcWin>0</TrcWin>
<newCpu>0</newCpu>
<uProt>0</uProt>
</DebugFlag>
<LintExecutable></LintExecutable>
<LintConfigFile></LintConfigFile>
<bLintAuto>0</bLintAuto>
<bAutoGenD>0</bAutoGenD>
<LntExFlags>0</LntExFlags>
<pMisraName></pMisraName>
<pszMrule></pszMrule>
<pSingCmds></pSingCmds>
<pMultCmds></pMultCmds>
<pMisraNamep></pMisraNamep>
<pszMrulep></pszMrulep>
<pSingCmdsp></pSingCmdsp>
<pMultCmdsp></pMultCmdsp>
<DebugDescription>
<Enable>1</Enable>
<EnableLog>0</EnableLog>
<Protocol>2</Protocol>
<DbgClock>10000000</DbgClock>
</DebugDescription>
</TargetOption>
</Target>
<Group>
<GroupName>drivers</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>1</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\drivers\hal_gpio_driver.c</PathWithFileName>
<FilenameWithoutPath>hal_gpio_driver.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>2</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\drivers\hal_i2c_driver.c</PathWithFileName>
<FilenameWithoutPath>hal_i2c_driver.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>3</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\drivers\hal_gpio_driver.h</PathWithFileName>
<FilenameWithoutPath>hal_gpio_driver.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>1</GroupNumber>
<FileNumber>4</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\drivers\hal_i2c_driver.h</PathWithFileName>
<FilenameWithoutPath>hal_i2c_driver.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>userApp</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>5</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\userApp\i2c_main.c</PathWithFileName>
<FilenameWithoutPath>i2c_main.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>6</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\led\led.c</PathWithFileName>
<FilenameWithoutPath>led.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>7</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>..\led\led.h</PathWithFileName>
<FilenameWithoutPath>led.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>8</FileNumber>
<FileType>5</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\userApp\i2c_main.h</PathWithFileName>
<FilenameWithoutPath>i2c_main.h</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
<File>
<GroupNumber>2</GroupNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\userApp\i2c_int_handler.c</PathWithFileName>
<FilenameWithoutPath>i2c_int_handler.c</FilenameWithoutPath>
<RteFlg>0</RteFlg>
<bShared>0</bShared>
</File>
</Group>
<Group>
<GroupName>inc</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>0</RteFlg>
</Group>
<Group>
<GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>
</Group>
<Group>
<GroupName>::Device</GroupName>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>
</Group>
</ProjectOpt>
| {
"pile_set_name": "Github"
} |
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Zend_Loader
*/
namespace Zend\Loader\Exception;
require_once __DIR__ . '/DomainException.php';
/**
* Plugin class loader exceptions
*
* @category Zend
* @package Zend_Loader
* @subpackage Exception
*/
class PluginLoaderException extends DomainException
{
}
| {
"pile_set_name": "Github"
} |
from __future__ import print_function
#!/usr/bin/env python
"""
Illustrating how to use optimization algorithms in a reinforcement learning framework.
"""
__author__ = 'Tom Schaul, [email protected]'
from pybrain.utilities import fListToString
from pybrain.rl.environments.cartpole.balancetask import BalanceTask
from pybrain.tools.shortcuts import buildNetwork
from pybrain.optimization import HillClimber, CMAES #@UnusedImport
# from pybrain.rl.learners.continuous.policygradients import ENAC
# from pybrain.rl.agents.learning import LearningAgent
from pybrain.rl.agents import OptimizationAgent
from pybrain.rl.experiments import EpisodicExperiment
# any episodic task
task = BalanceTask()
# any neural network controller
net = buildNetwork(task.outdim, 1, task.indim)
# any optimization algorithm to be plugged in, for example:
# learner = CMAES(storeAllEvaluations = True)
# or:
learner = HillClimber(storeAllEvaluations = True)
# in a non-optimization case the agent would be a LearningAgent:
# agent = LearningAgent(net, ENAC())
# here it is an OptimizationAgent:
agent = OptimizationAgent(net, learner)
# the agent and task are linked in an Experiment
# and everything else happens under the hood.
exp = EpisodicExperiment(task, agent)
exp.doEpisodes(100)
print('Episodes learned from:', len(learner._allEvaluations))
n, fit = learner._bestFound()
print('Best fitness found:', fit)
print('with this network:')
print(n)
print('containing these parameters:')
print(fListToString(n.params, 4))
| {
"pile_set_name": "Github"
} |
---
title: redcup
github: 'https://github.com/nadjetey/redcup'
demo: 'http://nadjetey.github.io/redcup/'
author: Nii Adjetey Sowah
ssg:
- Jekyll
cms:
- No Cms
date: 2014-01-26T21:40:33.000Z
github_branch: master
description: This is a Jekyll Theme
stale: true
--- | {
"pile_set_name": "Github"
} |
#ifndef GUARD_AGB_FLASH_H
#define GUARD_AGB_FLASH_H
// Exported type declarations
// Exported RAM declarations
// Exported ROM declarations
u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void));
u16 IdentifyFlash(void);
u32 ProgramFlashSectorAndVerify(u16 sectorNum, u8 *src);
#endif //GUARD_AGB_FLASH_H
| {
"pile_set_name": "Github"
} |
package com.cundong.recyclerview;
import android.support.v7.widget.GridLayoutManager;
/**
* Created by cundong on 2015/10/23.
* <p/>
* RecyclerView为GridLayoutManager时,设置了HeaderView,就会用到这个SpanSizeLookup
*/
public class HeaderSpanSizeLookup extends GridLayoutManager.SpanSizeLookup {
private HeaderAndFooterRecyclerViewAdapter mAdapter;
private int mSpanSize = 1;
public HeaderSpanSizeLookup(HeaderAndFooterRecyclerViewAdapter adapter, int spanSize) {
this.mAdapter = adapter;
this.mSpanSize = spanSize;
}
@Override
public int getSpanSize(int position) {
if (mAdapter == null) {
throw new RuntimeException("you must setAdapter for RecyclerView first.");
}
boolean isHeaderOrFooter = mAdapter.isHeader(position) || mAdapter.isFooter(position);
return isHeaderOrFooter ? mSpanSize : 1;
}
} | {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek <[email protected]>
* Copyright (C) 2009 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.
* 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS 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 APPLE OR ITS 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 "config.h"
#include "InspectorDatabaseResource.h"
#if ENABLE(DATABASE) && ENABLE(INSPECTOR)
#include "Database.h"
#include "InspectorFrontend.h"
#include "InspectorValues.h"
namespace WebCore {
static int nextUnusedId = 1;
PassRefPtr<InspectorDatabaseResource> InspectorDatabaseResource::create(PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
{
return adoptRef(new InspectorDatabaseResource(database, domain, name, version));
}
InspectorDatabaseResource::InspectorDatabaseResource(PassRefPtr<Database> database, const String& domain, const String& name, const String& version)
: m_database(database)
, m_id(nextUnusedId++)
, m_domain(domain)
, m_name(name)
, m_version(version)
{
}
void InspectorDatabaseResource::bind(InspectorFrontend::Database* frontend)
{
RefPtr<InspectorObject> jsonObject = InspectorObject::create();
jsonObject->setNumber("id", m_id);
jsonObject->setString("domain", m_domain);
jsonObject->setString("name", m_name);
jsonObject->setString("version", m_version);
frontend->addDatabase(jsonObject);
}
} // namespace WebCore
#endif // ENABLE(DATABASE) && ENABLE(INSPECTOR)
| {
"pile_set_name": "Github"
} |
#
# Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
"""
This file contains the show replication topology functionality.
"""
import sys
from mysql.utilities.exception import UtilError
def show_topology(master_vals, options={}):
"""Show the slaves/topology map for a master.
This method find the slaves attached to a server if it is a master. It
can also discover the replication topology if the recurse option is
True (default = False).
It prints a tabular list of the master(s) and slaves found. If the
show_list option is True, it will also print a list of the output
(default = False).
master_vals[in] Master connection in form user:passwd@host:port:socket
or login-path:port:socket.
options[in] dictionary of options
recurse If True, check each slave found for additional slaves
Default = False
prompt_user If True, prompt user if slave connection fails with
master connection parameters
Default = False
num_retries Number of times to retry a failed connection attempt
Default = 0
quiet if True, print only the data
Default = False
format Format of list
Default = Grid
width width of report
Default = 75
max_depth maximum depth of recursive search
Default = None
"""
from mysql.utilities.common.topology_map import TopologyMap
topo = TopologyMap(master_vals, options)
topo.generate_topology_map(options.get('max_depth', None))
if not options.get("quiet", False) and topo.depth():
print "\n# Replication Topology Graph"
if not topo.slaves_found():
print "No slaves found."
topo.print_graph()
print
if options.get("show_list", False):
from mysql.utilities.common.format import print_list
# make a list from the topology
topology_list = topo.get_topology_map()
print_list(sys.stdout, options.get("format", "GRID"),
["Master", "Slave"], topology_list, False, True)
| {
"pile_set_name": "Github"
} |
/**
* THIS PLUGIN IS TIGHTLY COUPLED TO THE padHierarchy PLUGIN
* AND WILL PROBABLY END UP BEING MERGED WITH THAT OTHER PLUGIN.
*
* This plugin hooks into the pad-writing process adding an array
* related images to the JSON metadata. These images are then
* used to create some horizontal navigation for traversing
* a set of related documents by thumbnail.
*/
import("etherpad.log");
import("plugins.navigateByImageContent.static.js.main");
import("plugins.navigateByImageContent.hooks");
function navigateByImageContentInit() {
this.hooks = ['renderNavigation','padModelWriteToDB'];
this.client = new main.navigateByImageContentInit();
this.description = 'Adds a header section where all documents can be traversed horizontally by the images they contain.';
this.renderNavigation = hooks.renderNavigation;
this.padModelWriteToDB = hooks.padModelWriteToDB;
this.install = install;
this.uninstall = uninstall;
}
function install() {
log.info("Installing navigateByImageContent");
}
function uninstall() {
log.info("Uninstalling navigateByImageContent");
}
| {
"pile_set_name": "Github"
} |
/* No comment provided by engineer. */
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ foi transferido e está pronto a instalar! Gostaria de o fazer agora e reiniciar %1$@ posteriormente?";
/* No comment provided by engineer. */
"%1$@ can't be updated when it's running from a read-only volume like a disk image or an optical drive. Move %1$@ to your Applications folder, relaunch it from there, and try again." = "%1$@ não pode ser actualizado quando está a ser executado a partir de um volume apenas de leitura como uma imagem de disco ou disco óptico. Mova %1$@ para a sua pasta Aplicações, reinicie-o daí e tente de novo.";
/* No comment provided by engineer. */
"%@ %@ is currently the newest version available." = "%1$@ %2$@ é neste momento a versão mais recente disponível.";
/* No comment provided by engineer. */
"%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ está agora disponível—Você tem a versão %3$@. Gostaria de a transferir agora?";
/* No comment provided by engineer. */
"%@ downloaded" = "%@ transferido";
/* No comment provided by engineer. */
"%@ of %@" = "%1$@ de %2$@";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Uma nova versão de %@ está dísponível!";
/* No comment provided by engineer. */
"A new version of %@ is ready to install!" = "Uma nova versão de %@ está pronta a instalar!";
/* No comment provided by engineer. */
"An error occurred in retrieving update information. Please try again later." = "Ocorreu um erro ao recolher informação sobre actualizações disponíveis. Por favor tente mais tarde.";
/* No comment provided by engineer. */
"An error occurred while downloading the update. Please try again later." = "Ocorreu um erro ao transferir a actualização. Por favor tente mais tarde.";
/* No comment provided by engineer. */
"An error occurred while extracting the archive. Please try again later." = "Ocorreu um erro ao extrair o arquivo. Por favor tente mais tarde.";
/* No comment provided by engineer. */
"An error occurred while installing the update. Please try again later." = "Ocorreu um erro ao instalar a actualização. Por favor tente mais tarde.";
/* No comment provided by engineer. */
"An error occurred while parsing the update feed." = "Ocorrer um erro ao processar o feed de actualização.";
/* No comment provided by engineer. */
"An error occurred while relaunching %1$@, but the new version will be available next time you run %1$@." = "Ocorreu um erro ao reiniciar %1$@, mas a nova versão estará disponível na próxima vez que iniciar %1$@.";
/* the unit for bytes */
"B" = "B";
/* No comment provided by engineer. */
"Cancel" = "Cancelar";
/* No comment provided by engineer. */
"Cancel Update" = "Cancelar Actualização";
/* No comment provided by engineer. */
"Checking for updates..." = "A procurar actualizações…";
/* Take care not to overflow the status window. */
"Downloading update..." = "A transferir actualização…";
/* Take care not to overflow the status window. */
"Extracting update..." = "A extrair actualização…";
/* the unit for gigabytes */
"GB" = "GB";
/* No comment provided by engineer. */
"Install and Relaunch" = "Instalar e Reiniciar";
/* Take care not to overflow the status window. */
"Installing update..." = "A instalar actualização…";
/* the unit for kilobytes */
"KB" = "KB";
/* the unit for megabytes */
"MB" = "MB";
/* No comment provided by engineer. */
"OK" = "OK";
/* No comment provided by engineer. */
"Ready to Install" = "Pronto para Instalar";
/* No comment provided by engineer. */
"Should %1$@ automatically check for updates? You can always check for updates manually from the %1$@ menu." = "Deverá %1$@ procurar por actualizações automaticamente? Poderá sempre procurar actualizações manualmente a partir do menu de %1$@.";
/* No comment provided by engineer. */
"Update Error!" = "Erro na Actualização!";
/* No comment provided by engineer. */
"Updating %@" = "A actualizar %@";
/* No comment provided by engineer. */
"You already have the newest version of %@." = "Já tem a versão mais recente de %@.";
/* No comment provided by engineer. */
"You're up-to-date!" = "Está actualizado!";
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head>
<style>
span { color: red }
:default + span { color: green }
span.reverse { color: green }
:default + span.reverse { color: red }
input { display: none }
</style>
</head>
<body onload="document.getElementById('foo').type = 'image';
document.getElementById('bar').type = ''">
<form>
<input id="bar" type="submit"><span class="reverse">This should be green</span>
<input id="foo"><span>This should be green</span>
<input type="image"><span class="reverse">This should be green</span>
</form>
</body>
</html>
| {
"pile_set_name": "Github"
} |
# Spring starter
## Dependencies
@@dependency[sbt,Maven,Gradle] {
group=fr.maif
artifact=izanami-spring
version=$version$
}
## Configuration
### Settings
|Key | Description |
|---------------------------------------------|---------------------------------------------------------------------------------------------------------------------|
| `izanami.host` | server address. eg http://localhost:9000 |
| `izanami.client-id` | client id |
| `izanami.client-secret` | client secret |
| `izanami.client-id-header-name` | client id header name |
| `izanami.client-secret-header-name` | client secret header name |
| `izanami.backend` | Undefined (default) or SseBackend |
| `izanami.page-size` | Size of the pages fetched by the client (default 200) |
| `izanami.zone-id` | Zone id for dates (default: Paris/Europe) |
| `izanami.dispatcher` | The akka dispatcher |
| `izanami.feature.strategy.type` | `DevStrategy`, `FetchStrategy`, `FetchWithCacheStrategy`, `CacheWithSseStrategy` or `CacheWithPollingStrategy` |
| `izanami.feature.strategy.error-strategy` | `Crash` or `RecoverWithFallback` (default) |
| `izanami.feature.strategy.duration` | `FetchWithCacheStrategy` duration of the cache. ex: `1 second` or `5 minutes` |
| `izanami.feature.strategy.max-element` | `FetchWithCacheStrategy` max elements in cache |
| `izanami.feature.strategy.polling-interval` | `CacheWithSseStrategy` or `CacheWithPollingStrategy` polling interval (optional for `CacheWithSseStrategy`), ex: `1 second` or `5 minutes` |
| `izanami.feature.strategy.patterns` | `CacheWithSseStrategy` or `CacheWithPollingStrategy` pattern for keys to keep in cache |
| `izanami.feature.fallback` | a json array of features used as fallbacks |
| `izanami.feature.autocreate` | `true` or `false` (default) |
| `izanami.config.strategy.type` | `DevStrategy`, `FetchStrategy`, `FetchWithCacheStrategy`, `CacheWithSseStrategy` or `CacheWithPollingStrategy` |
| `izanami.config.strategy.error-strategy` | `Crash` or `RecoverWithFallback` (default) |
| `izanami.config.strategy.duration` | `FetchWithCacheStrategy` duration of the cache. ex: `1 second` or `5 minutes` |
| `izanami.config.strategy.max-element` | `FetchWithCacheStrategy` max elements in cache |
| `izanami.config.strategy.polling-interval` | `CacheWithSseStrategy` or `CacheWithPollingStrategy` polling interval (optional for `CacheWithSseStrategy`), ex: `1 second` or `5 minutes` |
| `izanami.config.strategy.patterns` | `CacheWithSseStrategy` or `CacheWithPollingStrategy` pattern for keys to keep in cache |
| `izanami.config.fallback` | a json array of configs used as fallbacks |
| `izanami.config.autocreate` | `true` or `false` (default) |
| `izanami.experiment.fallback` | a json array of experiments used as fallbacks |
| `izanami.experiment.strategy.type` | `DevStrategy` or `FetchStrategy` |
| `izanami.proxy.feature.patterns` | Patterns used to expose the features through the proxy |
| `izanami.proxy.config.patterns` | Patterns used to expose the configs through the proxy |
| `izanami.proxy.experiment.patterns` | Patterns used to expose the experiments through the proxy |
### Spring starter minimum config
```
izanami:
host: http://localhost:8080
client-id: xxxx
client-secret: xxxx
feature:
strategy:
type: DevStrategy
config:
strategy:
type: DevStrategy
experiment:
strategy:
type: DevStrategy
```
### Spring starter full configuration
```
izanami:
host: http://localhost:8080
client-id: xxxx
client-secret: xxxx
client-id-header-name: Izanami-Client
client-secret-header-name: Izanami-Secret
backend: SseBackend
page-size: 5
zone-id: America/Phoenix
dispatcher: izanami.blocking-dispatcher
feature:
strategy:
type: FetchWithCacheStrategy
error-strategy: RecoverWithFallback
duration: 2 minutes
max-element: 5
fallback: >
[
{ "id": "mytvshows:season:markaswatched", "enabled": false },
{ "id": "mytvshows:providers:tvdb", "enabled": true },
{ "id": "mytvshows:providers:betaserie", "enabled": false },
{ "id": "mytvshows:providers:omdb", "enabled": false }
]
autocreate: true
config:
fallback: >
[
{ "id": "izanami:example:config", "value": { "emailProvider": "test" } }
]
strategy:
type: CacheWithSseStrategy
error-strategy: Crash
polling-interval: 1 minute
patterns: [mytvshows:*, izanami:*]
autocreate: true
experiment:
fallback: >
[
{
"id": "mytvshows:gotoepisodes:button",
"name": "Test button",
"description": "Test button",
"enabled": true,
"variant": {
"id": "A",
"name": "Variant A",
"description": "Variant A"
}
}
]
strategy:
type: DevStrategy
proxy:
feature:
patterns: feature*
config:
patterns: config*
experiment:
patterns: experiment*
```
## Spring beans
The beans exposed by this starter are
* `IzanamiClient` : the root client
* `FeatureClient` : the feature client if feature settings are defined
* `ConfigClient` : the config client if feature settings are defined
* `ExperimentsClient` : the experiment client if feature settings are defined
* `Proxy` : the proxy used to expose the data via http
If the spring reactor is on the dependencies :
* `ReactiveConfigClient`: The reactive version of the feature client if feature settings are defined
* `ReactiveExperimentClient`: The reactive version of the config client if feature settings are defined
* `ReactiveFeatureClient`: The reactive version of the experiment client if feature settings are defined
| {
"pile_set_name": "Github"
} |
# ECS instance policy
For an EC2 instance to connect itself to ECS it needs rights to do so.
* [Why do we need ECS instance policies?](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)
* [ECS roles explained](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ecs_managed_policies.html)
* [More ECS policy examples explained](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/IAMPolicyExamples.html)
| {
"pile_set_name": "Github"
} |
// libjingle
// Copyright 2004 Google Inc.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// 3. The name of the author may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "talk/media/base/filemediaengine.h"
#include <climits>
#include "talk/base/buffer.h"
#include "talk/base/event.h"
#include "talk/base/logging.h"
#include "talk/base/pathutils.h"
#include "talk/base/stream.h"
#include "talk/media/base/rtpdump.h"
#include "talk/media/base/rtputils.h"
#include "talk/media/base/streamparams.h"
namespace cricket {
///////////////////////////////////////////////////////////////////////////
// Implementation of FileMediaEngine.
///////////////////////////////////////////////////////////////////////////
int FileMediaEngine::GetCapabilities() {
int capabilities = 0;
if (!voice_input_filename_.empty()) {
capabilities |= AUDIO_SEND;
}
if (!voice_output_filename_.empty()) {
capabilities |= AUDIO_RECV;
}
if (!video_input_filename_.empty()) {
capabilities |= VIDEO_SEND;
}
if (!video_output_filename_.empty()) {
capabilities |= VIDEO_RECV;
}
return capabilities;
}
VoiceMediaChannel* FileMediaEngine::CreateChannel() {
talk_base::FileStream* input_file_stream = NULL;
talk_base::FileStream* output_file_stream = NULL;
if (voice_input_filename_.empty() && voice_output_filename_.empty())
return NULL;
if (!voice_input_filename_.empty()) {
input_file_stream = talk_base::Filesystem::OpenFile(
talk_base::Pathname(voice_input_filename_), "rb");
if (!input_file_stream) {
LOG(LS_ERROR) << "Not able to open the input audio stream file.";
return NULL;
}
}
if (!voice_output_filename_.empty()) {
output_file_stream = talk_base::Filesystem::OpenFile(
talk_base::Pathname(voice_output_filename_), "wb");
if (!output_file_stream) {
delete input_file_stream;
LOG(LS_ERROR) << "Not able to open the output audio stream file.";
return NULL;
}
}
return new FileVoiceChannel(input_file_stream, output_file_stream);
}
VideoMediaChannel* FileMediaEngine::CreateVideoChannel(
VoiceMediaChannel* voice_ch) {
talk_base::FileStream* input_file_stream = NULL;
talk_base::FileStream* output_file_stream = NULL;
if (video_input_filename_.empty() && video_output_filename_.empty())
return NULL;
if (!video_input_filename_.empty()) {
input_file_stream = talk_base::Filesystem::OpenFile(
talk_base::Pathname(video_input_filename_), "rb");
if (!input_file_stream) {
LOG(LS_ERROR) << "Not able to open the input video stream file.";
return NULL;
}
}
if (!video_output_filename_.empty()) {
output_file_stream = talk_base::Filesystem::OpenFile(
talk_base::Pathname(video_output_filename_), "wb");
if (!output_file_stream) {
delete input_file_stream;
LOG(LS_ERROR) << "Not able to open the output video stream file.";
return NULL;
}
}
return new FileVideoChannel(input_file_stream, output_file_stream);
}
///////////////////////////////////////////////////////////////////////////
// Definition of RtpSenderReceiver.
///////////////////////////////////////////////////////////////////////////
class RtpSenderReceiver
: public talk_base::Thread, public talk_base::MessageHandler {
public:
RtpSenderReceiver(MediaChannel* channel,
talk_base::StreamInterface* input_file_stream,
talk_base::StreamInterface* output_file_stream);
// Called by media channel. Context: media channel thread.
bool SetSend(bool send);
void SetSendSsrc(uint32 ssrc);
void OnPacketReceived(talk_base::Buffer* packet);
// Override virtual method of parent MessageHandler. Context: Worker Thread.
virtual void OnMessage(talk_base::Message* pmsg);
private:
// Read the next RTP dump packet, whose RTP SSRC is the same as first_ssrc_.
// Return true if successful.
bool ReadNextPacket(RtpDumpPacket* packet);
// Send a RTP packet to the network. The input parameter data points to the
// start of the RTP packet and len is the packet size. Return true if the sent
// size is equal to len.
bool SendRtpPacket(const void* data, size_t len);
MediaChannel* media_channel_;
talk_base::scoped_ptr<talk_base::StreamInterface> input_stream_;
talk_base::scoped_ptr<talk_base::StreamInterface> output_stream_;
talk_base::scoped_ptr<RtpDumpLoopReader> rtp_dump_reader_;
talk_base::scoped_ptr<RtpDumpWriter> rtp_dump_writer_;
// RTP dump packet read from the input stream.
RtpDumpPacket rtp_dump_packet_;
uint32 start_send_time_;
bool sending_;
bool first_packet_;
uint32 first_ssrc_;
DISALLOW_COPY_AND_ASSIGN(RtpSenderReceiver);
};
///////////////////////////////////////////////////////////////////////////
// Implementation of RtpSenderReceiver.
///////////////////////////////////////////////////////////////////////////
RtpSenderReceiver::RtpSenderReceiver(
MediaChannel* channel,
talk_base::StreamInterface* input_file_stream,
talk_base::StreamInterface* output_file_stream)
: media_channel_(channel),
sending_(false),
first_packet_(true) {
input_stream_.reset(input_file_stream);
if (input_stream_) {
rtp_dump_reader_.reset(new RtpDumpLoopReader(input_stream_.get()));
// Start the sender thread, which reads rtp dump records, waits based on
// the record timestamps, and sends the RTP packets to the network.
Thread::Start();
}
// Create a rtp dump writer for the output RTP dump stream.
output_stream_.reset(output_file_stream);
if (output_stream_) {
rtp_dump_writer_.reset(new RtpDumpWriter(output_stream_.get()));
}
}
bool RtpSenderReceiver::SetSend(bool send) {
bool was_sending = sending_;
sending_ = send;
if (!was_sending && sending_) {
PostDelayed(0, this); // Wake up the send thread.
start_send_time_ = talk_base::Time();
}
return true;
}
void RtpSenderReceiver::SetSendSsrc(uint32 ssrc) {
if (rtp_dump_reader_) {
rtp_dump_reader_->SetSsrc(ssrc);
}
}
void RtpSenderReceiver::OnPacketReceived(talk_base::Buffer* packet) {
if (rtp_dump_writer_) {
rtp_dump_writer_->WriteRtpPacket(packet->data(), packet->length());
}
}
void RtpSenderReceiver::OnMessage(talk_base::Message* pmsg) {
if (!sending_) {
// If the sender thread is not sending, ignore this message. The thread goes
// to sleep until SetSend(true) wakes it up.
return;
}
if (!first_packet_) {
// Send the previously read packet.
SendRtpPacket(&rtp_dump_packet_.data[0], rtp_dump_packet_.data.size());
}
if (ReadNextPacket(&rtp_dump_packet_)) {
int wait = talk_base::TimeUntil(
start_send_time_ + rtp_dump_packet_.elapsed_time);
wait = talk_base::_max(0, wait);
PostDelayed(wait, this);
} else {
Quit();
}
}
bool RtpSenderReceiver::ReadNextPacket(RtpDumpPacket* packet) {
while (talk_base::SR_SUCCESS == rtp_dump_reader_->ReadPacket(packet)) {
uint32 ssrc;
if (!packet->GetRtpSsrc(&ssrc)) {
return false;
}
if (first_packet_) {
first_packet_ = false;
first_ssrc_ = ssrc;
}
if (ssrc == first_ssrc_) {
return true;
}
}
return false;
}
bool RtpSenderReceiver::SendRtpPacket(const void* data, size_t len) {
if (!media_channel_ || !media_channel_->network_interface()) {
return false;
}
talk_base::Buffer packet(data, len, kMaxRtpPacketLen);
return media_channel_->network_interface()->SendPacket(&packet);
}
///////////////////////////////////////////////////////////////////////////
// Implementation of FileVoiceChannel.
///////////////////////////////////////////////////////////////////////////
FileVoiceChannel::FileVoiceChannel(
talk_base::StreamInterface* input_file_stream,
talk_base::StreamInterface* output_file_stream)
: send_ssrc_(0),
rtp_sender_receiver_(new RtpSenderReceiver(this, input_file_stream,
output_file_stream)) {}
FileVoiceChannel::~FileVoiceChannel() {}
bool FileVoiceChannel::SetSendCodecs(const std::vector<AudioCodec>& codecs) {
// TODO(whyuan): Check the format of RTP dump input.
return true;
}
bool FileVoiceChannel::SetSend(SendFlags flag) {
return rtp_sender_receiver_->SetSend(flag != SEND_NOTHING);
}
bool FileVoiceChannel::AddSendStream(const StreamParams& sp) {
if (send_ssrc_ != 0 || sp.ssrcs.size() != 1) {
LOG(LS_ERROR) << "FileVoiceChannel only supports one send stream.";
return false;
}
send_ssrc_ = sp.ssrcs[0];
rtp_sender_receiver_->SetSendSsrc(send_ssrc_);
return true;
}
bool FileVoiceChannel::RemoveSendStream(uint32 ssrc) {
if (ssrc != send_ssrc_)
return false;
send_ssrc_ = 0;
rtp_sender_receiver_->SetSendSsrc(send_ssrc_);
return true;
}
void FileVoiceChannel::OnPacketReceived(talk_base::Buffer* packet) {
rtp_sender_receiver_->OnPacketReceived(packet);
}
///////////////////////////////////////////////////////////////////////////
// Implementation of FileVideoChannel.
///////////////////////////////////////////////////////////////////////////
FileVideoChannel::FileVideoChannel(
talk_base::StreamInterface* input_file_stream,
talk_base::StreamInterface* output_file_stream)
: send_ssrc_(0),
rtp_sender_receiver_(new RtpSenderReceiver(this, input_file_stream,
output_file_stream)) {}
FileVideoChannel::~FileVideoChannel() {}
bool FileVideoChannel::SetSendCodecs(const std::vector<VideoCodec>& codecs) {
// TODO(whyuan): Check the format of RTP dump input.
return true;
}
bool FileVideoChannel::SetSend(bool send) {
return rtp_sender_receiver_->SetSend(send);
}
bool FileVideoChannel::AddSendStream(const StreamParams& sp) {
if (send_ssrc_ != 0 || sp.ssrcs.size() != 1) {
LOG(LS_ERROR) << "FileVideoChannel only support one send stream.";
return false;
}
send_ssrc_ = sp.ssrcs[0];
rtp_sender_receiver_->SetSendSsrc(send_ssrc_);
return true;
}
bool FileVideoChannel::RemoveSendStream(uint32 ssrc) {
if (ssrc != send_ssrc_)
return false;
send_ssrc_ = 0;
rtp_sender_receiver_->SetSendSsrc(send_ssrc_);
return true;
}
void FileVideoChannel::OnPacketReceived(talk_base::Buffer* packet) {
rtp_sender_receiver_->OnPacketReceived(packet);
}
} // namespace cricket
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.