problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
To show admob banner and interstitial ads we need play Console account? : I'm created my application in android studio and attach banner and interstitial ads with Test id after successfully build my app i use my admob ad unit id of banner and interstitial but 10 days go already and my ads not displaying.
1. Do we need a play Console account compulsory to display ads ?
2. i have 1 image and one button in my layout , how many content we need to have display ads in my app ?
because i see many videos on YouTube they say we need content in your apps.
3. My friend have a Play Console account i use there (keystore) .jsk file to signed my application after signed apps start displaying ads also i use "Apk Editor Pro" to sign apk its start displaying ads . how ?
Please help me out to fix this. thanks in Advance.
| 0debug
|
static uint32_t bitband_readl(void *opaque, target_phys_addr_t offset)
{
uint32_t addr;
uint32_t mask;
uint32_t v;
addr = bitband_addr(opaque, offset) & ~3;
mask = (1 << ((offset >> 2) & 31));
mask = tswap32(mask);
cpu_physical_memory_read(addr, (uint8_t *)&v, 4);
return (v & mask) != 0;
}
| 1threat
|
How can I pass external variable in excel macro for header? : I'm printing no of pages in right header (eg. Page 1 of [total no of pages]) I want to pass my variable after &P of &fcount(fcount is my variable). How can I pass this?
| 0debug
|
Show all value inside or outside a JS Loop : I made this JS loop.
var intt =number;
var divider=[intt];
var i;
var count=0;
var b;
var temp=0;
var temp2=0;
for(i=1; i<=intt; i++){
if(number%i==0){
divider[count]=i;
b=count++;
}
}
I was wondering, how do I put all the values of loop in an `alert()`?
| 0debug
|
BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
BlockDriverState *bs, Error **errp)
{
ImageInfo **p_image_info;
BlockDriverState *bs0;
BlockDeviceInfo *info = g_malloc0(sizeof(*info));
info->file = g_strdup(bs->filename);
info->ro = bs->read_only;
info->drv = g_strdup(bs->drv->format_name);
info->encrypted = bs->encrypted;
info->encryption_key_missing = false;
info->cache = g_new(BlockdevCacheInfo, 1);
*info->cache = (BlockdevCacheInfo) {
.writeback = blk ? blk_enable_write_cache(blk) : true,
.direct = !!(bs->open_flags & BDRV_O_NOCACHE),
.no_flush = !!(bs->open_flags & BDRV_O_NO_FLUSH),
};
if (bs->node_name[0]) {
info->has_node_name = true;
info->node_name = g_strdup(bs->node_name);
}
if (bs->backing_file[0]) {
info->has_backing_file = true;
info->backing_file = g_strdup(bs->backing_file);
}
info->detect_zeroes = bs->detect_zeroes;
if (blk && blk_get_public(blk)->throttle_state) {
ThrottleConfig cfg;
throttle_group_get_config(blk, &cfg);
info->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg;
info->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg;
info->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg;
info->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg;
info->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg;
info->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg;
info->has_bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max;
info->bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max;
info->has_bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max;
info->bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max;
info->has_bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max;
info->bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max;
info->has_iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max;
info->iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max;
info->has_iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max;
info->iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max;
info->has_iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max;
info->iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max;
info->has_bps_max_length = info->has_bps_max;
info->bps_max_length =
cfg.buckets[THROTTLE_BPS_TOTAL].burst_length;
info->has_bps_rd_max_length = info->has_bps_rd_max;
info->bps_rd_max_length =
cfg.buckets[THROTTLE_BPS_READ].burst_length;
info->has_bps_wr_max_length = info->has_bps_wr_max;
info->bps_wr_max_length =
cfg.buckets[THROTTLE_BPS_WRITE].burst_length;
info->has_iops_max_length = info->has_iops_max;
info->iops_max_length =
cfg.buckets[THROTTLE_OPS_TOTAL].burst_length;
info->has_iops_rd_max_length = info->has_iops_rd_max;
info->iops_rd_max_length =
cfg.buckets[THROTTLE_OPS_READ].burst_length;
info->has_iops_wr_max_length = info->has_iops_wr_max;
info->iops_wr_max_length =
cfg.buckets[THROTTLE_OPS_WRITE].burst_length;
info->has_iops_size = cfg.op_size;
info->iops_size = cfg.op_size;
info->has_group = true;
info->group = g_strdup(throttle_group_get_name(blk));
}
info->write_threshold = bdrv_write_threshold_get(bs);
bs0 = bs;
p_image_info = &info->image;
info->backing_file_depth = 0;
while (1) {
Error *local_err = NULL;
bdrv_query_image_info(bs0, p_image_info, &local_err);
if (local_err) {
error_propagate(errp, local_err);
qapi_free_BlockDeviceInfo(info);
return NULL;
}
if (bs0->drv && bs0->backing) {
info->backing_file_depth++;
bs0 = bs0->backing->bs;
(*p_image_info)->has_backing_image = true;
p_image_info = &((*p_image_info)->backing_image);
} else {
break;
}
while (blk && bs0 && bs0->drv && bs0->implicit) {
bs0 = backing_bs(bs0);
}
}
return info;
}
| 1threat
|
python 3 scatter plot gives "ValueError: Masked arrays must be 1-D" even though i am not using any masked array : <p>I am trying to plot a scatter plot using the .scatter method below. Here</p>
<p><code>ax.scatter(X[:,0], X[:,1], c = colors, marker = 'o', s=80, edgecolors = 'none')</code></p>
<p>with the input/args classes below:</p>
<p><code>X[:,0]] type: <class 'numpy.matrixlib.defmatrix.matrix'>
X[:,1]] type: <class 'numpy.matrixlib.defmatrix.matrix'>
colors type: <class 'list'></code></p>
<p>however python is throwing a value error as seen here:
<a href="https://i.stack.imgur.com/rGG61.png" rel="noreferrer">error image</a></p>
| 0debug
|
How to get public IP address in javascript : <p>I am working on an application wherein I want to track clients public IP address.
I don't want to use <a href="http://ipinfo.io" rel="nofollow noreferrer">http://ipinfo.io</a> as its an insecure connection.</p>
<p>Is it possible to get clients public IP address using core javascript?</p>
<p>Thanks</p>
| 0debug
|
When c# catch and handle event? : <p>I have this code :</p>
<pre><code>serialPort.PinChanged +=Func5;
Func1();
Func2();
//here event throw
Func3();
Func4();
Console.ReadKey();
</code></pre>
<p>When I enter to <code>Func5</code>? Only when my thread will not have what to do?(after the last line)?</p>
<p>Or when the event throw? Is that depend witch type of event is that?</p>
<p>How can I set that I want to catch this event immediately ? </p>
| 0debug
|
ngrx dealing with nested array in object : <p>I am learning the redux pattern and using ngrx with angular 2. I am creating a sample blog site which has following shape.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>export interface BlogContent {
id: string;
header: string;
tags: string[];
title: string;
actualContent: ActualContent[];
}</code></pre>
</div>
</div>
</p>
<p>and my reducer and actions are as following:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import { ActionReducer, Action } from '@ngrx/store';
import * as _ from 'lodash';
export interface ActualContent {
id: string;
type: string;
data: string;
}
export interface BlogContent {
id: string;
header: string;
tags: string[];
title: string;
actualContent: ActualContent[];
}
export const initialState: BlogContent = {
id: '',
header: '',
tags: [],
title: '',
actualContent: [],
};
export const ADD_OPERATION = 'ADD_OPERATION';
export const REMOVE_OPERATION = 'REMOVE_OPERATION';
export const RESET_OPERATION = 'RESET_OPERATION';
export const ADD_IMAGE_ID = 'ADD_IMAGE_ID';
export const ADD_FULL_BLOG = 'ADD_FULL_BLOG';
export const ADD_BLOG_CONTENT_OPERATION = 'ADD_BLOG_CONTENT_OPERATION';
export const ADD_BLOG_TAG_OPERATION = 'ADD_BLOG_TAG_OPERATION';
export const blogContent: ActionReducer<BlogContent> = (state: BlogContent= initialState, action: Action ) => {
switch (action.type) {
case ADD_OPERATION :
return Object.assign({}, state, action.payload );
case ADD_BLOG_CONTENT_OPERATION :
return Object.assign({}, state, { actualContent: [...state.actualContent, action.payload]});
case ADD_BLOG_TAG_OPERATION :
return Object.assign({}, state, { tags: [...state.tags, action.payload]});
case REMOVE_OPERATION :
return Object.assign({}, state, { actualContent: state.actualContent.filter((blog) => blog.id !== action.payload.id) });
case ADD_IMAGE_ID : {
let index = _.findIndex(state.actualContent, {id: action.payload.id});
console.log(index);
if ( index >= 0 ) {
return Object.assign({}, state, {
actualContent : [
...state.actualContent.slice(0, index),
action.payload,
...state.actualContent.slice(index + 1)
]
});
}
return state;
}
default :
return state;
}
};</code></pre>
</div>
</div>
</p>
<p>and this is working fine but i am not sure if its the right approach or should i somehow separate the ActualContent into its own reducer and actions and then merge them.
Sorry if this post does not belong here and you can guide me where should put this post and i will remove it from here. Thanks in advance.</p>
<p>P.S. I have done some research but couldnt find any article that has complex nested objects so that i can refer. Please add any useful blog links of ngrx or related topic which can help me out.</p>
| 0debug
|
VB .NET regular expression : I want the regular expression in vb .net that match any occurrence of three or more plus signs +++ in any string like:
Hello John +++++ I liked your post +++ it is great ++++++++ thank you
| 0debug
|
static void fd_accept_incoming_migration(void *opaque)
{
QEMUFile *f = opaque;
qemu_set_fd_handler2(qemu_get_fd(f), NULL, NULL, NULL, NULL);
process_incoming_migration(f);
}
| 1threat
|
void helper_unlock(void)
{
spin_unlock(&global_cpu_lock);
}
| 1threat
|
static int no_init_out (HWVoiceOut *hw, struct audsettings *as)
{
audio_pcm_init_info (&hw->info, as);
hw->samples = 1024;
return 0;
}
| 1threat
|
Async and Await programming help please. : want to run a void function that writes to a textblock in WPF
private async Task<int> TASK_ClickthroughBuild(string server, int frame, int click)
{
if (server == "value")
{
CreativeCode.Inlines.Add(openScript + newLine);
CreativeCode.Inlines.Add("var " + click + " = '%%CLICK_URL_ESC%%%%DEST_URL%%';" + newLine);
CreativeCode.Inlines.Add("var " + frame + " = document.getElementById('" + frame + "');" + newLine);
CreativeCode.Inlines.Add(frame + ".href = " + click + ";" + newLine);
CreativeCode.Inlines.Add(closeScript);
PASSBACKframeINT = frame;
}
return PASSBACKframeINT;
}
The above function returns an integer value and writes code to a textblock.
This is the second function.
private async Task clickElementBuild()
{
CreativeCode.Inlines.Add("<a href='#' id='" + PASSBACKframeINT + "' target='_blank' class='" + PASSBACKwrapINT + "' >" + newLine);
CreativeCode.Inlines.Add("<div class='" + PASSBACKblockINT + "' id='" + overlayINT + "'></div>" + newLine);
}
The second function, the code needs to write the textblock code ABOVE the first function, but depends on the returned value of first function to write properly.
So I need to write this in an Asynchronous format. Can I have pointers or a better way of doing this?
Thanks
| 0debug
|
static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
const float *la, int channel, int prev_type)
{
AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data;
AacPsyChannel *pch = &pctx->ch[channel];
int grouping = 0;
int uselongblock = 1;
int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
float clippings[AAC_NUM_BLOCKS_SHORT];
int i;
FFPsyWindowInfo wi = { { 0 } };
if (la) {
float hpfsmpl[AAC_BLOCK_SIZE_LONG];
float const *pf = hpfsmpl;
float attack_intensity[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS];
float energy_subshort[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS];
float energy_short[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
const float *firbuf = la + (AAC_BLOCK_SIZE_SHORT/4 - PSY_LAME_FIR_LEN);
int att_sum = 0;
psy_hp_filter(firbuf, hpfsmpl, psy_fir_coeffs);
for (i = 0; i < PSY_LAME_NUM_SUBBLOCKS; i++) {
energy_subshort[i] = pch->prev_energy_subshort[i + ((AAC_NUM_BLOCKS_SHORT - 1) * PSY_LAME_NUM_SUBBLOCKS)];
assert(pch->prev_energy_subshort[i + ((AAC_NUM_BLOCKS_SHORT - 2) * PSY_LAME_NUM_SUBBLOCKS + 1)] > 0);
attack_intensity[i] = energy_subshort[i] / pch->prev_energy_subshort[i + ((AAC_NUM_BLOCKS_SHORT - 2) * PSY_LAME_NUM_SUBBLOCKS + 1)];
energy_short[0] += energy_subshort[i];
}
for (i = 0; i < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; i++) {
float const *const pfe = pf + AAC_BLOCK_SIZE_LONG / (AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS);
float p = 1.0f;
for (; pf < pfe; pf++)
p = FFMAX(p, fabsf(*pf));
pch->prev_energy_subshort[i] = energy_subshort[i + PSY_LAME_NUM_SUBBLOCKS] = p;
energy_short[1 + i / PSY_LAME_NUM_SUBBLOCKS] += p;
if (p > energy_subshort[i + 1])
p = p / energy_subshort[i + 1];
else if (energy_subshort[i + 1] > p * 10.0f)
p = energy_subshort[i + 1] / (p * 10.0f);
else
p = 0.0;
attack_intensity[i + PSY_LAME_NUM_SUBBLOCKS] = p;
}
for (i = 0; i < (AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS; i++)
if (!attacks[i / PSY_LAME_NUM_SUBBLOCKS])
if (attack_intensity[i] > pch->attack_threshold)
attacks[i / PSY_LAME_NUM_SUBBLOCKS] = (i % PSY_LAME_NUM_SUBBLOCKS) + 1;
for (i = 1; i < AAC_NUM_BLOCKS_SHORT + 1; i++) {
float const u = energy_short[i - 1];
float const v = energy_short[i];
float const m = FFMAX(u, v);
if (m < 40000) {
if (u < 1.7f * v && v < 1.7f * u) {
if (i == 1 && attacks[0] < attacks[i])
attacks[0] = 0;
attacks[i] = 0;
}
}
att_sum += attacks[i];
}
if (attacks[0] <= pch->prev_attack)
attacks[0] = 0;
att_sum += attacks[0];
if (pch->prev_attack == 3 || att_sum) {
uselongblock = 0;
for (i = 1; i < AAC_NUM_BLOCKS_SHORT + 1; i++)
if (attacks[i] && attacks[i-1])
attacks[i] = 0;
}
} else {
uselongblock = !(prev_type == EIGHT_SHORT_SEQUENCE);
}
lame_apply_block_type(pch, &wi, uselongblock);
if (audio) {
for (i = 0; i < AAC_NUM_BLOCKS_SHORT; i++) {
const float *wbuf = audio + i * AAC_BLOCK_SIZE_SHORT;
float max = 0;
int j;
for (j = 0; j < AAC_BLOCK_SIZE_SHORT; j++)
max = FFMAX(max, fabsf(wbuf[j]));
clippings[i] = max;
}
} else {
for (i = 0; i < 8; i++)
clippings[i] = 0;
}
wi.window_type[1] = prev_type;
if (wi.window_type[0] != EIGHT_SHORT_SEQUENCE) {
float clipping = 0.0f;
wi.num_windows = 1;
wi.grouping[0] = 1;
if (wi.window_type[0] == LONG_START_SEQUENCE)
wi.window_shape = 0;
else
wi.window_shape = 1;
for (i = 0; i < 8; i++)
clipping = FFMAX(clipping, clippings[i]);
wi.clipping[0] = clipping;
} else {
int lastgrp = 0;
wi.num_windows = 8;
wi.window_shape = 0;
for (i = 0; i < 8; i++) {
if (!((pch->next_grouping >> i) & 1))
lastgrp = i;
wi.grouping[lastgrp]++;
}
for (i = 0; i < 8; i += wi.grouping[i]) {
int w;
float clipping = 0.0f;
for (w = 0; w < wi.grouping[i] && !clipping; w++)
clipping = FFMAX(clipping, clippings[i+w]);
wi.clipping[i] = clipping;
}
}
for (i = 0; i < 9; i++) {
if (attacks[i]) {
grouping = i;
break;
}
}
pch->next_grouping = window_grouping[grouping];
pch->prev_attack = attacks[8];
return wi;
}
| 1threat
|
int ff_h264_set_parameter_from_sps(H264Context *h)
{
if (h->flags & CODEC_FLAG_LOW_DELAY ||
(h->sps.bitstream_restriction_flag &&
!h->sps.num_reorder_frames)) {
if (h->avctx->has_b_frames > 1 || h->delayed_pic[0])
av_log(h->avctx, AV_LOG_WARNING, "Delayed frames seen. "
"Reenabling low delay requires a codec flush.\n");
else
h->low_delay = 1;
}
if (h->avctx->has_b_frames < 2)
h->avctx->has_b_frames = !h->low_delay;
if (h->avctx->bits_per_raw_sample != h->sps.bit_depth_luma ||
h->cur_chroma_format_idc != h->sps.chroma_format_idc) {
if (h->avctx->codec &&
h->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU &&
(h->sps.bit_depth_luma != 8 || h->sps.chroma_format_idc > 1)) {
av_log(h->avctx, AV_LOG_ERROR,
"VDPAU decoding does not support video colorspace.\n");
return AVERROR_INVALIDDATA;
}
if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 14 &&
h->sps.bit_depth_luma != 11 && h->sps.bit_depth_luma != 13) {
h->avctx->bits_per_raw_sample = h->sps.bit_depth_luma;
h->cur_chroma_format_idc = h->sps.chroma_format_idc;
h->pixel_shift = h->sps.bit_depth_luma > 8;
ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma,
h->sps.chroma_format_idc);
ff_h264chroma_init(&h->h264chroma, h->sps.bit_depth_chroma);
ff_h264qpel_init(&h->h264qpel, h->sps.bit_depth_luma);
ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
h->sps.chroma_format_idc);
ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
} else {
av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",
h->sps.bit_depth_luma);
return AVERROR_INVALIDDATA;
}
}
return 0;
}
| 1threat
|
int inet_aton (const char * str, struct in_addr * add)
{
const char * pch = str;
unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0;
add1 = atoi(pch);
pch = strpbrk(pch,".");
if (pch == 0 || ++pch == 0) return 0;
add2 = atoi(pch);
pch = strpbrk(pch,".");
if (pch == 0 || ++pch == 0) return 0;
add3 = atoi(pch);
pch = strpbrk(pch,".");
if (pch == 0 || ++pch == 0) return 0;
add4 = atoi(pch);
if (!add1 || (add1|add2|add3|add4) > 255) return 0;
add->s_addr=(add4<<24)+(add3<<16)+(add2<<8)+add1;
return 1;
}
| 1threat
|
Spherical Cosinus Haversine Formula Android studio : So currently i write a function haversine formula to calculate distance for 2 coordinate, and i find this code but i dont know how to write it in android. here is the function that i will created. this
private double SphericalCosinus(double lat1, double long1, double lat2,
double long2) {
//formula
}
and the formula is this one, there is some tutorial that tell me to use math libarary but i always write the code wrong because the apps didnt show the location. here is the formula i get
=(6371.1*((2*ASIN(SQRT((SIN((RADIANS(lat2)-RADIANS(lat1))/2)^2)+COS(RADIANS(lat2))*COS(RADIANS(lat1))*(SIN((RADIANS(long2)-RADIANS(long1))/2)^2))))))
| 0debug
|
File extension for serialized protobuf output : <p>Seems odd that I can't find the answer to this, but what file extension are you supposed to use when storing serialized protobuf output in a file? Just .protobuf? The json equivalent of what I am talking about would be a .json file.</p>
| 0debug
|
Convert bigint to timestamp in scala : while converting bigint to timestamp, junk value is coming. See the query below.
Appreciate any help
scala> spark.sql("select cast(cast(cast(CAST('2015-11-15 18:15:06.51' AS TIMESTAMP) as double)*1000 + cast('64082' as double) as bigint) as timestamp) " ).show(truncate=false)
+-----------------------------------------------------------------------------------------------------------------------------------------------+
|CAST(CAST(((CAST(CAST(2015-11-15 18:15:06.51 AS TIMESTAMP) AS DOUBLE) * CAST(1000 AS DOUBLE)) + CAST(64082 AS DOUBLE)) AS BIGINT) AS TIMESTAMP)|
+-----------------------------------------------------------------------------------------------------------------------------------------------+
|47843-07-20 09:36:32.0 |
+-----------------------------------------------------------------------------------------------------------------------------------------------+
| 0debug
|
struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
BlockDriverState *bd, qemu_irq irq, qemu_irq dma[],
omap_clk fclk, omap_clk iclk)
{
struct omap_mmc_s *s = (struct omap_mmc_s *)
g_malloc0(sizeof(struct omap_mmc_s));
s->irq = irq;
s->dma = dma;
s->clk = fclk;
s->lines = 4;
s->rev = 2;
omap_mmc_reset(s);
memory_region_init_io(&s->iomem, NULL, &omap_mmc_ops, s, "omap.mmc",
omap_l4_region_size(ta, 0));
omap_l4_attach(ta, 0, &s->iomem);
s->card = sd_init(bd, false);
if (s->card == NULL) {
exit(1);
}
s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0);
sd_set_cb(s->card, NULL, s->cdet);
return s;
}
| 1threat
|
Sqrt of a floating point number : <p>Write a C program that asks the user to enter a floating point number from the keyboard and then prints out the square root of that number is the question. What am I doing wrong?</p>
<pre><code>#include <stdio.h>
#include <math.h>
int main(int argc, char *argv[])
{
double x, result;
printf("Enter a positive number.\n");
scanf("&f", &x);
result = sqrt(x);
printf("The square root of %f is %f.\n", x, result);
return 0;
}
</code></pre>
| 0debug
|
imageview shows same picture on both imageview clicked by one : i have two imageview one img1 and second is img2.i wanna capture an image from camera to click on both imageview and show on it.but here is problem that i m clicking image from click on img1 and same image showing on both imageview.if i click on img1 and click image from there then img2 also showing same picture without click on there if i m clicking on img2 then click an image from there then that picture showing on img1 also.
i wanna to show differ images which is clicked by camera on both differ imageview.
img1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, requestcode);
}
});
img2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, requestcode);
}
});
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (this.requestcode == requestCode && resultCode == RESULT_OK) {
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
img.setImageBitmap(bitmap);
img2.setImageBitmap(bitmap);
}
}
| 0debug
|
How to write a cosine theorem on Java? : How to write this theorem correctly as is written in the formula?
package com.company;
public class Exercise8 {
public static void main(String[] args) {
double AB = 6;
double AC = 16;
double Angle = 60;
double CosOfAngle = 0.5;
// Почему-то значение косинуса 60 градусов вместо 0.5, пишет
-0.9524129804151563??? (Do not pay attention)
// Formula is BC^2 = AB^2 + AC^2 - 2AB*AC * cos A
double bc = (2*(Math.pow(AB,2) + Math.pow(AC,2) -
((AB * AC)))*CosOfAngle);
double BC = Math.sqrt(bc);
double P = AB + BC + AC;
double p = 0.5 * P; // Где p - полупериметр
double S0 = (p*((p-AB)*(p-BC)*(p-AC)));
double S1 = Math.sqrt(S0);
double S = Math.round(S1);
System.out.println("Perimeter of triangle is : " + P + " cm ");
System.out.println("Area of triangle is : " + S + " cm^2 ");
}
}
| 0debug
|
document.write('<script src="evil.js"></script>');
| 1threat
|
ASP.NET Core web api action selection based on Accept header : <p>I want to return two different formatted responses for the same feature (a list of entities) based on the accept header of the request, it is for a "json" and a "html" request.</p>
<p>Does the asp.net core support select different actions for the same route based upon the <strong>Accept Header</strong> from the request?</p>
| 0debug
|
How can I estimate standard error in maximum likelihood destinati in : <p>I can’t estimate standard error for parametri in maximum likelihood estimation. How could I do?</p>
| 0debug
|
static int init_output_stream_streamcopy(OutputStream *ost)
{
OutputFile *of = output_files[ost->file_index];
InputStream *ist = get_input_stream(ost);
AVCodecParameters *par_dst = ost->st->codecpar;
AVCodecParameters *par_src = ost->ref_par;
AVRational sar;
int i, ret;
uint32_t codec_tag = par_dst->codec_tag;
av_assert0(ist && !ost->filter);
avcodec_parameters_to_context(ost->enc_ctx, ist->st->codecpar);
ret = av_opt_set_dict(ost->enc_ctx, &ost->encoder_opts);
if (ret < 0) {
av_log(NULL, AV_LOG_FATAL,
"Error setting up codec context options.\n");
return ret;
}
avcodec_parameters_from_context(par_src, ost->enc_ctx);
if (!codec_tag) {
unsigned int codec_tag_tmp;
if (!of->ctx->oformat->codec_tag ||
av_codec_get_id (of->ctx->oformat->codec_tag, par_src->codec_tag) == par_src->codec_id ||
!av_codec_get_tag2(of->ctx->oformat->codec_tag, par_src->codec_id, &codec_tag_tmp))
codec_tag = par_src->codec_tag;
}
ret = avcodec_parameters_copy(par_dst, par_src);
if (ret < 0)
return ret;
par_dst->codec_tag = codec_tag;
if (!ost->frame_rate.num)
ost->frame_rate = ist->framerate;
ost->st->avg_frame_rate = ost->frame_rate;
ret = avformat_transfer_internal_stream_timing_info(of->ctx->oformat, ost->st, ist->st, copy_tb);
if (ret < 0)
return ret;
ost->st->time_base = av_add_q(av_stream_get_codec_timebase(ost->st), (AVRational){0, 1});
ost->st->disposition = ist->st->disposition;
if (ist->st->nb_side_data) {
ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data,
sizeof(*ist->st->side_data));
if (!ost->st->side_data)
return AVERROR(ENOMEM);
ost->st->nb_side_data = 0;
for (i = 0; i < ist->st->nb_side_data; i++) {
const AVPacketSideData *sd_src = &ist->st->side_data[i];
AVPacketSideData *sd_dst = &ost->st->side_data[ost->st->nb_side_data];
if (ost->rotate_overridden && sd_src->type == AV_PKT_DATA_DISPLAYMATRIX)
continue;
sd_dst->data = av_malloc(sd_src->size);
if (!sd_dst->data)
return AVERROR(ENOMEM);
memcpy(sd_dst->data, sd_src->data, sd_src->size);
sd_dst->size = sd_src->size;
sd_dst->type = sd_src->type;
ost->st->nb_side_data++;
}
}
ost->parser = av_parser_init(par_dst->codec_id);
ost->parser_avctx = avcodec_alloc_context3(NULL);
if (!ost->parser_avctx)
return AVERROR(ENOMEM);
switch (par_dst->codec_type) {
case AVMEDIA_TYPE_AUDIO:
if (audio_volume != 256) {
av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n");
exit_program(1);
}
if((par_dst->block_align == 1 || par_dst->block_align == 1152 || par_dst->block_align == 576) && par_dst->codec_id == AV_CODEC_ID_MP3)
par_dst->block_align= 0;
if(par_dst->codec_id == AV_CODEC_ID_AC3)
par_dst->block_align= 0;
break;
case AVMEDIA_TYPE_VIDEO:
if (ost->frame_aspect_ratio.num) {
sar =
av_mul_q(ost->frame_aspect_ratio,
(AVRational){ par_dst->height, par_dst->width });
av_log(NULL, AV_LOG_WARNING, "Overriding aspect ratio "
"with stream copy may produce invalid files\n");
}
else if (ist->st->sample_aspect_ratio.num)
sar = ist->st->sample_aspect_ratio;
else
sar = par_src->sample_aspect_ratio;
ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar;
ost->st->avg_frame_rate = ist->st->avg_frame_rate;
ost->st->r_frame_rate = ist->st->r_frame_rate;
break;
}
return 0;
}
| 1threat
|
Understanding Amazon web services free tier : <p>I am very new to technology world. I want to host a website on AWS free tier as I dont have budget right now but I am not getting what their free tier is offering since they are using a bit more technical terms for their components. </p>
<p>Can anybody help me here.</p>
<p>My website will be running on java, postgres, spring etc </p>
| 0debug
|
why isnt it piping to the cd command? : <p>I read that if you use the | command then it pipes the output of the first command to the input of the second,then why is it working?</p>
<p>Thank you!</p>
<pre><code>find -size 1033c | cd
</code></pre>
| 0debug
|
Laravel Blade - Advantage of @slot/@component vs @include? : <p>Laravel 5.4 Blade introduced the concept of components & slots - but I can't see what they add over the traditional @include. As I understand, with component/slots, you do:</p>
<p>In template component-tpl.blade.php:</p>
<pre><code><div class='container'>
<h1>{{$slot1}}</h1>
<h2>{{$slot2}}</h2>
</div>
</code></pre>
<p>Using slots in page template, you do:</p>
<pre><code>@component('component-tpl')
@slot('slot1')
The content of Slot 1
@endslot
@slot('slot2')
The content of Slot 2
@endslot
@endcomponent
</code></pre>
<p>What functionality does that provide over the older:</p>
<pre><code>@include('component-tpl',['slot1'=>'The content of Slot 1',
'slot2'=>"The content of Slot 2"])
</code></pre>
<p>using the exact same 'component-tpl.blade.php' Blade template?</p>
<p>What am I missing? Thanks for any insights.</p>
<p>Chris</p>
| 0debug
|
Convert matlab statement to python : <p>I should convert the following matlab statement in python: </p>
<pre><code>lam = find(abs(b)>tol,1,'first')-1;
</code></pre>
<p>Thanks in advance</p>
| 0debug
|
static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
{
unsigned tag, type, count, off, value = 0, value2 = 0;
int i, start;
int pos;
int ret;
double *dp;
ret = ff_tread_tag(&s->gb, s->le, &tag, &type, &count, &start);
if (ret < 0) {
goto end;
off = bytestream2_tell(&s->gb);
if (count == 1) {
switch (type) {
case TIFF_BYTE:
case TIFF_SHORT:
case TIFF_LONG:
value = ff_tget(&s->gb, type, s->le);
break;
case TIFF_RATIONAL:
value = ff_tget(&s->gb, TIFF_LONG, s->le);
value2 = ff_tget(&s->gb, TIFF_LONG, s->le);
break;
case TIFF_STRING:
if (count <= 4) {
break;
default:
value = UINT_MAX;
switch (tag) {
case TIFF_WIDTH:
s->width = value;
break;
case TIFF_HEIGHT:
s->height = value;
break;
case TIFF_BPP:
if (count > 4U) {
"This format is not supported (bpp=%d, %d components)\n",
value, count);
s->bppcount = count;
if (count == 1)
s->bpp = value;
else {
switch (type) {
case TIFF_BYTE:
case TIFF_SHORT:
case TIFF_LONG:
s->bpp = 0;
if (bytestream2_get_bytes_left(&s->gb) < type_sizes[type] * count)
for (i = 0; i < count; i++)
s->bpp += ff_tget(&s->gb, type, s->le);
break;
default:
s->bpp = -1;
break;
case TIFF_SAMPLES_PER_PIXEL:
if (count != 1) {
"Samples per pixel requires a single value, many provided\n");
if (value > 4U) {
"Samples per pixel %d is too large\n", value);
if (s->bppcount == 1)
s->bpp *= value;
s->bppcount = value;
break;
case TIFF_COMPR:
s->compr = value;
av_log(s->avctx, AV_LOG_DEBUG, "compression: %d\n", s->compr);
s->predictor = 0;
switch (s->compr) {
case TIFF_RAW:
case TIFF_PACKBITS:
case TIFF_LZW:
case TIFF_CCITT_RLE:
break;
case TIFF_G3:
case TIFF_G4:
s->fax_opts = 0;
break;
case TIFF_DEFLATE:
case TIFF_ADOBE_DEFLATE:
#if CONFIG_ZLIB
break;
#else
av_log(s->avctx, AV_LOG_ERROR, "Deflate: ZLib not compiled in\n");
return AVERROR(ENOSYS);
#endif
case TIFF_JPEG:
case TIFF_NEWJPEG:
avpriv_report_missing_feature(s->avctx, "JPEG compression");
return AVERROR_PATCHWELCOME;
case TIFF_LZMA:
#if CONFIG_LZMA
break;
#else
av_log(s->avctx, AV_LOG_ERROR, "LZMA not compiled in\n");
return AVERROR(ENOSYS);
#endif
default:
av_log(s->avctx, AV_LOG_ERROR, "Unknown compression method %i\n",
s->compr);
break;
case TIFF_ROWSPERSTRIP:
if (!value || (type == TIFF_LONG && value == UINT_MAX))
value = s->height;
s->rps = FFMIN(value, s->height);
break;
case TIFF_STRIP_OFFS:
if (count == 1) {
s->strippos = 0;
s->stripoff = value;
} else
s->strippos = off;
s->strips = count;
if (s->strips == 1)
s->rps = s->height;
s->sot = type;
break;
case TIFF_STRIP_SIZE:
if (count == 1) {
"stripsize %u too large\n", value);
s->stripsizesoff = 0;
s->stripsize = value;
s->strips = 1;
} else {
s->stripsizesoff = off;
s->strips = count;
s->sstype = type;
break;
case TIFF_XRES:
case TIFF_YRES:
set_sar(s, tag, value, value2);
break;
case TIFF_TILE_BYTE_COUNTS:
case TIFF_TILE_LENGTH:
case TIFF_TILE_OFFSETS:
case TIFF_TILE_WIDTH:
av_log(s->avctx, AV_LOG_ERROR, "Tiled images are not supported\n");
return AVERROR_PATCHWELCOME;
break;
case TIFF_PREDICTOR:
s->predictor = value;
break;
case TIFF_PHOTOMETRIC:
switch (value) {
case TIFF_PHOTOMETRIC_WHITE_IS_ZERO:
case TIFF_PHOTOMETRIC_BLACK_IS_ZERO:
case TIFF_PHOTOMETRIC_RGB:
case TIFF_PHOTOMETRIC_PALETTE:
case TIFF_PHOTOMETRIC_YCBCR:
s->photometric = value;
break;
case TIFF_PHOTOMETRIC_ALPHA_MASK:
case TIFF_PHOTOMETRIC_SEPARATED:
case TIFF_PHOTOMETRIC_CIE_LAB:
case TIFF_PHOTOMETRIC_ICC_LAB:
case TIFF_PHOTOMETRIC_ITU_LAB:
case TIFF_PHOTOMETRIC_CFA:
case TIFF_PHOTOMETRIC_LOG_L:
case TIFF_PHOTOMETRIC_LOG_LUV:
case TIFF_PHOTOMETRIC_LINEAR_RAW:
avpriv_report_missing_feature(s->avctx,
"PhotometricInterpretation 0x%04X",
value);
return AVERROR_PATCHWELCOME;
default:
av_log(s->avctx, AV_LOG_ERROR, "PhotometricInterpretation %u is "
"unknown\n", value);
break;
case TIFF_FILL_ORDER:
if (value < 1 || value > 2) {
"Unknown FillOrder value %d, trying default one\n", value);
value = 1;
s->fill_order = value - 1;
break;
case TIFF_PAL: {
GetByteContext pal_gb[3];
off = type_sizes[type];
if (count / 3 > 256 ||
bytestream2_get_bytes_left(&s->gb) < count / 3 * off * 3)
pal_gb[0] = pal_gb[1] = pal_gb[2] = s->gb;
bytestream2_skip(&pal_gb[1], count / 3 * off);
bytestream2_skip(&pal_gb[2], count / 3 * off * 2);
off = (type_sizes[type] - 1) << 3;
if (off > 31U) {
av_log(s->avctx, AV_LOG_ERROR, "palette shift %d is out of range\n", off);
for (i = 0; i < count / 3; i++) {
uint32_t p = 0xFF000000;
p |= (ff_tget(&pal_gb[0], type, s->le) >> off) << 16;
p |= (ff_tget(&pal_gb[1], type, s->le) >> off) << 8;
p |= ff_tget(&pal_gb[2], type, s->le) >> off;
s->palette[i] = p;
s->palette_is_set = 1;
break;
case TIFF_PLANAR:
s->planar = value == 2;
break;
case TIFF_YCBCR_SUBSAMPLING:
if (count != 2) {
av_log(s->avctx, AV_LOG_ERROR, "subsample count invalid\n");
for (i = 0; i < count; i++) {
s->subsampling[i] = ff_tget(&s->gb, type, s->le);
if (s->subsampling[i] <= 0) {
av_log(s->avctx, AV_LOG_ERROR, "subsampling %d is invalid\n", s->subsampling[i]);
break;
case TIFF_T4OPTIONS:
if (s->compr == TIFF_G3)
s->fax_opts = value;
break;
case TIFF_T6OPTIONS:
if (s->compr == TIFF_G4)
s->fax_opts = value;
break;
#define ADD_METADATA(count, name, sep)\
if ((ret = add_metadata(count, type, name, sep, s, frame)) < 0) {\
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");\
goto end;\
case TIFF_MODEL_PIXEL_SCALE:
ADD_METADATA(count, "ModelPixelScaleTag", NULL);
break;
case TIFF_MODEL_TRANSFORMATION:
ADD_METADATA(count, "ModelTransformationTag", NULL);
break;
case TIFF_MODEL_TIEPOINT:
ADD_METADATA(count, "ModelTiepointTag", NULL);
break;
case TIFF_GEO_KEY_DIRECTORY:
if (s->geotag_count) {
avpriv_request_sample(s->avctx, "Multiple geo key directories\n");
ADD_METADATA(1, "GeoTIFF_Version", NULL);
ADD_METADATA(2, "GeoTIFF_Key_Revision", ".");
s->geotag_count = ff_tget_short(&s->gb, s->le);
if (s->geotag_count > count / 4 - 1) {
s->geotag_count = count / 4 - 1;
av_log(s->avctx, AV_LOG_WARNING, "GeoTIFF key directory buffer shorter than specified\n");
if (bytestream2_get_bytes_left(&s->gb) < s->geotag_count * sizeof(int16_t) * 4) {
s->geotag_count = 0;
return -1;
s->geotags = av_mallocz_array(s->geotag_count, sizeof(TiffGeoTag));
if (!s->geotags) {
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
s->geotag_count = 0;
goto end;
for (i = 0; i < s->geotag_count; i++) {
s->geotags[i].key = ff_tget_short(&s->gb, s->le);
s->geotags[i].type = ff_tget_short(&s->gb, s->le);
s->geotags[i].count = ff_tget_short(&s->gb, s->le);
if (!s->geotags[i].type)
s->geotags[i].val = get_geokey_val(s->geotags[i].key, ff_tget_short(&s->gb, s->le));
else
s->geotags[i].offset = ff_tget_short(&s->gb, s->le);
break;
case TIFF_GEO_DOUBLE_PARAMS:
if (count >= INT_MAX / sizeof(int64_t))
if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t))
dp = av_malloc_array(count, sizeof(double));
if (!dp) {
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
goto end;
for (i = 0; i < count; i++)
dp[i] = ff_tget_double(&s->gb, s->le);
for (i = 0; i < s->geotag_count; i++) {
if (s->geotags[i].type == TIFF_GEO_DOUBLE_PARAMS) {
if (s->geotags[i].count == 0
|| s->geotags[i].offset + s->geotags[i].count > count) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", s->geotags[i].key);
} else {
char *ap = doubles2str(&dp[s->geotags[i].offset], s->geotags[i].count, ", ");
if (!ap) {
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
av_freep(&dp);
return AVERROR(ENOMEM);
s->geotags[i].val = ap;
av_freep(&dp);
break;
case TIFF_GEO_ASCII_PARAMS:
pos = bytestream2_tell(&s->gb);
for (i = 0; i < s->geotag_count; i++) {
if (s->geotags[i].type == TIFF_GEO_ASCII_PARAMS) {
if (s->geotags[i].count == 0
|| s->geotags[i].offset + s->geotags[i].count > count) {
av_log(s->avctx, AV_LOG_WARNING, "Invalid GeoTIFF key %d\n", s->geotags[i].key);
} else {
char *ap;
bytestream2_seek(&s->gb, pos + s->geotags[i].offset, SEEK_SET);
if (bytestream2_get_bytes_left(&s->gb) < s->geotags[i].count)
ap = av_malloc(s->geotags[i].count);
if (!ap) {
av_log(s->avctx, AV_LOG_ERROR, "Error allocating temporary buffer\n");
return AVERROR(ENOMEM);
bytestream2_get_bufferu(&s->gb, ap, s->geotags[i].count);
ap[s->geotags[i].count - 1] = '\0';
s->geotags[i].val = ap;
break;
case TIFF_ARTIST:
ADD_METADATA(count, "artist", NULL);
break;
case TIFF_COPYRIGHT:
ADD_METADATA(count, "copyright", NULL);
break;
case TIFF_DATE:
ADD_METADATA(count, "date", NULL);
break;
case TIFF_DOCUMENT_NAME:
ADD_METADATA(count, "document_name", NULL);
break;
case TIFF_HOST_COMPUTER:
ADD_METADATA(count, "computer", NULL);
break;
case TIFF_IMAGE_DESCRIPTION:
ADD_METADATA(count, "description", NULL);
break;
case TIFF_MAKE:
ADD_METADATA(count, "make", NULL);
break;
case TIFF_MODEL:
ADD_METADATA(count, "model", NULL);
break;
case TIFF_PAGE_NAME:
ADD_METADATA(count, "page_name", NULL);
break;
case TIFF_PAGE_NUMBER:
ADD_METADATA(count, "page_number", " / ");
break;
case TIFF_SOFTWARE_NAME:
ADD_METADATA(count, "software", NULL);
break;
default:
if (s->avctx->err_recognition & AV_EF_EXPLODE) {
"Unknown or unsupported tag %d/0X%0X\n",
tag, tag);
end:
if (s->bpp > 64U) {
"This format is not supported (bpp=%d, %d components)\n",
s->bpp, count);
s->bpp = 0;
bytestream2_seek(&s->gb, start, SEEK_SET);
return 0;
| 1threat
|
How can I delete multiple files from a directory specified by a multi-selected listbox in C# WPF? : <p>I have a directory that contains multiple text files. The name of each text file is also the same as the first line in the text file, which is the same name that it used to populate the text content of each listbox item.
ex. I have files "a", "b", and "c". My list box will contain the items "a", "b", and "c". I have my list box set to an extended selection so the user can select multiple files. I want the user the be able to delete selected files.
This is my current broken code:</p>
<pre><code>private void btnDeleteSelection_Click(object sender, RoutedEventArgs e)
{
var selectedFiles = lstSavedSites.SelectedItems;
string selectedFile;
try
{
foreach (var file in selectedFiles)
{
selectedFile = lstSavedSites.SelectedItem.ToString();
File.Delete("@C:/myFolderName/anotherFolderName/" + selectedFile);
}
PopulateListBox();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
</code></pre>
<p>The ex.Message says "The given path's format is not supported."</p>
| 0debug
|
CSS Hover Not Working On Nested SPAN : I would like to change the `background-color` and `color` when I hover over the `#startButton`. However, nothing changes in my current code (below).
HTML
<a href='#arrow' class='startButton' style='background-color: #fff; color: #555;' id='brickButton'>
<span id='theText'>
Start Your Search
</span>
</a>
CSS
#startButton:hover {
color: blue;
background-color: #fff;
}
| 0debug
|
How to make my page run in bacground : so, I have a form that when completed executes a script, but I dont want that script to show in the url part of the browser, so I want it to either run in background or instantly close even if the script wasnt completely done, can somoene help?
| 0debug
|
connection.query('SELECT * FROM users WHERE username = ' + input_string)
| 1threat
|
Encountering error: "Setting device discovery mode to DiscoveryMode_None" when setting up Camera (Swift) : <p>Here is my code setting up a simple camera app</p>
<pre><code>override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
let deviceSession = AVCaptureDeviceDiscoverySession(deviceTypes: [.builtInDualCamera, .builtInTelephotoCamera, .builtInWideAngleCamera], mediaType: AVMediaTypeVideo, position: .unspecified)
for device in (deviceSession?.devices)!{
if device.position == AVCaptureDevicePosition.front {
do {
currentDevice = device
let input = try AVCaptureDeviceInput(device: device)
if captureSession.canAddInput(input){
captureSession.addInput(input)
if captureSession.canAddOutput(photoOutput){
captureSession.addOutput(photoOutput)
}
if captureSession.canAddOutput(videoOutput){
captureSession.addOutput(videoOutput)
videoOutput.connection(withMediaType: AVMediaTypeVideo).isVideoMirrored = true
}
previewLayer = AVCaptureVideoPreviewLayer(session: captureSession)
previewLayer.videoGravity = AVLayerVideoGravityResizeAspectFill
previewLayer.connection.videoOrientation = .portrait //Change orientation
cameraView.layer.addSublayer(previewLayer)
cameraView.addSubview(takePictureButton)
cameraView.addSubview(takeVideoButton)
cameraView.addSubview(saveVideoButton)
previewLayer.position = CGPoint(x: self.view.center.x, y: self.view.center.y)
previewLayer.bounds = CGRect(x: 100, y: 150, width: self.view.frame.width, height: self.view.frame.height)
}
captureSession.startRunning()
} catch let avError {
print(avError)
}
}
}
}
</code></pre>
<p>This works fine, but throws this message in the debug window </p>
<pre><code>2018-02-26 20:12:27.699481-0800 FACS[1063:425226] [] <<<<
AVOutputDeviceDiscoverySession (FigRouteDiscoverer) >>>>
-[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl
outputDeviceDiscoverySessionDidChangeDiscoveryMode:]: Setting device
discovery mode to DiscoveryMode_None (client: FACS)
2018-02-26 20:12:27.774719-0800 FACS[1063:425226] [framework]
CUICatalog: Invalid asset name supplied: '(null)'
</code></pre>
<p>The strange part is that when I try to clean up the code above, it still works but now is much slower (by cleanup I mean put things in helper functions). By looking at related posts, </p>
<p><a href="https://stackoverflow.com/questions/47132877/playing-audio-from-url-give-me-this-log-error-and-stuck-swift">Playing audio from URL give me this log error and stuck .(Swift)</a></p>
<p><a href="https://stackoverflow.com/questions/47438401/avplayer-is-not-playing-in-ios-11">AVPlayer is not playing in iOS 11</a></p>
<p>the only thing I can deduce is that it has something related to IOS 11. How do I fix this error?</p>
| 0debug
|
Why does the while loop only take inputs of multiple 2? : <pre><code>package hw6;
import java.util.Scanner;
import java.util.ArrayList;
public class hw6q1 {
public static void main(String[] args) {
ArrayList<Integer> al = new ArrayList<Integer>();
Scanner input = new Scanner(System.in);
System.out.println("Enter integers between 1 and 100 (enter 0 to
stop):");
while(input.nextInt() != 0){
al.add(input.nextInt());
}
input.close();
for(int i = 0; i < al.size(); i++){
System.out.println(al.get(i));
}
}
}
</code></pre>
<p>So that is my code and when I run the program and give in the numbers 1 2 3 4 then 0 to end the loop it only prints 2 and 4. I was wondering why that is the case and how to fix it so that the arraylist gets all the number 1 2 3 and 4. </p>
| 0debug
|
static int qemu_chr_open_tty(QemuOpts *opts, CharDriverState **_chr)
{
const char *filename = qemu_opt_get(opts, "path");
CharDriverState *chr;
int fd;
TFR(fd = qemu_open(filename, O_RDWR | O_NONBLOCK));
if (fd < 0) {
return -errno;
}
tty_serial_init(fd, 115200, 'N', 8, 1);
chr = qemu_chr_open_fd(fd, fd);
chr->chr_ioctl = tty_serial_ioctl;
chr->chr_close = qemu_chr_close_tty;
*_chr = chr;
return 0;
}
| 1threat
|
static av_cold int X264_close(AVCodecContext *avctx)
{
X264Context *x4 = avctx->priv_data;
av_freep(&avctx->extradata);
av_freep(&x4->sei);
if (x4->enc) {
x264_encoder_close(x4->enc);
x4->enc = NULL;
}
av_frame_free(&avctx->coded_frame);
return 0;
}
| 1threat
|
Javascript: Loop Through Dynamically Generated Titles and Trunicate : <p>I have these titles that are dynamically generated on the server side of the app, and I would like to truncate them accordingly.</p>
<p>The snippet for generating the titles is:</p>
<pre><code> <p class="prod-title">{{ product.title }}</p>
</code></pre>
<p>The above generated an HTML code as:</p>
<pre><code><p class="prod-title"> Title 1 </p>
<p class="prod-title"> Title 2 </p>
<p class="prod-title"> Title 3 </p>
</code></pre>
<p>How can I truncate the generated titles based on a class using Jquery?</p>
| 0debug
|
Azure Function - How to launch the excel document : <p>I created an excel report within the Azure function. I am trying to launch this excel file at the end of the process. But I get this error this is not supported in the OS.</p>
<p>I tried the following code.</p>
<p><code>System.Diagnostics.Process.Start(reportSavePath);</code></p>
| 0debug
|
Difference between plugins and presets in .babelrc : <h2>Situation</h2>
<p>So I have a <code>.babelrc</code> like this:</p>
<pre><code>{
"presets": [
"es2015",
"stage-2",
"react"
],
"plugins": [
"transform-decorators-legacy"
]
}
</code></pre>
<h2>Question</h2>
<p>What is the difference between presets and plugins? Which one should I use to configure Babel?</p>
| 0debug
|
How to start debugger with an entry_point script : <p>I have a package installed in development mode with <code>pip install -e ./mylocalpkg</code>.</p>
<p>This package defines an <code>entry_points.console_script</code></p>
<pre><code>setup(
name='mylocalpkg',
...
entry_points={
'console_scripts': [
'myscript = mylocalpkg.scriptfile:main'
]
},
...
)
</code></pre>
<p>This script can be called with either way</p>
<pre><code>$ python -m mylocalpkg.scriptfile
$ myscript
</code></pre>
<p>However, I cannot debug this script:</p>
<pre><code>$ python -m pdb mylocalpkg.scriptfile
Error: mylocalpkg.scriptfile does not exist
$ python -m pdb myscript
Error: myscript does not exist
</code></pre>
<p>How can I start a debugging session with <code>pdb</code> while calling entry_point scripts ? </p>
| 0debug
|
void backup_start(BlockDriverState *bs, BlockDriverState *target,
int64_t speed, MirrorSyncMode sync_mode,
BdrvDirtyBitmap *sync_bitmap,
BlockdevOnError on_source_error,
BlockdevOnError on_target_error,
BlockCompletionFunc *cb, void *opaque,
BlockJobTxn *txn, Error **errp)
{
int64_t len;
BlockDriverInfo bdi;
int ret;
assert(bs);
assert(target);
assert(cb);
if (bs == target) {
error_setg(errp, "Source and target cannot be the same");
return;
}
if (!bdrv_is_inserted(bs)) {
error_setg(errp, "Device is not inserted: %s",
bdrv_get_device_name(bs));
return;
}
if (!bdrv_is_inserted(target)) {
error_setg(errp, "Device is not inserted: %s",
bdrv_get_device_name(target));
return;
}
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_BACKUP_SOURCE, errp)) {
return;
}
if (bdrv_op_is_blocked(target, BLOCK_OP_TYPE_BACKUP_TARGET, errp)) {
return;
}
if (sync_mode == MIRROR_SYNC_MODE_INCREMENTAL) {
if (!sync_bitmap) {
error_setg(errp, "must provide a valid bitmap name for "
"\"incremental\" sync mode");
return;
}
if (bdrv_dirty_bitmap_create_successor(bs, sync_bitmap, errp) < 0) {
return;
}
} else if (sync_bitmap) {
error_setg(errp,
"a sync_bitmap was provided to backup_run, "
"but received an incompatible sync_mode (%s)",
MirrorSyncMode_lookup[sync_mode]);
return;
}
len = bdrv_getlength(bs);
if (len < 0) {
error_setg_errno(errp, -len, "unable to get length for '%s'",
bdrv_get_device_name(bs));
goto error;
}
BackupBlockJob *job = block_job_create(&backup_job_driver, bs, speed,
cb, opaque, errp);
if (!job) {
goto error;
}
job->on_source_error = on_source_error;
job->on_target_error = on_target_error;
job->target = target;
job->sync_mode = sync_mode;
job->sync_bitmap = sync_mode == MIRROR_SYNC_MODE_INCREMENTAL ?
sync_bitmap : NULL;
ret = bdrv_get_info(job->target, &bdi);
if (ret < 0 && !target->backing) {
error_setg_errno(errp, -ret,
"Couldn't determine the cluster size of the target image, "
"which has no backing file");
error_append_hint(errp,
"Aborting, since this may create an unusable destination image\n");
goto error;
} else if (ret < 0 && target->backing) {
job->cluster_size = BACKUP_CLUSTER_SIZE_DEFAULT;
} else {
job->cluster_size = MAX(BACKUP_CLUSTER_SIZE_DEFAULT, bdi.cluster_size);
}
bdrv_op_block_all(target, job->common.blocker);
job->common.len = len;
job->common.co = qemu_coroutine_create(backup_run);
block_job_txn_add_job(txn, &job->common);
qemu_coroutine_enter(job->common.co, job);
return;
error:
if (sync_bitmap) {
bdrv_reclaim_dirty_bitmap(bs, sync_bitmap, NULL);
}
}
| 1threat
|
PHP - Parse Json : <p>I have an answer in json, but how can I parse?</p>
<p>Response: (var_dump)</p>
<pre><code>C:\wamp64\www\PHP\index.php:17:
object(stdClass)[1]
public 'success' => boolean true
public 'data' =>
array (size=1)
0 =>
object(stdClass)[2]
public 'key' => string '11111-11111-11111-11111-11111' (length=29)
public 'allowed_acts' => int 1
</code></pre>
<p>I tried this code, but dont works</p>
<pre><code>if ($keys) {
$json = json_decode($keys);
//$dump = var_dump($json);
//echo $dump;
echo $json['key'];
}
</code></pre>
<p>Fatal error: Cannot use object of type stdClass as array in C:\wamp64\www\PHP\index.php on line 21</p>
| 0debug
|
float64 helper_fstod(CPUSPARCState *env, float32 src)
{
float64 ret;
clear_float_exceptions(env);
ret = float32_to_float64(src, &env->fp_status);
check_ieee_exceptions(env);
return ret;
}
| 1threat
|
which one the best tools PHP either Bootstrap.? : <p>To create dynamic pages for hosting purpose,what are the tools are required. </p>
| 0debug
|
static GenericList *qmp_input_next_list(Visitor *v, GenericList *tail,
size_t size)
{
QmpInputVisitor *qiv = to_qiv(v);
StackObject *so = &qiv->stack[qiv->nb_stack - 1];
if (!so->entry) {
return NULL;
}
tail->next = g_malloc0(size);
return tail->next;
}
| 1threat
|
Why do I need getters and setters in ICommand? : <p>New to C#/MVVM and this doesn't make sense to me?</p>
<p>This is my implementation of a RelayCommand inheriting from ICommand:</p>
<pre><code>internal class RelayCommand : ICommand
{
private readonly Predicate<object> _canExecute;
private readonly Action _execute;
public event EventHandler CanExecuteChanged = (sender, e) => {};
public RelayCommand(Action execute) : this(execute, null){ }
public RelayCommand(Action execute, Predicate<object> canExecute)
{
_execute = execute;
_canExecute = canExecute;
}
public bool CanExecute(object parameter) => (_canExecute == null) ? true : _canExecute(parameter);
public void Execute(object parameter) => _execute();
}
</code></pre>
<p>I found out through testing that I simply can't just do this:</p>
<pre><code>public RelayCommand TestCommand;
</code></pre>
<p>I have to do this:</p>
<pre><code>public RelayCommand TestCommand { get; set; }
</code></pre>
<p>Otherwise declaring the command in the constructor like this:</p>
<pre><code>TestCommand = new RelayCommand(TestCommandFunction);
public void TestCommandFunction(){}
</code></pre>
<p>won't work. Why is this the case?</p>
| 0debug
|
Issues figuring out how to fix C++ Blackjack program : <p>I'm currently trying to make a simple Blackjack program that is single player and only has cards from 1-10. The issue that I'm having is that whenever I ask for a new card for the third time, it doesn't total up my cards properly. The program also doesn't restart properlyHere is an example of the output:</p>
<pre><code>Welcome to Blackjack!
Here are your first cards: 10, 2
Your total is 12.
Would you like to draw another card? (y/n)
y
You got a new card with a value of 6.
Your total is now 18.
Would you like to draw another card? (y/n)
y
You got a new card with a value of 4.
Your total is now 16.
Would you like to draw another card? (y/n)
n
Welcome to Blackjack!
Here are your first cards: 6, 4
Your total is 10.
Would you like to draw another card? (y/n)
</code></pre>
<p>I have tried using a do-while loop so that it asks for a new card whenever the total < 21 but it ends up the same way. I'm at a loss at how to solve this. </p>
<pre><code>#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int getCard(int);
int main()
{
srand(time(0));
int total, card1, card2, newTotal = 0;
char choice, playAgain = 'y';
while (playAgain == 'y')
{
cout << "Welcome to Blackjack!\n";
card1 = rand() % 10 + 1;
card2 = rand() % 10 + 1;
total = card1 + card2;
cout << "Here are your first cards: " << card1 << ", " << card2 << endl;
cout << "Your total is " << total << "." << endl;
cout << "Would you like to draw another card? (y/n)\n";
cin >> choice;
while (choice == 'y')
{
newTotal = getCard(total);
if (newTotal > 21)
{
cout << "Bust!" << endl;
choice = 'n';
}
else if (newTotal < 21)
{
cout << "Would you like to draw another card? (y/n)\n";
cin >> choice;
}
else
{
cout << "Congratulations, you won!\n";
choice = 'n';
}
}
}
cout << "Would you like to play again? (y/n)\n";
cin >> playAgain;
return 0;
}
int getCard(int total)
{
int addCard, newTotal;
addCard = rand() % 10 + 1;
newTotal = total + addCard;
cout << "You got a new card with a value of " << addCard << "." <<
endl;
cout << "Your total is now " << newTotal << "." << endl;
return newTotal;
}
</code></pre>
<p>The program is expected to start the player off with 2 cards and then ask them if they'd like to draw another one. If they input 'y' then it would do so and retotal the cards up. If they say no, then the game just ends. If they say yes and the new cards makes the total > 21 then it returns "bust." If it makes the total become 21 then it tells the player that it wins. At the end of each game, it should ask the player if they would like to play again. </p>
| 0debug
|
I am getting errro while trying to return an array.c++ : I am getting 3 errors:-
line 12:-invalid conversion from int* to int
line 17:-x was not declared in this scope
line 16:- expected primary expression before',' token
please fix this,
#include<iostream>
int power(int x[5])
{
x[0]=12;
x[1]=23;
x[2]=234;
x[3]=344;
x[4]=232;
return x;
}
int main()
{
int power[5]={1,2,3,,4,5};
std::cout<<x[0]<<std::endl;
x();
std::cout<<x[0]<<std::endl;
return 0;
}
your help would be appreciated!
| 0debug
|
static int do_token_out(USBDevice *s, USBPacket *p)
{
if (p->devep != 0)
return s->info->handle_data(s, p);
switch(s->setup_state) {
case SETUP_STATE_ACK:
if (s->setup_buf[0] & USB_DIR_IN) {
s->setup_state = SETUP_STATE_IDLE;
} else {
}
return 0;
case SETUP_STATE_DATA:
if (!(s->setup_buf[0] & USB_DIR_IN)) {
int len = s->setup_len - s->setup_index;
if (len > p->len)
len = p->len;
memcpy(s->data_buf + s->setup_index, p->data, len);
s->setup_index += len;
if (s->setup_index >= s->setup_len)
s->setup_state = SETUP_STATE_ACK;
return len;
}
s->setup_state = SETUP_STATE_IDLE;
return USB_RET_STALL;
default:
return USB_RET_STALL;
}
}
| 1threat
|
from operator import itemgetter
def index_minimum(test_list):
res = min(test_list, key = itemgetter(1))[0]
return (res)
| 0debug
|
static uint8_t qpci_spapr_io_readb(QPCIBus *bus, void *addr)
{
QPCIBusSPAPR *s = container_of(bus, QPCIBusSPAPR, bus);
uint64_t port = (uintptr_t)addr;
uint8_t v;
if (port < s->pio.size) {
v = readb(s->pio_cpu_base + port);
} else {
v = readb(s->mmio_cpu_base + port);
}
return v;
}
| 1threat
|
static int kvm_put_sregs(CPUState *env)
{
struct kvm_sregs sregs;
memset(sregs.interrupt_bitmap, 0, sizeof(sregs.interrupt_bitmap));
if (env->interrupt_injected >= 0) {
sregs.interrupt_bitmap[env->interrupt_injected / 64] |=
(uint64_t)1 << (env->interrupt_injected % 64);
}
if ((env->eflags & VM_MASK)) {
set_v8086_seg(&sregs.cs, &env->segs[R_CS]);
set_v8086_seg(&sregs.ds, &env->segs[R_DS]);
set_v8086_seg(&sregs.es, &env->segs[R_ES]);
set_v8086_seg(&sregs.fs, &env->segs[R_FS]);
set_v8086_seg(&sregs.gs, &env->segs[R_GS]);
set_v8086_seg(&sregs.ss, &env->segs[R_SS]);
} else {
set_seg(&sregs.cs, &env->segs[R_CS]);
set_seg(&sregs.ds, &env->segs[R_DS]);
set_seg(&sregs.es, &env->segs[R_ES]);
set_seg(&sregs.fs, &env->segs[R_FS]);
set_seg(&sregs.gs, &env->segs[R_GS]);
set_seg(&sregs.ss, &env->segs[R_SS]);
}
set_seg(&sregs.tr, &env->tr);
set_seg(&sregs.ldt, &env->ldt);
sregs.idt.limit = env->idt.limit;
sregs.idt.base = env->idt.base;
sregs.gdt.limit = env->gdt.limit;
sregs.gdt.base = env->gdt.base;
sregs.cr0 = env->cr[0];
sregs.cr2 = env->cr[2];
sregs.cr3 = env->cr[3];
sregs.cr4 = env->cr[4];
sregs.cr8 = cpu_get_apic_tpr(env->apic_state);
sregs.apic_base = cpu_get_apic_base(env->apic_state);
sregs.efer = env->efer;
return kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs);
}
| 1threat
|
int qemu_boot_set(const char *boot_order)
{
if (!boot_set_handler) {
return -EINVAL;
}
return boot_set_handler(boot_set_opaque, boot_order);
}
| 1threat
|
How to handle back button on Ionic 2 : <p>How can I handle the back button action on Ionic 2?</p>
<p>I want to be able to know what to do depending on which page is being shown to the user.</p>
<p>I didn't find a good answer to this question, but after a while I figured it out myself a way to do it. I'm gonna share with you all.</p>
<p>Thanks</p>
| 0debug
|
Hi guys, i have a problem when i run phpunit, can sombody help me? :" : Hy guys, i have a problem when i run PHPUNIT in my terminal...I`m just a beginner and i need some help :\
[1]devel@manjaro1|0|16:41:28|~ > cd Projects/forum
[2]devel@manjaro1|0|16:41:34|~/Projects/forum > phpunit
PHP Fatal error: Uncaught PHPUnit_Framework_Exception: Neither ".php" nor ".php" could be opened. in /opt/lampp/lib/php/PHPUnit/Util/Skeleton/Test.php:100
Stack trace:`enter code here`
#0 /opt/lampp/lib/php/PHPUnit/TextUI/Command.php(152): PHPUnit_Util_Skeleton_Test->__construct('', '')
#1 /opt/lampp/lib/php/PHPUnit/TextUI/Command.php(126): PHPUnit_TextUI_Command->run(Array, true)
#2 /opt/lampp/bin/phpunit(46): PHPUnit_TextUI_Command::main()
#3 {main}
thrown in /opt/lampp/lib/php/PHPUnit/Util/Skeleton/Test.php on line 100
Fatal error: Uncaught PHPUnit_Framework_Exception: Neither ".php" nor ".php" could be opened. in /opt/lampp/lib/php/PHPUnit/Util/Skeleton/Test.php:100
Stack trace:
#0 /opt/lampp/lib/php/PHPUnit/TextUI/Command.php(152): PHPUnit_Util_Skeleton_Test->__construct('', '')
#1 /opt/lampp/lib/php/PHPUnit/TextUI/Command.php(126): PHPUnit_TextUI_Command->run(Array, true)
#2 /opt/lampp/bin/phpunit(46): PHPUnit_TextUI_Command::main()
#3 {main}
thrown in /opt/lampp/lib/php/PHPUnit/Util/Skeleton/Test.php on line 100
| 0debug
|
How to add Google Analytics to Github respository : <p>I like to add google analytics on my github respository. So i can keep track of user visit.</p>
| 0debug
|
What is a "stage" in the context of amazon api gateway? : <p>What is a "stage" in the context of amazon api gateway. What is it's purpose and how many are meant to be created.</p>
<p>Is there any relation to "staging" in the production/staging/development convention.</p>
| 0debug
|
Jquery Multiple Select Show values in <li> : <p>I would like to display the value of all my select fields in a list (li).</p>
<p>Here is my HTML code.</p>
<pre><code><select name="is_format" id="is_format">
<option value="A4">{l s='A4'}</option>
<option value="A3">{l s='A3'}</option>
</select>
<select name="is_color" id="is_color">
<option value="Couleur" selected>{l s='Couleur'}</option>
<option value="Noir/Blanc">{l s='Noir et Blanc'}</option>
</select>
</code></pre>
<p>Thank you</p>
| 0debug
|
static void loop_filter(H264Context *h, H264SliceContext *sl, int start_x, int end_x)
{
uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize, mb_x, mb_y;
const int end_mb_y = h->mb_y + FRAME_MBAFF(h);
const int old_slice_type = sl->slice_type;
const int pixel_shift = h->pixel_shift;
const int block_h = 16 >> h->chroma_y_shift;
if (h->deblocking_filter) {
for (mb_x = start_x; mb_x < end_x; mb_x++)
for (mb_y = end_mb_y - FRAME_MBAFF(h); mb_y <= end_mb_y; mb_y++) {
int mb_xy, mb_type;
mb_xy = h->mb_xy = mb_x + mb_y * h->mb_stride;
sl->slice_num = h->slice_table[mb_xy];
mb_type = h->cur_pic.mb_type[mb_xy];
sl->list_count = h->list_counts[mb_xy];
if (FRAME_MBAFF(h))
h->mb_mbaff =
h->mb_field_decoding_flag = !!IS_INTERLACED(mb_type);
h->mb_x = mb_x;
h->mb_y = mb_y;
dest_y = h->cur_pic.f.data[0] +
((mb_x << pixel_shift) + mb_y * h->linesize) * 16;
dest_cb = h->cur_pic.f.data[1] +
(mb_x << pixel_shift) * (8 << CHROMA444(h)) +
mb_y * h->uvlinesize * block_h;
dest_cr = h->cur_pic.f.data[2] +
(mb_x << pixel_shift) * (8 << CHROMA444(h)) +
mb_y * h->uvlinesize * block_h;
if (MB_FIELD(h)) {
linesize = sl->mb_linesize = h->linesize * 2;
uvlinesize = sl->mb_uvlinesize = h->uvlinesize * 2;
if (mb_y & 1) {
dest_y -= h->linesize * 15;
dest_cb -= h->uvlinesize * (block_h - 1);
dest_cr -= h->uvlinesize * (block_h - 1);
}
} else {
linesize = sl->mb_linesize = h->linesize;
uvlinesize = sl->mb_uvlinesize = h->uvlinesize;
}
backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize,
uvlinesize, 0);
if (fill_filter_caches(h, sl, mb_type))
continue;
sl->chroma_qp[0] = get_chroma_qp(h, 0, h->cur_pic.qscale_table[mb_xy]);
sl->chroma_qp[1] = get_chroma_qp(h, 1, h->cur_pic.qscale_table[mb_xy]);
if (FRAME_MBAFF(h)) {
ff_h264_filter_mb(h, sl, mb_x, mb_y, dest_y, dest_cb, dest_cr,
linesize, uvlinesize);
} else {
ff_h264_filter_mb_fast(h, sl, mb_x, mb_y, dest_y, dest_cb,
dest_cr, linesize, uvlinesize);
}
}
}
sl->slice_type = old_slice_type;
h->mb_x = end_x;
h->mb_y = end_mb_y - FRAME_MBAFF(h);
sl->chroma_qp[0] = get_chroma_qp(h, 0, sl->qscale);
sl->chroma_qp[1] = get_chroma_qp(h, 1, sl->qscale);
}
| 1threat
|
int check_intra_pred8x8_mode_emuedge(int mode, int mb_x, int mb_y)
{
switch (mode) {
case DC_PRED8x8:
return check_dc_pred8x8_mode(mode, mb_x, mb_y);
case VERT_PRED8x8:
return !mb_y ? DC_127_PRED8x8 : mode;
case HOR_PRED8x8:
return !mb_x ? DC_129_PRED8x8 : mode;
case PLANE_PRED8x8:
return check_tm_pred8x8_mode(mode, mb_x, mb_y);
}
return mode;
}
| 1threat
|
Simulate button presses programmatically : Sound simple but I need some help here
I have a `Button` that I want to triggered using code.
How can I achieve this?
| 0debug
|
R: ggplot2 pointrange example : <p>I am currently reading <strong>R for Data Science</strong> by Hadley Wickham. In that, there is the following example:</p>
<pre><code>library(tidyverse)
ggplot(data = diamonds) +
stat_summary(
mapping = aes(x = cut, y = depth),
fun.ymin = min,
fun.ymax = max,
fun.y = median
)
</code></pre>
<p>Now, there is a question as how to create the same plot by using appropriate <code>geom_</code> function. I looked at the default <code>geom</code> for <code>stat_summary</code> and it is <code>pointrange</code>.</p>
<p>So I tried the following:</p>
<pre><code>ggplot(data = diamonds) + geom_pointrange(mapping = aes(x = cut, y = depth), stat = "summary")
</code></pre>
<p>But I do not get the <code>min</code> and <code>max</code> points on the plot. </p>
<p><strong>How do I get the exact plot by using <code>geom_pointrange</code>?</strong></p>
| 0debug
|
Variable not being a variable with fwrite : <p>I wanted to ask, how I can write down a variable without it's getting detected as one.</p>
<p>As example:</p>
<pre><code>$data = <<< DATA
<?php
$dbServername = $_POST["admin"];
?>
DATA;
</code></pre>
<p>$dbServername shouldn't be a variable, but $_POST["admin"]; should be one.</p>
<p>I want, to write with fwrite the $_POST["admin"] variable into a document. But when $dbServername also gets detected as a variable, but it should be one, it throws errors.</p>
<p>Any Idea how to fix this?</p>
| 0debug
|
Dart SDK is not configured : <p>I installed Flutter and set up Android Studio. Then I cloned an example of flutter on GitHub (<a href="https://github.com/flutter/flutter" rel="noreferrer">https://github.com/flutter/flutter</a>) and launched it in Android Studio, but it warns me "Dart SDK is not configured", this happened to my co-worker as well. But if I create a new project in Android Studio, no problem at all.</p>
<p>What I have done:</p>
<ol>
<li><p>Installed Flutter</p></li>
<li><p>Installed Android Studio, along with Flutter plugin including Dart plugin</p></li>
<li><p>Flutter run in command line works fine, all five tests passed. (See below)</p></li>
</ol>
<blockquote>
<p>[✓] Flutter (on Mac OS X 10.13.3 17D47, locale en-US, channel dev)
• Flutter version 0.0.22 at /Users/katelyn/flutter
• Framework revision 3001b3307d (7 days ago), 2018-01-30 11:37:15 -0800
• Engine revision 8f2d72b183
• Tools Dart version 2.0.0-dev.16.0
• Engine Dart version 2.0.0-edge.7af4db0ea091dddca6b2da851e6dda8d7f9467e8</p>
<p>[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/katelyn/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)</p>
<p>[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.2, Build version 9C40b
• ios-deploy 1.9.2
• CocoaPods version 1.4.0</p>
<p>[✓] Android Studio (version 3.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)</p>
<p>[✓] Connected devices
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 7.1.1 (API 25) (emulator)</p>
</blockquote>
<p>Last week, I can run their example thru command line (in that dir),</p>
<pre><code>flutter run
</code></pre>
<p>but now I it shows some errors with Gradle. </p>
<blockquote>
<p>Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 0.7s
Resolving dependencies...<br>
* Error running Gradle:
Exit code 1 from: /Users/katelyn/AndroidStudioProjects/flutter/examples/flutter_gallery/android/gradlew app:properties:</p>
<p>FAILURE: Build failed with an exception.</p>
<ul>
<li><p>Where:
Build file '/Users/katelyn/AndroidStudioProjects/flutter/examples/flutter_gallery/android/app/build.gradle' line: 20</p></li>
<li><p>What went wrong:
A problem occurred evaluating project ':app'.
3</p></li>
<li><p>Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.</p></li>
<li><p>Get more help at <a href="https://help.gradle.org" rel="noreferrer">https://help.gradle.org</a></p></li>
</ul>
<p>BUILD FAILED in 0s</p>
<p>Please review your Gradle project setup in the android/ folder.</p>
</blockquote>
<p>Sorry in advance I don't have enough reputation to upload pics.</p>
| 0debug
|
Convert photo (jpg or any format) to .rda : <p>Hi: Is there any way i can convert any photo (preferably jpg format) to .rda file so that I can do PCA analysis? My objective is to convert photo to rda. Take first few components of from pca do the similar operation to another photo file so that i can compare them..</p>
| 0debug
|
static FlatRange *address_space_lookup(AddressSpace *as, AddrRange addr)
{
return bsearch(&addr, as->current_map.ranges, as->current_map.nr,
sizeof(FlatRange), cmp_flatrange_addr);
}
| 1threat
|
void mmio_ide_init (target_phys_addr_t membase, target_phys_addr_t membase2,
MemoryRegion *address_space,
qemu_irq irq, int shift,
DriveInfo *hd0, DriveInfo *hd1)
{
MMIOState *s = g_malloc0(sizeof(MMIOState));
ide_init2_with_non_qdev_drives(&s->bus, hd0, hd1, irq);
s->shift = shift;
memory_region_init_io(&s->iomem1, &mmio_ide_ops, s,
"ide-mmio.1", 16 << shift);
memory_region_init_io(&s->iomem2, &mmio_ide_cs_ops, s,
"ide-mmio.2", 2 << shift);
memory_region_add_subregion(address_space, membase, &s->iomem1);
memory_region_add_subregion(address_space, membase2, &s->iomem2);
vmstate_register(NULL, 0, &vmstate_ide_mmio, s);
qemu_register_reset(mmio_ide_reset, s);
}
| 1threat
|
static void kvm_cpu_fill_host(x86_def_t *x86_cpu_def)
{
uint32_t eax = 0, ebx = 0, ecx = 0, edx = 0;
assert(kvm_enabled());
x86_cpu_def->name = "host";
host_cpuid(0x0, 0, &eax, &ebx, &ecx, &edx);
x86_cpu_def->level = eax;
x86_cpu_def->vendor1 = ebx;
x86_cpu_def->vendor2 = edx;
x86_cpu_def->vendor3 = ecx;
host_cpuid(0x1, 0, &eax, &ebx, &ecx, &edx);
x86_cpu_def->family = ((eax >> 8) & 0x0F) + ((eax >> 20) & 0xFF);
x86_cpu_def->model = ((eax >> 4) & 0x0F) | ((eax & 0xF0000) >> 12);
x86_cpu_def->stepping = eax & 0x0F;
x86_cpu_def->ext_features = ecx;
x86_cpu_def->features = edx;
if (x86_cpu_def->level >= 7) {
x86_cpu_def->cpuid_7_0_ebx_features = kvm_arch_get_supported_cpuid(kvm_state, 0x7, 0, R_EBX);
} else {
x86_cpu_def->cpuid_7_0_ebx_features = 0;
}
host_cpuid(0x80000000, 0, &eax, &ebx, &ecx, &edx);
x86_cpu_def->xlevel = eax;
host_cpuid(0x80000001, 0, &eax, &ebx, &ecx, &edx);
x86_cpu_def->ext2_features = edx;
x86_cpu_def->ext3_features = ecx;
cpu_x86_fill_model_id(x86_cpu_def->model_id);
x86_cpu_def->vendor_override = 0;
if (x86_cpu_def->vendor1 == CPUID_VENDOR_VIA_1 &&
x86_cpu_def->vendor2 == CPUID_VENDOR_VIA_2 &&
x86_cpu_def->vendor3 == CPUID_VENDOR_VIA_3) {
host_cpuid(0xC0000000, 0, &eax, &ebx, &ecx, &edx);
if (eax >= 0xC0000001) {
x86_cpu_def->xlevel2 = eax;
host_cpuid(0xC0000001, 0, &eax, &ebx, &ecx, &edx);
x86_cpu_def->ext4_features = edx;
}
}
x86_cpu_def->svm_features = -1;
}
| 1threat
|
git squash commits while retaining author's info : <p>My coworker (let's call him John here) and I work on a feature. and our working branch look like the following</p>
<pre><code>--o--o--o # this is develop branch
\ o--o--o # this is John's branch
\ / \
o----o--o--o--o--o--o # this is our cowork branch
\ /
o--o--o--o--o--o # this is my branch
</code></pre>
<p>We've finished our work and are ready to merge our cowork to develop branch.</p>
<p>At this point, there are a lot of commits in the cowork branch, which is not expected to be seen by other developers. So I want to squash those commits into one commit.</p>
<p>But after squashing (resolving some conflicts), I've found that the author info all direct to me, there is no John's info.</p>
<p>So my question here is that is there some way to retain both John's and my info while combining those commits together?</p>
| 0debug
|
static void lance_cleanup(NetClientState *nc)
{
PCNetState *d = qemu_get_nic_opaque(nc);
pcnet_common_cleanup(d);
}
| 1threat
|
error: expected expression in list of expressions [I'm extremely new pls help] : So, I am doing these little swift assignments to get better at Swift and the code:
class StringCaterpillar {
var bodyArray = ["h" , "e" , "l" , "l" , "o"]
func add(_ text:String) {
for text in 0...5 {
print([text])
} // this is line 30
}
func go() {
print(
}
}
Has one error.
The error is, as you can tell: "playground:30:5: Error: expected expression in list of expressions. Yes, I have not finished the 2nd function but I am just wondering if you guys could tell me where the error in this code is as well as what the overall concept of the error actually means.
Thank you!
| 0debug
|
static void cpu_notify_map_clients(void)
{
MapClient *client;
while (!LIST_EMPTY(&map_client_list)) {
client = LIST_FIRST(&map_client_list);
client->callback(client->opaque);
cpu_unregister_map_client(client);
}
}
| 1threat
|
int ff_j2k_dwt_init(DWTContext *s, uint16_t border[2][2], int decomp_levels, int type)
{
int i, j, lev = decomp_levels, maxlen,
b[2][2];
if (decomp_levels >= FF_DWT_MAX_DECLVLS)
return AVERROR_INVALIDDATA;
s->ndeclevels = decomp_levels;
s->type = type;
for (i = 0; i < 2; i++)
for(j = 0; j < 2; j++)
b[i][j] = border[i][j];
maxlen = FFMAX(b[0][1] - b[0][0],
b[1][1] - b[1][0]);
while(--lev >= 0){
for (i = 0; i < 2; i++){
s->linelen[lev][i] = b[i][1] - b[i][0];
s->mod[lev][i] = b[i][0] & 1;
for (j = 0; j < 2; j++)
b[i][j] = (b[i][j] + 1) >> 1;
}
}
if (type == FF_DWT97)
s->linebuf = av_malloc((maxlen + 12) * sizeof(float));
else if (type == FF_DWT53)
s->linebuf = av_malloc((maxlen + 6) * sizeof(int));
else
return -1;
if (!s->linebuf)
return AVERROR(ENOMEM);
return 0;
}
| 1threat
|
C# + selenium: loop for finding elements by classname and work with them : everybody!
I just started to learn Selenium WebDriver and I collided with a few issues.
I googled a lot, but it was unsuccessful.
So, I am going to write a parser of a website.
| 0debug
|
static av_always_inline int lcg_random(int previous_val)
{
return previous_val * 1664525 + 1013904223;
}
| 1threat
|
Why do nested MaybeT's cause exponential allocation : <p>I have a program. </p>
<pre><code>import Control.Monad
import Control.Monad.Identity
import Control.Monad.Trans.Maybe
import System.Environment
tryR :: Monad m => ([a] -> MaybeT m [a]) -> ([a] -> m [a])
tryR f x = do
m <- runMaybeT (f x)
case m of
Just t -> return t
Nothing -> return x
check :: MonadPlus m => Int -> m Int
check x = if x `mod` 2 == 0 then return (x `div` 2) else mzero
foo :: MonadPlus m => [Int] -> m [Int]
foo [] = return []
foo (x:xs) = liftM2 (:) (check x) (tryR foo xs)
runFoo :: [Int] -> [Int]
runFoo x = runIdentity $ tryR foo x
main :: IO ()
main = do
[n_str] <- getArgs
let n = read n_str :: Int
print $ runFoo [2,4..n]
</code></pre>
<p>The main interesting thing about this program is that it can have many nested layers of MaybeT's. Here, doing so serves absolutely no purpose, but it did in the original program where I encountered this problem.</p>
<p>Care to take a guess of the time complexity of this program?</p>
<p>Okay, you cheated by reading the title of this question. Yes, it's exponential:</p>
<pre><code>[jkoppel@dhcp-18-189-103-38:~/tmp]$ time ./ExpAlloc 50 (03-31 17:15)
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
./ExpAlloc 50 8.10s user 0.06s system 99% cpu 8.169 total
[jkoppel@dhcp-18-189-103-38:~/tmp]$ time ./ExpAlloc 52 (03-31 17:15)
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]
./ExpAlloc 52 16.10s user 0.12s system 99% cpu 16.227 total
[jkoppel@dhcp-18-189-103-38:~/tmp]$ time ./ExpAlloc 54 (03-31 17:16)
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27]
./ExpAlloc 54 32.32s user 0.23s system 99% cpu 32.561 total
</code></pre>
<p>Some further inspection shows the reason is because it allocates an exponential amount of memory, which naturally takes an exponential amount of time:</p>
<pre><code>[jkoppel@dhcp-18-189-103-38:~/tmp]$ time ./ExpAlloc 40 +RTS -s (03-31 17:17)
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
939,634,520 bytes allocated in the heap
5,382,816 bytes copied during GC
75,808 bytes maximum residency (2 sample(s))
66,592 bytes maximum slop
2 MB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 1796 colls, 0 par 0.008s 0.009s 0.0000s 0.0000s
Gen 1 2 colls, 0 par 0.000s 0.000s 0.0001s 0.0001s
INIT time 0.000s ( 0.000s elapsed)
MUT time 0.243s ( 0.246s elapsed)
GC time 0.008s ( 0.009s elapsed)
EXIT time 0.000s ( 0.000s elapsed)
Total time 0.252s ( 0.256s elapsed)
%GC time 3.2% (3.6% elapsed)
Alloc rate 3,869,930,149 bytes per MUT second
Productivity 96.8% of total user, 95.3% of total elapsed
./ExpAlloc 40 +RTS -s 0.25s user 0.00s system 98% cpu 0.260 total
[jkoppel@dhcp-18-189-103-38:~/tmp]$ time ./ExpAlloc 42 +RTS -s (03-31 17:17)
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]
1,879,159,424 bytes allocated in the heap
10,767,048 bytes copied during GC
95,504 bytes maximum residency (3 sample(s))
71,152 bytes maximum slop
2 MB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 3593 colls, 0 par 0.016s 0.018s 0.0000s 0.0000s
Gen 1 3 colls, 0 par 0.000s 0.000s 0.0001s 0.0001s
INIT time 0.000s ( 0.000s elapsed)
MUT time 0.493s ( 0.498s elapsed)
GC time 0.016s ( 0.018s elapsed)
EXIT time 0.000s ( 0.000s elapsed)
Total time 0.510s ( 0.517s elapsed)
%GC time 3.1% (3.5% elapsed)
Alloc rate 3,810,430,292 bytes per MUT second
Productivity 96.8% of total user, 95.7% of total elapsed
./ExpAlloc 42 +RTS -s 0.51s user 0.01s system 99% cpu 0.521 total
[jkoppel@dhcp-18-189-103-38:~/tmp]$ time ./ExpAlloc 44 +RTS -s (03-31 17:17)
[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22]
3,758,208,408 bytes allocated in the heap
21,499,312 bytes copied during GC
102,056 bytes maximum residency (5 sample(s))
73,784 bytes maximum slop
2 MB total memory in use (0 MB lost due to fragmentation)
Tot time (elapsed) Avg pause Max pause
Gen 0 7186 colls, 0 par 0.032s 0.037s 0.0000s 0.0009s
Gen 1 5 colls, 0 par 0.000s 0.001s 0.0001s 0.0001s
INIT time 0.000s ( 0.000s elapsed)
MUT time 0.979s ( 0.987s elapsed)
GC time 0.033s ( 0.038s elapsed)
EXIT time 0.000s ( 0.000s elapsed)
Total time 1.013s ( 1.024s elapsed)
%GC time 3.2% (3.7% elapsed)
Alloc rate 3,840,757,815 bytes per MUT second
Productivity 96.7% of total user, 95.6% of total elapsed
./ExpAlloc 44 +RTS -s 1.01s user 0.01s system 99% cpu 1.029 total
</code></pre>
<p>I cannot for the life of me figure out why it does this. I'd appreciate any light people could shed on the situation.</p>
| 0debug
|
How to make if statement to check whether a R package is installed or not in R : <p>I am trying to make a personal R-function.</p>
<p>I want add if statement which can check whether essential R packages are installed.</p>
<p>I used exist() function but its purpose is to examine existence of an object
so it didn't work.</p>
<p>Is there a basic command for checking existence of a specific R-package in R?</p>
<p>Thx</p>
| 0debug
|
Check if a Set of tuples contains a Set of 2 elements : Given these two collections :
val countrys = Set(("Paris","France"),("Berlin","Germany"),("Madrid","Spain"))
val values = Set("Paris","France")
How can I check if `countrys` contains `values` ?
| 0debug
|
How to correctly get layer weights from Conv2D in keras? : <p>I have Conv2D layer defines as: <br></p>
<pre><code>Conv2D(96, kernel_size=(5, 5),
activation='relu',
input_shape=(image_rows, image_cols, 1),
kernel_initializer=initializers.glorot_normal(seed),
bias_initializer=initializers.glorot_uniform(seed),
padding='same',
name='conv_1')
</code></pre>
<p>This is the first layer in my network. <br>
Input dimensions are 64 by 160, image is 1 channel. <br>
I am trying to visualize weights from this convolutional layer but not sure how to get them. <br>
Here is how I am doing this now: <br></p>
<p>1.Call</p>
<pre><code>layer.get_weights()[0]
</code></pre>
<p>This returs an array of shape (5, 5, 1, 96). 1 is because images are 1-channel.<br></p>
<p>2.Take 5 by 5 filters by</p>
<pre><code>layer.get_weights()[0][:,:,:,j][:,:,0]
</code></pre>
<p>Very ugly but I am not sure how to simplify this, any comments are very appreciated. <br></p>
<p>I am not sure in these 5 by 5 squares. Are they filters actually? <br>
If not could anyone please tell how to correctly grab filters from the model?<br></p>
| 0debug
|
Get a clan error when compiling a SIMPLE C program using GCC under my mac book pro : i just write a simple c program as follows:
int main(int argc, char *argv[])
{ return argc; }
However, when I compile and link the program, I encounter a Clang error. What's up with the setting or gcc?
LB:test liangbin$ gcc ./src/test_main.c -o ./obj/test_main.o
LB:test liangbin$ gcc ./obj/test_main.o -o ./bin/test_main
ld: can't link with a main executable file './obj/test_main.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)*
[enter image description here][1]
[1]: https://i.stack.imgur.com/pNY95.jpg
| 0debug
|
.on() doesn't work properly with dynamic content : <p>I have a simple js script which gets backgrounds of the following elements:
<div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code> <ul class="vk_image_grid">
<li style="background-image: url(https://name.com/image1.jpg)" class="block">
</li>
<li style="background-image: url(https://name.com/image2.jpg)" class="block">
</li>
<li style="background-image: url(https://name.com/image3.jpg)" class="block">
</li>
</ul>
<script>
$("ul li").on( "click", function() {
var bg = $(this).css('background-image');
alert(bg);
</script></code></pre>
</div>
</div>
</p>
<p>It works perfectly with the first two <code>li</code> which are generated by php. But it doesn't show the background of the third <code>li</code> which is generateed by another jQuery script. How can I fix the issue?</p>
| 0debug
|
Insert Data to Excel from SQL Table using bystored procedure : I would like to insert a data from SQL Table to Excel sheet everyday using by stored procedure.. It has to be delete the datas in excel and insert again the new datas to same sheet again for everyday..
How I am gonna do that ?
| 0debug
|
static bool memory_region_get_may_overlap(Object *obj, Error **errp)
{
MemoryRegion *mr = MEMORY_REGION(obj);
return mr->may_overlap;
}
| 1threat
|
VS2015: Compiling doesn't work? : The visual studio I use displays ' cannot start debugging bcuz the debug target is missing. Pls build the project and retry, or set the outputpath and AssemblyName appropriately to point at the correct location for the target assembly'.
Am new to programming, n I can't seem 2 understand what this means.Thanks 4 assisting me
| 0debug
|
static void range_merge(Range *range1, Range *range2)
{
if (range1->end < range2->end) {
range1->end = range2->end;
}
if (range1->begin > range2->begin) {
range1->begin = range2->begin;
}
}
| 1threat
|
PDO Connection established but not inserted in Cakephp.. Plz Help this : I am trying to insert the values into the table through controller in Cakephp. I've tested first.. It says db connected succesfully. but i've inserted something into the table using PDO by prepared statement it show the error like "Error: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound".
Here is my table structure:
CREATE TABLE IF NOT EXISTS `test` (
`id` int(10) unsigned NOT NULL,
`name` varchar(255) NOT NULL,
`job` varchar(255) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
The function i mentioned in my controller is,
public function insdb() {
$sqlInsert = $this->User->query("INSERT INTO `test` (`name`, `job`) VALUES (:name1,:job1)");
$preparedStatement = $conn->prepare($sqlInsert);
$preparedStatement->User->execute(array(':name1' => 'Tony', ':job1' => 'gardner'));
}
| 0debug
|
How to add roles to nodes in Kubernetes? : <p>When I provision a Kubernetes cluster using kubeadm and I get my nodes tagged as none. It's a know bug in Kubernetes and currently a PR is in-progress. However, I would like to know if there is an option to add a Role name manually for the node?</p>
<pre><code>root@ip-172-31-14-133:~# kubectl get nodes
NAME STATUS ROLES AGE VERSION
ip-172-31-14-133 Ready master 19m v1.9.3
ip-172-31-6-147 Ready <none> 16m v1.9.3
</code></pre>
| 0debug
|
static void test_dynamic_globalprop(void)
{
g_test_trap_subprocess("/qdev/properties/dynamic/global/subprocess", 0, 0);
g_test_trap_assert_passed();
g_test_trap_assert_stderr_unmatched("*prop1*");
g_test_trap_assert_stderr_unmatched("*prop2*");
g_test_trap_assert_stderr("*Warning: \"-global dynamic-prop-type-bad.prop3=103\" not used\n*");
g_test_trap_assert_stderr_unmatched("*prop4*");
g_test_trap_assert_stderr("*Warning: \"-global nohotplug-type.prop5=105\" not used\n*");
g_test_trap_assert_stderr("*Warning: \"-global nondevice-type.prop6=106\" not used\n*");
g_test_trap_assert_stdout("");
}
| 1threat
|
Memory limit in jupyter notebook : <p>How do I set a maximum memory limit for a jupyter notebook process? </p>
<p>If I use too much RAM the computer gets blocked and I have to press the power button to restart the computer manually.</p>
<p>Is there a way of automatically killing a jupyter notebook process as soon as a user-set memory limit is surpassed or to throw a memory error? Thanks</p>
| 0debug
|
def remove_nested(test_tup):
res = tuple()
for count, ele in enumerate(test_tup):
if not isinstance(ele, tuple):
res = res + (ele, )
return (res)
| 0debug
|
static void vnc_write(VncState *vs, const void *data, size_t len)
{
buffer_reserve(&vs->output, len);
if (buffer_empty(&vs->output)) {
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, vnc_client_write, vs);
}
buffer_append(&vs->output, data, len);
}
| 1threat
|
Regex for matching a character without leading and trailing spaces : <p>How to find regex for matching a character without leading and trailing spaces<br/>
Example : "This is a sample String"
Need a regex for capturing character "a" like.<br/><br/>
This is a s<strong>a</strong>mple String.</p>
<p>Thanks</p>
| 0debug
|
c++ program that returns half of an object : <p>I am new to c++ and learning it. I am writing a simple program that returns half of an object. My code looks something like</p>
<pre><code>#include<iostream>
#include<string>
using namespace std;
template <class T>
double half(int x)
{
double h = x / 2;
return h;
}
class TuitionBill
{
friend ostream& operator+(ostream, TuitionBill);
private:
string student;
double amount;
public:
TuitionBill(string, double);
double operator/(int);
};
TuitionBill::TuitionBill(string student, double amt)
{
student = student;
amount = amt;
}
double TuitionBill::operator+(int factor)
{
double half = amount / factor;
return half;
}
ostream& operator+(ostream& o, TuitionBill& t)
{
o << t.student << " Tuition: $" << t.amount << endl;
return o;
}
int main()
{
int a = 47;
double b = 39.25;
TuitionBill tb("Smith", 4000.00);
cout << "Half of " << a << " is " << half(a) << endl;
cout << "Half of " << b << " is " << half(b) << endl;
cout << "Half of " << tb << " is " << half(tb) << endl;
return 0;
}
</code></pre>
<p>What is wrong in here? I want to learn this program. Can anyone guide me through this ? I want to use template function here.</p>
| 0debug
|
I want to develop my own Dat Grid View for Win Form : <p>i want to develop my own data grid for Win From from scratch.
Data grid with features like
Grouping
sorting
filtering
adding text row
adding subtotal in between rows</p>
<p>I have tried using custom control but it becomes too slow when i add grouping and sorting and designing features</p>
<p>Now i am finding a way to design my own control.
In which basic language the win form controls are made.
like telerik dev express ? in which language these controls are made?</p>
| 0debug
|
Join two tables using a medicore relational table : <p>I have three tables</p>
<p>table1</p>
<p><a href="https://i.stack.imgur.com/Q4TJW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q4TJW.png" alt="enter image description here"></a></p>
<p>table2</p>
<p><a href="https://i.stack.imgur.com/XudWX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XudWX.png" alt="enter image description here"></a></p>
<p>table3 (This is the relational table of table1 and table 2)</p>
<p><a href="https://i.stack.imgur.com/7Ebsk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Ebsk.png" alt="enter image description here"></a></p>
<p>How can I join table1 and table2 using table3 ? I need the following output</p>
<p>What will be the sql?</p>
<p><a href="https://i.stack.imgur.com/mt40n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mt40n.png" alt="enter image description here"></a></p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.