problem
stringlengths
26
131k
labels
class label
2 classes
how to input JSON data with dynamic data array : person 1 input data with data array like this : {"type":"1","name":"John", "phone":"898171"} person 2 not set the phone, like this : {"type":"1","name":"Lisa"} // only write 2 array... I have source code in my controller like this : $data = json_decode(file_get_contents('php://input'), true); if(!$data['phone']->iSEmpty){ echo "you haven't set the phone number!" } but is not working.. error when second person input data.. "Undefined index: phone" Sorry for my bad english btw...
0debug
Singleton with properties in Swift 3 : <p>In Apple's <a href="https://developer.apple.com/library/prerelease/content/documentation/Swift/Conceptual/BuildingCocoaApps/AdoptingCocoaDesignPatterns.html#//apple_ref/doc/uid/TP40014216-CH7-ID6">Using Swift with Cocoa and Objective-C document</a> (updated for Swift 3) they give the following example of the Singleton pattern:</p> <pre><code>class Singleton { static let sharedInstance: Singleton = { let instance = Singleton() // setup code return instance }() } </code></pre> <p>Let's imagine that this singleton needs to manage a variable array of Strings. How/where would I declare that property and ensure it gets initialized properly to an empty <code>[String]</code> array?</p>
0debug
static void put_subframe_samples(DCAEncContext *c, int ss, int band, int ch) { if (c->abits[band][ch] <= 7) { int sum, i, j; for (i = 0; i < 8; i += 4) { sum = 0; for (j = 3; j >= 0; j--) { sum *= ff_dca_quant_levels[c->abits[band][ch]]; sum += c->quantized[ss * 8 + i + j][band][ch]; sum += (ff_dca_quant_levels[c->abits[band][ch]] - 1) / 2; } put_bits(&c->pb, bit_consumption[c->abits[band][ch]] / 4, sum); } } else { int i; for (i = 0; i < 8; i++) { int bits = bit_consumption[c->abits[band][ch]] / 16; put_sbits(&c->pb, bits, c->quantized[ss * 8 + i][band][ch]); } } }
1threat
when i am installing loopback cli then getting these error in reactjs : [when i install npm install -g loopback-cli than showing this error i have set environment variable like this C:\Python27\python.exe;C:\Program Files\nodejs\ ][1] [1]: https://i.stack.imgur.com/laiiO.png
0debug
static int pci_set_default_subsystem_id(PCIDevice *pci_dev) { uint16_t *id; id = (void*)(&pci_dev->config[PCI_SUBSYSTEM_VENDOR_ID]); id[0] = cpu_to_le16(pci_default_sub_vendor_id); id[1] = cpu_to_le16(pci_default_sub_device_id); return 0; }
1threat
The name 'mousePosition does not exist in the current context : Tried doing 2D and 3D. I want the player to click and drag objects to stack them. I tried copying and pasting code from a video and it still didn't work.
0debug
static int find_pte64(CPUPPCState *env, struct mmu_ctx_hash64 *ctx, int h, int rw, int type, int target_page_bits) { hwaddr pteg_off; target_ulong pte0, pte1; int i, good = -1; int ret, r; ret = -1; pteg_off = (ctx->hash[h] * HASH_PTEG_SIZE_64) & env->htab_mask; for (i = 0; i < HPTES_PER_GROUP; i++) { pte0 = ppc_hash64_load_hpte0(env, pteg_off + i*HASH_PTE_SIZE_64); pte1 = ppc_hash64_load_hpte1(env, pteg_off + i*HASH_PTE_SIZE_64); r = pte64_check(ctx, pte0, pte1, h, rw, type); LOG_MMU("Load pte from %016" HWADDR_PRIx " => " TARGET_FMT_lx " " TARGET_FMT_lx " %d %d %d " TARGET_FMT_lx "\n", pteg_off + (i * 16), pte0, pte1, (int)(pte0 & 1), h, (int)((pte0 >> 1) & 1), ctx->ptem); switch (r) { case -3: return -1; case -2: ret = -2; good = i; break; case -1: default: break; case 0: ret = 0; good = i; goto done; } } if (good != -1) { done: LOG_MMU("found PTE at addr %08" HWADDR_PRIx " prot=%01x ret=%d\n", ctx->raddr, ctx->prot, ret); pte1 = ctx->raddr; if (ppc_hash64_pte_update_flags(ctx, &pte1, ret, rw) == 1) { ppc_hash64_store_hpte1(env, pteg_off + good * HASH_PTE_SIZE_64, pte1); } } if (target_page_bits != TARGET_PAGE_BITS) { ctx->raddr |= (ctx->eaddr & ((1 << target_page_bits) - 1)) & TARGET_PAGE_MASK; } return ret; }
1threat
Pass data from parent to child component in vue.js : <p>I am trying to pass data from a parent to a child component. However, the data I am trying to pass keeps printing out as blank in the child component. My code:</p> <p>In <code>Profile.js</code> (Parent component)</p> <pre><code>&lt;template&gt; &lt;div class="container"&gt; &lt;profile-form :user ="user"&gt;&lt;/profile-form&gt; &lt;/div&gt; &lt;/template&gt; &lt;script&gt; import ProfileForm from './ProfileForm' module.exports = { data: function () { return { user: '' } }, methods: { getCurrentUser: function () { var self = this auth.getCurrentUser(function(person) { self.user = person }) }, } &lt;/script&gt; </code></pre> <p>In <code>ProfileForm.js</code> (Child component)</p> <pre><code>&lt;template&gt; &lt;div class="container"&gt; &lt;h1&gt;Profile Form Component&lt;/h1&gt; &lt;/div&gt; &lt;/template&gt; &lt;script&gt; module.exports = { created: function () { console.log('user data from parent component:') console.log(this.user) //prints out an empty string }, } &lt;/script&gt; </code></pre> <p>Note - my <code>user</code> is loaded via my <code>getCurrentUser()</code> method... Can someone help?</p> <p>Thanks in advance!</p>
0debug
static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket* avpkt) { WMAProDecodeCtx *s = avctx->priv_data; GetBitContext* gb = &s->pgb; const uint8_t* buf = avpkt->data; int buf_size = avpkt->size; int num_bits_prev_frame; int packet_sequence_number; *got_frame_ptr = 0; if (s->packet_done || s->packet_loss) { s->packet_done = 0; if (buf_size < avctx->block_align) { av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n", buf_size, avctx->block_align); return AVERROR_INVALIDDATA; } s->next_packet_start = buf_size - avctx->block_align; buf_size = avctx->block_align; s->buf_bit_size = buf_size << 3; init_get_bits(gb, buf, s->buf_bit_size); packet_sequence_number = get_bits(gb, 4); skip_bits(gb, 2); num_bits_prev_frame = get_bits(gb, s->log2_frame_size); av_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number, num_bits_prev_frame); if (!s->packet_loss && ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) { s->packet_loss = 1; av_log(avctx, AV_LOG_ERROR, "Packet loss detected! seq %x vs %x\n", s->packet_sequence_number, packet_sequence_number); } s->packet_sequence_number = packet_sequence_number; if (num_bits_prev_frame > 0) { int remaining_packet_bits = s->buf_bit_size - get_bits_count(gb); if (num_bits_prev_frame >= remaining_packet_bits) { num_bits_prev_frame = remaining_packet_bits; s->packet_done = 1; } save_bits(s, gb, num_bits_prev_frame, 1); av_dlog(avctx, "accumulated %x bits of frame data\n", s->num_saved_bits - s->frame_offset); if (!s->packet_loss) decode_frame(s, data, got_frame_ptr); } else if (s->num_saved_bits - s->frame_offset) { av_dlog(avctx, "ignoring %x previously saved bits\n", s->num_saved_bits - s->frame_offset); } if (s->packet_loss) { s->num_saved_bits = 0; s->packet_loss = 0; } } else { int frame_size; s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3; init_get_bits(gb, avpkt->data, s->buf_bit_size); skip_bits(gb, s->packet_offset); if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size && (frame_size = show_bits(gb, s->log2_frame_size)) && frame_size <= remaining_bits(s, gb)) { save_bits(s, gb, frame_size, 0); s->packet_done = !decode_frame(s, data, got_frame_ptr); } else if (!s->len_prefix && s->num_saved_bits > get_bits_count(&s->gb)) { s->packet_done = !decode_frame(s, data, got_frame_ptr); } else s->packet_done = 1; } if (s->packet_done && !s->packet_loss && remaining_bits(s, gb) > 0) { save_bits(s, gb, remaining_bits(s, gb), 0); } s->packet_offset = get_bits_count(gb) & 7; if (s->packet_loss) return AVERROR_INVALIDDATA; return get_bits_count(gb) >> 3; }
1threat
php id encoding to have exact same character length for any given id : <p>i want to encode id such as customer id to unique string (alpha/numeric) to hide the id, also i want to keep encoded string to have same length always, say 16 characters. Also it should be decodable.</p> <p>example: id = 1 encoded id = abcd12345e6f7g80</p> <p>id = 100000 encoded id = edfgj129j5e6j3gk9</p>
0debug
Installing python packages offline : <p>I have a python virtual environment created using virtualenv. Now I want to install different python packages like pandas or numpy. But is there any way to install these packages offline. Given, I already have these packages in base environment. </p>
0debug
static int find_slice_quant(AVCodecContext *avctx, const AVFrame *pic, int trellis_node, int x, int y, int mbs_per_slice, ProresThreadData *td) { ProresContext *ctx = avctx->priv_data; int i, q, pq, xp, yp; const uint16_t *src; int slice_width_factor = av_log2(mbs_per_slice); int num_cblocks[MAX_PLANES], pwidth; int plane_factor[MAX_PLANES], is_chroma[MAX_PLANES]; const int min_quant = ctx->profile_info->min_quant; const int max_quant = ctx->profile_info->max_quant; int error, bits, bits_limit; int mbs, prev, cur, new_score; int slice_bits[TRELLIS_WIDTH], slice_score[TRELLIS_WIDTH]; int overquant; uint16_t *qmat; int linesize[4], line_add; if (ctx->pictures_per_frame == 1) line_add = 0; else line_add = ctx->cur_picture_idx ^ !pic->top_field_first; mbs = x + mbs_per_slice; for (i = 0; i < ctx->num_planes; i++) { is_chroma[i] = (i == 1 || i == 2); plane_factor[i] = slice_width_factor + 2; if (is_chroma[i]) plane_factor[i] += ctx->chroma_factor - 3; if (!is_chroma[i] || ctx->chroma_factor == CFACTOR_Y444) { xp = x << 4; yp = y << 4; num_cblocks[i] = 4; pwidth = avctx->width; } else { xp = x << 3; yp = y << 4; num_cblocks[i] = 2; pwidth = avctx->width >> 1; } linesize[i] = pic->linesize[i] * ctx->pictures_per_frame; src = (const uint16_t*)(pic->data[i] + yp * linesize[i] + line_add * pic->linesize[i]) + xp; if (i < 3) { get_slice_data(ctx, src, linesize[i], xp, yp, pwidth, avctx->height / ctx->pictures_per_frame, td->blocks[i], td->emu_buf, mbs_per_slice, num_cblocks[i], is_chroma[i]); } else { get_alpha_data(ctx, src, linesize[i], xp, yp, pwidth, avctx->height / ctx->pictures_per_frame, td->blocks[i], mbs_per_slice, ctx->alpha_bits); } } for (q = min_quant; q < max_quant + 2; q++) { td->nodes[trellis_node + q].prev_node = -1; td->nodes[trellis_node + q].quant = q; } for (q = min_quant; q <= max_quant; q++) { bits = 0; error = 0; for (i = 0; i < ctx->num_planes - !!ctx->alpha_bits; i++) { bits += estimate_slice_plane(ctx, &error, i, src, linesize[i], mbs_per_slice, num_cblocks[i], plane_factor[i], ctx->quants[q], td); } if (ctx->alpha_bits) bits += estimate_alpha_plane(ctx, &error, src, linesize[3], mbs_per_slice, q, td->blocks[3]); if (bits > 65000 * 8) { error = SCORE_LIMIT; break; } slice_bits[q] = bits; slice_score[q] = error; } if (slice_bits[max_quant] <= ctx->bits_per_mb * mbs_per_slice) { slice_bits[max_quant + 1] = slice_bits[max_quant]; slice_score[max_quant + 1] = slice_score[max_quant] + 1; overquant = max_quant; } else { for (q = max_quant + 1; q < 128; q++) { bits = 0; error = 0; if (q < MAX_STORED_Q) { qmat = ctx->quants[q]; } else { qmat = td->custom_q; for (i = 0; i < 64; i++) qmat[i] = ctx->quant_mat[i] * q; } for (i = 0; i < ctx->num_planes - !!ctx->alpha_bits; i++) { bits += estimate_slice_plane(ctx, &error, i, src, linesize[i], mbs_per_slice, num_cblocks[i], plane_factor[i], qmat, td); } if (ctx->alpha_bits) bits += estimate_alpha_plane(ctx, &error, src, linesize[3], mbs_per_slice, q, td->blocks[3]); if (bits <= ctx->bits_per_mb * mbs_per_slice) break; } slice_bits[max_quant + 1] = bits; slice_score[max_quant + 1] = error; overquant = q; } td->nodes[trellis_node + max_quant + 1].quant = overquant; bits_limit = mbs * ctx->bits_per_mb; for (pq = min_quant; pq < max_quant + 2; pq++) { prev = trellis_node - TRELLIS_WIDTH + pq; for (q = min_quant; q < max_quant + 2; q++) { cur = trellis_node + q; bits = td->nodes[prev].bits + slice_bits[q]; error = slice_score[q]; if (bits > bits_limit) error = SCORE_LIMIT; if (td->nodes[prev].score < SCORE_LIMIT && error < SCORE_LIMIT) new_score = td->nodes[prev].score + error; else new_score = SCORE_LIMIT; if (td->nodes[cur].prev_node == -1 || td->nodes[cur].score >= new_score) { td->nodes[cur].bits = bits; td->nodes[cur].score = new_score; td->nodes[cur].prev_node = prev; } } } error = td->nodes[trellis_node + min_quant].score; pq = trellis_node + min_quant; for (q = min_quant + 1; q < max_quant + 2; q++) { if (td->nodes[trellis_node + q].score <= error) { error = td->nodes[trellis_node + q].score; pq = trellis_node + q; } } return pq; }
1threat
Simple password verification function (php) not working? (begginer q) : This is it: function password_matches($username, $password){ //precon: user_exists($username) $u = $GLOBALS['conn']->real_escape_string($username); $q = "SELECT password FROM users WHERE username = '$u'"; $result = mysqli_query($GLOBALS['conn'], $q); $result2 = mysqli_fetch_field($result); return ($result2 == $password); } If you think this should work just tell me, I know my problems could be coming form somewhere else outside this function but I think that's less likely. Thanks a lot!
0debug
I want to change a ternary operator to if and else statements : How to change this shorthand ternary operator to if-else statements header.style.width = header.style.width === "1265px" ? '0px' : '1265px';
0debug
How to sync to specific folder using command line in Perforce : <p>Suppose I have mapped my depot to client workspace as <code>c:/perforce/project</code> but now </p> <p>I want to sync all the files present in <code>c:/perforce/project/fold1/fold2</code> folder. </p> <p>How can we do it, as the command p4 sync takes only file names and not folder.</p>
0debug
static av_always_inline int setup_classifs(vorbis_context *vc, vorbis_residue *vr, uint8_t *do_not_decode, unsigned ch_used, int partition_count) { int p, j, i; unsigned c_p_c = vc->codebooks[vr->classbook].dimensions; unsigned inverse_class = ff_inverse[vr->classifications]; unsigned temp, temp2; for (p = 0, j = 0; j < ch_used; ++j) { if (!do_not_decode[j]) { temp = get_vlc2(&vc->gb, vc->codebooks[vr->classbook].vlc.table, vc->codebooks[vr->classbook].nb_bits, 3); av_dlog(NULL, "Classword: %u\n", temp); if ((int)temp < 0) return temp; av_assert0(vr->classifications > 1); if (temp <= 65536) { for (i = partition_count + c_p_c - 1; i >= partition_count; i--) { temp2 = (((uint64_t)temp) * inverse_class) >> 32; if (i < vr->ptns_to_read) vr->classifs[p + i] = temp - temp2 * vr->classifications; temp = temp2; } } else { for (i = partition_count + c_p_c - 1; i >= partition_count; i--) { temp2 = temp / vr->classifications; if (i < vr->ptns_to_read) vr->classifs[p + i] = temp - temp2 * vr->classifications; temp = temp2; } } } p += vr->ptns_to_read; } return 0; }
1threat
dashcode error with java array se.mebe.Lion@7852e922, se.mebe.Zebra@4e25154f, se.mebe.Monkey@70dea4e : <p>public void addAnimalsToZoo() {</p> <pre><code> Animal[] zoo = new Animal[animals.length + 5]; System.arraycopy(animals, 0, zoo, 0, animals.length); for (count = 0; count &lt; zoo.length; count++) System.out.println("new animals with new array" + "\t" + zoo[count]); } </code></pre>
0debug
C# ASP.NET Date and Time without jQuery : <p>I am new to ASP.NET and want to use date and time for the user to enter their desired date. I have looked around and saw people using jQuery but is there another way to implement it nicely?</p>
0debug
How to pass the text box data using session to the nextpage in php : I want to pass the text box data to the next page(demo2) and i need to save all the data together in my db i tried using session the value i passed is sending to the next page but i want the textbox data to be passed... Help me out!! Below is my code **demo1.php** <!-- begin snippet: js hide: false --> <!-- language: lang-html --> **demo1.php** <?php session_start(); if($_POST) { if($_POST['act'] == "add") { $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $nationality = $_POST['nationality']; $conn = mysql_connect("localhost","root",""); $db = mysql_select_db("reg",$conn); } } echo "Session variables are set."; if(@$_GET) { $_SESSION["firstname"] = "$firstname"; $_SESSION["lastname"] = " $lastname"; $_SESSION["nationality"] = "$nationality"; echo $firstname; echo $lastname; echo $nationality; } ?> <!DOCTYPE html> <html lang="en"> <head> </head> <body> <form method="POST"> <?php if(isset($_GET['id'])) { ?> <input type="hidden" name="act" value="edit"/> <input type="hidden" name="id" value="<?php echo $id; ?>"/> <?php } else{ ?> <input type="hidden" name="act" value="add"/> <?php } ?> <label> FirstName</label> <input type="text" name="firstname" value="<?php echo @$firstname; ?>"><br> <label> LastName</label> <input type="text" name="lastname" value="<?php echo @$lastname; ?>"><br> <label> Nationality</label> <input type="text" name="nationality" value="<?php echo @$nationality; ?>"><br> <a href="demo2.php"> <input type="button" id="next" name="next" value="next" > <?PHP $_SESSION["firstname"] = "Preethi"; $_SESSION["lastname"] = " Rajan"; $_SESSION["nationality"] = "Indian"; ?> </form> </body> </html> <!-- end snippet --> **demo2.php** <?php session_start(); if($_POST) { if($_POST['act'] == "add") { $firstname= $_SESSION['firstname']; $lastname= $_SESSION['lastname']; $nationality= $_SESSION['nationality']; $mobileno = $_POST['mobileno']; $email = $_POST['email']; $commaddr = $_POST['commaddr']; $city = $_POST['city']; $pincode = $_POST['pincode']; $state = $_POST['state']; $permaddr = $_POST['permaddr']; $conn = mysql_connect("localhost","root",""); $db = mysql_select_db("reg",$conn); $sql = "INSERT INTO registration (firstname,lastname,nationality,mobileno,email,commaddr,city,pincode,state,permaddr) VALUES ('".$_SESSION["firstname"]."','".$_SESSION["lastname"]."' ,'".$_SESSION["nationality"]."', '".$mobileno."' , '".$email."' , '".$commaddr."','".$city."','".$pincode."','".$state."','".$permaddr."')"; $rep = mysql_query($sql); } } ?> <!DOCTYPE html> <html lang="en"> <head> </head> <form action="demo2.php" method="POST"> <?php if(isset($_GET['id'])) { ?> <input type="hidden" name="act" value="edit"/> <input type="hidden" name="id" value="<?php echo $id; ?>"/> <?php } else{ ?> <input type="hidden" name="act" value="add"/> <?php } ?> <label> Mobile Number</label> <input type="text" name="mobileno" value="<?php echo @$mobileno; ?>"><br> <label> E Mail ID</label> <input type="text" name="email" value="<?php echo @$email; ?>"><br> <label> Communication Address</label> <input type="text" name="commaddr" value="<?php echo @$commaddr; ?>"><br> <label> City</label> <input type="text" name="city" value="<?php echo @$city; ?>"><br> <label>Pin Code</label> <input type="text" name="pincode" value="<?php echo @$pincode; ?>"><br> <label>State</label> <input type="text" name="state" value="<?php echo @$state; ?>"><br> <label> Permanent Address</label> <input type="text" name="permaddr" value="<?php echo @$permaddr; ?>"><br> <input type="submit" name="submit" value="submit" style="height:50px; width:150px"> </form> </body> </html>
0debug
static int amovie_request_frame(AVFilterLink *outlink) { MovieContext *movie = outlink->src->priv; int ret; if (movie->is_done) return AVERROR_EOF; if ((ret = amovie_get_samples(outlink)) < 0) return ret; avfilter_filter_samples(outlink, avfilter_ref_buffer(movie->samplesref, ~0)); avfilter_unref_buffer(movie->samplesref); movie->samplesref = NULL; return 0; }
1threat
I can't submit form after validation in javascript : I want to validate my form using javascript. I validated all fields successfully but my form is not submitting?
0debug
static int decode_packet(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kResLevel *rlevel, int precno, int layno, uint8_t *expn, int numgbits) { int bandno, cblkny, cblknx, cblkno, ret; if (!(ret = get_bits(s, 1))){ j2k_flush(s); return 0; } else if (ret < 0) return ret; for (bandno = 0; bandno < rlevel->nbands; bandno++){ J2kBand *band = rlevel->band + bandno; J2kPrec *prec = band->prec + precno; int pos = 0; if (band->coord[0][0] == band->coord[0][1] || band->coord[1][0] == band->coord[1][1]) continue; for (cblkny = prec->yi0; cblkny < prec->yi1; cblkny++) for(cblknx = prec->xi0, cblkno = cblkny * band->cblknx + cblknx; cblknx < prec->xi1; cblknx++, cblkno++, pos++){ J2kCblk *cblk = band->cblk + cblkno; int incl, newpasses, llen; if (cblk->npasses) incl = get_bits(s, 1); else incl = tag_tree_decode(s, prec->cblkincl + pos, layno+1) == layno; if (!incl) continue; else if (incl < 0) return incl; if (!cblk->npasses) cblk->nonzerobits = expn[bandno] + numgbits - 1 - tag_tree_decode(s, prec->zerobits + pos, 100); if ((newpasses = getnpasses(s)) < 0) return newpasses; if ((llen = getlblockinc(s)) < 0) return llen; cblk->lblock += llen; if ((ret = get_bits(s, av_log2(newpasses) + cblk->lblock)) < 0) return ret; cblk->lengthinc = ret; cblk->npasses += newpasses; } } j2k_flush(s); if (codsty->csty & J2K_CSTY_EPH) { if (AV_RB16(s->buf) == J2K_EPH) { s->buf += 2; } else { av_log(s->avctx, AV_LOG_ERROR, "EPH marker not found.\n"); } } for (bandno = 0; bandno < rlevel->nbands; bandno++){ J2kBand *band = rlevel->band + bandno; int yi, cblknw = band->prec[precno].xi1 - band->prec[precno].xi0; for (yi = band->prec[precno].yi0; yi < band->prec[precno].yi1; yi++){ int xi; for (xi = band->prec[precno].xi0; xi < band->prec[precno].xi1; xi++){ J2kCblk *cblk = band->cblk + yi * cblknw + xi; if (s->buf_end - s->buf < cblk->lengthinc) return AVERROR(EINVAL); bytestream_get_buffer(&s->buf, cblk->data, cblk->lengthinc); cblk->length += cblk->lengthinc; cblk->lengthinc = 0; } } } return 0; }
1threat
How to change text padding in android bottom navigation view : <p>I am using the bottom navigation view for an android app. I have increased the size of my icon, but now the icon runs over the text. Here is what I see:</p> <p><a href="https://i.stack.imgur.com/9iNJs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/9iNJs.png" alt="enter image description here"></a></p> <p>Here is a diagram of the bottom navigation view according to google design docs:</p> <p><a href="https://i.stack.imgur.com/ZfThH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZfThH.png" alt="enter image description here"></a></p> <p>The number 10, I want to change that padding, but when I look in the properties for the navigation bar, I don't see where I can do it. How can I change it to a smaller number? In my bottom_layout.xml I am setting my items up like so:</p> <pre><code>&lt;item android:id="@+id/menu_notifications" android:title="Professionals" android:icon="@drawable/ic_action_name" app:showAsAction="ifRoom" /&gt; </code></pre> <p>How can I change the bottom text padding?</p> <p>thanks</p>
0debug
static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { ZeroCodecContext *zc = avctx->priv_data; AVFrame *pic = avctx->coded_frame; AVFrame *prev_pic = &zc->previous_frame; z_stream *zstream = &zc->zstream; uint8_t *prev, *dst; int i, j, zret; pic->reference = 3; if (avctx->get_buffer(avctx, pic) < 0) { av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); return AVERROR(ENOMEM); zret = inflateReset(zstream); if (zret != Z_OK) { av_log(avctx, AV_LOG_ERROR, "Could not reset inflate: %d\n", zret); return AVERROR(EINVAL); zstream->next_in = avpkt->data; zstream->avail_in = avpkt->size; prev = prev_pic->data[0]; dst = pic->data[0]; if (avpkt->flags & AV_PKT_FLAG_KEY) { pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; } else { pic->key_frame = 0; pic->pict_type = AV_PICTURE_TYPE_P; for (i = 0; i < avctx->height; i++) { zstream->next_out = dst; zstream->avail_out = avctx->width << 1; zret = inflate(zstream, Z_SYNC_FLUSH); if (zret != Z_OK && zret != Z_STREAM_END) { av_log(avctx, AV_LOG_ERROR, "Inflate failed with return code: %d\n", zret); return AVERROR(EINVAL); if (!(avpkt->flags & AV_PKT_FLAG_KEY)) for (j = 0; j < avctx->width << 1; j++) dst[j] += prev[j] & -!dst[j]; prev += prev_pic->linesize[0]; dst += pic->linesize[0]; if (prev_pic->data[0]) avctx->release_buffer(avctx, prev_pic); *prev_pic = *pic; *data_size = sizeof(AVFrame); *(AVFrame *)data = *pic; return avpkt->size;
1threat
Mysql like query search : I am working on crud functionality in php and mysql for user table.I have keep user status "a" and "d" for "active" and "deactive" respectivaly in database .My problem is when user search on frontend lets say "active" then how I can query to fetch all active status record.Please help..
0debug
Better "centerpoint" than centroid : <p>I'm using the centroid of polygons to attach a marker in a map application. This works definitely fine for convex polygons and quite good for many concave polygons.</p> <p>However, some polygons (banana, donut) obviously don't produce the desired result: The centroid is in these cases <em>outside</em> the polygons area.</p> <p>Does anybody know a better approach to find a suitable point <em>within</em> any polygons area (which may contain holes!) to attach a marker?</p> <p><a href="https://i.stack.imgur.com/Z7E9J.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Z7E9J.png" alt="enter image description here"></a></p>
0debug
void OPPROTO op_sdiv_T1_T0(void) { int64_t x0; int32_t x1; x0 = T0 | ((int64_t) (env->y) << 32); x1 = T1; x0 = x0 / x1; if ((int32_t) x0 != x0) { T0 = x0 < 0? 0x80000000: 0x7fffffff; T1 = 1; } else { T0 = x0; T1 = 0; FORCE_RET();
1threat
C++ doesn't tell you the size of a dynamic array. But why? : <p>I know that there is no way in C++ to obtain the size of a dynamically created array, such as:</p> <pre><code>int* a; a = new int[n]; </code></pre> <p>What I would like to know is: Why? Did people just forget this in the specification of C++, or is there a technical reason for this?</p> <p>Isn't the information stored somewhere? After all, the command</p> <pre><code>delete[] a; </code></pre> <p>seems to know how much memory it has to release, so it seems to me that <code>delete[]</code> has some way of knowing the size of <code>a</code>.</p>
0debug
Iterate with threshold stored in database : <p>I have a variable number of transactions in every month saved in the database. I have to calculate a payment according a structure like as 0-100 transaction, 1 € for every transaction, 101-200 2€ for each, 201 to 300 3€ for each, etc. The first 100 transactions I’ll pay 100 €, the next 100 transactions I’ll pay 200 € and in this way. Until here is easy for me, the problem become because the number of thresholds (in the earlier example was 3), can be variable, sometimes is 3, other times could be 2, 4, 5 or whatever. These thresholds are stored in a table in the database. Please, can someone help me. Thanks in advance.</p>
0debug
looking for a python library to detect post requests inside an url : <p>I'm looking for a library, I don't know if it's exists. I need to parse an url to check if there is a post request form inside it. If there is one, it should list the parameters of that post request. Example process:</p> <p>-url: <a href="http://www.example.com" rel="nofollow">http://www.example.com</a></p> <p>-It has a post request form to "saveprofile.php" with parameters "name,lastname,password"</p> <p>-Save those information to a text file</p> <p>Do you know any library which achieves this goal?</p>
0debug
Why do both promise .then() and .catch() are called? : <p>I'm beginning to write a discord bot with the Discord.js library (version 11.5.1). Promises returned by methods don't work as expected because then() and catch() callbacks are both called if it's successful.</p> <p>I'm using nodejs version 11.15.0.</p> <p>In this example, I send a message in the test-bot channel when the bot in logged.</p> <pre><code>const Discord = require('discord.js'); const client = new Discord.Client(); const auth = require('./auth.json'); client.on('ready', () =&gt; { const guild = client.guilds.find( guild =&gt; guild.name === 'test'); const channel = guild.channels.find( ch =&gt; ch.name === 'test-bot'); if (!channel) { console.error('no channel found'); return ; } channel.send('heeeello') .then(console.log('cool')) .catch(console.error('grrr')); }); client.login(auth.token); </code></pre> <p>The message is well sended on the discord channel and the console output is:</p> <pre><code>cool grrr </code></pre> <p>but I don't expect <code>grrr</code> in the output.</p>
0debug
Having trouble with the order of items in the legend of a ggplot bar chart : <p>My data looks like</p> <pre><code> language tone count tone_percent label_pos pos 1 c positive 3460 36.16977 18.08488 7 2 c neutral 2046 21.38825 46.86389 7 3 c negative 4060 42.44198 78.77901 7 4 c# positive 3732 41.26949 20.63475 3 5 c# neutral 1832 20.25876 51.39887 3 6 c# negative 3479 38.47175 80.76413 3 7 c++ positive 3136 33.13960 16.56980 8 8 c++ neutral 2008 21.21949 43.74934 8 9 c++ negative 4319 45.64092 77.17954 8 </code></pre> <p>And I have been trying to visualize them by using ggplot2 bar chart:</p> <pre><code>p &lt;-ggplot() + theme_bw() + geom_bar(aes(y=tone_percent, x=reorder(language, -pos), fill=tone), data=data, stat="identity") + geom_text(data=data, aes(x = language, y = label_pos, ymax=label_pos, hjust = 0.5, label = paste0(round(tone_percent),"%")), size=4) + labs(x="Language", y="Percentage of tone") + scale_fill_manual(values=c('#F45E5A', '#5086FF', '#17B12B')) + theme(legend.position="bottom", legend.direction="horizontal", legend.title = element_blank()) + coord_flip() </code></pre> <p>and it gives almost excellent result: <a href="https://i.stack.imgur.com/MXfLV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MXfLV.png" alt="enter image description here"></a></p> <p>However, the legend shows the labels in alphabetical order, but I would like to display them in the same order as bars are drawn in the chart : Positive then Neutral then Negative</p> <p>Is there any way to achieve that?</p>
0debug
static int local_unlinkat_common(FsContext *ctx, int dirfd, const char *name, int flags) { int ret = -1; if (ctx->export_flags & V9FS_SM_MAPPED_FILE) { int map_dirfd; if (flags == AT_REMOVEDIR) { int fd; fd = openat(dirfd, name, O_RDONLY | O_DIRECTORY | O_PATH); if (fd == -1) { goto err_out; } ret = unlinkat(fd, VIRTFS_META_DIR, AT_REMOVEDIR); close_preserve_errno(fd); if (ret < 0 && errno != ENOENT) { goto err_out; } } map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR); ret = unlinkat(map_dirfd, name, 0); close_preserve_errno(map_dirfd); if (ret < 0 && errno != ENOENT) { goto err_out; } } ret = unlinkat(dirfd, name, flags); err_out: return ret; }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
static int create_dynamic_disk(BlockBackend *blk, uint8_t *buf, int64_t total_sectors) { VHDDynDiskHeader *dyndisk_header = (VHDDynDiskHeader *) buf; size_t block_size, num_bat_entries; int i; int ret; int64_t offset = 0; block_size = 0x200000; num_bat_entries = (total_sectors + block_size / 512) / (block_size / 512); ret = blk_pwrite(blk, offset, buf, HEADER_SIZE); if (ret) { goto fail; } offset = 1536 + ((num_bat_entries * 4 + 511) & ~511); ret = blk_pwrite(blk, offset, buf, HEADER_SIZE); if (ret < 0) { goto fail; } offset = 3 * 512; memset(buf, 0xFF, 512); for (i = 0; i < (num_bat_entries * 4 + 511) / 512; i++) { ret = blk_pwrite(blk, offset, buf, 512); if (ret < 0) { goto fail; } offset += 512; } memset(buf, 0, 1024); memcpy(dyndisk_header->magic, "cxsparse", 8); dyndisk_header->data_offset = cpu_to_be64(0xFFFFFFFFFFFFFFFFULL); dyndisk_header->table_offset = cpu_to_be64(3 * 512); dyndisk_header->version = cpu_to_be32(0x00010000); dyndisk_header->block_size = cpu_to_be32(block_size); dyndisk_header->max_table_entries = cpu_to_be32(num_bat_entries); dyndisk_header->checksum = cpu_to_be32(vpc_checksum(buf, 1024)); offset = 512; ret = blk_pwrite(blk, offset, buf, 1024); if (ret < 0) { goto fail; } fail: return ret; }
1threat
Insert Sring on Database : Please help me to : Insert Sring (Sting Inherited from Edit Text) to database by SQLite <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> String et11 = et1.getText().toString(); String et22 = et2.getText().toString(); db.execSQL("INSERT INTO ZAKHIRE (USER , PAS) VALUES ( " + et11 + et22 +")"); db.close(); <!-- end snippet -->
0debug
Symfony 4, include assets from vendor directory : <p>I would like to load vendor assets, downloaded with composer inside vendor directory, from my twig template.</p> <p>Using a relative path is one solution (in this example I'm going to include bootstrap css, but the same problem is for any other libs required from composer, as jQuery, jQueryUI etc. )</p> <pre><code>&lt;link rel="stylesheet" href="{{ asset('../vendor/twbs/bootstrap/dist/css/bootstrap.min.css') }}" &gt; </code></pre> <p>Symfony docs suggest to use asset:install in order to generate a symlink from vendor directory to public, but I was unable to understand how it works. assets:install -h wasn't so clear to let me understand how to link a specific vendor path to the public directory.</p> <p>Creating a simlink with </p> <pre><code>ln -s /path/of/vendor/lib /path/public/dir </code></pre> <p>works fine but, symlinks created will be deleted every time I look for an update with composer.</p> <p>Any idea about "a best practice" to include assets from vendor directory?</p> <p>Thank you</p>
0debug
How to add a dependency to another project properly using gradle? : <p>Hello I am new to gradle and it is a little bit confusing for me. How should I add a dependency in my gradle configuration to have access to <em>B1.java</em> in <em>projectA1</em>? Project B is gradle project and project A is just a folder with another gradle projects.</p> <p>Here is my structure:</p> <ol> <li>Workspace: <ul> <li>ProjectA <ul> <li>projectA1 <ul> <li>... </li> <li><strong>here I want to have access to <em>B1.java</em></strong></li> <li>build.gradle</li> </ul></li> <li>projectA2 <ul> <li>...</li> <li>build.gradle</li> </ul></li> </ul></li> <li>ProjectB <ul> <li>projectB1 <ul> <li><em>B1.java</em></li> <li>... </li> <li>build.gradle</li> </ul></li> <li>projectB2 <ul> <li>...</li> <li>build.gradle</li> </ul></li> <li>build.gradle</li> </ul></li> </ul></li> </ol> <p>I tried to read gradle documentation, but it is not clear for me. Any help appreciated. Thanks!</p>
0debug
Angular 2 Event emitters vs Subject : <p>In Angular 2 what is the difference between Event Emitter and Subject for announcing an event? It seems like event emitters are less complicated to declare....Which way is preferred by Angular 2?</p> <pre><code>dataRefreshEvent = new EventEmitter(); private companyDataAnnouncedSource = new Subject(); companyDataAnnouncedSource$ = this.companyDataAnnouncedSource.asObservable(); </code></pre>
0debug
static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) { MOVContext *mov = s->priv_data; MOVStreamContext *sc; AVIndexEntry *sample; AVStream *st = NULL; int ret; mov->fc = s; retry: sample = mov_find_next_sample(s, &st); if (!sample) { mov->found_mdat = 0; if (!mov->next_root_atom) return AVERROR_EOF; avio_seek(s->pb, mov->next_root_atom, SEEK_SET); mov->next_root_atom = 0; if (mov_read_default(mov, s->pb, (MOVAtom){ AV_RL32("root"), INT64_MAX }) < 0 || avio_feof(s->pb)) return AVERROR_EOF; av_log(s, AV_LOG_TRACE, "read fragments, offset 0x%"PRIx64"\n", avio_tell(s->pb)); goto retry; } sc = st->priv_data; sc->current_sample++; if (mov->next_root_atom) { sample->pos = FFMIN(sample->pos, mov->next_root_atom); sample->size = FFMIN(sample->size, (mov->next_root_atom - sample->pos)); } if (st->discard != AVDISCARD_ALL) { if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n", sc->ffindex, sample->pos); return AVERROR_INVALIDDATA; } ret = av_get_packet(sc->pb, pkt, sample->size); if (ret < 0) return ret; if (sc->has_palette) { uint8_t *pal; pal = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); if (!pal) { av_log(mov->fc, AV_LOG_ERROR, "Cannot append palette to packet\n"); } else { memcpy(pal, sc->palette, AVPALETTE_SIZE); sc->has_palette = 0; } } #if CONFIG_DV_DEMUXER if (mov->dv_demux && sc->dv_audio_container) { avpriv_dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size, pkt->pos); av_freep(&pkt->data); pkt->size = 0; ret = avpriv_dv_get_packet(mov->dv_demux, pkt); if (ret < 0) return ret; } #endif } pkt->stream_index = sc->ffindex; pkt->dts = sample->timestamp; if (sc->ctts_data && sc->ctts_index < sc->ctts_count) { pkt->pts = pkt->dts + sc->dts_shift + sc->ctts_data[sc->ctts_index].duration; sc->ctts_sample++; if (sc->ctts_index < sc->ctts_count && sc->ctts_data[sc->ctts_index].count == sc->ctts_sample) { sc->ctts_index++; sc->ctts_sample = 0; } if (sc->wrong_dts) pkt->dts = AV_NOPTS_VALUE; } else { int64_t next_dts = (sc->current_sample < st->nb_index_entries) ? st->index_entries[sc->current_sample].timestamp : st->duration; pkt->duration = next_dts - pkt->dts; pkt->pts = pkt->dts; } if (st->discard == AVDISCARD_ALL) goto retry; pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0; pkt->pos = sample->pos; return 0; }
1threat
How to run a mutation on mount with React Apollo 2.1's Mutation component? : <p>We are currently moving from <a href="https://facebook.github.io/relay/docs/en/introduction-to-relay.html" rel="noreferrer">Relay</a> to <a href="https://www.apollographql.com/docs/react/" rel="noreferrer">React Apollo 2.1</a> and something I'm doing seems fishy.</p> <p><strong>Context:</strong> Some components must only be rendered if the user is authenticated (via an API key), so there is an <code>Authenticator</code> component guarding the rest of the tree.</p> <p>In <code>App.js</code>, it gets used like this (obviously all snippets below are minimal examples):</p> <pre><code>import React from 'react'; import Authenticator from './Authenticator'; import MyComponent from './MyComponent'; export default function App({ apiKey }) { return ( &lt;Authenticator apiKey={apiKey} render={({ error, token }) =&gt; { if (error) return &lt;div&gt;{error.message}&lt;/div&gt;; if (token) return &lt;MyComponent token={token} /&gt;; return &lt;div&gt;Authenticating...&lt;/div&gt;; }} /&gt; ); } </code></pre> <p>If authentication succeeds, <code>MyComponent</code> gets rendered. <code>Authentication</code> sends the authentication mutation to the server when rendered/mounted for the first time and calls the <a href="https://reactjs.org/docs/render-props.html" rel="noreferrer">render prop</a> accordingly. <code>Authentication.js</code> looks as such:</p> <pre><code>import gql from 'graphql-tag'; import React from 'react'; import { Mutation } from 'react-apollo'; const AUTH_MUTATION = gql`mutation Login($apiKey: String!) { login(apiKey: $apiKey) { token } }`; export default function Authenticator({ apiKey, render }) { return ( &lt;Mutation mutation={AUTH_MUTATION} variables={{ apiKey }}&gt; {(login, { data, error, called }) =&gt; { if (!called) login(); // ⚠️ This seems sketchy ⚠️ const token = (data &amp;&amp; data.login.token) || undefined; return render({ error, token }); }} &lt;/Mutation&gt; ); } </code></pre> <p>That <code>if (!called) login();</code> is what is giving me pause. If I don't specify <code>if (!called)</code>, the UI becomes epileptic and sends thousands of requests (which makes sense, calling <code>login()</code> causes <code>render()</code> to re-run), but is that how it's supposed to be used?</p> <p>It seems like the <a href="https://www.apollographql.com/docs/react/react-apollo-migration.html#query-component" rel="noreferrer"><code>Query</code> component equivalent</a> differs in that simply rendering it emits the request. and I am wondering if there is a way to apply the same mechanism to <code>Mutation</code>, which requires calling the mutate function as part of the render prop.</p> <p>The Relay equivalent of the snippet above does exactly what React Apollo's <code>Query</code> does on <code>Mutation</code>:</p> <pre><code>// Authentication.js import React from 'react'; import { graphql, QueryRenderer } from 'react-relay'; import { Environment } from 'relay-runtime'; // Hiding out all the `Environment`-related boilerplate const environment = return new Environment(/* ... */); const AUTH_MUTATION = graphql`mutation Login($apiKey: String!) { login(apiKey: $apiKey) { token } }`; export default function Authenticator({ apiKey, render }) { return ( &lt;QueryRenderer query={AUTH_MUTATION} variables={{ apiKey }} render={render} /&gt; ); } // App.js import React from 'react'; import Authenticator from './Authenticator'; import MyComponent from './MyComponent'; export default function App({ apiKey }) { return ( &lt;Authenticator apiKey={apiKey} render={({ error, props }) =&gt; { if (error) return &lt;div&gt;{error.message}&lt;/div&gt;; if (props) return &lt;MyComponent token={props.loginAPI.token)} /&gt;; return &lt;div&gt;Authenticating...&lt;/div&gt;; }} /&gt; ); } </code></pre>
0debug
how does Collections.binarySearch() with comparator work when the input is not in sorted? : <p>I am confused that this method doesn't work as expected:</p> <p>public static int binarySearch(List list, T key, Comparator c)</p> <p>here is my code</p> <pre><code>// Create a list List&lt;Domain&gt; l = new ArrayList&lt;Domain&gt;(); l.add(new Domain(10, "quiz.geeksforgeeks.org")); l.add(new Domain(70, "practice.geeksforgeeks.org")); l.add(new Domain(30, "code.geeksforgeeks.org")); l.add(new Domain(40, "www.geeksforgeeks.org")); l.add(new Domain(20, "practice.geeksforgeeks.org")); l.add(new Domain(21, "practice.geeksforgeeks.org")); // Searching a domain with key value 10. To search // we create an object of domain with key 10. int index = Collections.binarySearch(l, new Domain(31, null),new Comparator&lt;Domain&gt;() { public int compare(Domain u1, Domain u2) { return u1.getId().compareTo(u2.getId()); } }); System.out.println("Found at index " + index); </code></pre> <p>it returns -7 to me which is not correct. From the documentation, it says "The list must be sorted into ascending order according to the specified comparator". Here the sorted list should be :Domain(10...,20,21,30,40,70 I didnt see why the -7?</p>
0debug
How can I reset the preview window to the right of the screen? : <p>Im not really sure about how my preview window ended up as a different window. I would like to restore it back to the left of the screen, like the default mode. I can't find the way to do it! Thank you!</p>
0debug
C# Beginner - "Use of Unassigned Local Variable" Issue : <p>New to C# (only coding for a week so far) trying to create a practice program. Can't seem to get the data I want stored in 'price1' and 'price2'. Error is CS0165 Use of unassigned local variable 'price1' and 'price2'.</p> <p>I've tried moving lines of code around and adding in a return command, but I can't quite seem to figure it out.</p> <pre><code> Console.Write("What grocery are you buying: "); string product1 = Console.ReadLine(); Console.Write("How many are you buying: "); int quantity1 = Convert.ToInt32(Console.ReadLine()); double price1; if (product1 == "Steak") { price1 = Convert.ToDouble(steak.price * quantity1); } if (product1 == "Cheerios") { price1 = Convert.ToDouble(cheerios.price * quantity1); } if (product1 == "Pepsi") { price1 = Convert.ToDouble(pepsi.price * quantity1); } if (product1 == "Celeste Pizza") { price1 = Convert.ToDouble(celeste.price * quantity1); } Console.Write("What second grocery are you buying: "); string product2 = Console.ReadLine(); Console.Write("How many are you buying: "); int quantity2 = Convert.ToInt32(Console.ReadLine()); double price2; if (product2 == "Steak") { price2 = Convert.ToDouble(steak.price * quantity2); } if (product1 == "Cheerios") { price2 = Convert.ToDouble(cheerios.price * quantity2); } if (product1 == "Pepsi") { price2 = Convert.ToDouble(pepsi.price * quantity2); } if (product1 == "Celeste Pizza") { price2 = Convert.ToDouble(celeste.price * quantity2); } Console.WriteLine(price1 + price2); </code></pre> <p>Trying to get data stored in 'price1' and 'price2' so I can add them together at the end. Sorry if I'm getting any terminology wrong here.</p>
0debug
Getting a error TypeError: color.charAt is not a function in C:/...../node_modules/@material-ui/core/styles/colorManipulator.js:148 : <p>Here is a link to the screenshot of the error : <a href="https://drive.google.com/open?id=1HL-Fy1M4tHp9qMUpt88PzOfI10AHHem-" rel="noreferrer">https://drive.google.com/open?id=1HL-Fy1M4tHp9qMUpt88PzOfI10AHHem-</a> .</p> <p>This is the code portion where colors are used.</p> <pre><code>const theme = createMuiTheme({ palette: { primary: { light: '#33c9dc', main: '#00bcd4', dark: '#008394', contrastText: '#fff' }, secondary: { light: '#ff6333', main: '#ff3d00', dark: '#b22a00', contrastText: '#fff' } }, typography: { useNextVariants: true }, form: { textAlign: "center" }, image: { margin: "10px auto 10px auto" }, pageTitle: { margin: "10px auto 10px auto" }, textField: { margin: "10px auto 10px auto" }, button: { marginTop: 20, position: "relative" }, customError: { color: "red", fontSize: "0.8rem", marginTop: 5 }, progress: { position: "absolute" } }); </code></pre> <p>I already tried changing the colors from hexadecimal to rgb values, it didn't work.</p>
0debug
Convert String date YYYY-MM to date in Javascript : <p>I have a date as a String like : <code>2015-12</code> for december 2015.</p> <p>I would like to convert this date to get this date in milliseconds in javascript. (From the first day of the month)</p> <p>How can i do it ?</p>
0debug
how to add zeros to string in php : <p>I have strings: <code>23-65, 123-45, 2-5435, 345-4</code> I want to add zeros to them so all of them will look like <code>###-#### (three digits dash four digits): 023-0065, 123-0045, 002-5435, 345-0004</code> How can i do it in php? Thanks!</p>
0debug
Can anyone give a simple code for houghlines using C#? As i got the transform, i want to detect the lines in images : Heloo all, Can anyone give me a simple code for houghlines in c# since i am new to .net,i didnt know how to do hough transform.Then i found the code for Hough transform but i need to detect the lines in images. for that theta and rho value is needed.
0debug
What's the difference between a stack file and a Compose file? : <p>I'm learning about using Docker Compose to deploy applications in multiple containers, across multiple hosts. And I have come across two configuration files - stack file, and Compose file.</p> <p>From the <a href="https://docs.docker.com/docker-cloud/apps/stack-yaml-reference/" rel="noreferrer">Cloud stack file YAML reference</a>, it states <em>a stack file is a file in YAML format that defines one or more services, similar to a <code>docker-compose.yml</code> file but with a few extensions.</em></p> <p>And from <a href="https://blog.nimbleci.com/2016/09/14/docker-stacks-and-why-we-need-them/" rel="noreferrer">this post</a>, it states that <em>stacks are very similar to docker-compose except they define services while docker-compose defines containers</em>.</p> <p>They look very similar, so I am wondering when I would use the stack file, and when to use the Compose file?</p>
0debug
How to resolve : unexpected error occured Initializing Android Designer" in VS 2015 with Xamarin : <p>Bringing up a new PC with Xamarin and VS 2015 Pro I received the following error:</p> <blockquote> <p>An unexpected error occurred trying to initialize Android Designer. Please verify the Android SDK path and the Java Development Kit path on Tools->Options->Xamarin->Android Settings menu. Please see the logs for more details.</p> </blockquote> <p>I verified the SDK's are installed correctly. VS didn't generate any kind of Activity Log so I believe the log must lie elsewhere. Anyone know where I can find this log to find out more about what is wrong ?</p>
0debug
How to keep context in javascript methods after call ajax? : <p>hi i have a problem with es6 and in particulary the methods of class. See my exemple :</p> <p>my first class :</p> <pre><code>class A{ constructor(){ this.B = new B(); this.test = 5; } methodA1(){ B.methodB1(this.methodA2); } methodA2(){ console.log(this.test); } } </code></pre> <p>the second class :</p> <pre><code>class B{ methodB1(callback){ $.get("url",function(data){ ... callback(); }); } } </code></pre> <p>When you execute methodA1, the code return : this is undefined (in a methodeA2) ! In fact when you call a callback function in ajax call the callback lost the context of class. Somebody have an idea to skirt this problem ?</p> <p>Thanks.</p>
0debug
ofstream reference using string? : <p>I'm making a program with several functions:</p> <pre><code>int totalDays(ofstream &amp;outputFile, int noEmployee) { string fileName = "employeeAbsences.txt"; outputFile.open(fileName); </code></pre> <p>However, I don't know how to call it:</p> <pre><code>int main() { int employeesNumber = employees(); string fileName = "employeeAbsences.txt"; employees(); totalDays(fileName, employeesNumber); </code></pre> <p>the fileName is underlined in the call saying it cannot be a string. What name am I supposed to call the first function with??</p>
0debug
def group_keyvalue(l): result = {} for k, v in l: result.setdefault(k, []).append(v) return result
0debug
scope of do-catch in swift - cannot assign value to outside variable : <p>I have made some code to make POST request to my php script which is placed on my servers. I have tested and that part is working fine. I got the problem with the returning result from the server - I get it in JSON format, and print in inside do-catch statement - its OK. I assign the returning variable to variable which is declared outside of the do-catch and its not "visible". Let me show my code, it will be more simplier to explain when you see the code:</p> <pre><code>//sending inputs to server and receiving info from server let json:[String:AnyObject] = [ "username" : username!, "password" : password!, "iphone" : "1" ] var link = "http://www.pnc.hr/rfid/login.php" var novi:String = "" do { let jsonData = try NSJSONSerialization.dataWithJSONObject(json, options: .PrettyPrinted) // create post request let url = NSURL(string: link)! let request = NSMutableURLRequest(URL: url) request.HTTPMethod = "POST" // insert json data to the request request.setValue("application/json; charset=utf-8", forHTTPHeaderField: "Content-Type") request.HTTPBody = jsonData request.addValue("application/json", forHTTPHeaderField: "Content-Type") request.addValue("application/json", forHTTPHeaderField: "Accept") let task = NSURLSession.sharedSession().dataTaskWithRequest(request){ data, response, error in if error != nil{ print("Error 55 -&gt; \(error)") return } do { let result = try NSJSONSerialization.JSONObjectWithData(data!, options: []) as? [String:AnyObject] print("FIRST PRINT -&gt; \(result!["password"])") novi = String(result!["password"]) //return result } catch { print("Error 43-&gt; \(error)") } } task.resume() } catch { //handle error. Probably return or mark function as throws print(error) } print("SECOND PRINT -&gt; \(novi)") </code></pre> <p>If you see <code>print("FIRST PRINT -&gt; \(result!["password"])")</code> - it executes normally and output all the variables. Then if you see <code>print("SECOND PRINT -&gt; \(novi)")</code> at the end of the code it outputs empty sting - like I haven't assigned variable to it. </p>
0debug
static int decode_b_picture_header(VC9Context *v) { int pqindex; if (v->profile == PROFILE_SIMPLE) { av_log(v, AV_LOG_ERROR, "Found a B frame while in Simple Profile!\n"); return FRAME_SKIPED; } v->bfraction = vc9_bfraction_lut[get_vlc2(&v->gb, vc9_bfraction_vlc.table, VC9_BFRACTION_VLC_BITS, 2)]; if (v->bfraction < -1) { av_log(v, AV_LOG_ERROR, "Invalid BFRaction\n"); return FRAME_SKIPED; } else if (!v->bfraction) { return decode_bi_picture_header(v); } pqindex = get_bits(&v->gb, 5); if (v->quantizer_mode == QUANT_FRAME_IMPLICIT) v->pq = pquant_table[0][pqindex]; else { v->pq = pquant_table[v->quantizer_mode-1][pqindex]; } if (pqindex < 9) v->halfpq = get_bits(&v->gb, 1); if (v->quantizer_mode == QUANT_FRAME_EXPLICIT) v->pquantizer = get_bits(&v->gb, 1); if (v->extended_mv == 1) v->mvrange = get_prefix(&v->gb, 0, 3); v->mv_mode = get_bits(&v->gb, 1); if (v->pq < 13) { if (!v->mv_mode) { v->mv_mode = get_bits(&v->gb, 2); if (v->mv_mode) av_log(v, AV_LOG_ERROR, "mv_mode for lowquant B frame was %i\n", v->mv_mode); } } else { if (!v->mv_mode) { if (get_bits(&v->gb, 1)) av_log(v, AV_LOG_ERROR, "mv_mode for highquant B frame was %i\n", v->mv_mode); } v->mv_mode = 1-v->mv_mode; } if (v->mv_mode == MV_PMODE_MIXED_MV) { if (bitplane_decoding( v->mv_type_mb_plane, v->width_mb, v->height_mb, v)<0) return -1; } bitplane_decoding(v->direct_mb_plane, v->width_mb, v->height_mb, v); bitplane_decoding(v->skip_mb_plane, v->width_mb, v->height_mb, v); v->mv_diff_vlc = &vc9_mv_diff_vlc[get_bits(&v->gb, 2)]; v->cbpcy_vlc = &vc9_cbpcy_p_vlc[get_bits(&v->gb, 2)]; if (v->dquant) { vop_dquant_decoding(v); } if (v->vstransform) { v->ttmbf = get_bits(&v->gb, 1); if (v->ttmbf) { v->ttfrm = get_bits(&v->gb, 2); av_log(v, AV_LOG_INFO, "Transform used: %ix%i\n", (v->ttfrm & 2) ? 4 : 8, (v->ttfrm & 1) ? 4 : 8); } } return 0; }
1threat
java multiple classes exercise : Here is the code below . public class Country{ private String name; private City [] cities; private int index =0; public Country (String n, int nrc){ // nrc as in number of cities name = n; cities = new City[nrc]; } public boolean exists (City str){ for(int i =0; i>index;i++){ if(cities[i].equals(str)){ return true; } } return false; } public void addCity (City str){ if(str == null){ System.out.print("City not initialized!"); } if(exists(str)){ System.out.print("City exists!"); } if(cities.length == index){ System.out.print("Not enough space in array!"); } cities[index++] = str; } } I want to know what " cities[index++] = str " is supposed to do. Anyone help? Thanks.
0debug
Tax Rate in new Stripe Checkout : <p><br> I've implemented the new <code>Stripe Checkout</code> on my <code>NodeJS server</code>, but I cannot specify the <strong>Tax Rate</strong> for Invoicing.</p> <p>As per my understanding <strong>Tax Rates</strong> should be specified in the <a href="https://stripe.com/docs/api/payment_intents/object#payment_intent_object-invoice" rel="noreferrer">Payment Intent API</a>. Fact is that the new <code>Checkout</code> automatically creates a <code>Payment Intent</code> via its <a href="https://stripe.com/docs/api/checkout/sessions/create" rel="noreferrer">CreateSession</a> (see <code>payment_intent_data</code>), but I'm not able to insert a <strong>Tax Rate</strong> upon its creation.</p> <p>How can this be done? What I want to achieve is to have the user know the Tax % both in the <code>Checkout UI</code> and in the final <code>email invoice</code>.</p> <p>This is my code:</p> <pre><code>return stripe.checkout.sessions.create({ payment_method_types: [paymentMethod], line_items: [{ name: name, description: description, images: [imageUrl], amount: amount, currency: currency, quantity: 1 }], success_url: successUrl, cancel_url: cancelUrl, customer: stripeId, payment_intent_data: { receipt_email: email, metadata: { userId: userId, amount: amount, currency: currency, ref: ref, stripeId: stripeId, details: details } } }).then(session =&gt; { return res.send(session) </code></pre>
0debug
Python 2 vs Python 3 - Difference in behavior of filter : <p>Could someone please help me understand why the following code that implements the "sieve of Eratosthenes" behaves differently across Python 2 and Python 3.</p> <pre><code>l = range(2, 20) for i in range(2, 6): l = filter(lambda x: x == i or x % i != 0, l) print(tuple(l)) </code></pre> <p>With Python 2.7:</p> <pre><code>&gt; python filter.py (2, 3, 5, 7, 11, 13, 17, 19) </code></pre> <p>with Python 3.6:</p> <pre><code>&gt; python filter.py (2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 16, 17, 18, 19) </code></pre> <p>I understand that Python3's filter returns a filter object but can't explain the final result. (The code is from this lambdas tutorial <a href="http://www.secnetix.de/olli/Python/lambda_functions.hawk" rel="noreferrer">1</a>).</p>
0debug
(Urgent issue that need to be solved within 2 hours) selenium chromedriver suddenly not working : seesion not created exception : My code, which used to work until yesterday, suddenly stopped working. I'd been running codes from jupyter notebook to auto-collect repeating data from a webpage. It is as follows(url is changed to google for privacy reasons): # use selenium to start Chrome session to open a certain page dr = webdriver.Chrome() dr.get("http://www.google.com") The error message I got: --------------------------------------------------------------------------- WebDriverException Traceback (most recent call last) <ipython-input-25-84be89301b0d> in <module>() 1 # use selenium to start Chrome session to open google. ----> 2 dr = webdriver.Chrome() 3 dr.get("http://www.google.com") /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, chrome_options, service_args, desired_capabilities, service_log_path) 65 command_executor=ChromeRemoteConnection( 66 remote_server_addr=self.service.service_url), ---> 67 desired_capabilities=desired_capabilities) 68 except: 69 self.quit() /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in __init__(self, command_executor, desired_capabilities, browser_profile, proxy, keep_alive) 85 self.error_handler = ErrorHandler() 86 self.start_client() ---> 87 self.start_session(desired_capabilities, browser_profile) 88 self._switch_to = SwitchTo(self) 89 self._mobile = Mobile(self) /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in start_session(self, desired_capabilities, browser_profile) 139 desired_capabilities['firefox_profile'] = browser_profile.encoded 140 response = self.execute(Command.NEW_SESSION, { --> 141 'desiredCapabilities': desired_capabilities, 142 }) 143 self.session_id = response['sessionId'] /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py in execute(self, driver_command, params) 199 response = self.command_executor.execute(driver_command, params) 200 if response: --> 201 self.error_handler.check_response(response) 202 response['value'] = self._unwrap_value( 203 response.get('value', None)) /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py in check_response(self, response) 179 elif exception_class == UnexpectedAlertPresentException and 'alert' in value: 180 raise exception_class(message, screen, stacktrace, value['alert'].get('text')) --> 181 raise exception_class(message, screen, stacktrace) 182 183 def _value_or_default(self, obj, key, default): WebDriverException: Message: session not created exception from unknown error: Runtime.executionContextCreated has invalid 'context': {"auxData":{"frameId":"7600.1","isDefault":true},"id":1,"name":"","origin":"://"} (Session info: chrome=54.0.2840.71) (Driver info: chromedriver=2.20.353124 (035346203162d32c80f1dce587c8154a1efa0c3b),platform=Mac OS X 10.11.6 x86_64) Can anyone help? I really have no idea how to solve this and why I'm suddenly getting this message. And it's quite urgent. Thanks in advance.
0debug
This is my output ,how to merge the arrays . i wnat like this : Array ( [0] => Array ( [ht_amenity_id] => 1 [ht_amenity_name] => Central Air Conditioning [ht_category] => 1 [ht_cat_name] => General ) [1] => Array ( [ht_amenity_id] => 2 [ht_amenity_name] => Facilities for disabled guests [ht_category] => 1 [ht_cat_name] => General ) [2] => Array ( [ht_amenity_id] => 3 [ht_amenity_name] => Climate control [ht_category] => 2 [ht_cat_name] => Services ) ) this my output .how to merge the array I want like this Array ( [0] => Array ( [ht_amenity_id][0] => 1 [ht_amenity_id][1] => 2 [ht_amenity_name][0] => Central Air Conditioning [ht_amenity_name][1] => Facilities for disabled guests [ht_category] => 1 [ht_cat_name] => General ) [1] => Array ( [ht_amenity_id] => 3 [ht_amenity_name] => Climate control [ht_category] => 2 [ht_cat_name] => Services ) )
0debug
What is the Javascript equivalent of writing 'If not" : <p>Python programmer here. </p> <p>I don't know how to write this. I tried using 'if !in' and '!if in', but I don't know how. Tried to Google it but got no results.</p>
0debug
Translating Arrays in psuedocode to python : Hello I am trying to write a short program using the following psuedocode I can not figure out how to translate the arrays in psuedocode into python for example "declare Names[5] as a string" I tried to put "Name[5] = string" but it will come up with unresolved reference I tried looking up tutorials on how to use arrays but still can't figure it out could you give me a few tips or some good videos explaining arrays ` Main Call writeNammeAssn() Declare Names[5] As String Declare Sales[5] As Float Set Max = 0 Set K = 0 Set Index = 0 Names[K] = getName() Sales[K] = getFloat() While Names[K] != "*" If Sales[K] > Max Then Set Index = K Set Max = Sales[Index] End If Set K = K + 1 Names[K] = getName() Sales[K] = getInt() End While Write "Maximum sales for the month: " + Max Write "Salesperson: " + Names[Index] End Main
0debug
Hello. I wanna html, css emmet function on php file in VS CODE : Let me show you my problem. If i code on .php file <div id= ~~ emmet => idate, idn_to_ascii, idn_to_utf-8 ... etc If i code on .htmlfile <div id= ~~ emmet => id I use html,css,js emmets on .html file. But i can't use html,css,js emmets on .php file. If you know about this problem, please comment to me.
0debug
textbox user control not displaying date in DD/mm/yyyy format : <p>Aspx Webpage accepting value in DD/mm/yyyy format but while retrieving value from database using datetime object get method it is showing correctly in dd/mm/yyyy but assigning in mm/DD/yyyy format to datebox Instead it should show DD/mm/yyyy format?please suggest tried parsetext n all but not working</p>
0debug
static int bdrv_wr_badreq_sectors(BlockDriverState *bs, int64_t sector_num, int nb_sectors) { if (sector_num < 0 || nb_sectors < 0) return 1; if (sector_num > bs->total_sectors - nb_sectors) { if (bs->autogrow) bs->total_sectors = sector_num + nb_sectors; else return 1; } return 0; }
1threat
static void FUNCC(pred4x4_vertical_add)(uint8_t *_pix, const int16_t *_block, ptrdiff_t stride) { int i; pixel *pix = (pixel*)_pix; const dctcoef *block = (const dctcoef*)_block; stride >>= sizeof(pixel)-1; pix -= stride; for(i=0; i<4; i++){ pixel v = pix[0]; pix[1*stride]= v += block[0]; pix[2*stride]= v += block[4]; pix[3*stride]= v += block[8]; pix[4*stride]= v + block[12]; pix++; block++; } }
1threat
Angular 2.0.0 - Testing " imported by the module 'DynamicTestModule' " : <p>I am having a problem in testing app.component.ts in Angular 2. I am using angular-cli. Whenever I run ng test, my app.component.spec.ts makes the console prompt with the error: </p> <pre><code> Failed: Unexpected directive 'HomeModuleComponent' imported by the module 'DynamicTestModule' Error: Unexpected directive 'HomeModuleComponent' imported by the module 'DynamicTestModule' </code></pre> <p>I imported the HomeModuleComponent in TestBed</p> <pre><code>TestBed.configureTestingModule({ declarations: [AppComponent], imports : [ HomeModuleComponent ] }); </code></pre> <p>Can anyone help me with this problem?</p>
0debug
R markdown: can I insert a pdf to the r markdown file as an image? : <p>I am trying to insert a pdf image into an r markdown file. I know it is possible to insert jpg or png images. I was just wondering if it is also possible to insert a pdf image. Thanks very much! </p>
0debug
static void mov_fix_index(MOVContext *mov, AVStream *st) { MOVStreamContext *msc = st->priv_data; AVIndexEntry *e_old = st->index_entries; int nb_old = st->nb_index_entries; const AVIndexEntry *e_old_end = e_old + nb_old; const AVIndexEntry *current = NULL; MOVStts *ctts_data_old = msc->ctts_data; int64_t ctts_index_old = 0; int64_t ctts_sample_old = 0; int64_t ctts_count_old = msc->ctts_count; int64_t edit_list_media_time = 0; int64_t edit_list_duration = 0; int64_t frame_duration = 0; int64_t edit_list_dts_counter = 0; int64_t edit_list_dts_entry_end = 0; int64_t edit_list_start_ctts_sample = 0; int64_t curr_cts; int64_t edit_list_index = 0; int64_t index; int64_t index_ctts_count; int flags; unsigned int ctts_allocated_size = 0; int64_t start_dts = 0; int64_t edit_list_media_time_dts = 0; int64_t edit_list_start_encountered = 0; int64_t search_timestamp = 0; int64_t* frame_duration_buffer = NULL; int num_discarded_begin = 0; int first_non_zero_audio_edit = -1; int packet_skip_samples = 0; MOVIndexRange *current_index_range; if (!msc->elst_data || msc->elst_count <= 0 || nb_old <= 0) { return; } msc->index_ranges = av_malloc((msc->elst_count + 1) * sizeof(msc->index_ranges[0])); if (!msc->index_ranges) { av_log(mov->fc, AV_LOG_ERROR, "Cannot allocate index ranges buffer\n"); return; } msc->current_index_range = msc->index_ranges; current_index_range = msc->index_ranges - 1; st->index_entries = NULL; st->index_entries_allocated_size = 0; st->nb_index_entries = 0; msc->ctts_data = NULL; msc->ctts_count = 0; msc->ctts_index = 0; msc->ctts_sample = 0; if (msc->dts_shift > 0) edit_list_dts_entry_end -= msc->dts_shift; if (ctts_data_old && ctts_count_old > 0) { edit_list_dts_entry_end -= ctts_data_old[0].duration; av_log(mov->fc, AV_LOG_DEBUG, "Offset DTS by ctts[%d].duration: %d\n", 0, ctts_data_old[0].duration); } start_dts = edit_list_dts_entry_end; while (get_edit_list_entry(mov, msc, edit_list_index, &edit_list_media_time, &edit_list_duration, mov->time_scale)) { av_log(mov->fc, AV_LOG_DEBUG, "Processing st: %d, edit list %"PRId64" - media time: %"PRId64", duration: %"PRId64"\n", st->index, edit_list_index, edit_list_media_time, edit_list_duration); edit_list_index++; edit_list_dts_counter = edit_list_dts_entry_end; edit_list_dts_entry_end += edit_list_duration; num_discarded_begin = 0; if (edit_list_media_time == -1) { continue; } if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { if (first_non_zero_audio_edit < 0) { first_non_zero_audio_edit = 1; } else { first_non_zero_audio_edit = 0; } if (first_non_zero_audio_edit > 0) st->skip_samples = msc->start_pad = 0; } edit_list_media_time_dts = edit_list_media_time; if (msc->dts_shift > 0) { edit_list_media_time_dts -= msc->dts_shift; } search_timestamp = edit_list_media_time_dts; if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) { search_timestamp = FFMAX(search_timestamp - msc->time_scale, e_old[0].timestamp); } index = find_prev_closest_index(st, e_old, nb_old, search_timestamp, 0); if (index == -1) { av_log(mov->fc, AV_LOG_WARNING, "st: %d edit list: %"PRId64" Missing key frame while searching for timestamp: %"PRId64"\n", st->index, edit_list_index, search_timestamp); index = find_prev_closest_index(st, e_old, nb_old, search_timestamp, AVSEEK_FLAG_ANY); if (index == -1) { av_log(mov->fc, AV_LOG_WARNING, "st: %d edit list %"PRId64" Cannot find an index entry before timestamp: %"PRId64".\n" "Rounding edit list media time to zero.\n", st->index, edit_list_index, search_timestamp); index = 0; edit_list_media_time = 0; } } current = e_old + index; ctts_index_old = 0; ctts_sample_old = 0; for (index_ctts_count = 0; index_ctts_count < index; index_ctts_count++) { if (ctts_data_old && ctts_index_old < ctts_count_old) { ctts_sample_old++; if (ctts_data_old[ctts_index_old].count == ctts_sample_old) { ctts_index_old++; ctts_sample_old = 0; } } } edit_list_start_ctts_sample = ctts_sample_old; edit_list_start_encountered = 0; for (; current < e_old_end; current++, index++) { frame_duration = (current + 1 < e_old_end) ? ((current + 1)->timestamp - current->timestamp) : edit_list_duration; flags = current->flags; curr_cts = current->timestamp + msc->dts_shift; if (ctts_data_old && ctts_index_old < ctts_count_old) { av_log(mov->fc, AV_LOG_DEBUG, "shifted frame pts, curr_cts: %"PRId64" @ %"PRId64", ctts: %d, ctts_count: %"PRId64"\n", curr_cts, ctts_index_old, ctts_data_old[ctts_index_old].duration, ctts_count_old); curr_cts += ctts_data_old[ctts_index_old].duration; ctts_sample_old++; if (ctts_sample_old == ctts_data_old[ctts_index_old].count) { if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count, &ctts_allocated_size, ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample, ctts_data_old[ctts_index_old].duration) == -1) { av_log(mov->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n", ctts_index_old, ctts_data_old[ctts_index_old].count - edit_list_start_ctts_sample, ctts_data_old[ctts_index_old].duration); break; } ctts_index_old++; ctts_sample_old = 0; edit_list_start_ctts_sample = 0; } } if (curr_cts < edit_list_media_time || curr_cts >= (edit_list_duration + edit_list_media_time)) { if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && st->codecpar->codec_id != AV_CODEC_ID_VORBIS && curr_cts < edit_list_media_time && curr_cts + frame_duration > edit_list_media_time && first_non_zero_audio_edit > 0) { packet_skip_samples = edit_list_media_time - curr_cts; st->skip_samples += packet_skip_samples; edit_list_dts_counter -= packet_skip_samples; if (edit_list_start_encountered == 0) { edit_list_start_encountered = 1; if (frame_duration_buffer) { fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter, frame_duration_buffer, num_discarded_begin); av_freep(&frame_duration_buffer); } } av_log(mov->fc, AV_LOG_DEBUG, "skip %d audio samples from curr_cts: %"PRId64"\n", packet_skip_samples, curr_cts); } else { flags |= AVINDEX_DISCARD_FRAME; av_log(mov->fc, AV_LOG_DEBUG, "drop a frame at curr_cts: %"PRId64" @ %"PRId64"\n", curr_cts, index); if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && edit_list_start_encountered == 0) { num_discarded_begin++; frame_duration_buffer = av_realloc(frame_duration_buffer, num_discarded_begin * sizeof(int64_t)); if (!frame_duration_buffer) { av_log(mov->fc, AV_LOG_ERROR, "Cannot reallocate frame duration buffer\n"); break; } frame_duration_buffer[num_discarded_begin - 1] = frame_duration; if (first_non_zero_audio_edit > 0 && st->codecpar->codec_id != AV_CODEC_ID_VORBIS) { st->skip_samples += frame_duration; msc->start_pad = st->skip_samples; } } } } else if (edit_list_start_encountered == 0) { edit_list_start_encountered = 1; if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && frame_duration_buffer) { fix_index_entry_timestamps(st, st->nb_index_entries, edit_list_dts_counter, frame_duration_buffer, num_discarded_begin); av_freep(&frame_duration_buffer); } } if (add_index_entry(st, current->pos, edit_list_dts_counter, current->size, current->min_distance, flags) == -1) { av_log(mov->fc, AV_LOG_ERROR, "Cannot add index entry\n"); break; } if (current_index_range < msc->index_ranges || index != current_index_range->end) { current_index_range++; current_index_range->start = index; } current_index_range->end = index + 1; if (edit_list_start_encountered > 0) { edit_list_dts_counter = edit_list_dts_counter + frame_duration; } if (((curr_cts + frame_duration) >= (edit_list_duration + edit_list_media_time)) && ((flags & AVINDEX_KEYFRAME) || ((st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)))) { if (ctts_data_old && ctts_sample_old != 0) { if (add_ctts_entry(&msc->ctts_data, &msc->ctts_count, &ctts_allocated_size, ctts_sample_old - edit_list_start_ctts_sample, ctts_data_old[ctts_index_old].duration) == -1) { av_log(mov->fc, AV_LOG_ERROR, "Cannot add CTTS entry %"PRId64" - {%"PRId64", %d}\n", ctts_index_old, ctts_sample_old - edit_list_start_ctts_sample, ctts_data_old[ctts_index_old].duration); break; } } break; } } } st->duration = edit_list_dts_entry_end - start_dts; av_free(e_old); av_free(ctts_data_old); current_index_range++; current_index_range->start = 0; current_index_range->end = 0; msc->current_index = msc->index_ranges[0].start; }
1threat
~/.setprompt: No such file or directory : <p>trying to change directory in csh script. But i am getting following error :</p> <p><strong><code>~/.setprompt</code>: No such file or directory</strong></p> <p>permission of above file is like that :</p> <p>-rwxrwxrwx 1 vgangwar 46 Oct 5 2015 /home/vgangwar/.setprompt</p>
0debug
static int file_write(URLContext *h, const unsigned char *buf, int size) { FileContext *c = h->priv_data; int r = write(c->fd, buf, size); return (-1 == r)?AVERROR(errno):r; }
1threat
Sending all aspx page as an e-mail body : <p>I have an aspx page that give an exam result. I would like to send copy of this page as an e-mail body. I did a lot of search about this situation but i can not find any solution.</p>
0debug
Can't handle with regexp, could you provide some hint? : I need to split this string by space: ``` <i>Lorem</i> 1 <span class="text-danger">ipsum</span> dolor sit amet, consectetur adipisicing elit. Animi consequuntur, eos? Error facere maiores minima molestiae obcaecati, quis voluptatum. Aspernatur cumque doloremque ducimus eos explicabo facilis fuga, nulla quos voluptate. ``` The difficulty is that I also have html tags inside. I tried something like this, but it takes spaces as well ``` /<(.*?)>(.*?)<(.*?)>|\w*(.*?)(?:\s*?[,?.-])?/g ``` Could you please help to fix my regexp?
0debug
C++ Class member is nullpointer : <p>I have a class (to render Text):</p> <pre><code>class TextRenderer { public: TextRenderer(); void RenderText(GLFWwindow *window, std::string text); private: FT_Library ft; FT_Face face; }; </code></pre> <p>where I initialize the members <code>ft</code> and <code>face</code> in the constructor</p> <pre><code>TextRenderer::TextRenderer() { FT_Library ft; FT_Face face; FT_Init_FreeType(&amp;ft)); FT_New_Face(ft, "Assets/monospace.ttf", 0, &amp;face); FT_Load_Char(face, 3, FT_LOAD_RENDER); } void TextRenderer::RenderText(GLFWwindow *window, std::string text) { FT_GlyphSlot slot = face-&gt;glyph; //Shortcut ... } </code></pre> <p>but when I want to use it like this:</p> <pre><code> TextRenderer tr; while (cond) { tr.RenderText(consoleEngine.window, prefix + inp); } </code></pre> <p>I get an error stating </p> <pre><code>Exception thrown: read access violation. this-&gt;face was nullptr. </code></pre> <p>for the first line of the <code>TextRenderer::RenterText</code> function.</p> <p>I don't understand this. Isn't the variable face a member of the class TextRenderer and should thus have access to it?</p>
0debug
mysql query to fetch these results : <p>i have three tables<br> 1.<strong>project_ref_table</strong> with columns<br> project_id(pk)<br> project_name<br> client_id(fk)<br> project_description </p> <p>and 2.<strong>client_ref_table</strong> with column<br> client_id(pk)<br> client_name<br> client_email<br> client_address </p> <p>3.<strong>emp_ref_table</strong><br> emp_id(pk) emp_name<br> emp_address<br> project_id(fk)<br> dept_id<br> <strong>Suppose user who login with his emp_id is a manager and i need to fetch his client list with their project like this</strong></p> <p><strong>client_name|client_email|client_address|project_name</strong></p>
0debug
How to create method that can receive a parameter of both: byte[] and Byte[] : which can be called: method(new byte[5]) and method(new Byte[5]) e.g. i have in my code: Byte[] array = list.toArray(new Byte[list.size()]); byte[] bytes = str.getBytes(); and to work with both arrays i forced to duplicate each method separately for byte[] and Byte[]
0debug
static void omap_pin_cfg_init(MemoryRegion *system_memory, target_phys_addr_t base, struct omap_mpu_state_s *mpu) { memory_region_init_io(&mpu->pin_cfg_iomem, &omap_pin_cfg_ops, mpu, "omap-pin-cfg", 0x800); memory_region_add_subregion(system_memory, base, &mpu->pin_cfg_iomem); omap_pin_cfg_reset(mpu); }
1threat
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
static void qmf_32_subbands(DCAContext * s, int chans, float samples_in[32][8], float *samples_out, float scale) { const float *prCoeff; int i; int sb_act = s->subband_activity[chans]; int subindex; scale *= sqrt(1/8.0); if (!s->multirate_inter) prCoeff = fir_32bands_nonperfect; else prCoeff = fir_32bands_perfect; for (subindex = 0; subindex < 8; subindex++) { for (i = 0; i < sb_act; i++){ uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ ((i-1)&2)<<30; AV_WN32A(&s->raXin[i], v); } for (; i < 32; i++) s->raXin[i] = 0.0; s->synth.synth_filter_float(&s->imdct, s->subband_fir_hist[chans], &s->hist_index[chans], s->subband_fir_noidea[chans], prCoeff, samples_out, s->raXin, scale); samples_out+= 32; } }
1threat
ios how to show htmlString into webview the html string contains bootstrap image : ******************** The html string is. ****************** "description": "<p> Business Name and City Located In <i class=\"fa fa-check\"></i></p>\r\n <p> Contact Info and Address <i class=\"fa fa-check\"></i></p>\r\n <p> Business & Product Detail <i class=\"fa fa-check\"></i></p>\r\n <p> Share Button <i class=\"fa fa-check\"></i></p>\r\n <p> Ability to See Page Traffic <i class=\"fa fa-check\"></i></p>\r\n <p> Full Page Control <i class=\"fa fa-check\"></i></p>\r\n <p> Customize Pictures/ Gallery <i class=\"fa fa-check\"></i></p>\r\n <p> Customize Video <i class=\"fa fa-check\"></i></p>\r\n <p> 2 Premium Ads a Month <i class=\"fa fa-check\"></i></p>\r\n <p> FaceBook and Instagram LinkOn Monthly Ad <i class=\"fa fa-check\"></i></p>\r\n <p> Complimentary Business Intro Video <i class=\"fa fa-check\"></i></p>"
0debug
theora_header (AVFormatContext * s, int idx) { struct ogg *ogg = s->priv_data; struct ogg_stream *os = ogg->streams + idx; AVStream *st = s->streams[idx]; struct theora_params *thp = os->private; int cds = st->codec->extradata_size + os->psize + 2; uint8_t *cdp; if(!(os->buf[os->pstart] & 0x80)) return 0; if(!thp){ thp = av_mallocz(sizeof(*thp)); os->private = thp; if (os->buf[os->pstart] == 0x80) { GetBitContext gb; int width, height; init_get_bits(&gb, os->buf + os->pstart, os->psize*8); skip_bits_long(&gb, 7*8); thp->version = get_bits_long(&gb, 24); if (thp->version < 0x030100) { av_log(s, AV_LOG_ERROR, "Too old or unsupported Theora (%x)\n", thp->version); return -1; width = get_bits(&gb, 16) << 4; height = get_bits(&gb, 16) << 4; avcodec_set_dimensions(st->codec, width, height); if (thp->version >= 0x030400) skip_bits(&gb, 100); if (thp->version >= 0x030200) { width = get_bits_long(&gb, 24); height = get_bits_long(&gb, 24); if ( width <= st->codec->width && width > st->codec->width-16 && height <= st->codec->height && height > st->codec->height-16) avcodec_set_dimensions(st->codec, width, height); skip_bits(&gb, 16); st->codec->time_base.den = get_bits_long(&gb, 32); st->codec->time_base.num = get_bits_long(&gb, 32); st->time_base = st->codec->time_base; st->sample_aspect_ratio.num = get_bits_long(&gb, 24); st->sample_aspect_ratio.den = get_bits_long(&gb, 24); if (thp->version >= 0x030200) skip_bits_long(&gb, 38); if (thp->version >= 0x304000) skip_bits(&gb, 2); thp->gpshift = get_bits(&gb, 5); thp->gpmask = (1 << thp->gpshift) - 1; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_THEORA; } else if (os->buf[os->pstart] == 0x83) { vorbis_comment (s, os->buf + os->pstart + 7, os->psize - 8); st->codec->extradata = av_realloc (st->codec->extradata, cds + FF_INPUT_BUFFER_PADDING_SIZE); cdp = st->codec->extradata + st->codec->extradata_size; *cdp++ = os->psize >> 8; *cdp++ = os->psize & 0xff; memcpy (cdp, os->buf + os->pstart, os->psize); st->codec->extradata_size = cds; return 1;
1threat
static int cuvid_test_dummy_decoder(AVCodecContext *avctx, const CUVIDPARSERPARAMS *cuparseinfo, int probed_width, int probed_height) { CuvidContext *ctx = avctx->priv_data; CUVIDDECODECREATEINFO cuinfo; CUvideodecoder cudec = 0; int ret = 0; memset(&cuinfo, 0, sizeof(cuinfo)); cuinfo.CodecType = cuparseinfo->CodecType; cuinfo.ChromaFormat = cudaVideoChromaFormat_420; cuinfo.OutputFormat = cudaVideoSurfaceFormat_NV12; cuinfo.ulWidth = probed_width; cuinfo.ulHeight = probed_height; cuinfo.ulTargetWidth = cuinfo.ulWidth; cuinfo.ulTargetHeight = cuinfo.ulHeight; cuinfo.target_rect.left = 0; cuinfo.target_rect.top = 0; cuinfo.target_rect.right = cuinfo.ulWidth; cuinfo.target_rect.bottom = cuinfo.ulHeight; cuinfo.ulNumDecodeSurfaces = ctx->nb_surfaces; cuinfo.ulNumOutputSurfaces = 1; cuinfo.ulCreationFlags = cudaVideoCreate_PreferCUVID; cuinfo.bitDepthMinus8 = 0; cuinfo.DeinterlaceMode = cudaVideoDeinterlaceMode_Weave; ret = CHECK_CU(ctx->cvdl->cuvidCreateDecoder(&cudec, &cuinfo)); if (ret < 0) return ret; ret = CHECK_CU(ctx->cvdl->cuvidDestroyDecoder(cudec)); if (ret < 0) return ret; return 0; }
1threat
function simple in python : if n is 3, then the sequence ATATATATAG contains 4x ATA, 3x TAT and 1x TAG. The proportion is thus 4/8=0.5. The higher this number, the more repetitive the sequence. Write a function simple(s,n) where s is a sequence and n is the length of the n-gram to consider. The function will return the proportion described above. could someone help me with this please.
0debug
static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) { AVFilterLink *outlink = inlink->dst->outputs[0]; AVFilterBufferRef *outpicref = NULL; int ret = 0; if (inpicref->perms & AV_PERM_PRESERVE) { outpicref = ff_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); if (!outpicref) return AVERROR(ENOMEM); avfilter_copy_buffer_ref_props(outpicref, inpicref); outpicref->video->w = outlink->w; outpicref->video->h = outlink->h; } else { outpicref = avfilter_ref_buffer(inpicref, ~0); if (!outpicref) return AVERROR(ENOMEM); } ret = ff_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0)); if (ret < 0) { avfilter_unref_bufferp(&outpicref); return ret; } outlink->out_buf = outpicref; return 0; }
1threat
simple calculator that shows the different between 2 numbers in C# : <p>first of all sorry for my broken language. i would like to create a calculator that shows the different between 2 numbers in C# i tried to make it but i always end up with adding the textbox 1 to the textbox 2 and displaying the total in text box 3, which i don't want to do please see the GUI , it's simple i also would like to make the number in green color if the different is positive and red if the different is negative. see the picture thanks! <a href="https://i.stack.imgur.com/Ziw26.png" rel="nofollow noreferrer">simple gui</a></p>
0debug
How to specify wildcard artifacts subdirectories in .gitlab-ci.yml? : <p>I'm using GitLab CI to build a C# solution and try to pass some build artifacts from one build stage to another.</p> <p>The problem is, that the artifacts are not located in a single directory but in different subdirectories, which however all have the same names <code>bin/</code> or <code>obj/</code>.</p> <p>My <code>.gitlab-ci.yml</code> looks like the following:</p> <pre><code>... stages: - build - test build: stage: build script: CALL %MSBuild% ... artifacts: paths: - /**/bin/ - /**/obj/ expire_in: 6 hrs test: stage: test dependencies: - build ... </code></pre> <p>I tried to capture the artifacts using different ways, e.g.</p> <pre><code>**/bin/ **/obj/ </code></pre> <p>(invalid syntax), or</p> <pre><code>.*/bin/ .*/obj/ </code></pre> <p>but that one did not find any artifacts, just as <code>/**/bin/</code> and <code>/**/obj/</code>, giving me following errors:</p> <pre><code>Uploading artifacts... WARNING: /**/bin/: no matching files WARNING: /**/obj/: no matching files </code></pre> <p><strong>How can I specify a subdirectory pattern to be scanned for artifacts? Or is this even possible at all?</strong></p> <p>Simply using</p> <pre><code>artifacts: untracked: true </code></pre> <p>is not an option, because of a huge untracked <code>packages/</code> subdirectory, which causes artifacts upload to fail because of a too large archive:</p> <pre><code>Uploading artifacts... untracked: found 4513 files ERROR: Uploading artifacts to coordinator... too large archive id=36 responseStatus=413 Request Entity Too Large token=... FATAL: Too large </code></pre>
0debug
main function in c with arguments that are defined as definitions : i am currently trying to get arguments from the command line to my main function in c. my program is as follows. #include <stdio.h> #include <stdlib.h> #define BANK1 (0X00100) #define BANK2 (0x11010) . . #define BANKN (0xNNNNN) int write_to_bank(int bank, int value); int main(int argc, char **argv) { int a,v; a=strtol(argv[2],NULL,0); v=strtol(argv[3],NULL,0); write_to_bank(a,v); } int write_to_bank(int bank, int value){ // some relevant code } if i pass the arguments as follows the integers are correctly parsed to the function ./main 0x00100 0x20 but when i try to pass the arguments to my main function in the following way i am not actually parsing the right bank value ./main BANK1 0x30 Is there any way i could pass the definition as an argument to my main functuion where c automatically translates the definition to the corresponding value and parses to the function argument. -A.R
0debug
how to implement calling oracle DB operation large number of times : <p>I am writing a report generation program in Java, with oracle DB. I have a stored procedure, that will retrieve one value at a time. From my Java Program I am calling the procedure repeatedly. In extreme case, I have to call the procedure <strong>60,000 times</strong>. But it shows problems like, wrong value is returned after a specified calls (like 300 calls). kindly tell me how to sort out this. Thanks. </p>
0debug
I tried and find ways to solve it but this keeps coming out. : java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ebookshop?useSSL=false at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at project.QueryServlet.doGet(QueryServlet.java:24) at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)
0debug
Materialize css- Is it possibe to CENTER the navbar : I am using Materialize. My site has Navigation centered on top and the site Logo below that. Please see image: [Webpage layout][1] [1]: http://i.stack.imgur.com/VG5wg.png I tried a lot but couldnt center it. Kindly let me know how it is possible.. Thanks a lot.
0debug
How to Save, View & Delete images from sqlite in Android studio? : <p>I am making a note taker android app using android studio for my school project. What it can currently do is save, view, edit &amp; delete text notes. And i used sqlite.</p> <p>But I need one more feature to add, which is saving photos as notes. The user can use the camera or phone gallery to save images, then saves it for viewing or to delete it later.</p> <p>Can you guys help me out?</p>
0debug
Type Properties In Swift : <p>I am unable to get what is 'Type Properties' defined in Swift. I follow below link but unable to get what is exactly. </p> <p><a href="https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Properties.html#//apple_ref/doc/uid/TP40014097-CH14-ID254" rel="nofollow noreferrer">Type Properties</a></p> <p>I am curious what is the need of Type properties &amp; where we can use them in our code.</p>
0debug
2 tabstop or 4 tabstop for Python : <p>I am currently using 4 space tabstops in Vim. A work colleague says i should have it as 2 and not to indent 4 spaces in Python. I understand why 2 spaces is better, but PEP8 says to have 4 spaces. What is the better practise?</p> <p>(I could set my tabstop to 2 and then tab twice)</p>
0debug
How to make such database record in php mysql such that A inform B,B inform C,and C inform D such that when I look at who A answer should be B,C,D? : <p>How to make such database record in php mysql such that A inform B,B inform C,and C inform D such that when I look at who A answer should be B,C,D?</p>
0debug
Markdown: Reference to section from another file : <p>I have two markdown files: a <code>parent.md</code> and a <code>child.md</code>.</p> <p>So <code>parent.md</code>:</p> <pre><code># Main section ## sub-section </code></pre> <p>I'd like to make reference to <code>## sub-section</code> from <code>child.md</code>.</p> <p>Any ideas?</p>
0debug
void ppc_hash64_stop_access(uint64_t token) { if (kvmppc_kern_htab) { kvmppc_hash64_free_pteg(token); } }
1threat
I want to open a new window/tab with POST Data, but it's not working : <p>Here is one of the calls that is generated via PHP:</p> <pre><code> &lt;script&gt; var copyrecipient = []; var customhintcopy = []; copyrecipient.push('customer'); copyrecipient.push('healthinsurance'); customhintcopy.push('4'); customhintcopy.push('6'); $.ajax({ type: "POST", url: "./content/pdf-view-bill.php", data: { bills: '6', copyrecipient:copyrecipient, customhintcopy:customhintcopy, additionaltextcopy: '', copycoveringnotes: '5', documentationcopy: '1', original: '1' } success: function(data){ var win = window.open(); win.document.write(data); } })&lt;/script&gt; </code></pre> <p>The console throws "Uncaught SyntaxError: Unexpected identifier" on the "success-line", and i have no idea why. What i want is a new window or tab to open, that gets sent the data i have defined above. Anyone can help me? I'm pretty new to Ajax...</p>
0debug
Please help describe what kind of file I'm dealing with and how to dump this into a mysql table : I'm downloading this file from an FTP server and when I open it in VIM it looks like this: [![enter image description here][1]][1] [![enter image description here][2]][2] When I do open this in notepad++, I see this(looks normal): [![enter image description here][4]][4] So I tried to see what encoding this file is in and saw that it's in [![enter image description here][5]][5] Now the problem is that after downloading the file from the FTP I need to dump this file into a temp table. How can I safely dump this into my table which is in utf8? When I do the import to my mysql table it looks like the one below with a space in between the characters: [![enter image description here][6]][6] [1]: http://i.stack.imgur.com/bs273.png [2]: http://i.stack.imgur.com/oDmxP.png [3]: http://i.stack.imgur.com/Ve7xn.png [4]: http://i.stack.imgur.com/vYgkJ.png [5]: http://i.stack.imgur.com/GmgRS.png [6]: http://i.stack.imgur.com/3fpfj.png
0debug
static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc) { int addr_reg, r0, r1, rbase, data_reg, mem_index, bswap; #ifdef CONFIG_SOFTMMU int r2; void *label1_ptr, *label2_ptr; #endif data_reg = *args++; addr_reg = *args++; mem_index = *args; #ifdef CONFIG_SOFTMMU r0 = 3; r1 = 4; r2 = 0; rbase = 0; tcg_out_tlb_read (s, r0, r1, r2, addr_reg, opc, offsetof (CPUState, tlb_table[mem_index][0].addr_write)); tcg_out32 (s, CMP | BF (7) | RA (r2) | RB (r1) | CMP_L); label1_ptr = s->code_ptr; #ifdef FAST_PATH tcg_out32 (s, BC | BI (7, CR_EQ) | BO_COND_TRUE); #endif tcg_out_mov (s, 3, addr_reg); tcg_out_rld (s, RLDICL, 4, data_reg, 0, 64 - (1 << (3 + opc))); tcg_out_movi (s, TCG_TYPE_I64, 5, mem_index); tcg_out_call (s, (tcg_target_long) qemu_st_helpers[opc], 1); label2_ptr = s->code_ptr; tcg_out32 (s, B); #ifdef FAST_PATH reloc_pc14 (label1_ptr, (tcg_target_long) s->code_ptr); #endif tcg_out32 (s, (LD_ADDEND | RT (r0) | RA (r0) | (offsetof (CPUTLBEntry, addend) - offsetof (CPUTLBEntry, addr_write)) )); tcg_out32 (s, ADD | RT (r0) | RA (r0) | RB (addr_reg)); #else #if TARGET_LONG_BITS == 32 tcg_out_rld (s, RLDICL, addr_reg, addr_reg, 0, 32); #endif r1 = 3; r0 = addr_reg; 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, STWBRX | SAB (data_reg, rbase, r0)); tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4); tcg_out_rld (s, RLDICL, 0, data_reg, 32, 0); tcg_out32 (s, STWBRX | SAB (0, rbase, r1)); } else tcg_out32 (s, STDX | SAB (data_reg, rbase, r0)); break; } #ifdef CONFIG_SOFTMMU reloc_pc24 (label2_ptr, (tcg_target_long) s->code_ptr); #endif }
1threat
get the maximum value of the associative array in php : <p>I have the following array</p> <pre><code>Array ( [anger] =&gt; 0 [disgust] =&gt; 20 [fear] =&gt; 0 [joy] =&gt; 22.853 [sadness] =&gt; 0 [surprise] =&gt; 0 ) Array ( [anger] =&gt; 0 [disgust] =&gt; 20 [fear] =&gt; 0 [joy] =&gt; 22.853 [sadness] =&gt; 0 [surprise] =&gt; 0 ) </code></pre> <p>I want to get key of the maximum value from the array that is joy from the above array. Thank you for helping in advance.</p>
0debug