problem
stringlengths
26
131k
labels
class label
2 classes
how to delete a specific file from specific folder in Ubuntu 16.04 using Terminal : <p>I want to delete a zip file using terminal but i dont know what the command is for that purpose in Ubuntu. </p> <p><strong>fileName</strong>: android-studio-ide-162.3871768-linux.zip <br> <strong>location</strong>: /home/raza/Downloads</p> <p>this is the file i want to delete form the location mention above.</p>
0debug
Location.back() not working with Angular Tour of Heroes : I noticed that the location.back() is not functioning well on StackBlitz.com for the tour of heroes application. Any idea why this behavior? https://stackblitz.com/angular/qvvrbgrmmda?file=src%2Fapp%2Fhero-detail%2Fhero-detail.component.ts Thanks
0debug
jquery prop method not functioning as expected : I am getting issue with jquery prop method. if i am setting value dynamically, and then disabling the input then the value is hiding. Below is my code: $("#firstName").val("First Name"); $("input").prop("disabled",true); and now clicking edit button and removing disabled. $("input").prop("disabled",false); at this point of time, my value is again visible. can anybody help me in understanding this and make that value visible even on disable mode. Thanks
0debug
Convert a string of integers from input to array of integers in R : I have string of integers from input text box ( in r shiny) like this : input[["var1"]] "1,2,3,4" I want to convert it into a numeric vector like below: values <- c(1,2,3,4) Any help would be highly appreciated. Thanks, Ravijeet
0debug
How to retrieve MongoDb collection validator rules? : <p>On MongoDB 3.4.4 I've created a collection with a validator, but now some inserts fail this rules and I can't understand why. </p> <ol> <li>Is there a way to output the rules of the validor? I'm afraid the rules applied are different from what I think they are...</li> <li>Is there a way to improve the error message? "Document failed validation" in this scenario is quite useless.</li> </ol> <p>Thank you!</p>
0debug
void avformat_close_input(AVFormatContext **ps) { AVFormatContext *s = *ps; AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; flush_packet_queue(s); if (s->iformat->read_close) s->iformat->read_close(s); avformat_free_context(s); *ps = NULL; avio_close(pb); }
1threat
X264_close(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; if(x4->enc) x264_encoder_close(x4->enc); return 0; }
1threat
window.location.href = 'http://attack.com?user=' + user_input;
1threat
static void do_wav_capture(Monitor *mon, const QDict *qdict) { const char *path = qdict_get_str(qdict, "path"); int has_freq = qdict_haskey(qdict, "freq"); int freq = qdict_get_try_int(qdict, "freq", -1); int has_bits = qdict_haskey(qdict, "bits"); int bits = qdict_get_try_int(qdict, "bits", -1); int has_channels = qdict_haskey(qdict, "nchannels"); int nchannels = qdict_get_try_int(qdict, "nchannels", -1); CaptureState *s; s = qemu_mallocz (sizeof (*s)); freq = has_freq ? freq : 44100; bits = has_bits ? bits : 16; nchannels = has_channels ? nchannels : 2; if (wav_start_capture (s, path, freq, bits, nchannels)) { monitor_printf(mon, "Faied to add wave capture\n"); qemu_free (s); } QLIST_INSERT_HEAD (&capture_head, s, entries); }
1threat
Add tap gesture to UIStackView : <p>Im attempting to add a <code>UITapGesture</code> to a <code>UIStackView</code> within a collectionView cell but each time I do my app crashes. (All <code>IBOutlets</code> are connected) This there something I'm doing wrong here?</p> <pre><code> let fGuesture = UITapGestureRecognizer(target: self, action: #selector(self.showF(_:))) cell.fstackView.addGestureRecognizer(fGuesture) func showF(sender: AnyObject){ print(111) } </code></pre>
0debug
Class path contains multiple SLF4J bindings, pls tell me which dependency should I remove from the pom to resolved this problem : <p>In my pom.xml file, I found following dependencies, in my parent pom.xml contain logback-classic dependency and another module contain slf4j-api dependency,</p> <pre><code> &lt;dependency&gt; &lt;groupId&gt;org.slf4j&lt;/groupId&gt; &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt; &lt;version&gt;${slf4j.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt; &lt;artifactId&gt;logback-classic&lt;/artifactId&gt; &lt;version&gt;${logback.version}&lt;/version&gt; &lt;/dependency&gt; logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class slf4j-simple-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class </code></pre>
0debug
Why does golang time function fail on certain dates : <p>I have checked the other suggestions for fixing this problem and they don't work.</p> <p>The current code seems to work until you enter a different date and then I get random failures like below.</p> <p>The code is as follows:</p> <pre><code>yy, mm, dd = 11, 27, 2019 s_yy, s_mm, s_dd = 11, 1, 2019 e_yy, e_mm, e_dd = 1, 1, 2020 input := fmt.Sprintf("%d-%d-%d", yy, mm, dd) input += "T15:04:05.000-07:00" t, _ := time.Parse("2006-01-02T15:04:05.000-07:00", input) input_s := fmt.Sprintf("%d-%d-%d", s_yy, s_mm, s_dd) input_s += "T15:04:05.000-07:00" t_s, _ := time.Parse("2006-01-02T15:04:05.000-07:00", input_s) input_e := fmt.Sprintf("%d-%d-%d", e_yy, e_mm, e_dd) input_e += "T15:04:05.000-07:00" t_e, _ := time.Parse("2006-01-02T15:04:05.000-07:00", input_e) fmt.Println("t = ", t, " t_s = ", t_s, " t_e", t_e) </code></pre> <p>The result is the following:</p> <p>t = 2019-12-27 15:04:05 -0700 -0700 t_s = 0001-01-01 00:00:00 +0000 UTC t_e 0001-01-01 00:00:00 +0000 UTC</p> <p>Any Help would be a help Thanks in advance.</p>
0debug
Java:how to convert list of Songs into stream of Strings : I have a list of songs, which is a class with 3 values: songName, albumName, duration and hash. I have write a function which return a Stream<String> of all the songs ordered by name. My first idea was this: public Stream<String> orderedSongNames() { return songs.stream().sorted((s1,s2)>s1.getSongName().compareTo(s2.getSongName())); } The problem is that in this way, the return value is a Stream<Song>.
0debug
How to estimate the time headway between two pair of vehicle arrival at a fixed point on road : [Speed and Headway data image file <---- click here so see the image file][1] [1]: https://i.stack.imgur.com/aQnVf.jpg This is a very big headache doing this type of data manipulation in excel. The challenge is I have to calculate the headway differences between pair of vehicles for different lanes. Let me first describe the features of the data that is shown in the attached image link v_type ----> is Vehicle type, where, 2w = two wheeler, car = standard car, auto = 3 wheeler vehicle, lcv = light commercial vehicle (smaller size good carrier) lane ----> lane specify the road is a 3 lane decided road i.e. both side of the median the road comprises of three lanes and 1, 2, 3 is lane number on which the vehicle is moving exit_time ----> exit time means the cumulative time in second one after another vehicle arrival at a particular section of a road. The image shows if first 2w cross the section or line after 4 second then the next auto cross after 9 second. so the time headway of arrival of auto after 2w is 9-4 = 5 second. The challenge is here to segregate the data lane-wise say first I have to segregate the lane 1 vehicles and then I have to calculate time headway in different pair of vehicles like i) all 2w arrival after car pair, ii) car arrival after 2w, iii) 2w arrival after auto, iv) auto arrival after 2w, v) lcv arrival after 2w, vi) 2w arrival after lcv and after segregating all vehicles in par I have to calculate the headway differences between pairs by calculating the differences between vehicle pair arrival time so the key challenges are i) first segregate the vehicle pair of different types lane wise ii) then calculate headway between them This I have to do using R-programming. So any suggestion on codes will be appropriated.
0debug
Visual Studio Code: How to show Overloads in IntelliSense? : <p>I am working with the new asp.net core 1.0 framework on Visual Studio Code. </p> <p>My question is, how do I traverse through all the overloads a method might have?</p> <p><a href="https://i.stack.imgur.com/DdFF9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/DdFF9.png" alt="VS Code method overloads"></a></p>
0debug
void vring_disable_notification(VirtIODevice *vdev, Vring *vring) { if (!(vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX))) { vring_set_used_flags(vdev, vring, VRING_USED_F_NO_NOTIFY); } }
1threat
How do you hide deprecated warnings in vscode for c++? : <p>I'm using commands such as printf() and scanf() a lot, and its really annoynig to declare in each new program that i want to make.</p> <p>Is there an easy way to just go into the settings, like in the linter or something, and tell vscode to just eat my shorts instead of bugging me with these warnings?</p>
0debug
static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) { ALSSpecificConfig *sconf = &ctx->sconf; AVCodecContext *avctx = ctx->avctx; GetBitContext *gb = &ctx->gb; unsigned int k; unsigned int s[8]; unsigned int sx[8]; unsigned int sub_blocks, log2_sub_blocks, sb_length; unsigned int start = 0; unsigned int opt_order; int sb; int32_t *quant_cof = bd->quant_cof; int32_t *current_res; bd->const_block = 0; bd->opt_order = 1; bd->js_blocks = get_bits1(gb); opt_order = bd->opt_order; if (!sconf->bgmc && !sconf->sb_part) { log2_sub_blocks = 0; } else { if (sconf->bgmc && sconf->sb_part) log2_sub_blocks = get_bits(gb, 2); else log2_sub_blocks = 2 * get_bits1(gb); } sub_blocks = 1 << log2_sub_blocks; if (bd->block_length & (sub_blocks - 1)) { av_log(avctx, AV_LOG_WARNING, "Block length is not evenly divisible by the number of subblocks.\n"); return -1; } sb_length = bd->block_length >> log2_sub_blocks; if (sconf->bgmc) { s[0] = get_bits(gb, 8 + (sconf->resolution > 1)); for (k = 1; k < sub_blocks; k++) s[k] = s[k - 1] + decode_rice(gb, 2); for (k = 0; k < sub_blocks; k++) { sx[k] = s[k] & 0x0F; s [k] >>= 4; } } else { s[0] = get_bits(gb, 4 + (sconf->resolution > 1)); for (k = 1; k < sub_blocks; k++) s[k] = s[k - 1] + decode_rice(gb, 0); } if (get_bits1(gb)) bd->shift_lsbs = get_bits(gb, 4) + 1; bd->store_prev_samples = (bd->js_blocks && bd->raw_other) || bd->shift_lsbs; if (!sconf->rlslms) { if (sconf->adapt_order) { int opt_order_length = av_ceil_log2(av_clip((bd->block_length >> 3) - 1, 2, sconf->max_order + 1)); bd->opt_order = get_bits(gb, opt_order_length); } else { bd->opt_order = sconf->max_order; } opt_order = bd->opt_order; if (opt_order) { int add_base; if (sconf->coef_table == 3) { add_base = 0x7F; quant_cof[0] = 32 * parcor_scaled_values[get_bits(gb, 7)]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[get_bits(gb, 7)]; for (k = 2; k < opt_order; k++) quant_cof[k] = get_bits(gb, 7); } else { int k_max; add_base = 1; to 19 k_max = FFMIN(opt_order, 20); for (k = 0; k < k_max; k++) { int rice_param = parcor_rice_table[sconf->coef_table][k][1]; int offset = parcor_rice_table[sconf->coef_table][k][0]; quant_cof[k] = decode_rice(gb, rice_param) + offset; } k_max = FFMIN(opt_order, 127); for (; k < k_max; k++) quant_cof[k] = decode_rice(gb, 2) + (k & 1); for (; k < opt_order; k++) quant_cof[k] = decode_rice(gb, 1); quant_cof[0] = 32 * parcor_scaled_values[quant_cof[0] + 64]; if (opt_order > 1) quant_cof[1] = -32 * parcor_scaled_values[quant_cof[1] + 64]; } for (k = 2; k < opt_order; k++) quant_cof[k] = (quant_cof[k] << 14) + (add_base << 13); } } if (sconf->long_term_prediction) { *bd->use_ltp = get_bits1(gb); if (*bd->use_ltp) { bd->ltp_gain[0] = decode_rice(gb, 1) << 3; bd->ltp_gain[1] = decode_rice(gb, 2) << 3; bd->ltp_gain[2] = ltp_gain_values[get_unary(gb, 0, 4)][get_bits(gb, 2)]; bd->ltp_gain[3] = decode_rice(gb, 2) << 3; bd->ltp_gain[4] = decode_rice(gb, 1) << 3; *bd->ltp_lag = get_bits(gb, ctx->ltp_lag_length); *bd->ltp_lag += FFMAX(4, opt_order + 1); } } if (bd->ra_block) { if (opt_order) bd->raw_samples[0] = decode_rice(gb, avctx->bits_per_raw_sample - 4); if (opt_order > 1) bd->raw_samples[1] = decode_rice(gb, s[0] + 3); if (opt_order > 2) bd->raw_samples[2] = decode_rice(gb, s[0] + 1); start = FFMIN(opt_order, 3); } if (sconf->bgmc) { unsigned int delta[sub_blocks]; unsigned int k [sub_blocks]; unsigned int b = av_clip((av_ceil_log2(bd->block_length) - 3) >> 1, 0, 5); unsigned int i = start; unsigned int high; unsigned int low; unsigned int value; ff_bgmc_decode_init(gb, &high, &low, &value); current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { k [sb] = s[sb] > b ? s[sb] - b : 0; delta[sb] = 5 - s[sb] + k[sb]; ff_bgmc_decode(gb, sb_length, current_res, delta[sb], sx[sb], &high, &low, &value, ctx->bgmc_lut, ctx->bgmc_lut_status); current_res += sb_length; } ff_bgmc_decode_end(gb); i = start; current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, i = 0) { unsigned int cur_tail_code = tail_code[sx[sb]][delta[sb]]; unsigned int cur_k = k[sb]; unsigned int cur_s = s[sb]; for (; i < sb_length; i++) { int32_t res = *current_res; if (res == cur_tail_code) { unsigned int max_msb = (2 + (sx[sb] > 2) + (sx[sb] > 10)) << (5 - delta[sb]); res = decode_rice(gb, cur_s); if (res >= 0) { res += (max_msb ) << cur_k; } else { res -= (max_msb - 1) << cur_k; } } else { if (res > cur_tail_code) res--; if (res & 1) res = -res; res >>= 1; if (cur_k) { res <<= cur_k; res |= get_bits_long(gb, cur_k); } } *current_res++ = res; } } } else { current_res = bd->raw_samples + start; for (sb = 0; sb < sub_blocks; sb++, start = 0) for (; start < sb_length; start++) *current_res++ = decode_rice(gb, s[sb]); } if (!sconf->mc_coding || ctx->js_switch) align_get_bits(gb); return 0; }
1threat
Recursive function, geometric progression : <p>I've just started learning C++ and I came across a simple problem but couldn't solve. Help me please,</p> <p>In geometric progression, b1=2, r=3. Create recursive function that outputs initial n sequences of progression. n should be input.</p>
0debug
def large_product(nums1, nums2, N): result = sorted([x*y for x in nums1 for y in nums2], reverse=True)[:N] return result
0debug
Django: conditional expression : <p>I have the following models:</p> <pre><code>class Agreement(models.Model): ... organization = models.ForeignKey("Organization") class Signed_Agreement(models.Model): agreement = models.ForeignKey("Agreement") member = models.ForeignKey("Member") </code></pre> <p>What I'm trying to do is get a list of all the agreements for a particular organization (self.organization) and annotate each agreement with information about whether or not it has been signed by a particular member (self.member).</p> <p>If the Agreement has been signed, then there exists an instance of Signed_Agreement for the particular agreement and member.</p> <p>How do I write a query for this?</p> <p>Here's my effort so far:</p> <pre><code>from django.db.models import When, F, Q, Value def get_queryset(self): agreements = _agreement_model.Agreement.objects.filter( organization=self.organization ).annotate( signed=When(Q(signed_agreement__member=self.member), then=Value(True)) ).order_by( 'name' ) return agreements </code></pre> <p>This is not producing the correct results. </p> <p>Any help would be appreciated. Thanks in advance.</p>
0debug
Python filter() function and list comparison : <p>I have a list in python like <code>l=('A','1,''B','2','C','3,''D','4')</code> and i need to filter out the value of A,B,C,D so i wrote a code like follow</p> <pre><code>list(filter(lambda x:x.isalpha(),l)) </code></pre> <p>then returned <code>['A', 'C']</code></p> <p>it did't return value B and D so i thought it was some thing i don't know about python filter function then i wrote it in list comparison like follows</p> <pre><code>[i for i in l if i.isalpha()] </code></pre> <p>but the strange thing is it also return the <code>['A', 'C']</code> so every time what happen to the value B and D </p> <p>Any one can explain me how to filter all alphabetic values out ???</p>
0debug
def get_Number(n, k): arr = [0] * n; i = 0; odd = 1; while (odd <= n): arr[i] = odd; i += 1; odd += 2; even = 2; while (even <= n): arr[i] = even; i += 1; even += 2; return arr[k - 1];
0debug
How To provide reference to another table from one table by using composite key : <p>Suppose I have one table which has two primary keys(composite key) and I want to provide reference to another table with the help of first table, so what should I do?</p>
0debug
Get local currency in swift : <p>I am setting up an little in app purchase store for muliple countries. How can I figure out that I have to show up the price in Dollar, Euro etc... I think it have to do with the localeIdentifier but I am not sure how to handle this</p>
0debug
Update a filter in a SQL select code : <p>I want to update the a filter in the following code I wrote. I am confused how to put.</p> <p>Code is:</p> <pre><code>$query = "SELECT P.`Building_info` as `name`,P.`Area` as `area`, avg( CASE WHEN P.`Bedroom`='4' THEN P.`$price` ELSE NULL END ) AS 'Beds_4', avg( CASE WHEN P.`Bedroom`='5' THEN P.`$price` ELSE NULL END ) AS 'Beds_5' FROM All_Rent P WHERE P.Building_info&lt;&gt;'' AND Sale_Rent='$accom' AND converted_date &gt; '$min_date' GROUP BY P.`Building_info`"; </code></pre> <p>I want to add a filter where <code>Area = "Euston Road"</code> i.e. select only the areas with the name "Euston Road"</p> <p>Can anyone help? </p>
0debug
void ff_vc1_mc_4mv_luma(VC1Context *v, int n, int dir, int avg) { MpegEncContext *s = &v->s; uint8_t *srcY; int dxy, mx, my, src_x, src_y; int off; int fieldmv = (v->fcm == ILACE_FRAME) ? v->blk_mv_type[s->block_index[n]] : 0; int v_edge_pos = s->v_edge_pos >> v->field_mode; uint8_t (*luty)[256]; int use_ic; if ((!v->field_mode || (v->ref_field_type[dir] == 1 && v->cur_field_type == 1)) && !v->s.last_picture.f->data[0]) return; mx = s->mv[dir][n][0]; my = s->mv[dir][n][1]; if (!dir) { if (v->field_mode && (v->cur_field_type != v->ref_field_type[dir]) && v->second_field) { srcY = s->current_picture.f->data[0]; luty = v->curr_luty; use_ic = v->curr_use_ic; } else { srcY = s->last_picture.f->data[0]; luty = v->last_luty; use_ic = v->last_use_ic; } } else { srcY = s->next_picture.f->data[0]; luty = v->next_luty; use_ic = v->next_use_ic; } if (!srcY) { av_log(v->s.avctx, AV_LOG_ERROR, "Referenced frame missing.\n"); return; } if (v->field_mode) { if (v->cur_field_type != v->ref_field_type[dir]) my = my - 2 + 4 * v->cur_field_type; } if (s->pict_type == AV_PICTURE_TYPE_P && n == 3 && v->field_mode) { int same_count = 0, opp_count = 0, k; int chosen_mv[2][4][2], f; int tx, ty; for (k = 0; k < 4; k++) { f = v->mv_f[0][s->block_index[k] + v->blocks_off]; chosen_mv[f][f ? opp_count : same_count][0] = s->mv[0][k][0]; chosen_mv[f][f ? opp_count : same_count][1] = s->mv[0][k][1]; opp_count += f; same_count += 1 - f; } f = opp_count > same_count; switch (f ? opp_count : same_count) { case 4: tx = median4(chosen_mv[f][0][0], chosen_mv[f][1][0], chosen_mv[f][2][0], chosen_mv[f][3][0]); ty = median4(chosen_mv[f][0][1], chosen_mv[f][1][1], chosen_mv[f][2][1], chosen_mv[f][3][1]); break; case 3: tx = mid_pred(chosen_mv[f][0][0], chosen_mv[f][1][0], chosen_mv[f][2][0]); ty = mid_pred(chosen_mv[f][0][1], chosen_mv[f][1][1], chosen_mv[f][2][1]); break; case 2: tx = (chosen_mv[f][0][0] + chosen_mv[f][1][0]) / 2; ty = (chosen_mv[f][0][1] + chosen_mv[f][1][1]) / 2; break; } s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][0] = tx; s->current_picture.motion_val[1][s->block_index[0] + v->blocks_off][1] = ty; for (k = 0; k < 4; k++) v->mv_f[1][s->block_index[k] + v->blocks_off] = f; } if (v->fcm == ILACE_FRAME) { int qx, qy; int width = s->avctx->coded_width; int height = s->avctx->coded_height >> 1; if (s->pict_type == AV_PICTURE_TYPE_P) { s->current_picture.motion_val[1][s->block_index[n] + v->blocks_off][0] = mx; s->current_picture.motion_val[1][s->block_index[n] + v->blocks_off][1] = my; } qx = (s->mb_x * 16) + (mx >> 2); qy = (s->mb_y * 8) + (my >> 3); if (qx < -17) mx -= 4 * (qx + 17); else if (qx > width) mx -= 4 * (qx - width); if (qy < -18) my -= 8 * (qy + 18); else if (qy > height + 1) my -= 8 * (qy - height - 1); } if ((v->fcm == ILACE_FRAME) && fieldmv) off = ((n > 1) ? s->linesize : 0) + (n & 1) * 8; else off = s->linesize * 4 * (n & 2) + (n & 1) * 8; src_x = s->mb_x * 16 + (n & 1) * 8 + (mx >> 2); if (!fieldmv) src_y = s->mb_y * 16 + (n & 2) * 4 + (my >> 2); else src_y = s->mb_y * 16 + ((n > 1) ? 1 : 0) + (my >> 2); if (v->profile != PROFILE_ADVANCED) { src_x = av_clip(src_x, -16, s->mb_width * 16); src_y = av_clip(src_y, -16, s->mb_height * 16); } else { src_x = av_clip(src_x, -17, s->avctx->coded_width); if (v->fcm == ILACE_FRAME) { if (src_y & 1) src_y = av_clip(src_y, -17, s->avctx->coded_height + 1); else src_y = av_clip(src_y, -18, s->avctx->coded_height); } else { src_y = av_clip(src_y, -18, s->avctx->coded_height + 1); } } srcY += src_y * s->linesize + src_x; if (v->field_mode && v->ref_field_type[dir]) srcY += s->current_picture_ptr->f->linesize[0]; if (fieldmv && !(src_y & 1)) v_edge_pos--; if (fieldmv && (src_y & 1) && src_y < 4) src_y--; if (v->rangeredfrm || use_ic || s->h_edge_pos < 13 || v_edge_pos < 23 || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx & 3) - 8 - s->mspel * 2 || (unsigned)(src_y - (s->mspel << fieldmv)) > v_edge_pos - (my & 3) - ((8 + s->mspel * 2) << fieldmv)) { srcY -= s->mspel * (1 + (s->linesize << fieldmv)); s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, s->linesize, 9 + s->mspel * 2, (9 + s->mspel * 2) << fieldmv, src_x - s->mspel, src_y - (s->mspel << fieldmv), s->h_edge_pos, v_edge_pos); srcY = s->edge_emu_buffer; if (v->rangeredfrm) { int i, j; uint8_t *src; src = srcY; for (j = 0; j < 9 + s->mspel * 2; j++) { for (i = 0; i < 9 + s->mspel * 2; i++) src[i] = ((src[i] - 128) >> 1) + 128; src += s->linesize << fieldmv; } } if (use_ic) { int i, j; uint8_t *src; src = srcY; for (j = 0; j < 9 + s->mspel * 2; j++) { int f = v->field_mode ? v->ref_field_type[dir] : (((j<<fieldmv)+src_y - (s->mspel << fieldmv)) & 1); for (i = 0; i < 9 + s->mspel * 2; i++) src[i] = luty[f][src[i]]; src += s->linesize << fieldmv; } } srcY += s->mspel * (1 + (s->linesize << fieldmv)); } if (s->mspel) { dxy = ((my & 3) << 2) | (mx & 3); if (avg) v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); else v->vc1dsp.put_vc1_mspel_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize << fieldmv, v->rnd); } else { dxy = (my & 2) | ((mx & 2) >> 1); if (!v->rnd) s->hdsp.put_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); else s->hdsp.put_no_rnd_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); } }
1threat
Cannot make C++ Hello World program, binary not found : I am just starting C++ and downloaded a compiler and an IDE, both eclipse, and tried to make my first C++ program. I use the Hello World C++ Makefile Project, and add the all the stuff on the next page. I then build the program, and the build says this: ***12:30:00 **** Build of configuration Default for project HelloWorld! **** make all Cannot run program "make": Launching failed Error: Program "make" not found in PATH PATH=[C:/Program Files (x86)/Java/jre1.8.0_91/bin/client;C:/Program Files (x86)/Java/jre1.8.0_91/bin;C:/Program Files (x86)/Java/jre1.8.0_91/lib/i386;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;c:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;c:\Program Files (x86)\Common Files\Roxio Shared\12.0\DLLShared\;C:\Program Files (x86)\Windows Live\Shared;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Users\Jen\Desktop\eclipse;] 12:30:00 Build Finished (took 122ms)*** I run the program, and it says: ***Launch failed. Binary not found.*** This is the code for the program: `#include <stdio.h> #include <stdlib.h> int main(void) { puts("Hello World!"); return EXIT_SUCCESS; }` There are two errors, too: 1. Function "puts" couldn't be resolved. 2. Symbol "EXIT_SUCCESS" couldn't be resolved. Thanks in advance! Nate N.
0debug
Can SSRS Reports be used without a SQL Server Database? : <p>I have an application that gets all its data from an old AS400 application. </p> <p>I get a model out (what in MVC I'd call a ViewModel) that has all the data for the reports, but the current legacy code is using the windows forms drawing API to place each box and label and data value on the report. It is hard-coded and maintenance is what you'd expect in terms of nightmare level. </p> <p>I want to switch over to a report based on the data object or a collection thereof. I know how to write code against an object data source in ASP.Net, but I was wondering if the same can be done using SSRS for the report design, then using the objects collection as the data source. Has anyone done this?</p> <p>Joey Morgan</p>
0debug
How to create local variable that throws exception? Java : <p>I am trying to create a new object in my main class, however, the class the object is referencing throws alot of IOExceptions. I know this is simple, but I just can't figure out the syntax to create this local variable. Please help</p> <pre><code>public static void main(String[] args) { ProcessBuilderExample start2 = new ProcessBuilderExample(); </code></pre> <p>Dr Java is giving me the error "Object must be caught or thrown"</p> <p>I tried this...</p> <pre><code>public static void main(String[] args) { ProcessBuilderExample start2 = new ProcessBuilderExample() throws IOException; </code></pre> <p>I get an error from this too. How do I declare this?</p>
0debug
Converting list with multiple data types(both string and integer) to a string in python : <p>I have below list with multiple data types(strings and integers). How do i convert this to a string.</p> <pre><code>sample_list =['a','b',1,'c',2,4,'d'] </code></pre> <p>Below statement is not working.</p> <pre><code>' '.join(sample_list) </code></pre>
0debug
XmlHolder VS Grutil.getXmlHolder : when we can create xmlholder instace with its consturctor XmlHolder(String xml) ie. using code def holder= new XmlHolder(context.expand('${Login#request}') why do we use GroovyUtils class to create xmlholder object as mentioned below..is it code performance def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context ) def holder = groovyUtils.getXmlHolder("GetUserTypes#ResponseAsXml")
0debug
void aio_notify(AioContext *ctx) { smp_mb(); if (!ctx->dispatching) { event_notifier_set(&ctx->notifier); } }
1threat
strip out non standard charicters from a defind string output in SQL : I am trying to strip out non standard charicters from a defind string output in SQL, there will be quite a few so i would like to use case rather than replace however i cant get it to work. any sugestions? (first post sorry about the formatting :( select distinct( CASE (SORT_CODE + cast(replicate('0',8-len(ACCOUNT_NUMBER)) + ACCOUNT_NUMBER as char(8)) + '0' + '17' --to be replaced by a check for a specific type + cast (replicate('0',11-len(replace(CURRENT_CHARGE_INCL,'.',''))) + replace(CURRENT_CHARGE_INCL,'.','') as char(11)) + cast(left(LAST_NAME, 10) + replicate(' ',18) as char(18)) + upper(cast(TRADING_NAME + replicate(' ',18) as char( 18))) ) WHEN '.' THEN ' ' WHEN '&' THEN ' ' WHEN ',' THEN ' ' else DD_line END) as DD_LINE
0debug
What is the alternate for -webkit-print-color-adjust in firefox and IE : <p>I had some issues with the printing the background colors.</p> <p>print-color-adjust made the background color issue solved in chrome.</p> <pre><code>body{ -webkit-print-color-adjust: exact; } </code></pre> <p>What are the <strong>alternate CSS</strong> in firefox and IE for this.</p>
0debug
C# - How can programm a textbox that add tags into a listbox just like stackoverflow tags are coded? : <p>Everytime I click enter, he deletes the textbox, adds the text of the word into the listbox?</p>
0debug
void do_adde (void) { T2 = T0; T0 += T1 + xer_ca; if (likely(!(T0 < T2 || (xer_ca == 1 && T0 == T2)))) { xer_ca = 0; } else { xer_ca = 1; } }
1threat
void call_pal (CPUState *env, int palcode) { target_ulong ret; if (logfile != NULL) fprintf(logfile, "%s: palcode %02x\n", __func__, palcode); switch (palcode) { case 0x83: if (logfile != NULL) fprintf(logfile, "CALLSYS n " TARGET_FMT_ld "\n", env->ir[0]); ret = do_syscall(env, env->ir[IR_V0], env->ir[IR_A0], env->ir[IR_A1], env->ir[IR_A2], env->ir[IR_A3], env->ir[IR_A4], env->ir[IR_A5]); if (ret >= 0) { env->ir[IR_A3] = 0; env->ir[IR_V0] = ret; } else { env->ir[IR_A3] = 1; env->ir[IR_V0] = -ret; } break; case 0x9E: env->ir[IR_V0] = env->unique; if (logfile != NULL) fprintf(logfile, "RDUNIQUE: " TARGET_FMT_lx "\n", env->unique); break; case 0x9F: env->unique = env->ir[IR_A0]; if (logfile != NULL) fprintf(logfile, "WRUNIQUE: " TARGET_FMT_lx "\n", env->unique); break; default: if (logfile != NULL) fprintf(logfile, "%s: unhandled palcode %02x\n", __func__, palcode); exit(1); } }
1threat
def permutation_coefficient(n, k): P = [[0 for i in range(k + 1)] for j in range(n + 1)] for i in range(n + 1): for j in range(min(i, k) + 1): if (j == 0): P[i][j] = 1 else: P[i][j] = P[i - 1][j] + ( j * P[i - 1][j - 1]) if (j < k): P[i][j + 1] = 0 return P[n][k]
0debug
CSS or JQuerry not working inside javascript : I am working on a website where in header I try to inspire people with a text that is constantly changing with javascript. One of the lines that appear among this text includes a link to the video, which was supposed to be a modal video, but it somehow fails to load properly while other videos outside this of this javascript work just fine. [Here][1] is the video of the problem. I am not sure, what isn't working here. Is it CSS or JQuerry? Here is the HTML code: <!doctype HTML> <html lang="en-US"> <head> <!-- load latest jQuery 3.1.1 --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <!--VIDEO-CSS--> <link href="./css/modal-videos.css" rel="stylesheet"> <!--HTML-CSS--> <link rel="stylesheet" href="./css/style.css"> <!--VIDEO-scripts--> <script src="./js/modal-videos-a.js"></script> <script src="./js/modal-videos-b.js"></script> <script src="./js/modal-videos-c.js"></script> </head> <body class="no-touch"> <div id="moto"></div> <!--THIS SCRIPT IS THE PROBLEM--> <script type="text/javascript" src="./js/headline.js"></script> <div class="boxspace"> <div class="box"> <div class="boxInner"> <div class="titleBox"> <header> Header title </header> <a href="./video/test.mp4">video</a> </p> </div> </div> </div> </div> </body> </html> Then here is the javascript `./js/headline.js` which is bugging me, because `<a href="./video/test.mp4">video</a>` isn't formated as instructed in `./css/modal-videos.css` although it references same local video file in a same way as in HTML file: var text = ["Line 1",'Line 2 and nonworking <a href="./video/test.mp4">video</a>.']; var counter = 0; var elem = document.getElementById("moto"); ChangeFunction(); setInterval(ChangeFunction, 3000); function ChangeFunction() { var moto = text[counter++]; $(elem).fadeOut('slow', function() { $(elem).html(moto); $(elem).fadeIn('slow'); }); if(counter >= text.length) { counter = 0; } } Here are also two CSS files - first `./css/modal-videos.css` (I just borrowed this one and I don't understand it very well) and second `./css/style.css`: .modal.fade.in { top: 20%; } .fade.in { opacity: 1; } .modal.fade { -webkit-transition: opacity .3s linear, top .3s ease-out; -moz-transition: opacity .3s linear, top .3s ease-out; -o-transition: opacity .3s linear, top .3s ease-out; transition: opacity .3s linear, top .3s ease-out; top: -25%; } .fade { opacity: 0; -webkit-transition: opacity 0.15s linear; -moz-transition: opacity 0.15s linear; -o-transition: opacity 0.15s linear; transition: opacity 0.15s linear; } .hide { display: none; } .modal { position: fixed; top: 10%; left: 50%; z-index: 1050; width: 560px; margin-left: -280px; background-color: #ffffff; border: 1px solid #999; border: 1px solid rgba(0, 0, 0, 0.3); -webkit-border-radius: 6px; -moz-border-radius: 6px; border-radius: 6px; -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3); -webkit-background-clip: padding-box; -moz-background-clip: padding-box; background-clip: padding-box; outline: none; margin-top: 10px; margin-bottom: 10px; overflow-y: hidden; } .modal-header { padding: 9px 15px; border-bottom: 1px solid #eee; } .modal-header .close { margin-top: 2px; } .close { float: right; font-weight: bold; line-height: 20px; color: #000000; text-shadow: 0 1px 0 #ffffff; opacity: 0.2; filter: alpha(opacity=20); font-size: 45px; height: 50px; cursor: pointer; } .modal-body { position: relative; max-height: 80%; overflow-y: visible; padding: 5px; margin-bottom: -4px; } .modal-body.modal-body-video iframe { height: 400px; width: 100%; } .modal-backdrop, .modal-backdrop.fade.in { opacity: 0.8; filter: alpha(opacity=80); } .modal-backdrop { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 1040; background-color: #000000; } .modal-header .link { white-space: normal; margin-left: 5px; } @media (max-width: 767px) { .modal.fade.in { top: 20px; } .modal { position: fixed; top: 20px; left: 20px; right: 20px; width: auto; margin: 0; } } @media (max-width: 480px) { .modal { top: 10px; left: 10px; right: 10px; } } and body{ margin: 0; padding-left: 10%; padding-right: 10%; padding-top: 2%; padding-bottom: 1%; } #moto{ margin-top: -20px; font-size: 1.7vw; text-align: center; height: 5vw; opacity: 0.8; } .boxspace { overflow: hidden; } .box { float: left; position: relative; width: 16.6666%; padding-bottom: 16.6666%; } .boxInner { position: absolute; left: 2%; right: 2%; top: 2%; bottom: 2%; overflow: hidden; border: thin solid #969696; border-radius: 4%; } .boxInner .titleBox { position: absolute; /*no top border*/ bottom: 0; left: 0; right: 0; /*we push the square down*/ margin-bottom: -20%; background: #000000; background: rgba(0, 0, 0, 0.8); color: #FFFFFF; padding-top: 2%; padding-bottom: 2%; padding-left: 2%; padding-right: 2%; text-align: center; font-size: 1.2vw; -webkit-transition: all 0.3s ease-out; -moz-transition: all 0.3s ease-out; -o-transition: all 0.3s ease-out; transition: all 0.3s ease-out; } .boxInner .titleBox header{ color: #FFFFFF; font-size: 1.4vw; } .boxInner .titleBox p{ color: #FFFFFF; font-size: 1.0vw; } body.no-touch .boxInner:hover .titleBox, body.touch .boxInner.touchFocus .titleBox { margin-bottom: 0px; } Has anyone got any suggestions on how to fix the video included in javascript to be rendered same as the other one? [1]: https://www.dropbox.com/s/dhewkwi83dddga8/output.mkv?dl=0
0debug
Cannot remove already declared permissions while app update on Google Play : Your recent app submission was rejected for violating the Permissions policy. Before submitting your app for another review, read through the policy and make sure your app is in compliance. Based on our review, we found your app’s expressed user experience did not match your declared core functionality Default Phone handler (and any other core functionality usage while default handler). Please remove these permissions from your app. - **The same error is shown even if the permissions are removed.** Default handler capability was listed on your declaration form, but your app does not appear to have default handler capability. Please submit a revised declaration form. - **There is no option to remove the core functionality "Default Phone Handler" from the declaration form.**
0debug
React Native Negative shadowOffset to create top shadow : <p>I am trying to create a bottom navigation bar like YouTube or Instagram have but I am running into issue creating the shadow effect:</p> <p>This is my current code;</p> <pre><code> shadowColor: '#000000', shadowOffset: { width: 0, height: 0 }, shadowRadius: 50, shadowOpacity: 1.0, elevation: 1 </code></pre> <p>This produces a shadow that is only visible on the bottom of the navigation bar but not on the top. Is there a way to place a negative shadowOffset so that the shadow is also visible on the top?</p> <p>Example:</p> <p><a href="https://i.stack.imgur.com/eOH3u.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eOH3u.png" alt="enter image description here"></a></p>
0debug
Haskell: Multiple definiton of data : **data Ponto = Cartesiano Double Double | Polar Double Double deriving (Show,Eq)** I'm doing a Work for a class and I have to use the definion above to do a function that calculates the distance of a point to the vertical axis, the coordinates can be as x and y or r and angle using the data type above. Can you help me understand how I use this type of definion in Haskell? Thank you and sorry but my english isn't the best!
0debug
regular expression for WORDS with space special characters : need regular expression for replace below string into below wrapper format Example: C# Regular expression for combination of space, alpha and special-character. Also for delta out: <span>C# <span>Regular <span>expression <span>for <span>combination <span>of </span><span>space<span>,</span> </span><span>alpha </span><span>and </span><span>special</span><span>-</span><span>character</span>. </span><span>Also </span><span>for </span><span>delta</span>
0debug
void object_property_add_child(Object *obj, const char *name, Object *child, Error **errp) { Error *local_err = NULL; gchar *type; type = g_strdup_printf("child<%s>", object_get_typename(OBJECT(child))); object_property_add(obj, name, type, object_get_child_property, NULL, object_finalize_child_property, child, &local_err); if (local_err) { error_propagate(errp, local_err); goto out; } object_ref(child); g_assert(child->parent == NULL); child->parent = obj; out: g_free(type); }
1threat
static void pcihotplug_write(void *opaque, uint32_t addr, uint32_t val) { struct pci_status *g = opaque; switch (addr) { case PCI_BASE: g->up = val; break; case PCI_BASE + 4: g->down = val; break; } PIIX4_DPRINTF("pcihotplug write %x <== %d\n", addr, val); }
1threat
why does arraylist hold object rather than reference variable, as opposed to array holding reference variable or primitives? : [enter image description here][1]When I'm learning array's knowledge, there are such descriptions saying array holds reference variables(not object itself) or primitives, as opposed to arraylist holding object.I want to confirm why arraylist can hold object rather than reference variables. [enter image description here][3] [1]: https://i.stack.imgur.com/PZrow.png [3]: https://i.stack.imgur.com/BwH9U.png
0debug
Error arising when using System.setProperty : System.setProperty is not supported when we click ctrl+space and giving errors multiple markers at this line. System.setProperty is a part of which jar file or where it is present? so that I can access it and use in my program. System.setProperty("webdriver.chrome.driver","E:\Selenium\chromedriver\chromedriver.exe");
0debug
This copy of libswiftCore.dylib requires an OS version prior to 12.2.0 : <p>The app crashes on launch when running from XCode 10.2 (before and after Swift 5.0 migration) with this on console</p> <blockquote> <p>This copy of libswiftCore.dylib requires an OS version prior to 12.2.0.</p> </blockquote> <p>I understand the error, but not sure what is required to fix this.</p>
0debug
Python:how random numbers are assigned to a list of arrary : List[] For i in range(6) Num=random.randit(1,6) List.append(num) Print(list) Is giving output in pattern: [2] [4 ,6] ETC. but i want output in a single list.like [5,5,3,5,2,1]
0debug
int ff_h264_decode_sei(H264Context *h){ while (get_bits_left(&h->gb) > 16) { int size, type; type=0; do{ if (get_bits_left(&h->gb) < 8) return AVERROR_INVALIDDATA; type+= show_bits(&h->gb, 8); }while(get_bits(&h->gb, 8) == 255); size=0; do{ if (get_bits_left(&h->gb) < 8) return AVERROR_INVALIDDATA; size+= show_bits(&h->gb, 8); }while(get_bits(&h->gb, 8) == 255); if(h->avctx->debug&FF_DEBUG_STARTCODE) av_log(h->avctx, AV_LOG_DEBUG, "SEI %d len:%d\n", type, size); switch(type){ case SEI_TYPE_PIC_TIMING: if(decode_picture_timing(h) < 0) return -1; break; case SEI_TYPE_USER_DATA_ITU_T_T35: if(decode_user_data_itu_t_t35(h, size) < 0) return -1; break; case SEI_TYPE_USER_DATA_UNREGISTERED: if(decode_unregistered_user_data(h, size) < 0) return -1; break; case SEI_TYPE_RECOVERY_POINT: if(decode_recovery_point(h) < 0) return -1; break; case SEI_BUFFERING_PERIOD: if(decode_buffering_period(h) < 0) return -1; break; case SEI_TYPE_FRAME_PACKING: if(decode_frame_packing(h, size) < 0) return -1; default: skip_bits(&h->gb, 8*size); } align_get_bits(&h->gb); } return 0; }
1threat
static FWCfgState *bochs_bios_init(AddressSpace *as, PCMachineState *pcms) { FWCfgState *fw_cfg; uint64_t *numa_fw_cfg; int i; const CPUArchIdList *cpus; MachineClass *mc = MACHINE_GET_CLASS(pcms); fw_cfg = fw_cfg_init_io_dma(FW_CFG_IO_BASE, FW_CFG_IO_BASE + 4, as); fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)pcms->apic_id_limit); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_bytes(fw_cfg, FW_CFG_ACPI_TABLES, acpi_tables, acpi_tables_len); fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override()); fw_cfg_add_bytes(fw_cfg, FW_CFG_E820_TABLE, &e820_reserve, sizeof(e820_reserve)); fw_cfg_add_file(fw_cfg, "etc/e820", e820_table, sizeof(struct e820_entry) * e820_entries); fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_cfg, sizeof(hpet_cfg)); numa_fw_cfg = g_new0(uint64_t, 1 + pcms->apic_id_limit + nb_numa_nodes); numa_fw_cfg[0] = cpu_to_le64(nb_numa_nodes); cpus = mc->possible_cpu_arch_ids(MACHINE(pcms)); for (i = 0; i < cpus->len; i++) { unsigned int apic_id = cpus->cpus[i].arch_id; assert(apic_id < pcms->apic_id_limit); if (cpus->cpus[i].props.has_node_id) { numa_fw_cfg[apic_id + 1] = cpu_to_le64(cpus->cpus[i].props.node_id); } } for (i = 0; i < nb_numa_nodes; i++) { numa_fw_cfg[pcms->apic_id_limit + 1 + i] = cpu_to_le64(numa_info[i].node_mem); } fw_cfg_add_bytes(fw_cfg, FW_CFG_NUMA, numa_fw_cfg, (1 + pcms->apic_id_limit + nb_numa_nodes) * sizeof(*numa_fw_cfg)); return fw_cfg; }
1threat
What's wrong with my code? Swift 3 sprite kit signal sigabbt : <p>I have a game with 4 button's at the bottom of the screen. It's work. But if I touch everywhere on the screen besides the buttons, the game crash down with messages Signal Sigabrt... Please can somebody help me?<a href="https://i.stack.imgur.com/q3hzf.png" rel="nofollow noreferrer">this is touchesBegan</a><a href="https://i.stack.imgur.com/YNBiX.png" rel="nofollow noreferrer">This is the error message</a></p>
0debug
How to alter the path for Postgres looking for extensions? : <p>I installed Postgres on a Windows machine, downloaded the binary installer for PostGIS and installed it. I only have one version of Postgres, so there is no messing up possible. </p> <p>Installing PostGIS using the binary installer is straight forward and you cannot mess up the installation directory either. it has to go into the Postgres directory.</p> <p>Now, when I want to create the PostGIS extension I am getting the following error:</p> <pre><code>ERROR: could not open extension control file "C:/APPS/POSTGR~1/pg96/../pg96/share/postgresql/extension/postgis.control": No such file or directory ********** Error ********** ERROR: could not open extension control file "C:/APPS/POSTGR~1/pg96/../pg96/share/postgresql/extension/postgis.control": No such file or directory SQL state: 58P01 </code></pre> <p>Though when I go into the directory <code>C:\APPS\PostgreSQL\pg96\share\extension</code> then I do have a <code>postgis.control</code> file present.</p> <p>How do I get the extension to work? I checked the content of the zipped PostGIS binaries and it looks like as if the structure is well preserved and all files are copied into the appropriate directories during the install process via the binary installer.</p>
0debug
can only concatenate str (not 'int') to str : <p>I want to make a simple addition program but get stuck at an error stating the following: TypeError: can only concatenate str (not 'int') to str.</p> <p>I have no idea what to do, I am pretty new to Python coding.</p> <pre><code>def addition(): x = int(input("Please enter the first number:")) y = int(input("Please enter the second number:")) z = x+y print("The sum of " +x+ " and " +y+ " gives " +z ) </code></pre> <p>I expect the code to return the value of the sum of the two entered values.</p>
0debug
string are splitted in 'list()' and not in '[]' why? in python : <br> I have been working in a project then I accidently discovered when I pass string,they are splitted in 'list()' but when I pass same string to '[ ]' there is not splitting into single letters of string can anyone tell what happend here..<br> >>> y = list("hello") >>> y ['h', 'e', 'l', 'l', 'o'] >>> z = ["hello"] >>> z ['hello'] >>>
0debug
How to wait for a stream to finish piping? (Nodejs) : <p>I have a for loop array of promises, so I used Promise.all to go through them and called then afterwards.</p> <pre><code>let promises = []; promises.push(promise1); promises.push(promise2); promises.push(promise3); Promise.all(promises).then((responses) =&gt; { for (let i = 0; i &lt; promises.length; i++) { if (promise.property === something) { //do something } else { let file = fs.createWriteStream('./hello.pdf'); let stream = responses[i].pipe(file); /* I WANT THE PIPING AND THE FOLLOWING CODE TO RUN BEFORE NEXT ITERATION OF FOR LOOP */ stream.on('finish', () =&gt; { //extract the text out of the pdf extract(filePath, {splitPages: false}, (err, text) =&gt; { if (err) { console.log(err); } else { arrayOfDocuments[i].text_contents = text; } }); }); } } </code></pre> <p>promise1, promise2, and promise3 are some http requests, and if one of them is an application/pdf, then I write it to a stream and parse the text out of it. But this code runs the next iteration before parsing the test out of the pdf. Is there a way to make the code wait until the piping to the stream and extracting are finished before moving on to the next iteration?</p>
0debug
How do I prevent StyleCop warning of a Hungarian notation when prefix is valid : <p>I have the following code:</p> <pre><code>var fxRate = new FxRate(); </code></pre> <p>which is giving me the following <a href="https://github.com/StyleCop/StyleCop.ReSharper" rel="noreferrer">StyleCop ReSharper</a> warning:</p> <blockquote> <p>The variable name 'fxRate' begins with a prefix that looks like Hungarian notation.</p> </blockquote> <p>I have tried copying the Settings.StyleCop file to my solution folder and adding an entry for fx:</p> <pre><code> &lt;Analyzers&gt; &lt;Analyzer AnalyzerId="StyleCop.CSharp.NamingRules"&gt; &lt;AnalyzerSettings&gt; &lt;CollectionProperty Name="Hungarian"&gt; ... &lt;Value&gt;fx&lt;/Value&gt; ... </code></pre> <p>I've restarted VS but I still get the same warning. I am using the StyleCop ReSharper extension in VS2017.</p> <p>How do I ensure 'fx' is a valid prefix in the solution (for all team members)?</p>
0debug
Not able to print with two decimals : <p>I am solving a problem in hackerrank , and i cannot print a output with two decimal places.</p> <p>I have tried round(number,2) and -</p> <pre><code>avg=(toavg[0]+toavg[1]+toavg[2])/3 print(float("{0:.2f}".format((toavg[0]+toavg[1]+toavg[2])/3))) </code></pre> <p>I am using python 3.</p> <pre><code>if __name__ == '__main__': n = int(input()) student_marks = {} for _ in range(n): name, *line = input().split() scores = list(map(float, line)) student_marks[name] = scores query_name = input() toavg=student_marks[query_name] avg=(toavg[0]+toavg[1]+toavg[2])/3 print(float("{0:.2f}".format((toavg[0]+toavg[1]+toavg[2])/3))) </code></pre> <p>I expected 56.00 or 36.50 but i got 56.0 or 36.5.</p>
0debug
static void v9fs_create(void *opaque) { int32_t fid; int err = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat stbuf; V9fsString name; V9fsString extension; int iounit; V9fsPDU *pdu = opaque; v9fs_path_init(&path); pdu_unmarshal(pdu, offset, "dsdbs", &fid, &name, &perm, &mode, &extension); trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (perm & P9_STAT_MODE_DIR) { err = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777, fidp->uid, -1, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_opendir(pdu, fidp); if (err < 0) { goto out; } fidp->fid_type = P9_FID_DIR; } else if (perm & P9_STAT_MODE_SYMLINK) { err = v9fs_co_symlink(pdu, fidp, &name, extension.data, -1 , &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_LINK) { int32_t ofid = atoi(extension.data); V9fsFidState *ofidp = get_fid(pdu, ofid); if (ofidp == NULL) { err = -EINVAL; goto out; } err = v9fs_co_link(pdu, ofidp, fidp, &name); put_fid(pdu, ofidp); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } } else if (perm & P9_STAT_MODE_DEVICE) { char ctype; uint32_t major, minor; mode_t nmode = 0; if (sscanf(extension.data, "%c %u %u", &ctype, &major, &minor) != 3) { err = -errno; goto out; } switch (ctype) { case 'c': nmode = S_IFCHR; break; case 'b': nmode = S_IFBLK; break; default: err = -EIO; goto out; } nmode |= perm & 0777; err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_NAMED_PIPE) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFIFO | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_SOCKET) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else { err = v9fs_co_open2(pdu, fidp, &name, -1, omode_to_uflags(mode)|O_CREAT, perm, &stbuf); if (err < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = omode_to_uflags(mode); if (fidp->open_flags & O_EXCL) { fidp->flags |= FID_NON_RECLAIMABLE; } } iounit = get_iounit(pdu, &fidp->path); stat_to_qid(&stbuf, &qid); offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit); err = offset; trace_v9fs_create_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit); out: put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, err); v9fs_string_free(&name); v9fs_string_free(&extension); v9fs_path_free(&path); }
1threat
-- counting occurences between dates of different date intervals : to simplify I have a query (MYSQL DB) that give me a table like this Person | Date_IN | Date_OUT | Structure During a year a person ENTER and EXIT many times, ENTER and EXIT could be also the same day. I'd like to count, for a specific day of year, how many person were IN each structure. The final goal is to have, for a given period (eg. 1st march --> 31st march), the sum of total person for each day for each structure. Can you help me?
0debug
int ff_msmpeg4_pred_dc(MpegEncContext *s, int n, int16_t **dc_val_ptr, int *dir_ptr) { int a, b, c, wrap, pred, scale; int16_t *dc_val; if (n < 4) { scale = s->y_dc_scale; } else { scale = s->c_dc_scale; } wrap = s->block_wrap[n]; dc_val= s->dc_val[0] + s->block_index[n]; a = dc_val[ - 1]; b = dc_val[ - 1 - wrap]; c = dc_val[ - wrap]; if(s->first_slice_line && (n&2)==0 && s->msmpeg4_version<4){ b=c=1024; } #if ARCH_X86 && HAVE_7REGS && HAVE_EBX_AVAILABLE __asm__ volatile( "movl %3, %%eax \n\t" "shrl $1, %%eax \n\t" "addl %%eax, %2 \n\t" "addl %%eax, %1 \n\t" "addl %0, %%eax \n\t" "mull %4 \n\t" "movl %%edx, %0 \n\t" "movl %1, %%eax \n\t" "mull %4 \n\t" "movl %%edx, %1 \n\t" "movl %2, %%eax \n\t" "mull %4 \n\t" "movl %%edx, %2 \n\t" : "+b" (a), "+c" (b), "+D" (c) : "g" (scale), "S" (ff_inverse[scale]) : "%eax", "%edx" ); #else if (scale == 8) { a = (a + (8 >> 1)) / 8; b = (b + (8 >> 1)) / 8; c = (c + (8 >> 1)) / 8; } else { a = FASTDIV((a + (scale >> 1)), scale); b = FASTDIV((b + (scale >> 1)), scale); c = FASTDIV((c + (scale >> 1)), scale); } #endif if(s->msmpeg4_version>3){ if(s->inter_intra_pred){ uint8_t *dest; int wrap; if(n==1){ pred=a; *dir_ptr = 0; }else if(n==2){ pred=c; *dir_ptr = 1; }else if(n==3){ if (abs(a - b) < abs(b - c)) { pred = c; *dir_ptr = 1; } else { pred = a; *dir_ptr = 0; } }else{ if(n<4){ wrap= s->linesize; dest= s->current_picture.f.data[0] + (((n >> 1) + 2*s->mb_y) * 8* wrap ) + ((n & 1) + 2*s->mb_x) * 8; }else{ wrap= s->uvlinesize; dest= s->current_picture.f.data[n - 3] + (s->mb_y * 8 * wrap) + s->mb_x * 8; } if(s->mb_x==0) a= (1024 + (scale>>1))/scale; else a= get_dc(dest-8, wrap, scale*8); if(s->mb_y==0) c= (1024 + (scale>>1))/scale; else c= get_dc(dest-8*wrap, wrap, scale*8); if (s->h263_aic_dir==0) { pred= a; *dir_ptr = 0; }else if (s->h263_aic_dir==1) { if(n==0){ pred= c; *dir_ptr = 1; }else{ pred= a; *dir_ptr = 0; } }else if (s->h263_aic_dir==2) { if(n==0){ pred= a; *dir_ptr = 0; }else{ pred= c; *dir_ptr = 1; } } else { pred= c; *dir_ptr = 1; } } }else{ if (abs(a - b) < abs(b - c)) { pred = c; *dir_ptr = 1; } else { pred = a; *dir_ptr = 0; } } }else{ if (abs(a - b) <= abs(b - c)) { pred = c; *dir_ptr = 1; } else { pred = a; *dir_ptr = 0; } } *dc_val_ptr = &dc_val[0]; return pred; }
1threat
Basic for loop summation in ruby : I'm new to ruby. What's wrong with this thought process when trying to sum the array values? I know there are other ways to do this like using reduce or even sum but am I not just adding the next value to 'sum' every iteration? def addArray(array) for i in array do sum += i end end addArray([1,3,6,8,7,10]);
0debug
static void test_qemu_strtoull_correct(void) { const char *str = "12345 foo"; char f = 'X'; const char *endptr = &f; uint64_t res = 999; int err; err = qemu_strtoull(str, &endptr, 0, &res); g_assert_cmpint(err, ==, 0); g_assert_cmpint(res, ==, 12345); g_assert(endptr == str + 5); }
1threat
Can we make custom filters in angularjs? : <p>I know there are some filters available in angularjs like <code>**currency**</code>, <code>**number**</code>. </p> <pre><code>{{ value | currency }} </code></pre> <p>Is there any filter available for Phone number formatting?</p> <p>And can I make my own filter?</p> <pre><code>{{ Phone-value | phoneFilter }} </code></pre> <p>I want to make my own <code>**phoneFilter**</code>.</p>
0debug
Disable "Break Mode" page in VS2015 : <p>Recently migrated from VS2010 to 2015. Now when I pause a running app to work on it, I get this very annoying "Break Mode" page with "The application is in break mode". Well, no shoot Sherlock, I pressed pause. I know its in break mode. The page is annoying and takes me away from the code I was going to work on completely unnecessarily.</p> <p>I didn't get this annoying page in 2010. I may have some setting switched back then on 2010 but too long to remember. </p> <p>Is there a way to disable this silly break mode page in VS2015?</p>
0debug
static void tcp_chr_connect(void *opaque) { CharDriverState *chr = opaque; TCPCharDriver *s = chr->opaque; struct sockaddr_storage ss, ps; socklen_t ss_len = sizeof(ss), ps_len = sizeof(ps); memset(&ss, 0, ss_len); if (getsockname(s->fd, (struct sockaddr *) &ss, &ss_len) != 0) { snprintf(chr->filename, CHR_MAX_FILENAME_SIZE, "Error in getsockname: %s\n", strerror(errno)); } else if (getpeername(s->fd, (struct sockaddr *) &ps, &ps_len) != 0) { snprintf(chr->filename, CHR_MAX_FILENAME_SIZE, "Error in getpeername: %s\n", strerror(errno)); } else { sockaddr_to_str(chr->filename, CHR_MAX_FILENAME_SIZE, &ss, ss_len, &ps, ps_len, s->is_listen, s->is_telnet); } s->connected = 1; if (s->chan) { chr->fd_in_tag = io_add_watch_poll(s->chan, tcp_chr_read_poll, tcp_chr_read, chr); } qemu_chr_be_generic_open(chr); }
1threat
difference between freestyle project and pipeline in jenkins : <p>I'm a little confused about Freestyle project and pipeline in jenkins when trying to create new items.</p> <p>When should I create item with Freestyle project? And in which case should I use pipeline?</p> <p>Do I need to store config.xml into code repository for future import? Or any other usage?</p> <p>Thanks for your help.</p>
0debug
static void usbnet_receive(void *opaque, const uint8_t *buf, size_t size) { USBNetState *s = opaque; struct rndis_packet_msg_type *msg; if (s->rndis) { msg = (struct rndis_packet_msg_type *) s->in_buf; if (!s->rndis_state == RNDIS_DATA_INITIALIZED) return; if (size + sizeof(struct rndis_packet_msg_type) > sizeof(s->in_buf)) return; memset(msg, 0, sizeof(struct rndis_packet_msg_type)); msg->MessageType = cpu_to_le32(RNDIS_PACKET_MSG); msg->MessageLength = cpu_to_le32(size + sizeof(struct rndis_packet_msg_type)); msg->DataOffset = cpu_to_le32(sizeof(struct rndis_packet_msg_type) - 8); msg->DataLength = cpu_to_le32(size); memcpy(msg + 1, buf, size); s->in_len = size + sizeof(struct rndis_packet_msg_type); } else { if (size > sizeof(s->in_buf)) return; memcpy(s->in_buf, buf, size); s->in_len = size; } s->in_ptr = 0; }
1threat
int ff_xvid_rate_control_init(MpegEncContext *s){ char *tmp_name; int fd, i; xvid_plg_create_t xvid_plg_create; xvid_plugin_2pass2_t xvid_2pass2; fd=av_tempfile("xvidrc.", &tmp_name, 0, s->avctx); if (fd == -1) { av_log(NULL, AV_LOG_ERROR, "Can't create temporary pass2 file.\n"); return -1; } for(i=0; i<s->rc_context.num_entries; i++){ static const char *frame_types = " ipbs"; char tmp[256]; RateControlEntry *rce; rce= &s->rc_context.entry[i]; snprintf(tmp, sizeof(tmp), "%c %d %d %d %d %d %d\n", frame_types[rce->pict_type], (int)lrintf(rce->qscale / FF_QP2LAMBDA), rce->i_count, s->mb_num - rce->i_count - rce->skip_count, rce->skip_count, (rce->i_tex_bits + rce->p_tex_bits + rce->misc_bits+7)/8, (rce->header_bits+rce->mv_bits+7)/8); write(fd, tmp, strlen(tmp)); } close(fd); memset(&xvid_2pass2, 0, sizeof(xvid_2pass2)); xvid_2pass2.version= XVID_MAKE_VERSION(1,1,0); xvid_2pass2.filename= tmp_name; xvid_2pass2.bitrate= s->avctx->bit_rate; xvid_2pass2.vbv_size= s->avctx->rc_buffer_size; xvid_2pass2.vbv_maxrate= s->avctx->rc_max_rate; xvid_2pass2.vbv_initial= s->avctx->rc_initial_buffer_occupancy; memset(&xvid_plg_create, 0, sizeof(xvid_plg_create)); xvid_plg_create.version= XVID_MAKE_VERSION(1,1,0); xvid_plg_create.fbase= s->avctx->time_base.den; xvid_plg_create.fincr= s->avctx->time_base.num; xvid_plg_create.param= &xvid_2pass2; if(xvid_plugin_2pass2(NULL, XVID_PLG_CREATE, &xvid_plg_create, &s->rc_context.non_lavc_opaque)<0){ av_log(NULL, AV_LOG_ERROR, "xvid_plugin_2pass2 failed\n"); return -1; } return 0; }
1threat
I'm trying to get the data from current excel file to another excel file using VBA but not working : I have a requirement where im doing copying and pasting data from current excel file to destination excel file. Below is the sample code; Sub ImportCSV() Dim strSourcePath As String Dim strDestPath As String Dim strFile As String Dim strData As String Dim x As Variant Dim Cnt As Long Dim r As Long Dim c As Long Application.ScreenUpdating = False 'Change the path to the source folder accordingly 'strSourcePath = "C:\Path\" strSourcePath = Application.ActiveWorkbook.Path If Right(strSourcePath, 1) <> "\" Then strSourcePath = strSourcePath & "\" 'Change the path to the destination folder accordingly strDestPath = Application.ActiveWorkbook.Path If Right(strDestPath, 1) <> "\" Then strDestPath = strDestPath & "\" strFile = Dir(strSourcePath & "*.csv") Set newbook = Workbooks.Add With newbook .SaveAs Filename:=strDestPath + "ERNTable.xlsx" .Close End With Do While Len(strFile) > 0 Cnt = Cnt + 1 If Cnt = 1 Then r = 1 Else r = Cells(Rows.Count, "A").End(xlUp).Row + 1 End If Open strSourcePath & strFile For Input As #1 If Cnt > 1 Then Line Input #1, strData End If Do Until EOF(1) Line Input #1, strData x = Split(strData, ",") For c = 0 To UBound(x) Cells(r, c + 1).Value = Trim(x(c)) Next c r = r + 1 Loop Close #1 Name strSourcePath & strFile As strDestPath & strFile strFile = Dir Loop Set newBook = workbooks.add with newBook .saveas filename:= "Finalfile.xlsx" End with ActiveSheet.Range("B$1:c$" &r).copy workbooks("Finalfile.xlsx").Worksheets("Sheet1").Range(("B$1:c$" &r) Workbooks("Finalfile.xlsx").Save Application.ScreenUpdating = True If Cnt = 0 Then _ MsgBox "No CSV files were found...", vbExclamation ' End If End Sub
0debug
Android Fingerprints: hasEnrolledFingerprints triggers exception on some Samsungs : <p>I'm seeing a lot of exceptions in our production app when enabling fingerprints coming from Android 6 users, which I cannot reproduce on any of my local Samsung devices. The stacktrace is:</p> <pre><code>Message: SecurityException: Permission Denial: getCurrentUser() from pid=24365, uid=10229 requires android.permission.INTERACT_ACROSS_USERS android.os.Parcel.readException in Parcel.java::1620 android.os.Parcel.readException in Parcel.java::1573 android.hardware.fingerprint.IFingerprintService$Stub$Proxy.hasEnrolledFingerprints in IFingerprintService.java::503 android.hardware.fingerprint.FingerprintManager.hasEnrolledFingerprints in FingerprintManager.java::762 android.support.v4.hardware.fingerprint.FingerprintManagerCompatApi23.a in SourceFile::39 android.support.v4.hardware.fingerprint.FingerprintManagerCompat$Api23FingerprintManagerCompatImpl.a in SourceFile::239 android.support.v4.hardware.fingerprint.FingerprintManagerCompat.a in SourceFile::66 </code></pre> <p>This is just using the standard <code>FingerprintManagerCompat</code> class from the support library, and the check works correctly on other devices.</p> <p>I don't want to add this permission to my app - it seems to have nothing to do with fingerprints.</p> <p>Has anyone encountered anything like this?</p>
0debug
Axios get in url works but with second parameter as object it doesn't : <p>I'm trying to send GET request as second parameter but it doesn't work while it does as url.</p> <p>This works, $_GET['naam'] returns test:</p> <pre><code>export function saveScore(naam, score) { return function (dispatch) { axios.get('http://****.nl/****/gebruikerOpslaan.php?naam=test') .then((response) =&gt; { dispatch({type: "SAVE_SCORE_SUCCESS", payload: response.data}) }) .catch((err) =&gt; { dispatch({type: "SAVE_SCORE_FAILURE", payload: err}) }) } }; </code></pre> <p>But when I try this, there is nothing in <code>$_GET</code> at all:</p> <pre><code>export function saveScore(naam, score) { return function (dispatch) { axios.get('http://****.nl/****/gebruikerOpslaan.php', { password: 'pass', naam: naam, score: score }) .then((response) =&gt; { dispatch({type: "SAVE_SCORE_SUCCESS", payload: response.data}) }) .catch((err) =&gt; { dispatch({type: "SAVE_SCORE_FAILURE", payload: err}) }) } }; </code></pre> <p>Why can't I do that? In the docs it clearly says it's possible. With <code>$_POST</code> it doesn't work either.</p>
0debug
Replacing word except when it is between letters : <p>For example I would like to change every "hi" to hello The problem is when I try to do it I get into some kind of problems. It translates other words badly like: from "his dog is nice" to "hellos dog is nice" How can I fix it (I am using php)</p>
0debug
Run remote php script from terminal : <p>how would I go about running a script @ <code>http://www.domain.com/php/script.php/</code> from my terminal window. Also, I would need to pass a variable, <code>$var1 = "string"</code>. How would I do this?</p>
0debug
WHY DO I GET 'RETURN' OUTSIDE FUNCTION on the line 6? : def getContinue(): response = input('Do you want to continue (y:n): ') while response not in ('y', 'n', 'Y', 'N'): response = input('Do you want to continue (y:n): ') if response in ('y', 'Y'): return 'y' else: return 'n' Write a Python function named getContinue that displays to the user “Do you want to continue (y/n): ”, and continues to prompt the user until either uppercase or lowercase 'y' or 'n' is entered, returning (lowercase) 'y' or 'n' as the function value.
0debug
i have to take integers in an array and output them in random order : this is the output i need Input Array: 1 2 3 4 5 6 7 Random Output: 7 2 3 6 1 5 4 this is what get Input size of the Array 5 Input Value 1 1 Input Value 2 2 Input Value 3 3 Input Value 4 4 Input Value 5 5 Random Output: 2 Random Output: 0 Random Output: 0 Random Output: 0 Random Output: 0 import java.util.Random; import java.util.Scanner; public class problem_2 { public static void main(String args[]){ Random r = new Random(); Scanner m = new Scanner(System.in); System.out.println("Input size of the Array"); int size = m.nextInt(); int a[] = new int[size]; int b[] = new int[size]; for(int i = 0;i<a.length;i++) { System.out.println("Input Value " +(i+1)); a[i] = m.nextInt(); } int cell = 0; int x = r.nextInt(size); int value = a[x]; while(cell<size) { for(int i =0; i<= size;i++) { if (b[i]==value) { cell++; } if(cell==0) { b[cell] = value; cell++; } System.out.println("Random Output: "+b[i]); } } } }
0debug
static av_always_inline int mvd_decode(HEVCContext *s) { int ret = 2; int k = 1; while (k < CABAC_MAX_BIN && get_cabac_bypass(&s->HEVClc->cc)) { ret += 1 << k; k++; } if (k == CABAC_MAX_BIN) av_log(s->avctx, AV_LOG_ERROR, "CABAC_MAX_BIN : %d\n", k); while (k--) ret += get_cabac_bypass(&s->HEVClc->cc) << k; return get_cabac_bypass_sign(&s->HEVClc->cc, -ret); }
1threat
Failed to resolve dependency in Gradle : <p>I am facing issue with gradel for the liberary </p> <pre><code>implementation 'com.android.support:appcompat-v7:27.1.1' </code></pre> <blockquote> <p>All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 25.2.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:support-media-compat:25.2.0 less... (Ctrl+F1) There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).</p> </blockquote> <p>My gradle file contains following code.</p> <p>My Android Studio is running on Android Studio 3.1</p> <pre><code>apply plugin: 'com.android.application' android { compileSdkVersion 27 defaultConfig { applicationId "greetgalleryfree.binarycrust.com" minSdkVersion 18 targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:27.1.1' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.google.firebase:firebase-database:11.8.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' } apply plugin: 'com.google.gms.google-services' </code></pre>
0debug
J query height and java script height gets 0 . Why? : I have a visible div on screen but when i gets its height, it returns always 0. How it is possible? I have tried many j query and JavaScript methods to get hight but it returns 0. This is my div: <div class="option-content"> <div class="row"> <div class="col-sm-12"> <div class="dropDownStyling" id="filterDropdowns"> </div> </div> </div> //Other contents </div> I have tried following methods to get height: var $element = $("#filterDropdowns"); $element.css("height") $element.height() $element.innerHeight() $element.outerHeight() Also tried javascript: document.getElementById('filterDropdowns').offsetHeight document.getElementById('filterDropdowns').clientHeight But in all cases, it returns 0,While it returns the width value.Then why height value gets 0?
0debug
How to Log object? : <p>I can see that Log facade is very useful. In the docs of laravel:</p> <blockquote> <p>The logger provides the eight logging levels defined in RFC 5424: emergency, alert, critical, error, warning, notice, info and debug.</p> </blockquote> <p>But, how would I log an instance of a model? like for example:</p> <pre><code>$user= User::find($user_id); </code></pre> <p>then, would it be possible to log the <code>$user</code> object?</p>
0debug
How do you use confirm dialogues in a custom Laravel Nova tool? : <p>Is it possible to use the built in Laravel Nova confirm dialogue in your own tool? All I would like to use is interact with it how Nova does itself.</p> <p>The docs are quite light on the JS topic, as the only built in UI you seem to be able to work with is the toasted plugin: <a href="https://nova.laravel.com/docs/1.0/customization/frontend.html#javascript" rel="noreferrer">https://nova.laravel.com/docs/1.0/customization/frontend.html#javascript</a></p> <p><a href="https://i.stack.imgur.com/SXvDF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SXvDF.png" alt="Built in Laravel Nova confirm dialogue"></a></p>
0debug
Undefined behavior of right-shift in C++ : <p>From cppreference.com:</p> <blockquote> <p>For unsigned a and for signed a with nonnegative values, the value of a >> b is the integer part of a/2<sup>b</sup> . For negative a, the value of a >> b is implementation-defined (in most implementations, this performs arithmetic right shift, so that the result remains negative).</p> <p>In any case, if the value of the right operand is negative or is greater or equal to the number of bits in the promoted left operand, the behavior is undefined.</p> </blockquote> <p>Why do we have an undefined behavior in case the right operand is greater or equal to the number of bits in the promoted left operand?<br/> It seems to me that the result should be 0 (at least for unsigned/positive integers)...</p> <p>In particular, with g++ (version 4.8.4, Ubuntu):</p> <pre><code>unsigned int x = 1; cout &lt;&lt; (x &gt;&gt; 16 &gt;&gt; 16) &lt;&lt; " " &lt;&lt; (x &gt;&gt; 32) &lt;&lt; endl; </code></pre> <p>gives: <code>0 1</code></p>
0debug
Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.1.0.0 : <p>I have a .NET Standard 1.4 class library that references the System.ComponentModel.Annotations (4.3.0) NuGet package.</p> <p>I'm then referencing this class library from a .NET Framework 4.6.2 test project. It builds fine, but at runtime I get the following error:</p> <blockquote> <p>System.IO.FileLoadException occurred HResult=0x80131040<br> Message=<strong>Could not load file or assembly 'System.ComponentModel.Annotations, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'</strong> or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)</p> </blockquote> <p>I tried adding a reference to the System.ComponentModel.Annotations (4.3.0) NuGet package from the net462 project, but that didn't make any difference.</p> <p>I tried adding a reference to the .NET Standard library from the net462 project, but still no luck.</p> <p>Am I missing something here? Is this a known bug, if so is there a work around?</p> <p>Any help is much appreciated!</p>
0debug
static void tcg_out_andi64(TCGContext *s, TCGReg dst, TCGReg src, uint64_t c) { int mb, me; assert(TCG_TARGET_REG_BITS == 64); if (mask64_operand(c, &mb, &me)) { if (mb == 0) { tcg_out_rld(s, RLDICR, dst, src, 0, me); } else { tcg_out_rld(s, RLDICL, dst, src, 0, mb); } } else if ((c & 0xffff) == c) { tcg_out32(s, ANDI | SAI(src, dst, c)); return; } else if ((c & 0xffff0000) == c) { tcg_out32(s, ANDIS | SAI(src, dst, c >> 16)); return; } else { tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_R0, c); tcg_out32(s, AND | SAB(src, dst, TCG_REG_R0)); } }
1threat
int qemu_strtol(const char *nptr, const char **endptr, int base, long *result) { char *p; int err = 0; if (!nptr) { if (endptr) { *endptr = nptr; } err = -EINVAL; } else { errno = 0; *result = strtol(nptr, &p, base); err = check_strtox_error(endptr, p, errno); } return err; }
1threat
int scsi_build_sense(uint8_t *in_buf, int in_len, uint8_t *buf, int len, bool fixed) { bool fixed_in; SCSISense sense; if (!fixed && len < 8) { return 0; } if (in_len == 0) { sense.key = NO_SENSE; sense.asc = 0; sense.ascq = 0; } else { fixed_in = (in_buf[0] & 2) == 0; if (fixed == fixed_in) { memcpy(buf, in_buf, MIN(len, in_len)); return MIN(len, in_len); } if (fixed_in) { sense.key = in_buf[2]; sense.asc = in_buf[12]; sense.ascq = in_buf[13]; } else { sense.key = in_buf[1]; sense.asc = in_buf[2]; sense.ascq = in_buf[3]; } } memset(buf, 0, len); if (fixed) { buf[0] = 0xf0; buf[2] = sense.key; buf[7] = 10; buf[12] = sense.asc; buf[13] = sense.ascq; return MIN(len, 18); } else { buf[0] = 0x72; buf[1] = sense.key; buf[2] = sense.asc; buf[3] = sense.ascq; return 8; } }
1threat
variable is undefined in else statement : <p>I am confused as to why I am getting an 'undefined' error in my code. I am trying to delete an id from an array using the variable of 'id', but it errors with 'undefined'. I have tried various options of moving the 'var id;' but still I get the error. I have marked in the code where the error is occuring and would be grateful if someone could help me to correct this error. Many thanks</p> <pre><code>$(function() { info = []; $(document).on('click', '.rowChk', function() { var id; if (this.checked) { $('#rowClk').show(); var currentRows = $(this).closest("tr"); var rackid = currentRows.find("td:eq(0)").text(); // var rackidnumber = currentRows.find("td:eq(1)").html(); var rackservice = currentRows.find("td:eq(2)").html(); var rackactivity = currentRows.find("td:eq(3)").html(); var rackdept = currentRows.find("td:eq(4)").html(); var rackcompany = currentRows.find("td:eq(5)").html(); var rackaddress = currentRows.find("td:eq(6)").html(); var rackuser = currentRows.find("td:eq(7)").html(); var rackitem = currentRows.find("td:eq(8)").html(); var rackddate = currentRows.find("td:eq(9)").html(); var rackdate = currentRows.find("td:eq(10)").html(); id = rackid; data = {}; data.rackids = id; // data.idnumber = rackidnumber; data.service = rackservice; data.activity = rackactivity; data.dept = rackdept; data.company = rackcompany; data.address = rackaddress; data.user = rackuser; data.item = rackitem; data.intakedate = rackdate; data.destroydate = rackddate; info.push(data); } else { console.log(id); &lt;--- Showing as undefined var index = info.findIndex(function(item) { return item.id === id; }); if (index !== -1) { info.splice(index, 1); if (info.length === 0) { $('#rowClk').css('display', 'none'); } } } }); }); </code></pre>
0debug
Load a Select from Radio in Flask/Python using Javascipt / jQuery : I'm trying to **load a input select control when the user select a radio option** in the form. The fields are built with flask-wtf, and populated dinamically in the view *(no problem with that)*: class FormRecord(Form): type = RadioField('Type') category = SelectField('Category') The JS script would execute the view that populate my select control: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> $(document).ready(function() { $("#type").change(function() { $.ajax({ type: "POST", url: "{{ url_for('select_type') }}", data: {cat: $("#type").val()}, success: function(data) { $("#category").html(data); } }); }); }); <!-- end snippet --> It seems the javascript is not working correctly, but what I am doing wrong ? ...
0debug
static void tcg_out_insn_3405(TCGContext *s, AArch64Insn insn, TCGType ext, TCGReg rd, uint16_t half, unsigned shift) { assert((shift & ~0x30) == 0); tcg_out32(s, insn | ext << 31 | shift << (21 - 4) | half << 5 | rd); }
1threat
Arrays being re-assigned (Python) : <p>I'm recreating Conway's game of life in pygame, and I've been having an issue implementing the preset feature. When I'm assigning the preset array to the default array, and then assigning it back to the default array again, the preset is changed. I'm only editing the array "Initial_frame" but it is somehow changing the preset array.</p> <p>Code: <a href="https://paste.pythondiscord.com/uvetekikot.py" rel="nofollow noreferrer">https://paste.pythondiscord.com/uvetekikot.py</a></p>
0debug
static int interp(RA144Context *ractx, int16_t *out, int block_num, int copyold, int energy) { int work[10]; int a = block_num + 1; int b = NBLOCKS - a; int x; for (x=0; x<30; x++) out[x] = (a * ractx->lpc_coef[0][x] + b * ractx->lpc_coef[1][x])>> 2; if (eval_refl(work, out, ractx)) { int_to_int16(out, ractx->lpc_coef[copyold]); return rescale_rms(ractx->lpc_refl_rms[copyold], energy); } else { return rescale_rms(rms(work), energy); } }
1threat
static void mmu6xx_dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env) { ppc6xx_tlb_t *tlb; target_ulong sr; int type, way, entry, i; cpu_fprintf(f, "HTAB base = 0x%"HWADDR_PRIx"\n", env->htab_base); cpu_fprintf(f, "HTAB mask = 0x%"HWADDR_PRIx"\n", env->htab_mask); cpu_fprintf(f, "\nSegment registers:\n"); for (i = 0; i < 32; i++) { sr = env->sr[i]; if (sr & 0x80000000) { cpu_fprintf(f, "%02d T=%d Ks=%d Kp=%d BUID=0x%03x " "CNTLR_SPEC=0x%05x\n", i, sr & 0x80000000 ? 1 : 0, sr & 0x40000000 ? 1 : 0, sr & 0x20000000 ? 1 : 0, (uint32_t)((sr >> 20) & 0x1FF), (uint32_t)(sr & 0xFFFFF)); } else { cpu_fprintf(f, "%02d T=%d Ks=%d Kp=%d N=%d VSID=0x%06x\n", i, sr & 0x80000000 ? 1 : 0, sr & 0x40000000 ? 1 : 0, sr & 0x20000000 ? 1 : 0, sr & 0x10000000 ? 1 : 0, (uint32_t)(sr & 0x00FFFFFF)); } } cpu_fprintf(f, "\nBATs:\n"); mmu6xx_dump_BATs(f, cpu_fprintf, env, ACCESS_INT); mmu6xx_dump_BATs(f, cpu_fprintf, env, ACCESS_CODE); if (env->id_tlbs != 1) { cpu_fprintf(f, "ERROR: 6xx MMU should have separated TLB" " for code and data\n"); } cpu_fprintf(f, "\nTLBs [EPN EPN + SIZE]\n"); for (type = 0; type < 2; type++) { for (way = 0; way < env->nb_ways; way++) { for (entry = env->nb_tlb * type + env->tlb_per_way * way; entry < (env->nb_tlb * type + env->tlb_per_way * (way + 1)); entry++) { tlb = &env->tlb.tlb6[entry]; cpu_fprintf(f, "%s TLB %02d/%02d way:%d %s [" TARGET_FMT_lx " " TARGET_FMT_lx "]\n", type ? "code" : "data", entry % env->nb_tlb, env->nb_tlb, way, pte_is_valid(tlb->pte0) ? "valid" : "inval", tlb->EPN, tlb->EPN + TARGET_PAGE_SIZE); } } } }
1threat
I have used the simpleblobdetector method and i have got two blobs. But now i want to find the x and y points of each blob for angle detection. : for (std::vector<cv::KeyPoint>::iterator blobIterator = keypoints.begin(); blobIterator != keypoints.end(); blobIterator++){ std::cout << "size of blob is: " << blobIterator->size << std::endl; std::cout << "point is at: " << blobIterator->pt.x << " " << blobIterator->pt.y << std::endl; }
0debug
def max_length_list(input_list): max_length = max(len(x) for x in input_list ) max_list = max(input_list, key = lambda i: len(i)) return(max_length, max_list)
0debug
What is the difference between cpan and cpanm? : <p>What is the difference between the <code>cpan</code> and <code>cpanm</code> commands?</p> <p>They both seem to install <code>perl</code> modules, so what is the difference?</p>
0debug
How do I manually send a password reset request in Laravel 5.2? : <p>I would like to manually send a password reset request to a specific user (not the one currently logged in) from within a controller. I did some digging around in the Laravel code and it seems like I should be calling <code>postEmail(Request $request)</code> in <code>ResetsPasswords</code>, but I can't seem to figure out how to get access to the right <code>PasswordController</code> instance to call it.</p>
0debug
int escc_init(target_phys_addr_t base, qemu_irq irqA, qemu_irq irqB, CharDriverState *chrA, CharDriverState *chrB, int clock, int it_shift) { DeviceState *dev; SysBusDevice *s; SerialState *d; dev = qdev_create(NULL, "escc"); qdev_prop_set_uint32(dev, "disabled", 0); qdev_prop_set_uint32(dev, "frequency", clock); qdev_prop_set_uint32(dev, "it_shift", it_shift); qdev_prop_set_chr(dev, "chrB", chrB); qdev_prop_set_chr(dev, "chrA", chrA); qdev_prop_set_uint32(dev, "chnBtype", ser); qdev_prop_set_uint32(dev, "chnAtype", ser); qdev_init(dev); s = sysbus_from_qdev(dev); sysbus_connect_irq(s, 0, irqB); sysbus_connect_irq(s, 1, irqA); if (base) { sysbus_mmio_map(s, 0, base); } d = FROM_SYSBUS(SerialState, s); return d->mmio_index; }
1threat
document.getElementById('input').innerHTML = user_input;
1threat
Python: IndexError: list index out of range - itens = [{}] : <p>I know it may seem like a simple question, but I really could not figure it out ...<br />How to solve?<br /><br />&gt;&gt;&gt; itens = [{}]<br />&gt;&gt;&gt; i = 0<br />&gt;&gt;&gt; itens[i]['vendedor'] = 1<br />&gt;&gt;&gt; i = 1<br />&gt;&gt;&gt; itens[i]['vendedor'] = 2<br />Traceback (most recent call last):<br /> File "&lt;stdin&gt;", line 1, in &lt;module&gt;<br />IndexError: list index out of range</p>
0debug