problem
stringlengths
26
131k
labels
class label
2 classes
Picturerbox dispose causing the picturebox invisible : I would like to knw when i put pictureBox1.Dispose (), the picturebox becomes invisible. Is there any ways which I could allow the picturebox stays with is being Dispose
0debug
Trying to append List/array based on condition : <p>I'm trying to add to an array based on a condition. Can someone clarify why the if statement isn't working as I intend it to? </p> <pre><code>all_staff = ["Judith", "Harry", "Jonathan", "Reuben"] new_staff = [] def person_finder(staff): for x in staff: if x == "Reuben" or "Harry" or "Jonathan": new_staff.append(x) else: continue return new_staff selected = person_finder(all_staff) def the_men(people): for x in people: print(x + " is a man") the_men(selected) </code></pre> <p>This returns:</p> <p>Judith is a man</p>
0debug
Programmatically capture Chrome Async Javascript stack trace : <p>I've been working on trying to add some better error logging to a web application that is only run on Chrome. In essence, I want to be able to capture and store stack traces. For synchronous code, this works fine, but for async code, I've run into something a tad strange. Essentially, Chrome appears to log additional information as part of its async stack trace feature, but I haven't been able to figure out how to capture it.</p> <p>Code, to run in Chrome browser console:</p> <pre><code>let e; let a = () =&gt; Promise.resolve(null) .then(() =&gt; (null).foo) .catch(err =&gt; { console.info(err); console.error(err); e = err; }) let b = () =&gt; a(); let c = () =&gt; b(); c(); </code></pre> <p>Output:</p> <pre><code>(info) TypeError: Cannot read property 'foo' of null at &lt;anonymous&gt;:3:20 (error, after expanding) TypeError: Cannot read property 'foo' of null at &lt;anonymous&gt;:3:20 (anonymous) @ VM1963:6 Promise.catch (async) a @ VM1963:4 b @ VM1963:9 c @ VM1963:10 (anonymous) @ VM1963:11 </code></pre> <p>So <code>console.error</code> gives me a stack trace threaded all the way through the callstack, presumably through some form of Chrome engine magick. <code>console.info</code> gives me the actual stack trace that's stored on <code>err</code>. If after this is all done I attempt to read the value of <code>e</code>, its stack is the two lines I get from the <code>console.info</code> statement, not the <code>console.error</code> statement.</p> <p>What I'm asking is, is there any way to capture and store the async stack trace that Chrome is generating and using when I call <code>console.error</code>?</p>
0debug
Your project exceeded quota for free storage for projects : we've started to get an error while querying error={"location":"free.stor age","message":"Quota exceeded: Your project exceeded quota for free storage for projects. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors","reason":"quotaExceeded"}) But I can't find any info about "quota fo free storage" What exactly the quota is about?
0debug
Why does selecting column(s) from a data.table results in a copy? : <p>It appears that selecting column(s) from the data.table with <code>[.data.table</code> results in a copy of the underlying vector(s). I am talking about very simple column selection, by name, there are no expressions to compute in <code>j</code> and there are no rows to subset in <code>i</code>. Even more strangely, the column subsetting in a data.frame appears to not make any copies. I am using the data.table version data.table 1.10.4. A simple example with details and benchmarks is provided below. My questions are:</p> <ul> <li>Am I doing something wrong? </li> <li>Is this a bug or is this the intended behavior? </li> <li>If this is intended, what is the best approach to subset a data.table by columns and avoid extra copy? </li> </ul> <p>The intended use-case involves large dataset, so avoiding extra copies is a must (especially since base R seems to already support this).</p> <pre><code>library(data.table) set.seed(12345) cpp_dt &lt;- data.table(a = runif(1e6), b = rnorm(1e6), c = runif(1e6)) cols=c("a","c") ## naive / data.frame style of column selection ## leads to a copy of the column vectors in cols subset_cols_1=function(dt,cols){ return(dt[,cols,with=F]) } ## alternative syntax, still results in a copy subset_cols_2=function(dt,cols){ return(dt[,..cols]) } ## work-around that uses data.frame column selection, ## appears to avoid the copy subset_cols_3=function(dt,cols){ setDF(dt) subset=dt[,cols] setDT(subset) setDT(dt) return(subset) } ## another approach that makes a "shallow" copy of the data.table ## then NULLs the not needed columns by reference ## appears to also avoid the copy subset_cols_4=function(dt,cols){ subset=dt[TRUE] other_cols=setdiff(names(subset),cols) set(subset,j=other_cols,value=NULL) return(subset) } subset_1=subset_cols_1(cpp_dt,cols) subset_2=subset_cols_2(cpp_dt,cols) subset_3=subset_cols_3(cpp_dt,cols) subset_4=subset_cols_4(cpp_dt,cols) </code></pre> <p>Now lets look at the memory allocation and compare to original data.</p> <pre><code>.Internal(inspect(cpp_dt)) # original data, keep an eye on 1st and 3d vector # @7fe8ba278800 19 VECSXP g1c7 [OBJ,MARK,NAM(2),ATT] (len=3, tl=1027) # @10e2ce000 14 REALSXP g1c7 [MARK,NAM(2)] (len=1000000, tl=0) 0.720904,0.875773,0.760982,0.886125,0.456481,... # @10f1a3000 14 REALSXP g1c7 [MARK,NAM(2)] (len=1000000, tl=0) -0.947317,-0.636669,0.167872,-0.206986,0.411445,... # @10f945000 14 REALSXP g1c7 [MARK,NAM(2)] (len=1000000, tl=0) 0.717611,0.95416,0.191546,0.48525,0.539878,... # ATTRIB: [removed] </code></pre> <p>Using <code>[.data.table</code> method to subset the columns:</p> <pre><code>.Internal(inspect(subset_1)) # looks like data.table is making a copy # @7fe8b9f3b800 19 VECSXP g0c7 [OBJ,NAM(1),ATT] (len=2, tl=1026) # @114cb0000 14 REALSXP g0c7 [MARK,NAM(2)] (len=1000000, tl=0) 0.720904,0.875773,0.760982,0.886125,0.456481,... # @1121ca000 14 REALSXP g0c7 [NAM(2)] (len=1000000, tl=0) 0.717611,0.95416,0.191546,0.48525,0.539878,... # ATTRIB: [removed] </code></pre> <p>Another syntax version that still uses <code>[.data.table</code> and still making a copy:</p> <pre><code>.Internal(inspect(subset_2)) # same, still copy # @7fe8b6402600 19 VECSXP g0c7 [OBJ,NAM(1),ATT] (len=2, tl=1026) # @115452000 14 REALSXP g0c7 [NAM(2)] (len=1000000, tl=0) 0.720904,0.875773,0.760982,0.886125,0.456481,... # @1100e7000 14 REALSXP g0c7 [NAM(2)] (len=1000000, tl=0) 0.717611,0.95416,0.191546,0.48525,0.539878,... # ATTRIB: [removed] </code></pre> <p>Using a sequence of <code>setDF</code>, followed by <code>[.data.frame</code> and <code>setDT</code>. Look, the vectors <code>a</code> and <code>c</code> are no longer copied! It appears that base R method is more efficient / has smaller memory footprint?</p> <pre><code>.Internal(inspect(subset_3)) # "[.data.frame" is not making a copy!! # @7fe8b633f400 19 VECSXP g0c7 [OBJ,NAM(2),ATT] (len=2, tl=1026) # @10e2ce000 14 REALSXP g1c7 [MARK,NAM(2)] (len=1000000, tl=0) 0.720904,0.875773,0.760982,0.886125,0.456481,... # @10f945000 14 REALSXP g1c7 [MARK,NAM(2)] (len=1000000, tl=0) 0.717611,0.95416,0.191546,0.48525,0.539878,... # ATTRIB: [removed] </code></pre> <p>Another approach is to make a shallow copy of the data.table, then NULL all the extra columns by reference in the new data.table. Again no copies are made.</p> <pre><code>.Internal(inspect(subset_4)) # 4th approach seems to also avoid the copy # @7fe8b924d800 19 VECSXP g0c7 [OBJ,NAM(2),ATT] (len=2, tl=1027) # @10e2ce000 14 REALSXP g1c7 [MARK,NAM(2)] (len=1000000, tl=0) 0.720904,0.875773,0.760982,0.886125,0.456481,... # @10f945000 14 REALSXP g1c7 [MARK,NAM(2)] (len=1000000, tl=0) 0.717611,0.95416,0.191546,0.48525,0.539878,... # ATTRIB: [removed] </code></pre> <p>Now lets look at the benchmarks of these four approaches. It looks like "[.data.frame" (<code>subset_cols_3</code>) is a clear winner.</p> <pre><code>microbenchmark({subset_cols_1(cpp_dt,cols)}, {subset_cols_2(cpp_dt,cols)}, {subset_cols_3(cpp_dt,cols)}, {subset_cols_4(cpp_dt,cols)}, times=100) # Unit: microseconds # expr min lq mean median uq max neval # { subset_cols_1(cpp_dt, cols) } 4772.092 5128.7395 8956.7398 7149.447 10189.397 53117.358 100 # { subset_cols_2(cpp_dt, cols) } 4705.383 5107.1690 8977.1816 6680.666 9206.164 53523.191 100 # { subset_cols_3(cpp_dt, cols) } 148.659 177.9595 285.4926 250.620 283.414 4422.968 100 # { subset_cols_4(cpp_dt, cols) } 193.912 241.9010 531.8308 336.467 384.844 20061.864 100 </code></pre>
0debug
Is there a quick way to check if there is at least one integer in a list in Python? : <p>I feel like there is definitely a quick way to check it, instead of having to loop through the entire list.</p>
0debug
How can I test gitlab-ci.yml? : <p>I've finally manage to make it work so that when you push to a branch job would launch, but I keep waiting for it to launch around 3min and then I've got errors which I need to fix and then commit again, and then waiting again. How can I just ssh to that public runner and test .gitlab-ci.yml "script" part just in the bash? </p>
0debug
static int request_frame(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; TrimContext *s = ctx->priv; int ret; s->got_output = 0; while (!s->got_output) { if (s->eof) return AVERROR_EOF; ret = ff_request_frame(ctx->inputs[0]); if (ret < 0) return ret; } return 0; }
1threat
Postgresql... How to find current timezone EST or EDT, I am doing it But expecting simple solution for all timzone., : Postgresql... How to find current timezone EST or EDT, I am doing it But expecting a simple solution for all timezone., Exact requirements: if I gave ET as local timezone I need current timezone with daylight. SELECT (CASE WHEN ((CURRENT_TIMESTAMP AT TIME ZONE 'America/New_York') - CURRENT_TIMESTAMP = '-04:00:00') then 'EDT' WHEN ((CURRENT_TIMESTAMP AT TIME ZONE 'America/New_York') - CURRENT_TIMESTAMP = '-05:00:00') then 'EST' ELSE ('OTH') END)
0debug
flat file source with no line feed or carriage return. : I have a flat file source with no line feed or carriage return. There is five character string, #@#@#, meaning that it is end of line.i.e, abc|def|123#@#@#xyz|tuv|567#@#@# .....I need to process this file thru informatica, but i believe i can not set the row delimiter with that five character string..I need to write a batch script(.bat) to replace all occurences of that string with a line feed character. I have searched a lot,and yet to find any result.Anyone know how i can handle it
0debug
static int filter_frame(AVFilterLink *link, AVFrame *in) { AVFilterContext *ctx = link->dst; AVFilterLink *outlink = ctx->outputs[0]; ColorSpaceContext *s = ctx->priv; AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h); int res; ptrdiff_t rgb_stride = FFALIGN(in->width * sizeof(int16_t), 32); unsigned rgb_sz = rgb_stride * in->height; struct ThreadData td; if (!out) { av_frame_free(&in); return AVERROR(ENOMEM); } av_frame_copy_props(out, in); out->color_primaries = s->user_prm == AVCOL_PRI_UNSPECIFIED ? default_prm[FFMIN(s->user_all, CS_NB)] : s->user_prm; if (s->user_trc == AVCOL_TRC_UNSPECIFIED) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(out->format); out->color_trc = default_trc[FFMIN(s->user_all, CS_NB)]; if (out->color_trc == AVCOL_TRC_BT2020_10 && desc && desc->comp[0].depth >= 12) out->color_trc = AVCOL_TRC_BT2020_12; } else { out->color_trc = s->user_trc; } out->colorspace = s->user_csp == AVCOL_SPC_UNSPECIFIED ? default_csp[FFMIN(s->user_all, CS_NB)] : s->user_csp; out->color_range = s->user_rng == AVCOL_RANGE_UNSPECIFIED ? in->color_range : s->user_rng; if (rgb_sz != s->rgb_sz) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(out->format); int uvw = in->width >> desc->log2_chroma_w; av_freep(&s->rgb[0]); av_freep(&s->rgb[1]); av_freep(&s->rgb[2]); s->rgb_sz = 0; av_freep(&s->dither_scratch_base[0][0]); av_freep(&s->dither_scratch_base[0][1]); av_freep(&s->dither_scratch_base[1][0]); av_freep(&s->dither_scratch_base[1][1]); av_freep(&s->dither_scratch_base[2][0]); av_freep(&s->dither_scratch_base[2][1]); s->rgb[0] = av_malloc(rgb_sz); s->rgb[1] = av_malloc(rgb_sz); s->rgb[2] = av_malloc(rgb_sz); s->dither_scratch_base[0][0] = av_malloc(sizeof(*s->dither_scratch_base[0][0]) * (in->width + 4)); s->dither_scratch_base[0][1] = av_malloc(sizeof(*s->dither_scratch_base[0][1]) * (in->width + 4)); s->dither_scratch_base[1][0] = av_malloc(sizeof(*s->dither_scratch_base[1][0]) * (uvw + 4)); s->dither_scratch_base[1][1] = av_malloc(sizeof(*s->dither_scratch_base[1][1]) * (uvw + 4)); s->dither_scratch_base[2][0] = av_malloc(sizeof(*s->dither_scratch_base[2][0]) * (uvw + 4)); s->dither_scratch_base[2][1] = av_malloc(sizeof(*s->dither_scratch_base[2][1]) * (uvw + 4)); s->dither_scratch[0][0] = &s->dither_scratch_base[0][0][1]; s->dither_scratch[0][1] = &s->dither_scratch_base[0][1][1]; s->dither_scratch[1][0] = &s->dither_scratch_base[1][0][1]; s->dither_scratch[1][1] = &s->dither_scratch_base[1][1][1]; s->dither_scratch[2][0] = &s->dither_scratch_base[2][0][1]; s->dither_scratch[2][1] = &s->dither_scratch_base[2][1][1]; if (!s->rgb[0] || !s->rgb[1] || !s->rgb[2] || !s->dither_scratch_base[0][0] || !s->dither_scratch_base[0][1] || !s->dither_scratch_base[1][0] || !s->dither_scratch_base[1][1] || !s->dither_scratch_base[2][0] || !s->dither_scratch_base[2][1]) { uninit(ctx); return AVERROR(ENOMEM); } s->rgb_sz = rgb_sz; } res = create_filtergraph(ctx, in, out); if (res < 0) return res; s->rgb_stride = rgb_stride / sizeof(int16_t); td.in = in; td.out = out; td.in_linesize[0] = in->linesize[0]; td.in_linesize[1] = in->linesize[1]; td.in_linesize[2] = in->linesize[2]; td.out_linesize[0] = out->linesize[0]; td.out_linesize[1] = out->linesize[1]; td.out_linesize[2] = out->linesize[2]; td.in_ss_h = av_pix_fmt_desc_get(in->format)->log2_chroma_h; td.out_ss_h = av_pix_fmt_desc_get(out->format)->log2_chroma_h; if (s->yuv2yuv_passthrough) { av_frame_copy(out, in); } else { ctx->internal->execute(ctx, convert, &td, NULL, FFMIN((in->height + 1) >> 1, ctx->graph->nb_threads)); } av_frame_free(&in); return ff_filter_frame(outlink, out); }
1threat
How to free up all memory pytorch is taken from gpu memory : <p>I have some kind of high level code, so model training and etc. are wrapped by <code>pipeline_network</code> class. My main goal is to train new model every new fold.</p> <pre><code>for train_idx, valid_idx in cv.split(meta_train[DEPTH_COLUMN].values.reshape(-1)): meta_train_split, meta_valid_split = meta_train.iloc[train_idx], meta_train.iloc[valid_idx] pipeline_network = unet(config=CONFIG, suffix = 'fold' + str(fold), train_mode=True) </code></pre> <p>But then I move on to 2nd fold everything fails out of gpu memory:</p> <pre><code>RuntimeError: cuda runtime error (2) : out of memory at /pytorch/torch/lib/THC/generic/THCStorage.cu:58 </code></pre> <p>At the end of epoch I tried to manually delete that pipeline with no luck: </p> <pre><code> def clean_object_from_memory(obj): #definition del obj gc.collect() torch.cuda.empty_cache() clean_object_from_memory( clean_object_from_memory) # calling </code></pre> <p>Calling this didn't help as well:</p> <pre><code>def dump_tensors(gpu_only=True): torch.cuda.empty_cache() total_size = 0 for obj in gc.get_objects(): try: if torch.is_tensor(obj): if not gpu_only or obj.is_cuda: del obj gc.collect() elif hasattr(obj, "data") and torch.is_tensor(obj.data): if not gpu_only or obj.is_cuda: del obj gc.collect() except Exception as e: pass </code></pre> <p>How can reset pytorch then I move on to the next fold?</p>
0debug
static int local_lstat(FsContext *ctx, const char *path, struct stat *stbuf) { return lstat(rpath(ctx, path), stbuf); }
1threat
static void free_drive(DeviceState *dev, Property *prop) { DriveInfo **ptr = qdev_get_prop_ptr(dev, prop); if (*ptr) { blockdev_auto_del((*ptr)->bdrv); } }
1threat
How to draw line in OpenGL ES 2.0 on Android? : <br> I am new to OpneGL ES 2.0. I have read some articles about it and successes to draw triangle shape android program. Now I want to write simple app to draw a sin wave by this 10 points: {-3.14, -0.00159265}, {-2.826, -0.31038}, {-2.512, -0.588816}, {-2.198, -0.809672}, {-1.884, -0.951351}, {-1.57, -1.}, {-1.256, -0.950859}, {-0.942, -0.808736}, {-0.628, -0.587528}, {-0.314, -0.308866}, {4.44089*10^-16, 4.44089*10^-16}, {0.314, 0.308866}, {0.628, 0.587528}, {0.942, 0.808736}, {1.256,0.950859}, {1.57, 1.}, {1.884, 0.951351}, {2.198, 0.809672}, {2.512,0.588816}, {2.826, 0.31038}, {3.14, 0.00159265} I have created my main Activity class: public class MainActivity extends Activity { private GLSurfaceView surface; public void onCreate(Bundle bundle) { super.onCreate(bundle); surface = new GLSurfaceView(this); surface.setEGLContextClientVersion(2); surface.setRenderer(new Renderer()); setContentView(surface); } public void onPause(){ super.onPause(); surface.onPause(); } public void onResume() { super.onResume(); surface.onResume(); } } Would you please help me what should be Renderer and Line Classes in OpenGL ES 20 on Android.<br> Thanks a lot
0debug
static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) { int addr_reg, r0, r1, data_reg, data_reg2, bswap, rbase; #ifdef CONFIG_SOFTMMU int mem_index, r2, addr_reg2; uint8_t *label_ptr; #endif data_reg = *args++; if (opc == 3) data_reg2 = *args++; else data_reg2 = 0; addr_reg = *args++; #ifdef CONFIG_SOFTMMU #if TARGET_LONG_BITS == 64 addr_reg2 = *args++; #else addr_reg2 = 0; #endif mem_index = *args; r0 = 3; r1 = 4; r2 = 0; rbase = 0; tcg_out_tlb_check ( s, r0, r1, r2, addr_reg, addr_reg2, opc & 3, offsetof (CPUArchState, tlb_table[mem_index][0].addr_write), offsetof (CPUTLBEntry, addend) - offsetof (CPUTLBEntry, addr_write), &label_ptr ); #else r0 = addr_reg; r1 = 3; rbase = GUEST_BASE ? TCG_GUEST_BASE_REG : 0; #endif #ifdef TARGET_WORDS_BIGENDIAN bswap = 0; #else bswap = 1; #endif switch (opc) { case 0: tcg_out32 (s, STBX | SAB (data_reg, rbase, r0)); break; case 1: if (bswap) tcg_out32 (s, STHBRX | SAB (data_reg, rbase, r0)); else tcg_out32 (s, STHX | SAB (data_reg, rbase, r0)); break; case 2: if (bswap) tcg_out32 (s, STWBRX | SAB (data_reg, rbase, r0)); else tcg_out32 (s, STWX | SAB (data_reg, rbase, r0)); break; case 3: if (bswap) { tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4); tcg_out32 (s, STWBRX | SAB (data_reg, rbase, r0)); tcg_out32 (s, STWBRX | SAB (data_reg2, rbase, r1)); } else { #ifdef CONFIG_USE_GUEST_BASE tcg_out32 (s, STWX | SAB (data_reg2, rbase, r0)); tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4); tcg_out32 (s, STWX | SAB (data_reg, rbase, r1)); #else tcg_out32 (s, STW | RS (data_reg2) | RA (r0)); tcg_out32 (s, STW | RS (data_reg) | RA (r0) | 4); #endif } break; } #ifdef CONFIG_SOFTMMU add_qemu_ldst_label (s, 0, opc, data_reg, data_reg2, addr_reg, addr_reg2, mem_index, s->code_ptr, label_ptr); #endif }
1threat
how do i get a code to write in a single line as output? : 1 2 3 4 2 2 3 4 3 2 3 4, how to write a code if a variable is a list of numbers 1-4 and another variable is no of times it needs to repeat. in this case x = [1,2,3,4] and y = 3 i have already tried to loop it for measures times and adding 1 to first number but cannot add them in a single line > beats_per_measure = 4 measures = 5 for a in range(0, measures): > x = str(a + 1) > for i in range(2, beats_per_measure + 1): > y= x + str(i) > print(y) you should replace the #number 1 with the number of the current measure. So, the first #number in each measure will always rise. like for first measure it reads 1234 and for second it reads 2234 and so on, all printed in a single line
0debug
void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS]) { int i; int w_align= 1; int h_align= 1; switch(s->pix_fmt){ case PIX_FMT_YUV420P: case PIX_FMT_YUYV422: case PIX_FMT_UYVY422: case PIX_FMT_YUV422P: case PIX_FMT_YUV440P: case PIX_FMT_YUV444P: case PIX_FMT_GBRP: case PIX_FMT_GRAY8: case PIX_FMT_GRAY16BE: case PIX_FMT_GRAY16LE: case PIX_FMT_YUVJ420P: case PIX_FMT_YUVJ422P: case PIX_FMT_YUVJ440P: case PIX_FMT_YUVJ444P: case PIX_FMT_YUVA420P: case PIX_FMT_YUVA444P: case PIX_FMT_YUV420P9LE: case PIX_FMT_YUV420P9BE: case PIX_FMT_YUV420P10LE: case PIX_FMT_YUV420P10BE: case PIX_FMT_YUV422P9LE: case PIX_FMT_YUV422P9BE: case PIX_FMT_YUV422P10LE: case PIX_FMT_YUV422P10BE: case PIX_FMT_YUV444P9LE: case PIX_FMT_YUV444P9BE: case PIX_FMT_YUV444P10LE: case PIX_FMT_YUV444P10BE: case PIX_FMT_GBRP9LE: case PIX_FMT_GBRP9BE: case PIX_FMT_GBRP10LE: case PIX_FMT_GBRP10BE: w_align = 16; h_align = 16 * 2; break; case PIX_FMT_YUV411P: case PIX_FMT_UYYVYY411: w_align=32; h_align=8; break; case PIX_FMT_YUV410P: if(s->codec_id == CODEC_ID_SVQ1){ w_align=64; h_align=64; } case PIX_FMT_RGB555: if(s->codec_id == CODEC_ID_RPZA){ w_align=4; h_align=4; } case PIX_FMT_PAL8: case PIX_FMT_BGR8: case PIX_FMT_RGB8: if(s->codec_id == CODEC_ID_SMC){ w_align=4; h_align=4; } break; case PIX_FMT_BGR24: if((s->codec_id == CODEC_ID_MSZH) || (s->codec_id == CODEC_ID_ZLIB)){ w_align=4; h_align=4; } break; default: w_align= 1; h_align= 1; break; } if(s->codec_id == CODEC_ID_IFF_ILBM || s->codec_id == CODEC_ID_IFF_BYTERUN1){ w_align= FFMAX(w_align, 8); } *width = FFALIGN(*width , w_align); *height= FFALIGN(*height, h_align); if (s->codec_id == CODEC_ID_H264) *height+=2; for (i = 0; i < 4; i++) linesize_align[i] = STRIDE_ALIGN; }
1threat
Oracle Stored Procedure to use another Schema's views : <p>I'm writing a Stored Procedure to automate a task, and in one of the steps I need to Select data from a view that's in another user's schema.</p> <p>I can query the data from that View outside the Stored Procedure but apparently not in a SP under my schema. </p> <p>Is this by design or am I missing something? Are there any workarounds?</p> <p>Thanks</p>
0debug
Error loading css when updating user record rails : I am using devise for authentication on a client app. After extensive reading of the wiki, I managed to configure my app to suit my needs properly. However I have a css loading problem. I chose the option of allowing an admin approve an account over `:confirmable` as I am not familiar with combining both `:confirmable` and approving the account. I followed [this][1] links instruction to do just that and [this link][2] to help with configuring my `routes.rb` file when updating the attribute. The issue now is, when I click the link to update the attribute, it does so flawlessly but the path for finding css after redirecting back changes. To clarify what I mean, let's say my css file is in public/user/mycss.css, when I sign in with devise, it loads properly but upon clicking the link_to tag it updates the record, but looks for mycss.css via `users/:id/approve/mycss.css` which doesnt exist(with reference to second link). I would be glad if someone could help me figure out why it's looking for the css file via that path. If there is anything I am doing wrong, I am ready to learn and benefit from it because I am fairly new to devise. [1]: https://github.com/plataformatec/devise/wiki/How-To:-Require-admin-to-activate-account-before-sign_in [2]: http://stackoverflow.com/questions/15329041/browser-based-new-user-approval-by-admin-in-rails-3-2-app-using-devise
0debug
i need to use the value of i outside of the loop : for(int i = 0 ; i < Tri.length; i++) for(int v = 1; v < Tri.length;v++) { boolean plz= Tri[i].compareColors(Tri[v]); if(v==i) continue; if(plz == true ) System.out.println("Trinagle " + i + " is equal to Triangle "+ v+ " "+ plz); } i need to use the value of i outside of the loop.Currently the print statement is being looped 21 X more than what i need. Is there any way i can access 'i' with having all my code in a for loop
0debug
static av_cold int msvideo1_decode_init(AVCodecContext *avctx) { Msvideo1Context *s = avctx->priv_data; s->avctx = avctx; if (s->avctx->bits_per_coded_sample == 8) { s->mode_8bit = 1; avctx->pix_fmt = AV_PIX_FMT_PAL8; } else { s->mode_8bit = 0; avctx->pix_fmt = AV_PIX_FMT_RGB555; } s->frame.data[0] = NULL; return 0; }
1threat
Which class will be applied to div and why? : <p>I came across a interesting code. If we run the below code snippet, green class will be applied for both the divs. Can anyone explain why? </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-css lang-css prettyprint-override"><code>.orange { color: orange; } .green { color: green; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="orange green"&gt;Div 1&lt;/div&gt; &lt;div class="green orange"&gt;Div 2&lt;/div&gt; </code></pre> </div> </div> </p>
0debug
Enable HTML Button after certain delay : <p>How do I display a countdown in a button, when the countdown gets to 0, it enables the button. Is this even possible? Thanks.</p>
0debug
int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options, int flags, BlockDriver *drv) { int ret; char tmp_filename[PATH_MAX + 1]; BlockDriverState *file = NULL; QDict *file_options = NULL; if (options == NULL) { options = qdict_new(); } bs->options = options; options = qdict_clone_shallow(options); if (flags & BDRV_O_SNAPSHOT) { BlockDriverState *bs1; int64_t total_size; BlockDriver *bdrv_qcow2; QEMUOptionParameter *create_options; char backing_filename[PATH_MAX]; if (qdict_size(options) != 0) { error_report("Can't use snapshot=on with driver-specific options"); ret = -EINVAL; goto fail; } assert(filename != NULL); bs1 = bdrv_new(""); ret = bdrv_open(bs1, filename, NULL, 0, drv); if (ret < 0) { bdrv_delete(bs1); goto fail; } total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK; bdrv_delete(bs1); ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename)); if (ret < 0) { goto fail; } if (path_has_protocol(filename)) { snprintf(backing_filename, sizeof(backing_filename), "%s", filename); } else if (!realpath(filename, backing_filename)) { ret = -errno; goto fail; } bdrv_qcow2 = bdrv_find_format("qcow2"); create_options = parse_option_parameters("", bdrv_qcow2->create_options, NULL); set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size); set_option_parameter(create_options, BLOCK_OPT_BACKING_FILE, backing_filename); if (drv) { set_option_parameter(create_options, BLOCK_OPT_BACKING_FMT, drv->format_name); } ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options); free_option_parameters(create_options); if (ret < 0) { goto fail; } filename = tmp_filename; drv = bdrv_qcow2; bs->is_temporary = 1; } if (flags & BDRV_O_RDWR) { flags |= BDRV_O_ALLOW_RDWR; } extract_subqdict(options, &file_options, "file."); ret = bdrv_file_open(&file, filename, file_options, bdrv_open_flags(bs, flags)); if (ret < 0) { goto fail; } if (!drv) { ret = find_image_format(file, filename, &drv); } if (!drv) { goto unlink_and_fail; } ret = bdrv_open_common(bs, file, filename, options, flags, drv); if (ret < 0) { goto unlink_and_fail; } if (bs->file != file) { bdrv_delete(file); file = NULL; } if ((flags & BDRV_O_NO_BACKING) == 0) { ret = bdrv_open_backing_file(bs); if (ret < 0) { goto close_and_fail; } } if (qdict_size(options) != 0) { const QDictEntry *entry = qdict_first(options); qerror_report(ERROR_CLASS_GENERIC_ERROR, "Block format '%s' used by " "device '%s' doesn't support the option '%s'", drv->format_name, bs->device_name, entry->key); ret = -EINVAL; goto close_and_fail; } QDECREF(options); if (!bdrv_key_required(bs)) { bdrv_dev_change_media_cb(bs, true); } if (bs->io_limits_enabled) { bdrv_io_limits_enable(bs); } return 0; unlink_and_fail: if (file != NULL) { bdrv_delete(file); } if (bs->is_temporary) { unlink(filename); } fail: QDECREF(bs->options); QDECREF(options); bs->options = NULL; return ret; close_and_fail: bdrv_close(bs); QDECREF(options); return ret; }
1threat
void pl181_init(uint32_t base, BlockDriverState *bd, qemu_irq irq0, qemu_irq irq1) { int iomemtype; pl181_state *s; s = (pl181_state *)qemu_mallocz(sizeof(pl181_state)); iomemtype = cpu_register_io_memory(0, pl181_readfn, pl181_writefn, s); cpu_register_physical_memory(base, 0x00000fff, iomemtype); s->base = base; s->card = sd_init(bd); s->irq[0] = irq0; s->irq[1] = irq1; qemu_register_reset(pl181_reset, s); pl181_reset(s); }
1threat
Python: Row wise operation in a list of lists : <p>I have a list of lists</p> <pre><code>[[1,2,3,4,5], [6,7,8,9,10], [11,12,13,14,15], [16,17,18,19,20]] </code></pre> <p>How do I create a list that subtracts the next row item from the current row item in this case: (7-2),(12-7),(17-12) to get a another list</p> <pre><code>[5,5,5] </code></pre>
0debug
MSSQL Linux Server Issue: SQL Server only supports SAFE assemblies : <p>We recently came across an issue when trying to register some custom SQL CLR assemblies we have created on SQL Server 2017 v14.0.3238.1.</p> <p>First of all, these assemblies require that they have External Access Permission, as they call external APIs. It seems that this issue is only appearing when trying to run them on an MSSQL Server that is hosted on a Linux Environment.</p> <p>In addition, we have tried creating asymmetric keys (both with SN.exe tool from Microsoft SDKs and through VS 2017) and also signing these CLR assemblies, without any luck. (Followed instructions as found on: <a href="https://techcommunity.microsoft.com/t5/SQL-Server-Support/Deploying-SQL-CLR-assembly-using-Asymmetric-key/ba-p/316727" rel="nofollow noreferrer">https://techcommunity.microsoft.com/t5/SQL-Server-Support/Deploying-SQL-CLR-assembly-using-Asymmetric-key/ba-p/316727</a>)</p> <p>When trying to register the assemblies, we are receiving the error: "Assembly 'Sample_CLR' cannot be loaded because this edition of SQL Server only supports SAFE assemblies."</p> <p>Has anyone stumbled across a similar issue before?</p>
0debug
SharedPreferences are not being cleared when I uninstall : <p>OK, this is a strange one that I didn't think was even possible.</p> <p>So, ever since I've been using a Nexus 5X, the SharedPreferences are not getting wiped when I uninstall my app.</p> <p>I install the app through Android Studio and test things. I then uninstall the app. I then resintall the app through Android Studio and all the SharedPreferences values are still there.</p> <p>I've tried clearing the data/cache in addition to uninstalling. The SharedPreferences are persistent through all those attempts.</p> <p>I am using stock Android 6.0 on a Nexus 5X. My device is not rooted. I am not using a custom ROM. I do not have this issue with my Nexus 4. </p> <p>Any ideas what might be causing this?</p>
0debug
static void multiwrite_cb(void *opaque, int ret) { MultiwriteCB *mcb = opaque; if (ret < 0) { mcb->error = ret; multiwrite_user_cb(mcb); } mcb->num_requests--; if (mcb->num_requests == 0) { if (mcb->error == 0) { multiwrite_user_cb(mcb); } qemu_free(mcb); } }
1threat
getting iaxclient to send audio to/get audio from buffer instead of audio-device : <p>I'm trying to write a C++ program (altough python would've been fine as well in case someone knows a better (IAX/SIP) alternative) which connects to an Asterisk server.</p> <p>After connecting, it should listen for audio and process that. It should also send audio back. I'm using <a href="https://sourceforge.net/projects/iaxclient/" rel="noreferrer">https://sourceforge.net/projects/iaxclient/</a> for that (note that there are several versions (betas, regular releases, svn version) which all behave differently).</p> <p>Now if I understood the code of the library correct, then it can call a callback function with an event. One of those events is IAXC_EVENT_AUDIO. In the structure of that IAXC_EVENT_AUDIO there's a direction; incoming outgoing. And that's where I'm lost: with some versions of iaxclient I only receive the IAXC_SOURCE_REMOTE messages, with some both. And if I switch to test-mode (which should only disable the audio-device) I often receive nothing at all. When I receive both IAXC_SOURCE_LOCAL and IAXC_SOURCE_REMOTE, I tried to set the buffers of those events to random data but that doesn't reach the other end at all (I set it to RAW mode).</p> <p>As anyone any suggestions how to resolve this?</p> <p>My test-code is:</p> <pre><code>#include &lt;iaxclient.h&gt; #include &lt;unistd.h&gt; int iaxc_event_callback(iaxc_event e) { if (e.type == IAXC_EVENT_TEXT) { printf("text\n"); } else if (e.type == IAXC_EVENT_LEVELS) { printf("level\n"); } else if (e.type == IAXC_EVENT_STATE) { struct iaxc_ev_call_state *st = iaxc_get_event_state(&amp;e); printf("\tcallno %d state %d format %d remote %s(%s)\n", st-&gt;callNo, st-&gt;state, st-&gt;format,st-&gt;remote, st-&gt;remote_name); iaxc_key_radio(st-&gt;callNo); } else if (e.type == IAXC_EVENT_NETSTAT) { printf("\tcallno %d rtt %d\n", e.ev.netstats.callNo, e.ev.netstats.rtt); } else if (e.type == IAXC_EVENT_AUDIO) { printf("\t AUDIO!!!! %d %u %d\n", e.ev.audio.source, e.ev.audio.ts, e.ev.audio.size); for(int i=0; i&lt;e.ev.audio.size; i++) printf("%02x ", e.ev.audio.data[i]); printf("\n"); } else { printf("type: %d\n", e.type); } return 1; } int main(int argc, char *argv[]) { iaxc_set_test_mode(1); printf("init %d\n", iaxc_initialize(1)); iaxc_set_formats(IAXC_FORMAT_SPEEX, IAXC_FORMAT_SPEEX); iaxc_set_event_callback(iaxc_event_callback); printf("get audio pref %d\n", iaxc_get_audio_prefs()); //printf("set audio pref %d\n", iaxc_set_audio_prefs(IAXC_AUDIO_PREF_RECV_REMOTE_ENCODED)); printf("set audio pref %d\n", iaxc_set_audio_prefs(IAXC_AUDIO_PREF_RECV_REMOTE_RAW | IAXC_AUDIO_PREF_RECV_LOCAL_RAW)); printf("get audio pref %d\n", iaxc_get_audio_prefs()); printf("start thread %d\n", iaxc_start_processing_thread()); int id = -1; printf("register %d\n", id = iaxc_register("6003", "1923", "192.168.64.1")); int callNo = -1; printf("call %d\n", callNo = iaxc_call("6003:1923@192.168.64.1/6001")); printf("unquelch: %d\n", iaxc_unquelch(callNo)); pause(); printf("finish\n"); printf("%d\n", iaxc_unregister(id)); printf("%d\n", iaxc_stop_processing_thread()); iaxc_shutdown(); return 0; } </code></pre>
0debug
how to assign values from vardump output to variables in php? : <p>here i have json output as below.what i want do is i want to take scope,production,refreshtoken,access_token as separate php variables from var_dump output.</p> <p>here is the json output</p> <pre><code>array ( 'status' =&gt; 'OK', 'statusCode' =&gt; 200, 'time' =&gt; 1.628268, 'header' =&gt; array ( 0 =&gt; 'HTTP/1.1 200 OK Date: Fri, 06 May 2016 06:22:42 GMT Server: O2-PassThrough-HTTP Content-Type: application/json Pragma: no-cache Cache-Control: no-store Transfer-Encoding: chunked ', ), 'body' =&gt; '{"scope":"TARGET","token_type":"bearer","expires_in":2324,"refresh_token":"4567f358c7b203fa6316432ab6ba814","access_token":"55667dabbf188334908b7c1cb7116d26"}', ) </code></pre> <p>Here is my php</p> <pre><code>var_dump($r); echo $var[0]."&lt;br&gt;"; echo $var[1]."&lt;br&gt;"; echo $var[2]."&lt;br&gt;"; echo $var[3]."&lt;br&gt;"; echo $var[4]."&lt;br&gt;"; echo $var[5]."&lt;br&gt;"; echo $var[6]."&lt;br&gt;"; echo $var[7]."&lt;br&gt;"; echo $var[8]."&lt;br&gt;"; </code></pre>
0debug
static int check_refcounts_l2(BlockDriverState *bs, BdrvCheckResult *res, uint16_t *refcount_table, int refcount_table_size, int64_t l2_offset, int flags) { BDRVQcowState *s = bs->opaque; uint64_t *l2_table, l2_entry; uint64_t next_contiguous_offset = 0; int i, l2_size, nb_csectors; l2_size = s->l2_size * sizeof(uint64_t); l2_table = g_malloc(l2_size); if (bdrv_pread(bs->file, l2_offset, l2_table, l2_size) != l2_size) goto fail; for(i = 0; i < s->l2_size; i++) { l2_entry = be64_to_cpu(l2_table[i]); switch (qcow2_get_cluster_type(l2_entry)) { case QCOW2_CLUSTER_COMPRESSED: if (l2_entry & QCOW_OFLAG_COPIED) { fprintf(stderr, "ERROR: cluster %" PRId64 ": " "copied flag must never be set for compressed " "clusters\n", l2_entry >> s->cluster_bits); l2_entry &= ~QCOW_OFLAG_COPIED; res->corruptions++; } nb_csectors = ((l2_entry >> s->csize_shift) & s->csize_mask) + 1; l2_entry &= s->cluster_offset_mask; inc_refcounts(bs, res, refcount_table, refcount_table_size, l2_entry & ~511, nb_csectors * 512); if (flags & CHECK_FRAG_INFO) { res->bfi.allocated_clusters++; res->bfi.compressed_clusters++; res->bfi.fragmented_clusters++; } break; case QCOW2_CLUSTER_ZERO: if ((l2_entry & L2E_OFFSET_MASK) == 0) { break; } case QCOW2_CLUSTER_NORMAL: { uint64_t offset = l2_entry & L2E_OFFSET_MASK; if (flags & CHECK_FRAG_INFO) { res->bfi.allocated_clusters++; if (next_contiguous_offset && offset != next_contiguous_offset) { res->bfi.fragmented_clusters++; } next_contiguous_offset = offset + s->cluster_size; } inc_refcounts(bs, res, refcount_table,refcount_table_size, offset, s->cluster_size); if (offset_into_cluster(s, offset)) { fprintf(stderr, "ERROR offset=%" PRIx64 ": Cluster is not " "properly aligned; L2 entry corrupted.\n", offset); res->corruptions++; } break; } case QCOW2_CLUSTER_UNALLOCATED: break; default: abort(); } } g_free(l2_table); return 0; fail: fprintf(stderr, "ERROR: I/O error in check_refcounts_l2\n"); g_free(l2_table); return -EIO; }
1threat
Assembly location for Razor SDK Tasks was not specified : <p>My project fails to build on a build server. I recently added a new ASP.Net Core (2.2) MVC project with razor pages. The project and the rest of the solution target the .Net Framework 4.7.2.</p> <p>In Visual Studio on my dev-machine this works fine, but the build server cannot build it. It shows this error.</p> <blockquote> <p>C:\Users\tfs-build.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(161):C:\Users\tfs-build.nuget\packages\microsoft.aspnetcore.razor.design\2.2.0\build\netstandard2.0\Microsoft.AspNetCore.Razor.Design.CodeGeneration.targets(161,5): Error : Assembly location for Razor SDK Tasks was not specified. The most likely cause is an older incompatible version of Microsoft.NET.Sdk.Razor, or Microsoft.NET.Sdk.Web used by this project. Please target a newer version of the .NET Core SDK.</p> </blockquote> <p>I made my coworker install the <a href="https://dotnet.microsoft.com/download" rel="noreferrer">.Net Core SDK 2.2</a>, since I remembered installing that on the dev-machine to be able to create the project. But this did not help on the buildserver.</p> <p>What could cause this? Why is the behaviour different from the development environment?</p>
0debug
how to restrict background data in android programmatically : I am trying to make an app, which stops individual apps from data usage . I checked everywhere... and got nothing...please help.. I have tried in [https://developer.android.com/training/basics/network-ops/data-saver.html][1] but it is showing data usage... but not how to restrict it. ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); // Checks if the device is on a metered network if (connMgr.isActiveNetworkMetered()) { // Checks user’s Data Saver settings. switch (connMgr.getRestrictBackgroundStatus()) { case RESTRICT_BACKGROUND_STATUS_ENABLED: // Background data usage is blocked for this app. Wherever possible, // the app should also use less data in the foreground. case RESTRICT_BACKGROUND_STATUS_WHITELISTED: // The app is whitelisted. Wherever possible, // the app should use less data in the foreground and background. case RESTRICT_BACKGROUND_STATUS_DISABLED: // Data Saver is disabled. Since the device is connected to a // metered network, the app should use less data wherever possible. } } else { // The device is not on a metered network. // Use data as required to perform syncs, downloads, and updates. } thanks in advance
0debug
static int usbredir_handle_bulk_data(USBRedirDevice *dev, USBPacket *p, uint8_t ep) { AsyncURB *aurb = async_alloc(dev, p); struct usb_redir_bulk_packet_header bulk_packet; DPRINTF("bulk-out ep %02X len %d id %u\n", ep, p->len, aurb->packet_id); bulk_packet.endpoint = ep; bulk_packet.length = p->len; bulk_packet.stream_id = 0; aurb->bulk_packet = bulk_packet; if (ep & USB_DIR_IN) { usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id, &bulk_packet, NULL, 0); } else { usbredir_log_data(dev, "bulk data out:", p->data, p->len); usbredirparser_send_bulk_packet(dev->parser, aurb->packet_id, &bulk_packet, p->data, p->len); } usbredirparser_do_write(dev->parser); return USB_RET_ASYNC; }
1threat
OKhttp PUT example : <p>My requirement is to use <code>PUT</code>, send a header and a body to server which will update something in the database.</p> <p>I just read <a href="http://square.github.io/okhttp/">okHttp documentation</a> and I was trying to use their <code>POST</code> example but it doesn't work for my use case <strong>(I think it might be because the server requires me to use <code>PUT</code> instead of <code>POST</code>)</strong>.</p> <p>This is my method with <code>POST</code>:</p> <pre><code> public void postRequestWithHeaderAndBody(String url, String header, String jsonBody) { MediaType JSON = MediaType.parse("application/json; charset=utf-8"); RequestBody body = RequestBody.create(JSON, jsonBody); OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url(url) .post(body) .addHeader("Authorization", header) .build(); makeCall(client, request); } </code></pre> <p>I have tried to search for okHttp example using <code>PUT</code>with no success, if I need to use <code>PUT</code>method is there anyway to use okHttp?</p> <p>I'm using okhttp:2.4.0 (just in case), thanks on any help!</p>
0debug
static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, VLCcode *codes, int flags) { int table_size, table_index, index, code_prefix, symbol, subtable_bits; int i, j, k, n, nb, inc; uint32_t code; VLC_TYPE (*table)[2]; table_size = 1 << table_nb_bits; if (table_nb_bits > 30) return -1; table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); if (table_index < 0) return table_index; table = &vlc->table[table_index]; for (i = 0; i < table_size; i++) { table[i][1] = 0; table[i][0] = -1; } for (i = 0; i < nb_codes; i++) { n = codes[i].bits; code = codes[i].code; symbol = codes[i].symbol; av_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code); if (n <= table_nb_bits) { j = code >> (32 - table_nb_bits); nb = 1 << (table_nb_bits - n); inc = 1; if (flags & INIT_VLC_LE) { j = bitswap_32(code); inc = 1 << n; } for (k = 0; k < nb; k++) { av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n); if (table[j][1] != 0) { av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); return AVERROR_INVALIDDATA; } table[j][1] = n; table[j][0] = symbol; j += inc; } } else { n -= table_nb_bits; code_prefix = code >> (32 - table_nb_bits); subtable_bits = n; codes[i].bits = n; codes[i].code = code << table_nb_bits; for (k = i+1; k < nb_codes; k++) { n = codes[k].bits - table_nb_bits; if (n <= 0) break; code = codes[k].code; if (code >> (32 - table_nb_bits) != code_prefix) break; codes[k].bits = n; codes[k].code = code << table_nb_bits; subtable_bits = FFMAX(subtable_bits, n); } subtable_bits = FFMIN(subtable_bits, table_nb_bits); j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix; table[j][1] = -subtable_bits; av_dlog(NULL, "%4x: n=%d (subtable)\n", j, codes[i].bits + table_nb_bits); index = build_table(vlc, subtable_bits, k-i, codes+i, flags); if (index < 0) return index; table = &vlc->table[table_index]; table[j][0] = index; av_assert0(table[j][0] == index); i = k-1; } } return table_index; }
1threat
Want to find the output as given bellow using Java program? Input - are you ready; output - ArE YoU ReAdY : import java.util.Scanner; import java.lang.*; public class Testdemo{ public static void main(String []args){ Scanner sc = new Scanner(System.in); String result = ""; System.out.println("enter the string"); String name =sc.nextLine(); String[] words = name.split("\\s"); for(int i=0;i<words.length;i++){ String med = words[i]; for(int j=0;j<med.length;j++){ if(i%2 == 0){ result = result + Character.toUpperCase(words[i].charAt(0)) + words[i].substring(1) + " "; } else{ result = result + Character.toLowerCase(words[i].charAt(0)) + words[i].substring(1) + " "; }} } System.out.println(result); } }
0debug
How do i remove the last character of the last string from a list of strings? : <p>If I have something like this:</p> <pre><code>a=['100','200','501','124','1234\n'] </code></pre> <p>How can I remove that <code>'\n'</code> ?</p>
0debug
error TS2339: Property 'for' does not exist on type 'HTMLProps<HTMLLabelElement>' : <p>Using typescript and react with TSX files with definitely typed type definitions, I am getting the error:</p> <pre><code>error TS2339: Property 'for' does not exist on type 'HTMLProps&lt;HTMLLabelElement&gt;'. </code></pre> <p>When trying to compile a component with the following TSX </p> <pre><code>&lt;label for={this.props.inputId} className="input-label"&gt;{this.props.label}&lt;/label&gt; </code></pre> <p>I have already solved but adding here for the next person since the solution didn't show up anywhere when searching (Google or StackOverflow)</p>
0debug
set value of input on form to a $_GET array : <p>I have a page that is receiving an array from $_GET. Lets say it has 3 values in $_GET['types'] containing: 'good', 'bad', and 'ugly'. Now on this page I am setting up a form and I need to pass this array into the form through an input. Maybe this short piece of code can help demonstrate what I'm trying to do</p> <pre><code>&lt;form action="dosomething.php" method="get"&gt; &lt;input name="types[]" value="&lt;?php echo $_GET['types']; ?&gt;" /&gt; &lt;/form&gt; </code></pre> <p>How can I accomplish this?</p>
0debug
how to use php to generate random 10 digit number that begin with the same two digitsusing php : I'm working on a banking and investment website/system for my school project, please can someone help me with a PHP code that generates a random 10 digits account number when users register, but the account numbers all have to start with the same two-digit numbers like 01, thank you
0debug
Jenkins Project Artifacts and Workspace : <p>I've used jenkins for quite a few years but have never set it up myself which I did at my new job. There are a couple questions and issues that I ran into.</p> <p><strong>Default workspace location</strong> - It seems like the latest Jenkins has the default workspace in Jenkins\jobs[projectName]\workspace and is overwritten (or wiped if selected) for every build. I thought that it should instead be in Jenkins\jobs[projectName]\builds[build_id]\ so that it would be able to store the workspace state for every build for future reference? </p> <p><strong>Displaying workspace on the project>Build_ID page</strong> - This goes along with the previous as I expected each 'workspace' for previous builds to show here. Currently in my setup this individual page gives you nothing except the Git revision and what repo changes triggered the build. As well as console output. Where are the artifacts? Where is the link to this build's workspace that was used?</p> <p><strong>Archiving Artifacts in builds</strong> - When choosing artifacts, the filter doesn't seem to work. My build creates a filestructure with the artifacts in it inside workspace. I want to store this and the artifacts filter says it starts at workspace. So I put in 'artifacts' and nothing gets stores (also where would this get stored?). I have also tried '/artifacts' and 'artifacts/*'. </p> <p>Any help would be great! Thanks!</p>
0debug
PHP: Can I put an IF statement in a <li> tag? : <p>Ok so i'm trying to make a checklist for a school website and I want to make an ordered list followed by the check box and the description. Here is my code for it but I get an error message saying "Unexpected IF statement." </p> <pre><code>echo "&lt;ol type='1'&gt; &lt;li&gt;" . if ($r['check1'] == 1){ echo "&lt;input type='checkbox' name='check1' value='1' checked&gt;submitted my JSCC admissions application for the upcoming term to JSCC Admissions and Records Services. \n&lt;br&gt;"; } else { echo "&lt;input type='checkbox' name='check1' value='1'&gt;submitted my JSCC admissions application for the upcoming term to JSCC Admissions and Records Services. \n&lt;br&gt;";} . "&lt;/li&gt; &lt;/ol&gt;\n"; </code></pre>
0debug
Getting before first underscore : Given a string say prod175100210_cat40510788__ I want only prod175100210. But when I do prod.*[^_] This regex, doesnot work. What should be legit regex for extracting only before first under score.
0debug
Goolgle Window Toolkit plugin is not working for chrome browser : i am new user of GWT toolkit. and i was running my application in chrome browser. but it was asking me to download the plugin to run GWT applications. then i gone through the link but it was showing me this problem....NOT COMPATIBLE [enter image description here][1] [1]: http://i.stack.imgur.com/bOyTG.jpg Please provide help.
0debug
Get user id and user name from balebot : <p>Please explain how to get user.id and user.name of client who talking with my bot in balebot. There is a peer class, but i don't know how exactly it works?</p>
0debug
How to wait until React component completely finished updating in Jest and/or Enzyme? : <p>In my create-react-app, I am trying to test a component that does multiple <code>setState</code>s when mounted.</p> <pre><code>class MyComponent extends React.Component { state = { a: undefined, b: undefined, c: undefined, }; fetchA() { // returns a promise } fetchB() { // returns a promise } fetchC() { // returns a promise } async componentDidMount() { const a = await fetchA(); this.setState({ a }); } async componentDidUpdate(prevProps, prevState) { if (prevState.a !== this.state.a) { const [b, c] = await Promise.all([ this.fetchB(a); this.fetchC(a); ]); this.setState({ b, c }); } } ... } </code></pre> <p>In my test, I do something like this, trying to let the <code>setState</code> in <code>componentDidUpdate</code> to finish before making assertions.</p> <pre><code>import { mount } from 'enzyme'; describe('MyComponent', () =&gt; { const fakeA = Promise.resolve('a'); const fakeB = Promise.resolve('b'); const fakeC = Promise.resolve('c'); MyComponent.prototype.fetchA = jest.fn(() =&gt; fakeA); MyComponent.prototype.fetchB = jest.fn(() =&gt; fakeB); MyComponent.prototype.fetchC = jest.fn(() =&gt; fakeC); it('sets needed state', async () =&gt; { const wrapper = mount(&lt;MyComponent /&gt;); await Promise.all([ fakeA, fakeB, fakeC ]); expect(wrapper.state()).toEqual({ a: 'a', b: 'b', c: 'c', }); }); }); </code></pre> <p>Here's the interesting part: My test above will fail because the last <code>setState</code> call (in <code>componentDidUpdate</code>) has not finished when the assertion is made. At that time, <code>state.a</code> is set, but <code>state.b</code> and <code>state.c</code> is not set yet.</p> <p>The only way I could make it work is by wedging <code>await Promise.resolve(null)</code> right before the assertion to give the last <code>setState</code> that extra tick/cycle to complete. This looks too hacky.</p> <p>Another thing I've tried is wrapping the assertion in <code>setImmediate()</code>, which works fine as long as the assertion passes. If it fails, it will terminate the whole test because of uncaught error.</p> <p>Has anyone overcome this problem?</p>
0debug
How to check if a number is palindrome in Java? : <p>I am new in Java and I need to complete this program to check if an integer is palindrome. Please help.</p> <pre><code>public static void main(String args[]){ System.out.println("Please enter an integer : "); int integer = new Scanner(System.in).nextInt(); if(isPalindrome(integer)){ System.out.println(integer + " is a palindrome"); }else{ System.out.println(integer + " is not a palindrome"); } } </code></pre>
0debug
i want a Query that show all of S# and Sname that they have all red P# : i have a database : S(S#,Sname,status,City) P(P#,Pname,color,weight,city) SP(S#,P#,number) i want a Query that show all of S# and Sname that they have all red P#. example: S: S1 Sname1 status1 city(1) S2 Sname2 status2 City(2) S3 Sname3 status3 City(3) P: P1 Pname1 red weight1 city(n) P2 Pname2 blue weight2 city(n) P3 Pname3 green weight3 city(n) P4 Pname4 red weight4 city(n) SP: S1 P1 number1 S1 p4 number2 s2 p1 number3 s3 p3 number4 S3 p1 number5 S3 p4 number6 S2 p2 number7 Expected answer: S1,Sname1 S3,Sname3
0debug
Printing out the result of an sql query not working : <p>I'm trying to execute a SQL query and print out the return on a webpage. It should print out a list of names from the table but it simply returns "NULL". Does anyone have an idea how to fix this?</p> <pre><code>$sql = "SELECT name from Players_christmas where name not in (select name from Players_halloween"); $assoc = mysqli_fetch_assoc($sql); var_dump($assoc); </code></pre>
0debug
Any suggestions to deserialize this json with Gson? : <p>Any suggestions to deserialize this json with Gson ? { "0": { "id": 1, "name": "pepe" }, "1": { "id": 2, "name": "pipo" }, "2": { "id": 3, "name": "pato" } ... n objects<br> }</p>
0debug
static int ra144_decode_frame(AVCodecContext * avctx, void *vdata, int *data_size, const uint8_t * buf, int buf_size) { static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; unsigned int a, b, c; int i; signed short *shptr; int16_t *data = vdata; unsigned int val; Real144_internal *glob = avctx->priv_data; GetBitContext gb; if(buf_size == 0) return 0; init_get_bits(&gb, buf, 20 * 8); for (i=0; i<10; i++) glob->swapbuf1[i] = decodetable[i][get_bits(&gb, sizes[i]) << 1]; do_voice(glob->swapbuf1, glob->swapbuf2); val = decodeval[get_bits(&gb, 5) << 1]; a = t_sqrt(val*glob->oldval) >> 12; for (c=0; c < NBLOCKS; c++) { if (c == (NBLOCKS - 1)) { dec1(glob, glob->swapbuf1, glob->swapbuf2, 3, val); } else { if (c * 2 == (NBLOCKS - 2)) { if (glob->oldval < val) { dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, a, glob->swapbuf2alt, c); } else { dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, a, glob->swapbuf2, c); } } else { if (c * 2 < (NBLOCKS - 2)) { dec2(glob, glob->swapbuf1alt, glob->swapbuf2alt, 3, glob->oldval, glob->swapbuf2, c); } else { dec2(glob, glob->swapbuf1, glob->swapbuf2, 3, val, glob->swapbuf2alt, c); } } } } for (b=0, c=0; c<4; c++) { unsigned int gval = glob->gbuf1[c * 2]; unsigned short *gsp = glob->gbuf2 + b; signed short output_buffer[40]; do_output_subblock(glob, gsp, gval, output_buffer, &gb); shptr = output_buffer; while (shptr < output_buffer + BLOCKSIZE) *data++ = av_clip_int16(*(shptr++) << 2); b += 30; } glob->oldval = val; FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1); FFSWAP(unsigned int *, glob->swapbuf2alt, glob->swapbuf2); *data_size = 2*160; return 20; }
1threat
Placing php ,html, php in one line : <p>Can someone please tell me what am I doing wrong in my code? Every time I try, I receive </p> <blockquote> <p>Parse error: syntax error, unexpected '.' </p> </blockquote> <pre><code>&lt;?php if ( is_woocommerce()){ '&lt;a href="' . home_url(); . '"&gt;Home&lt;/a&gt;' } else { '&lt;a href="' . home_url('/shop/'); . '"&gt;My Shop&lt;/a&gt;' }?&gt; </code></pre>
0debug
what actually happens when you connect your charger to your mobile phone..? : <p>I mean which command or software is activated in order to charge your battery?</p>
0debug
How to check the color code/color of an element in Appium : **How to check the color code/color of an element in Appium.** I'm unable to find the color of the element in appium because in one field I want to automate. The output is defined in different colors. How to verify this using Appium/UI automator.
0debug
static void vga_reset(void *opaque) { VGAState *s = (VGAState *) opaque; s->lfb_addr = 0; s->lfb_end = 0; s->map_addr = 0; s->map_end = 0; s->lfb_vram_mapped = 0; s->bios_offset = 0; s->bios_size = 0; s->sr_index = 0; memset(s->sr, '\0', sizeof(s->sr)); s->gr_index = 0; memset(s->gr, '\0', sizeof(s->gr)); s->ar_index = 0; memset(s->ar, '\0', sizeof(s->ar)); s->ar_flip_flop = 0; s->cr_index = 0; memset(s->cr, '\0', sizeof(s->cr)); s->msr = 0; s->fcr = 0; s->st00 = 0; s->st01 = 0; s->dac_state = 0; s->dac_sub_index = 0; s->dac_read_index = 0; s->dac_write_index = 0; memset(s->dac_cache, '\0', sizeof(s->dac_cache)); s->dac_8bit = 0; memset(s->palette, '\0', sizeof(s->palette)); s->bank_offset = 0; #ifdef CONFIG_BOCHS_VBE s->vbe_index = 0; memset(s->vbe_regs, '\0', sizeof(s->vbe_regs)); s->vbe_regs[VBE_DISPI_INDEX_ID] = VBE_DISPI_ID0; s->vbe_start_addr = 0; s->vbe_line_offset = 0; s->vbe_bank_mask = (s->vram_size >> 16) - 1; #endif memset(s->font_offsets, '\0', sizeof(s->font_offsets)); s->graphic_mode = -1; s->shift_control = 0; s->double_scan = 0; s->line_offset = 0; s->line_compare = 0; s->start_addr = 0; s->plane_updated = 0; s->last_cw = 0; s->last_ch = 0; s->last_width = 0; s->last_height = 0; s->last_scr_width = 0; s->last_scr_height = 0; s->cursor_start = 0; s->cursor_end = 0; s->cursor_offset = 0; memset(s->invalidated_y_table, '\0', sizeof(s->invalidated_y_table)); memset(s->last_palette, '\0', sizeof(s->last_palette)); memset(s->last_ch_attr, '\0', sizeof(s->last_ch_attr)); switch (vga_retrace_method) { case VGA_RETRACE_DUMB: break; case VGA_RETRACE_PRECISE: memset(&s->retrace_info, 0, sizeof (s->retrace_info)); break; } }
1threat
static int pci_unin_internal_init_device(SysBusDevice *dev) { UNINState *s; int pci_mem_config, pci_mem_data; s = FROM_SYSBUS(UNINState, dev); pci_mem_config = cpu_register_io_memory(pci_unin_config_read, pci_unin_config_write, s); pci_mem_data = cpu_register_io_memory(pci_unin_read, pci_unin_write, s); sysbus_init_mmio(dev, 0x1000, pci_mem_config); sysbus_init_mmio(dev, 0x1000, pci_mem_data); return 0; }
1threat
Difference between .. and ... in Ruby : <p>What is the difference between .. and ... in a ruby for loop.</p> <pre><code>for num in 1..5 puts num end </code></pre> <p>vs</p> <pre><code>for num in 1...5 puts num end </code></pre> <p>How are those two loops different.</p>
0debug
How to control the number of layer in nested for-loop in python? : <p>Given a list like <code>alist = [1, 3, 2, 20, 10, 13]</code>, I wanna write a function <code>find_group_f</code>, which can generate all possible combination of elements in <code>alist</code> and meanwhile I can dynamically control the number <code>k</code> of element in each group. For instance, if the number <code>k</code> is <code>2</code>, the function is equal to:</p> <pre><code>for e1 in alist: for e2 in alist[alist.index(e1)+1:]: print (e1, e2) </code></pre> <p>While the number <code>k</code> is 3, it would be like:</p> <pre><code>for e1 in alist: for e2 in alist[alist.index(e1)+1:]: for e3 in alist[alist.index(e2)+1:]: print (e1, e2, e3) </code></pre> <p>I wonder how can I implement like this? Thanks in advance!</p>
0debug
Spring Boot project in IntelliJ community edition : <p>I am new to IntelliJ Community edition. Can anyone help me with creating spring boot project in intelliJ Community edition. For ultimate edition there is spring-boot initializer but I cannot find anything for community edition. I followed this links but cannot find any solutions</p> <p><a href="https://www.youtube.com/watch?v=397QPCAjm0o" rel="noreferrer">enter link description here</a></p> <p><a href="https://sivalabs.in/2016/09/getting-started-springboot-intellij-idea-community-edition/" rel="noreferrer">enter link description here</a></p>
0debug
Groovy Switch statement with list of values : <p>I want to use Switch statement in Jenkins pipeline job. </p> <pre><code>def version = "1.2" switch(GIT_BRANCH) { case "develop": result = "dev" break case ["master", "support/${version}"]: result = "list" break case "support/${version}": result = "sup" break default: result = "def" break } echo "${result}" </code></pre> <p>When <code>GIT_BRANCH</code> is equal to:</p> <ul> <li><code>develop</code> - returned value is <code>dev</code> - OK</li> <li><code>master</code> - returned value is <code>list</code> - OK</li> <li><code>support/1.2</code> - returned value is <code>sup</code> - why not <code>list</code>?</li> </ul>
0debug
Multiline TextBox/Input Field In ASP.NET Core MVC : <p>To make multi line input field, Like ASP.NET MVC I have tried the following but didn't work in ASP.NET Core MVC:</p> <pre><code>public class Post { [DataType(DataType.MultilineText)] public string Body { get; set; } } </code></pre> <p>In the view:</p> <pre><code>&lt;input asp-for="Body" rows="40" class="form-control"/&gt; </code></pre> <p><strong>Any Suggestion will be highly appreciated!!</strong></p>
0debug
int has_altivec(void) { #ifdef __AMIGAOS4__ ULONG result = 0; extern struct ExecIFace *IExec; IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE); if (result == VECTORTYPE_ALTIVEC) return 1; return 0; #else #ifdef SYS_DARWIN int sels[2] = {CTL_HW, HW_VECTORUNIT}; int has_vu = 0; size_t len = sizeof(has_vu); int err; err = sysctl(sels, 2, &has_vu, &len, NULL, 0); if (err == 0) return (has_vu != 0); #else { signal (SIGILL, sigill_handler); if (sigsetjmp (jmpbuf, 1)) { signal (SIGILL, SIG_DFL); } else { canjump = 1; asm volatile ("mtspr 256, %0\n\t" "vand %%v0, %%v0, %%v0" : : "r" (-1)); signal (SIGILL, SIG_DFL); return 1; } } #endif return 0; #endif }
1threat
How to FORCE disable CORS in Javascript, PHP, or Every Piece Of Web Programming Language? : <p>I've been trying to get all my code works on my local server. I spend all the time of my life to get rid of errors to make everything run smoothly. Once it works, I uploaded it to my development server ( a place where my codes were play together, eat some meal, then die by the time ).</p> <p>Today I've done from creating another creatures of life with Jquery, he looks so happy when he was born into the local system and placed to the home I called "localhost". Then, I try to send him to the wild, he was dead even before he was loaded yet. I try to browse who was killed him, and I realized something called CORS is the suspect. Now I does really want to take a revenge, how to kill him ? If it cannot be killed, how can I force killing him ? He kills my creatures, I will never forgive him.</p> <p>This is how he looks :</p> <blockquote> <p>Failed to load <a href="http://localhost/dailyreport/function/TarikDataAbsensi.php" rel="nofollow noreferrer">http://localhost/dailyreport/function/TarikDataAbsensi.php</a>: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://my-creatures-new-home.com" rel="nofollow noreferrer">http://my-creatures-new-home.com</a>' is therefore not allowed access.</p> </blockquote>
0debug
while we creating a tem table in sql server ,where i can see the table structure? : create table #stun (name varchar(40),id int,gender varchar(40))
0debug
how to find min in time and max out time from table using MySQL query : i have a MySQL Table. i need to find MIN IN TIME AND MAX OUT TIME using MySQL. [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/iTC8m.png
0debug
static int qed_read_table(BDRVQEDState *s, uint64_t offset, QEDTable *table) { QEMUIOVector qiov; int noffsets; int i, ret; struct iovec iov = { .iov_base = table->offsets, .iov_len = s->header.cluster_size * s->header.table_size, }; qemu_iovec_init_external(&qiov, &iov, 1); trace_qed_read_table(s, offset, table); ret = bdrv_preadv(s->bs->file, offset, &qiov); if (ret < 0) { goto out; } qed_acquire(s); noffsets = qiov.size / sizeof(uint64_t); for (i = 0; i < noffsets; i++) { table->offsets[i] = le64_to_cpu(table->offsets[i]); } qed_release(s); ret = 0; out: trace_qed_read_table_cb(s, table, ret); return ret; }
1threat
static MemoryRegionSection *phys_page_find(PhysPageEntry lp, hwaddr addr, Node *nodes, MemoryRegionSection *sections) { PhysPageEntry *p; hwaddr index = addr >> TARGET_PAGE_BITS; int i; for (i = P_L2_LEVELS; lp.skip && (i -= lp.skip) >= 0;) { if (lp.ptr == PHYS_MAP_NODE_NIL) { return &sections[PHYS_SECTION_UNASSIGNED]; } p = nodes[lp.ptr]; lp = p[(index >> (i * P_L2_BITS)) & (P_L2_SIZE - 1)]; } return &sections[lp.ptr]; }
1threat
unable to import from imblearn.over_sampling import SMOTE : I have installed imblearn using pip install -U imbalanced-learn #version: conda version : 4.4.10 conda-build version : 3.4.1 python version : 3.6.4.final.0 I keep getting error related to numpy and scipy like module 'numpy.random' has no attribute 'mtrand' module 'numpy.polynomial' has no attribute 'polynomial' np.__version__ Out[11]: '1.14.0' scipy.__version__ Out[17]: '1.2.1' Please let me know how to fix this
0debug
Retrieving all the pairs of numbers that sum to a target in a list : <p>Suppose I have a list <code>[1,2,3,4,4]</code> and a target <code>5</code>. I need to find all the pairs from the list which sum to 5, i.e., <code>(1,4),(1,4),(2,3)</code>. Can someone suggest me an algorithm how to solve it in less than <code>O(n^2)</code>. I cam across this question while preparing for interview but I am not able to solve it in less than <code>O(n^2)</code>. Any Help is appreciated</p>
0debug
int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, VLC *vlc, const uint16_t *level_table, const uint16_t *run_table, int version, WMACoef *ptr, int offset, int num_coefs, int block_len, int frame_len_bits, int coef_nb_bits) { int code, run, level, sign; WMACoef* eptr = ptr + num_coefs; ptr += offset; for(;;) { code = get_vlc2(gb, vlc->table, VLCBITS, VLCMAX); if (code < 0) return -1; if (code == 1) { break; } else if (code == 0) { if (!version) { level = get_bits(gb, coef_nb_bits); run = get_bits(gb, frame_len_bits); } else { level = ff_wma_get_large_val(gb); if (get_bits1(gb)) { if (get_bits1(gb)) { if (get_bits1(gb)) { av_log(avctx,AV_LOG_ERROR, "broken escape sequence\n"); return -1; } else run = get_bits(gb, frame_len_bits) + 4; } else run = get_bits(gb, 2) + 1; } else run = 0; } } else { run = run_table[code]; level = level_table[code]; } sign = get_bits1(gb); if (!sign) level = -level; ptr += run; if (ptr >= eptr) { av_log(NULL, AV_LOG_ERROR, "overflow in spectral RLE, ignoring\n"); break; } *ptr++ = level; if (ptr >= eptr) break; } return 0; }
1threat
int64_t qmp_guest_fsfreeze_thaw(Error **err) { int ret; GuestFsfreezeMountList mounts; GuestFsfreezeMount *mount; int fd, i = 0, logged; QTAILQ_INIT(&mounts); ret = guest_fsfreeze_build_mount_list(&mounts); if (ret) { error_set(err, QERR_QGA_COMMAND_FAILED, "failed to enumerate filesystems"); return 0; } QTAILQ_FOREACH(mount, &mounts, next) { logged = false; fd = qemu_open(mount->dirname, O_RDONLY); if (fd == -1) { continue; } do { ret = ioctl(fd, FITHAW); if (ret == 0 && !logged) { i++; logged = true; } } while (ret == 0); close(fd); } guest_fsfreeze_state.status = GUEST_FSFREEZE_STATUS_THAWED; enable_logging(); guest_fsfreeze_free_mount_list(&mounts); return i; }
1threat
ORACLE JOIN TABLES : <p>I have </p> <pre><code>T1: USER_ID OSX 1 Y 2 Y T2: USER_ID ANDROID 1 Y 3 Y </code></pre> <p>I want to join the tables as follows but i don't know how</p> <pre><code>T3: USER_ID ANDROID OSX 1 Y Y 2 null Y 3 Y null </code></pre>
0debug
My python magic 8ball program isn't using my if statements? : <p>I am currently creating this magic 8ball program that should tell whether the question the user input starts with ("Should, is, am ,what, can, why..etc"). It then randomly chooses through a list and prints a str suitable to the question. </p> <p>However.. It doesn't use the if statements I've written and only prints "I dont quite know..".</p> <p>I've tried remaking the program differently - no success I've tried using different methods to get the first word of a str - no success.</p> <p>Here is my code:</p> <pre><code> import random, time, os what = ("Your answer is mine!", "I don't quite know..", "Who knows...") should = ("Yes, yes you should..", "Don't, please don't", "Okay...") isvar = ("I believe so.", "No, not at all.....") amvar = ("Yes, definetly", "No, not at all.....") whyvar = ("Your answer is mine...", "I dont quite know..") can = ("Yes, indeed", "No.... Idiot!", "Im not sure..") question = input("The answer resides within your question, which is..?\n:") first, *middle, last = question.split() rwhat = random.choice(what) rshoud = random.choice(should) ris = random.choice(isvar) ram = random.choice(amvar) rwhy = random.choice(whyvar) rcan = random.choice(can) first = str(first) if (first) == "what" or "What": print (rwhat) time.sleep(1) os.system('pause') elif (first) == "should" or "Should": print (rshoud) time.sleep(1) os.system('pause') elif (first) == "is" or "Is": print (ris) time.sleep(1) os.system('pause') elif (first) == "am" or "Am": print (ram) time.sleep(1) os.system('pause') elif (first) == "why" or "Why": print (rwhy) time.sleep(1) os.system('pause') elif (first) == "can" or "Can": print (rcan) time.sleep(1) os.system('pause') </code></pre> <p>it should run correctly.</p>
0debug
Can't install Android Studio on Windows7 with an error : <p>I tried to install <code>Android Studio 2.1</code> on my netbook, 32 bit. But, after I execute <code>android-studio-bundle-143.2915827-windows.exe</code>, an error occurred and I cannot install it.</p> <pre><code>the following SDK components were not installed android support repository and android sdk tools </code></pre> <p>I searched it but I have no idea what to do, would you please help me?</p> <p><a href="https://i.stack.imgur.com/LdA3w.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LdA3w.jpg" alt="enter image description here"></a></p> <p>I click "retry", but this error occurs again, then I click "cancel" and uninstall and reinstalled it, this error happens again. </p>
0debug
static int ape_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; APEContext *s = avctx->priv_data; uint8_t *sample8; int16_t *sample16; int32_t *sample24; int i, ch, ret; int blockstodecode; av_assert0(s->samples >= 0); if(!s->samples){ uint32_t nblocks, offset; int buf_size; if (!avpkt->size) { *got_frame_ptr = 0; return 0; } if (avpkt->size < 8) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } buf_size = avpkt->size & ~3; if (buf_size != avpkt->size) { av_log(avctx, AV_LOG_WARNING, "packet size is not a multiple of 4. " "extra bytes at the end will be skipped.\n"); } if (s->fileversion < 3950) buf_size += 2; av_fast_malloc(&s->data, &s->data_size, buf_size); if (!s->data) return AVERROR(ENOMEM); s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2); memset(s->data + (buf_size & ~3), 0, buf_size & 3); s->ptr = s->data; s->data_end = s->data + buf_size; nblocks = bytestream_get_be32(&s->ptr); offset = bytestream_get_be32(&s->ptr); if (s->fileversion >= 3900) { if (offset > 3) { av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); s->data = NULL; return AVERROR_INVALIDDATA; } if (s->data_end - s->ptr < offset) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } s->ptr += offset; } else { if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0) return ret; if (s->fileversion > 3800) skip_bits_long(&s->gb, offset * 8); else skip_bits_long(&s->gb, offset); } if (!nblocks || nblocks > INT_MAX) { av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %u.\n", nblocks); return AVERROR_INVALIDDATA; } s->samples = nblocks; if (init_frame_decoder(s) < 0) { av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n"); return AVERROR_INVALIDDATA; } } if (!s->data) { *got_frame_ptr = 0; return avpkt->size; } blockstodecode = FFMIN(s->blocks_per_loop, s->samples); if (s->fileversion < 3930) blockstodecode = s->samples; av_fast_malloc(&s->decoded_buffer, &s->decoded_size, 2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer)); if (!s->decoded_buffer) return AVERROR(ENOMEM); memset(s->decoded_buffer, 0, s->decoded_size); s->decoded[0] = s->decoded_buffer; s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8); frame->nb_samples = blockstodecode; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; s->error=0; if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) ape_unpack_mono(s, blockstodecode); else ape_unpack_stereo(s, blockstodecode); emms_c(); if (s->error) { s->samples=0; av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); return AVERROR_INVALIDDATA; } switch (s->bps) { case 8: for (ch = 0; ch < s->channels; ch++) { sample8 = (uint8_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff; } break; case 16: for (ch = 0; ch < s->channels; ch++) { sample16 = (int16_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample16++ = s->decoded[ch][i]; } break; case 24: for (ch = 0; ch < s->channels; ch++) { sample24 = (int32_t *)frame->data[ch]; for (i = 0; i < blockstodecode; i++) *sample24++ = s->decoded[ch][i] << 8; } break; } s->samples -= blockstodecode; *got_frame_ptr = 1; return !s->samples ? avpkt->size : 0; }
1threat
Is possible to get elements from XML using Notepad++ Regex? : <p>I have an XML with different <code>Item</code>'s which may contain the attribute <code>Setting</code> named <code>SerialNumber</code>. Im trying to get all the item names followed with the serial number.</p> <p>My approch is using Notepad++ Regex, to get the name of the <code>Item</code> and the value of the attribute <code>Setting</code> named <code>SerialNumber</code>something like this:</p> <blockquote> <p>Sender0;3990 Sender3;4444 Sender4;7774</p> </blockquote> <p>But trying it the only thing i can get is that notepad++ selects all the text... My fast approach was something like this: </p> <pre><code>^&lt;Item Name="(.*)" Category=".*&lt;Setting Name="SerialNumber"&gt;(.*)&lt;/Setting&gt;.*&lt;/Item&gt; </code></pre> <p>And replace:</p> <pre><code>(\1);(\2) </code></pre> <p>The XML:</p> <pre><code> &lt;Item Name="Sender0" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting Name="SerialNumber"&gt;3990&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; &lt;Item Name="Sender1" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; &lt;Item Name="Sender2" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; &lt;Item Name="Sender3" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting Name="SerialNumber"&gt;4444&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; &lt;Item Name="Sender4" Category="" ClassName="Cars" Schedule="" Enabled="true"&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;Setting Name="SerialNumber"&gt;7774&lt;/Setting&gt; &lt;Setting&gt;...&lt;/Setting&gt; &lt;/Item&gt; </code></pre> <p>Hope you can help me, thanks :)</p>
0debug
How to build multiple applications with angular-cli? : <p>The property <code>apps</code> in the <code>angular-cli.json</code> file is of array type. If I add a second element into this array, how can I instruct <code>ng build</code> to build both elements?</p>
0debug
my css file not loading when using mvc pattern css : I am new to mvc design pattern. i am trying to build my own mvc mini framework. so in my application, suppose http://localhost:8888/mvc/user/login this is a url. so in this url user is my controller and login is the method in user controller and this is coded in my core files like this: <?php /** * */ class Bootstrap { function __construct() { $url = isset($_GET['url'])?$_GET['url']:null; $url = rtrim($url,'/'); $url = explode('/', $url); //print_r($url); if (empty($url[0])) { require 'controllers/welcome.php'; $controller = new Welcome(); $controller->index(); return false; } $file = 'controllers/'.$url[0].'.php'; if (file_exists($file)) { require $file; } else { $this->showError(); } $controller = new $url[0]; //calling methods if (isset($url[2])) { if (method_exists($controller, $url[2])) { $controller->{$url[1]}($url[2]); } else { $this->showError(); } } else { if(isset($url[1])){ if (method_exists($controller, $url[1])) { $controller->{$url[1]}(); } else { $this->showError(); } } else { $controller->index(); } } } public function showError() { require 'controllers/CustomError.php'; $controller = new CustomError(); $controller->index(); return false; } } Now my issue is when i try to load css files in views my URL becomes like this: http://localhost:8888/mvc/public/css/style.css So now according to above code, it is assuming that public is a controller and CSS is a method. and it is giving an error. So how can I solve this problem? I hope you guys understood what is the problem. Thanks.
0debug
How to load URL on WKWebView? : <p>I am trying to load URL on WKWebView which contain the CSV file.</p> <p>When I tried it loading normally it was giving me an error: '<strong>The file format is not supported / it might be corrupted</strong>'.</p> <p>Even mobile safari is also giving me the same error.</p> <p>Then I tried using MIME type with the following method of WKWebView:</p> <pre><code> try! Data(ContentsOf: bulkUrl) webView.load(data, mimeType: "text/csv", characterEncodingName: "", baseURL: bulkUrl) </code></pre> <p>It works but giving me plain text.</p> <p>Same thing I tried it with UIWebView its opening CSV file in the correct format.</p> <p>I am not getting why WKWebView is not able to open the same file. Any idea?</p> <p>Thanks in advance</p>
0debug
document.write('<script src="evil.js"></script>');
1threat
void OPPROTO op_POWER_sllq (void) { uint32_t msk = -1; msk = msk << (T1 & 0x1FUL); if (T1 & 0x20UL) msk = ~msk; T1 &= 0x1FUL; T0 = (T0 << T1) & msk; T0 |= env->spr[SPR_MQ] & ~msk; RETURN(); }
1threat
matroska_read_packet (AVFormatContext *s, AVPacket *pkt) { MatroskaDemuxContext *matroska = s->priv_data; int res = 0; uint32_t id; while (matroska_deliver_packet(matroska, pkt)) { if (matroska->done) return AVERROR_IO; while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { return AVERROR_IO; } else if (matroska->level_up) { matroska->level_up--; break; } switch (id) { case MATROSKA_ID_CLUSTER: if ((res = ebml_read_master(matroska, &id)) < 0) break; if ((res = matroska_parse_cluster(matroska)) == 0) res = 1; break; default: case EBML_ID_VOID: res = ebml_read_skip(matroska); break; } if (matroska->level_up) { matroska->level_up--; break; } } if (res == -1) matroska->done = 1; } return 0; }
1threat
static int virtio_ccw_cb(SubchDev *sch, CCW1 ccw) { int ret; VirtioRevInfo revinfo; uint8_t status; VirtioFeatDesc features; void *config; hwaddr indicators; VqConfigBlock vq_config; VirtioCcwDevice *dev = sch->driver_data; VirtIODevice *vdev = virtio_ccw_get_vdev(sch); bool check_len; int len; hwaddr hw_len; VirtioThinintInfo *thinint; if (!dev) { return -EINVAL; } trace_virtio_ccw_interpret_ccw(sch->cssid, sch->ssid, sch->schid, ccw.cmd_code); check_len = !((ccw.flags & CCW_FLAG_SLI) && !(ccw.flags & CCW_FLAG_DC)); if (dev->force_revision_1 && dev->revision < 0 && ccw.cmd_code != CCW_CMD_SET_VIRTIO_REV) { return -ENOSYS; } switch (ccw.cmd_code) { case CCW_CMD_SET_VQ: ret = virtio_ccw_handle_set_vq(sch, ccw, check_len, dev->revision < 1); break; case CCW_CMD_VDEV_RESET: virtio_ccw_reset_virtio(dev, vdev); ret = 0; break; case CCW_CMD_READ_FEAT: if (check_len) { if (ccw.count != sizeof(features)) { ret = -EINVAL; break; } } else if (ccw.count < sizeof(features)) { ret = -EINVAL; break; } if (!ccw.cda) { ret = -EFAULT; } else { VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(vdev); features.index = address_space_ldub(&address_space_memory, ccw.cda + sizeof(features.features), MEMTXATTRS_UNSPECIFIED, NULL); if (features.index == 0) { if (dev->revision >= 1) { features.features = (uint32_t) (vdev->host_features & ~vdc->legacy_features); } else { features.features = (uint32_t)vdev->host_features; } } else if ((features.index == 1) && (dev->revision >= 1)) { features.features = (uint32_t)(vdev->host_features >> 32); } else { features.features = 0; } address_space_stl_le(&address_space_memory, ccw.cda, features.features, MEMTXATTRS_UNSPECIFIED, NULL); sch->curr_status.scsw.count = ccw.count - sizeof(features); ret = 0; } break; case CCW_CMD_WRITE_FEAT: if (check_len) { if (ccw.count != sizeof(features)) { ret = -EINVAL; break; } } else if (ccw.count < sizeof(features)) { ret = -EINVAL; break; } if (!ccw.cda) { ret = -EFAULT; } else { features.index = address_space_ldub(&address_space_memory, ccw.cda + sizeof(features.features), MEMTXATTRS_UNSPECIFIED, NULL); features.features = address_space_ldl_le(&address_space_memory, ccw.cda, MEMTXATTRS_UNSPECIFIED, NULL); if (features.index == 0) { virtio_set_features(vdev, (vdev->guest_features & 0xffffffff00000000ULL) | features.features); } else if ((features.index == 1) && (dev->revision >= 1)) { virtio_set_features(vdev, (vdev->guest_features & 0x00000000ffffffffULL) | ((uint64_t)features.features << 32)); } else { if (features.features) { fprintf(stderr, "Guest bug: features[%i]=%x (expected 0)\n", features.index, features.features); } } sch->curr_status.scsw.count = ccw.count - sizeof(features); ret = 0; } break; case CCW_CMD_READ_CONF: if (check_len) { if (ccw.count > vdev->config_len) { ret = -EINVAL; break; } } len = MIN(ccw.count, vdev->config_len); if (!ccw.cda) { ret = -EFAULT; } else { virtio_bus_get_vdev_config(&dev->bus, vdev->config); cpu_physical_memory_write(ccw.cda, vdev->config, len); sch->curr_status.scsw.count = ccw.count - len; ret = 0; } break; case CCW_CMD_WRITE_CONF: if (check_len) { if (ccw.count > vdev->config_len) { ret = -EINVAL; break; } } len = MIN(ccw.count, vdev->config_len); hw_len = len; if (!ccw.cda) { ret = -EFAULT; } else { config = cpu_physical_memory_map(ccw.cda, &hw_len, 0); if (!config) { ret = -EFAULT; } else { len = hw_len; memcpy(vdev->config, config, len); cpu_physical_memory_unmap(config, hw_len, 0, hw_len); virtio_bus_set_vdev_config(&dev->bus, vdev->config); sch->curr_status.scsw.count = ccw.count - len; ret = 0; } } break; case CCW_CMD_READ_STATUS: if (check_len) { if (ccw.count != sizeof(status)) { ret = -EINVAL; break; } } else if (ccw.count < sizeof(status)) { ret = -EINVAL; break; } if (!ccw.cda) { ret = -EFAULT; } else { address_space_stb(&address_space_memory, ccw.cda, vdev->status, MEMTXATTRS_UNSPECIFIED, NULL); sch->curr_status.scsw.count = ccw.count - sizeof(vdev->status);; ret = 0; } break; case CCW_CMD_WRITE_STATUS: if (check_len) { if (ccw.count != sizeof(status)) { ret = -EINVAL; break; } } else if (ccw.count < sizeof(status)) { ret = -EINVAL; break; } if (!ccw.cda) { ret = -EFAULT; } else { status = address_space_ldub(&address_space_memory, ccw.cda, MEMTXATTRS_UNSPECIFIED, NULL); if (!(status & VIRTIO_CONFIG_S_DRIVER_OK)) { virtio_ccw_stop_ioeventfd(dev); } if (virtio_set_status(vdev, status) == 0) { if (vdev->status == 0) { virtio_ccw_reset_virtio(dev, vdev); } if (status & VIRTIO_CONFIG_S_DRIVER_OK) { virtio_ccw_start_ioeventfd(dev); } sch->curr_status.scsw.count = ccw.count - sizeof(status); ret = 0; } else { ret = -ENOSYS; } } break; case CCW_CMD_SET_IND: if (check_len) { if (ccw.count != sizeof(indicators)) { ret = -EINVAL; break; } } else if (ccw.count < sizeof(indicators)) { ret = -EINVAL; break; } if (sch->thinint_active) { ret = -ENOSYS; break; } if (virtio_get_num_queues(vdev) > NR_CLASSIC_INDICATOR_BITS) { ret = -ENOSYS; break; } if (!ccw.cda) { ret = -EFAULT; } else { indicators = address_space_ldq_be(&address_space_memory, ccw.cda, MEMTXATTRS_UNSPECIFIED, NULL); dev->indicators = get_indicator(indicators, sizeof(uint64_t)); sch->curr_status.scsw.count = ccw.count - sizeof(indicators); ret = 0; } break; case CCW_CMD_SET_CONF_IND: if (check_len) { if (ccw.count != sizeof(indicators)) { ret = -EINVAL; break; } } else if (ccw.count < sizeof(indicators)) { ret = -EINVAL; break; } if (!ccw.cda) { ret = -EFAULT; } else { indicators = address_space_ldq_be(&address_space_memory, ccw.cda, MEMTXATTRS_UNSPECIFIED, NULL); dev->indicators2 = get_indicator(indicators, sizeof(uint64_t)); sch->curr_status.scsw.count = ccw.count - sizeof(indicators); ret = 0; } break; case CCW_CMD_READ_VQ_CONF: if (check_len) { if (ccw.count != sizeof(vq_config)) { ret = -EINVAL; break; } } else if (ccw.count < sizeof(vq_config)) { ret = -EINVAL; break; } if (!ccw.cda) { ret = -EFAULT; } else { vq_config.index = address_space_lduw_be(&address_space_memory, ccw.cda, MEMTXATTRS_UNSPECIFIED, NULL); if (vq_config.index >= VIRTIO_QUEUE_MAX) { ret = -EINVAL; break; } vq_config.num_max = virtio_queue_get_num(vdev, vq_config.index); address_space_stw_be(&address_space_memory, ccw.cda + sizeof(vq_config.index), vq_config.num_max, MEMTXATTRS_UNSPECIFIED, NULL); sch->curr_status.scsw.count = ccw.count - sizeof(vq_config); ret = 0; } break; case CCW_CMD_SET_IND_ADAPTER: if (check_len) { if (ccw.count != sizeof(*thinint)) { ret = -EINVAL; break; } } else if (ccw.count < sizeof(*thinint)) { ret = -EINVAL; break; } len = sizeof(*thinint); hw_len = len; if (!ccw.cda) { ret = -EFAULT; } else if (dev->indicators && !sch->thinint_active) { ret = -ENOSYS; } else { thinint = cpu_physical_memory_map(ccw.cda, &hw_len, 0); if (!thinint) { ret = -EFAULT; } else { uint64_t ind_bit = ldq_be_p(&thinint->ind_bit); len = hw_len; dev->summary_indicator = get_indicator(ldq_be_p(&thinint->summary_indicator), sizeof(uint8_t)); dev->indicators = get_indicator(ldq_be_p(&thinint->device_indicator), ind_bit / 8 + 1); dev->thinint_isc = thinint->isc; dev->routes.adapter.ind_offset = ind_bit; dev->routes.adapter.summary_offset = 7; cpu_physical_memory_unmap(thinint, hw_len, 0, hw_len); dev->routes.adapter.adapter_id = css_get_adapter_id( CSS_IO_ADAPTER_VIRTIO, dev->thinint_isc); sch->thinint_active = ((dev->indicators != NULL) && (dev->summary_indicator != NULL)); sch->curr_status.scsw.count = ccw.count - len; ret = 0; } } break; case CCW_CMD_SET_VIRTIO_REV: len = sizeof(revinfo); if (ccw.count < len) { ret = -EINVAL; break; } if (!ccw.cda) { ret = -EFAULT; break; } revinfo.revision = address_space_lduw_be(&address_space_memory, ccw.cda, MEMTXATTRS_UNSPECIFIED, NULL); revinfo.length = address_space_lduw_be(&address_space_memory, ccw.cda + sizeof(revinfo.revision), MEMTXATTRS_UNSPECIFIED, NULL); if (ccw.count < len + revinfo.length || (check_len && ccw.count > len + revinfo.length)) { ret = -EINVAL; break; } if (dev->revision >= 0 || revinfo.revision > virtio_ccw_rev_max(dev) || (dev->force_revision_1 && !revinfo.revision)) { ret = -ENOSYS; break; } ret = 0; dev->revision = revinfo.revision; break; default: ret = -ENOSYS; break; } return ret; }
1threat
Scala language relates in some way with ScalaScript : <p>My boss ia bashing Scala language due to an previous experience with ScalaScript from <a href="https://scala.com" rel="nofollow noreferrer">https://scala.com</a> so are there some relationship between they?</p> <p>I am trying to evagelize Scala in my company, so it is important to eliminate this misunderstandings.</p>
0debug
amortized analysis of dynamic array resizing : A question on amortized analysis of dynamic array resizing that has me stumped Instead of copying the N elements into an array of 2N, they are copied into an array with N/4 additional cells, going to capacity N + N/4 Show that performing a sequence of n additions to the array runs in O(n) Any tips, help much appreciated (not homework)
0debug
Python Functions Program : Hey guys I was hoping I could get some help writing this program with some comments to help me. https://i.imgur.com/xv0aHIg.png I got this far: def main(): a_tickets_sold = int(input('How many A tickets were sold?: ')) b_tickets_sold = int(input('How many B tickets were sold?: ')) c_tickets_sold = int(input('How many C tickets were sold?: ')) d_tickets_sold = int(input('How many D tickets were sold?: ')) def calculate_class_incomes(): a_total = a_tickets_sold * 30 b_total = b_tickets_sold * 30 c_total = c_tickets_sold * 30 d_total = d_tickets_sold * 30 main() calculate_class_incomes()
0debug
static void do_exit(void) { if (cur_stream) { stream_close(cur_stream); cur_stream = NULL; } uninit_opts(); #if CONFIG_AVFILTER avfilter_uninit(); #endif avformat_network_deinit(); if (show_status) printf("\n"); SDL_Quit(); av_log(NULL, AV_LOG_QUIET, ""); exit(0); }
1threat
Can a purely virtual function have an function accessor? : If my pure virtual function is i.e. virtual string func()=0, is it returnable to an accessor function?
0debug
sort data in mySQL : <p>my table is </p> <pre><code>+-----------+--------+--------+ | Name | Weight | Height | +-----------+--------+--------+ | Amin | 75 | 180 | | Mahdi | 90 | 190 | | Moahammad | 75 | 175 | | Ahmad | 60 | 175 | +-----------+--------+--------+ </code></pre> <p>I want sort a table from bigger Height and if Height is equal print lower weight first. and the result like this</p> <pre><code>Mahdi 190 90 Amin 180 75 Ahmad 175 60 Mohammad 175 75 </code></pre>
0debug
how to get list of all installed applications in iOS swift iOS version 11+ : I'm working on getting the list of all installed app , I'd find out here in this link : https://github.com/profburke/AppLister , that the solution adopted there doesn't support iOS latest version 11+ , the list of apps appears only in sumilator but in real device no, i tried to work on that with changing private frameworks used with the latest version, Isn's there any way to get all the list of installed application and check a specific bundle/app can be opened or no.
0debug
Open Dev Menu or reload app without shaking? : <p>Is there a way to open dev menu or reload app without shaking the app?</p> <p>Android Wireless over wifi so no usb cable Windows 10</p> <p>Hot reload or Live reload is not good enough and my arm hurts :)</p>
0debug
Disable auto fullscreen of YouTube embeds on iPhone : <p>As we will know from other questions on the site to in iOS Mobile Safari we have these tasty attributes <code>webkit-playesinline</code> and the more concise <code>playsinline</code> to disable auto fullscreen of videos.</p> <p>Despite that miracle I'm still unable to figure out how to add this to YouTube html5 embeds. As expected the YouTube <code>&lt;video&gt;</code> is contained within an <code>&lt;iframe&gt;</code>. </p> <p>the ideal result is something as the following: </p> <pre><code>&lt;video tabindex="-1" class="video-stream html5-main-video" style="width: 736px; height: 414px; left: 85px; top: 0px;" src="blob:https://www.youtube.com/6889sdad6d2-ec51-49ca-b357-a5bd9c3ede71" webkit-playsinline="true" playsinline="true"&gt; &lt;/video&gt; </code></pre> <p>I have tried, in vain, to do this via jquery.</p> <p>Any thoughts or ideas how to do this?</p>
0debug
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; VBDecContext * const c = avctx->priv_data; uint8_t *outptr, *srcptr; int i, j; int flags; uint32_t size; int rest = buf_size; int offset = 0; if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); c->pic.reference = 3; if(avctx->get_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } c->stream = buf; flags = bytestream_get_le16(&c->stream); rest -= 2; if(flags & VB_HAS_GMC){ i = (int16_t)bytestream_get_le16(&c->stream); j = (int16_t)bytestream_get_le16(&c->stream); offset = i + j * avctx->width; rest -= 4; } if(flags & VB_HAS_VIDEO){ size = bytestream_get_le32(&c->stream); if(size > rest){ av_log(avctx, AV_LOG_ERROR, "Frame size is too big\n"); return -1; } vb_decode_framedata(c, c->stream, size, offset); c->stream += size - 4; rest -= size; } if(flags & VB_HAS_PALETTE){ size = bytestream_get_le32(&c->stream); if(size > rest){ av_log(avctx, AV_LOG_ERROR, "Palette size is too big\n"); return -1; } vb_decode_palette(c, size); rest -= size; } memcpy(c->pic.data[1], c->pal, AVPALETTE_SIZE); c->pic.palette_has_changed = flags & VB_HAS_PALETTE; outptr = c->pic.data[0]; srcptr = c->frame; for(i = 0; i < avctx->height; i++){ memcpy(outptr, srcptr, avctx->width); srcptr += avctx->width; outptr += c->pic.linesize[0]; } FFSWAP(uint8_t*, c->frame, c->prev_frame); *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; return buf_size; }
1threat
How to implement FirebaseDB with a Django Web Application : <p>Am trying to implement Firebase Realtime Database with my Django Web Application. After properly setting up the configuration with Firebase, I got confused about how data will write into my Firebase Database from my Django website instead of using Sqlite, or Postgres. </p> <p>Under <code>settings.py</code>, do I need to set my engine to Firebase? Am totally confused here. I do not want to use the normal ORM such as Sqlite, Postgres etc. I want my app to use Firebase.</p> <p>Is there something else I need to understand about Firebase? </p> <p><strong>settings.py</strong></p> <pre><code>DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } </code></pre> <p><strong>pyrebase_settings</strong> file</p> <pre><code>import pyrebase config = { "apiKey": "my_api_key_is_here", "authDomain": "my_auth_domain_is_here", "databaseURL": "my_firebase_database_url_is_here", "projectId": "my_firebase_project_id_is_here", "storageBucket": "my_firebase_storageBucket_is_here", "serviceAccount": "my_serviceAccount.json_file_path_is_here", "messagingSenderId": "messagingSenderId_is_here" } # initialize app with config firebase = pyrebase.initialize_app(config) # authenticate a user auth = firebase.auth() user = auth.sign_in_with_email_and_password("email@usedforauthentication.com", "FstrongPasswordHere") db = firebase.database() </code></pre>
0debug
static int idcin_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; IdcinContext *s = avctx->priv_data; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); AVFrame *frame = data; int ret; s->buf = buf; s->size = buf_size; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; if (idcin_decode_vlcs(s, frame)) return AVERROR_INVALIDDATA; if (pal) { frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } memcpy(frame->data[1], s->pal, AVPALETTE_SIZE); *got_frame = 1; return buf_size; }
1threat
static int cbs_read_ue_golomb(CodedBitstreamContext *ctx, BitstreamContext *bc, const char *name, uint32_t *write_to, uint32_t range_min, uint32_t range_max) { uint32_t value; int position; if (ctx->trace_enable) { char bits[65]; unsigned int k; int i, j; position = bitstream_tell(bc); for (i = 0; i < 32; i++) { k = bitstream_read_bit(bc); bits[i] = k ? '1' : '0'; if (k) break; } if (i >= 32) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid ue-golomb " "code found while reading %s: " "more than 31 zeroes.\n", name); return AVERROR_INVALIDDATA; } value = 1; for (j = 0; j < i; j++) { k = bitstream_read_bit(bc); bits[i + j + 1] = k ? '1' : '0'; value = value << 1 | k; } bits[i + j + 1] = 0; --value; ff_cbs_trace_syntax_element(ctx, position, name, bits, value); } else { value = get_ue_golomb_long(bc); } if (value < range_min || value > range_max) { av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " "%"PRIu32", but must be in [%"PRIu32",%"PRIu32"].\n", name, value, range_min, range_max); return AVERROR_INVALIDDATA; } *write_to = value; return 0; }
1threat
How to migrate NPM package to an organization @scope : <p><a href="https://docs.npmjs.com/orgs/what-are-orgs" rel="noreferrer">NPM</a> has recently introduced @scopes / organizations for the modules. Is there a good way to migrate existing modules to the organization? Are there any tools for automating it for a large number of packages? Does NPM support redirects, so that other software could still use the old name, yet get a notification that it should be updated?</p>
0debug