problem
stringlengths
26
131k
labels
class label
2 classes
Enable CORS at Visual Studio Code : <p>I´m unable to start debugger on Visual Studio Code and also CORS extension on chrome, it simply does not appears as when I console yarn start.</p> <p>Is it any way to specify that I want CORS extension enabled on Chrome when debugging?</p> <p>This is my launch.json:</p> <pre><code>{ "version": "0.2.0", "configurations": [ { "name": "Chrome", "type": "chrome", "request": "launch", "url": "http://localhost:3000", "webRoot": "${workspaceRoot}/src" } ] } </code></pre>
0debug
void cpu_reset (CPUCRISState *env) { memset(env, 0, offsetof(CPUCRISState, breakpoints)); tlb_flush(env, 1); env->pregs[PR_VR] = 32; #if defined(CONFIG_USER_ONLY) env->pregs[PR_CCS] |= U_FLAG | I_FLAG; #else env->pregs[PR_CCS] = 0; #endif
1threat
Are badblocks related to a partition or permanent? : <p>I ran a check on a partition :</p> <pre><code>sudo e2fsck -c /dev/sdb3 </code></pre> <p>It found some bad blocks. As far as I understood, it marked the badblocks, so that no files will use them.</p> <p>My question is : is that "marking" persistent or is it linked to the partition ? More specifically, if I reformat the partition with something like</p> <pre><code>sudo mkfs.ext4 /dev/sdb3 </code></pre> <p>are the badblocks still marked ?</p>
0debug
How to pass parameters to on:click in Svelte? : <p>Binding a function to a button is easy and straightforward:</p> <pre><code>&lt;button on:click={handleClick}&gt; Clicks are handled by the handleClick function! &lt;/button&gt; </code></pre> <p>But I don't see a way to pass parameters (arguments) to the function, when I do this:</p> <pre><code>&lt;button on:click={handleClick("parameter1")}&gt; Oh no! &lt;/button&gt; </code></pre> <p>The function is called on page load, and never again.</p> <p>Is it possible at all to pass parameters to function called from <code>on:click{}</code>?</p> <p><hr> <strong>EDIT:</strong></p> <p>I just found a hacky way to do it. Calling the function from an inline handler works.</p> <pre><code>&lt;button on:click={() =&gt; handleClick("parameter1")}&gt; It works... &lt;/button&gt; </code></pre>
0debug
cant resolve method getInputStream() : i am creating app in anroidstudio i implemeted a method but getting error: cant resolve method "getInputStream" BufferedReader in = new BufferedReader( new InputStreamReader(clienSocket.getInputStream())); .getInputStream() method not resolving
0debug
PHP | How to get headers from GET Request? : <p>I want to display the received headers from the GET Request that I send,</p> <p>PHP:</p> <pre><code>&lt;?php $opts = array( 'http'=&gt;array( 'method'=&gt;"GET", 'header'=&gt;"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0" )); $context = stream_context_create($opts); $url = "http://spys.me/proxy.txt"; // instead of file_get_contents $data = getallheaders($url, false, $context); echo $data; </code></pre>
0debug
C#: Modifying the list : <p>I'm having a table(date is in mm/dd/yyyy format): </p> <pre><code>FromID ToID FromDate ToDate S1 S2 1/1/2016 1/15/2016 S2 S3 2/1/2016 3/14/2016 S1 S2 1/5/2016 1/20/2016 S2 S3 1/25/2016 2/25/2016 S1 S2 1/21/2016 1/25/2016 </code></pre> <p>I need to combine the rows such that the overlapping dates of the repeating fromId and ToId. For eg, for this table, the output should be:</p> <pre><code>FromID ToID FromDate ToDate S1 S2 1/1/2016 1/25/2016 S2 S3 1/25/2016 3/14/2016 </code></pre> <p>I have tried the following C# code to do it but it won't work.</p> <pre><code> public class MergeLists { static void Main(String[] args) { List&lt;ItemDetails&gt; theTempList = new List&lt;ItemDetails&gt;(); List&lt;ItemDetails&gt; theOriList = new List&lt;ItemDetails&gt;(); DateTime minDate = new DateTime(2016, 1, 1); DateTime maxDate = new DateTime(2016, 1, 1); int count; theOriList.Add(new ItemDetails("S1","S2", new DateTime(2016,1,1), new DateTime(2016,1,15))); theOriList.Add(new ItemDetails("S2", "S3", new DateTime(2016, 2, 1), new DateTime(2016, 2, 14))); theOriList.Add(new ItemDetails("S1", "S2", new DateTime(2016, 1, 5), new DateTime(2016, 1, 20))); theOriList.Add(new ItemDetails("S2", "S3", new DateTime(2016, 1, 25), new DateTime(2016, 2, 25))); theOriList.Add(new ItemDetails("S1", "S2", new DateTime(2016, 1, 21), new DateTime(2016, 1, 25))); theOriList = theOriList.OrderBy(x =&gt; x.fromId).ThenBy(x=&gt; x.toId).ToList(); int addnew = 0; for (int i = 0; i &lt; theOriList.Count; i++) { for (int j = i + 1; j &lt; theOriList.Count; j++) { if ((theOriList[i].fromId == theOriList[j].fromId) &amp;&amp; (theOriList[i].toId == theOriList[j].toId)) { if ((theOriList[i].fromDate &lt;= theOriList[j].fromDate) &amp;&amp; (theOriList[j].fromDate &lt;= theOriList[i].toDate)) { if (theOriList[j].toDate &gt; theOriList[i].toDate) { maxDate = theOriList[j].toDate; minDate = theOriList[i].fromDate; } else if (theOriList[j].toDate &lt; theOriList[i].toDate) { maxDate = theOriList[i].toDate; minDate = theOriList[i].fromDate; } } else if (theOriList[i].fromDate &gt; theOriList[j].fromDate) { if (theOriList[i].toDate &lt;= theOriList[j].toDate) { maxDate = theOriList[j].toDate; minDate = theOriList[j].fromDate; } else if (theOriList[i].toDate &gt; theOriList[j].toDate) { maxDate = theOriList[i].toDate; minDate = theOriList[j].fromDate; } } else if ((theOriList[j].fromDate &gt; theOriList[i].toDate)) { //Add directly addnew = 1; } } } if (addnew != 1) { theTempList.Add(new ItemDetails(theOriList[i].fromId, theOriList[i].toId, minDate, maxDate)); } else if (addnew == 1) theTempList.Add(new ItemDetails(theOriList[i].fromId, theOriList[i].toId, theOriList[i].fromDate, theOriList[i].toDate)); } theTempList = theTempList.OrderBy(x =&gt; x.fromId).ThenBy(x =&gt; x.toId).ToList(); foreach (ItemDetails x in theTempList) { Console.WriteLine("FromId: " + x.fromId + "\tToId: " + x.toId + "\tFromDate:" + x.fromDate + "\tToDate:" + x.toDate); } Console.ReadKey(); } } </code></pre>
0debug
static int coroutine_fn bdrv_co_do_pwrite_zeroes(BlockDriverState *bs, int64_t offset, int bytes, BdrvRequestFlags flags) { BlockDriver *drv = bs->drv; QEMUIOVector qiov; struct iovec iov = {0}; int ret = 0; bool need_flush = false; int head = 0; int tail = 0; int max_write_zeroes = MIN_NON_ZERO(bs->bl.max_pwrite_zeroes, INT_MAX); int alignment = MAX(bs->bl.pwrite_zeroes_alignment, bs->bl.request_alignment); int max_transfer = MIN_NON_ZERO(bs->bl.max_transfer, MAX_BOUNCE_BUFFER); assert(alignment % bs->bl.request_alignment == 0); head = offset % alignment; tail = (offset + bytes) % alignment; max_write_zeroes = QEMU_ALIGN_DOWN(max_write_zeroes, alignment); assert(max_write_zeroes >= bs->bl.request_alignment); while (bytes > 0 && !ret) { int num = bytes; if (head) { num = MIN(MIN(bytes, max_transfer), alignment - head); head = (head + num) % alignment; assert(num < max_write_zeroes); } else if (tail && num > alignment) { num -= tail; if (num > max_write_zeroes) { num = max_write_zeroes; ret = -ENOTSUP; if (drv->bdrv_co_pwrite_zeroes) { ret = drv->bdrv_co_pwrite_zeroes(bs, offset, num, flags & bs->supported_zero_flags); if (ret != -ENOTSUP && (flags & BDRV_REQ_FUA) && !(bs->supported_zero_flags & BDRV_REQ_FUA)) { need_flush = true; } else { assert(!bs->supported_zero_flags); if (ret == -ENOTSUP) { BdrvRequestFlags write_flags = flags & ~BDRV_REQ_ZERO_WRITE; if ((flags & BDRV_REQ_FUA) && !(bs->supported_write_flags & BDRV_REQ_FUA)) { write_flags &= ~BDRV_REQ_FUA; need_flush = true; num = MIN(num, max_transfer); iov.iov_len = num; if (iov.iov_base == NULL) { iov.iov_base = qemu_try_blockalign(bs, num); if (iov.iov_base == NULL) { ret = -ENOMEM; goto fail; memset(iov.iov_base, 0, num); qemu_iovec_init_external(&qiov, &iov, 1); ret = bdrv_driver_pwritev(bs, offset, num, &qiov, write_flags); if (num < max_transfer) { qemu_vfree(iov.iov_base); iov.iov_base = NULL; offset += num; bytes -= num; fail: if (ret == 0 && need_flush) { ret = bdrv_co_flush(bs); qemu_vfree(iov.iov_base); return ret;
1threat
Unexpected end tag (HTML ERROR) : <p>I've just started working with html and javascript, and in my index.html file I'm getting an error for the closing head tag and opening body tag. The error says "Unexpected end/start tag (ignored)". As far as I can tell, everything in the html file is opened and closed correctly, and in the right order. Below is a picture of my code for reference. <a href="http://i.stack.imgur.com/HuJhF.png" rel="nofollow">html code</a></p>
0debug
int ff_request_frame(AVFilterLink *link) { int ret = -1; FF_TPRINTF_START(NULL, request_frame); ff_tlog_link(NULL, link, 1); if (link->closed) return AVERROR_EOF; av_assert0(!link->frame_requested); link->frame_requested = 1; while (link->frame_requested) { if (link->srcpad->request_frame) ret = link->srcpad->request_frame(link); else if (link->src->inputs[0]) ret = ff_request_frame(link->src->inputs[0]); if (ret == AVERROR_EOF && link->partial_buf) { AVFrame *pbuf = link->partial_buf; link->partial_buf = NULL; ret = ff_filter_frame_framed(link, pbuf); } if (ret < 0) { link->frame_requested = 0; if (ret == AVERROR_EOF) link->closed = 1; } else { av_assert0(!link->frame_requested || link->flags & FF_LINK_FLAG_REQUEST_LOOP); } } return ret; }
1threat
static inline uint32_t efsctuiz(uint32_t val) { CPU_FloatU u; u.l = val; if (unlikely(float32_is_nan(u.f))) return 0; return float32_to_uint32_round_to_zero(u.f, &env->vec_status); }
1threat
HTML True or false in editor? : <p>I'm creating a helpful HTML template and would like to do something where you can toggle tags on and off.</p> <p>I would like to make it simple like ="true" where you change true or false to whatever you want.</p> <p>Is there a way i could do this within one html file?</p>
0debug
static always_inline void mpeg_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int field_based, int bottom_field, int field_select, uint8_t **ref_picture, op_pixels_func (*pix_op)[4], int motion_x, int motion_y, int h) { uint8_t *ptr_y, *ptr_cb, *ptr_cr; int dxy, uvdxy, mx, my, src_x, src_y, uvsrc_x, uvsrc_y, v_edge_pos, uvlinesize, linesize; #if 0 if(s->quarter_sample) { motion_x>>=1; motion_y>>=1; #endif v_edge_pos = s->v_edge_pos >> field_based; linesize = s->current_picture.linesize[0] << field_based; uvlinesize = s->current_picture.linesize[1] << field_based; dxy = ((motion_y & 1) << 1) | (motion_x & 1); src_x = s->mb_x* 16 + (motion_x >> 1); src_y =(s->mb_y<<(4-field_based)) + (motion_y >> 1); if (s->out_format == FMT_H263) { if((s->workaround_bugs & FF_BUG_HPEL_CHROMA) && field_based){ mx = (motion_x>>1)|(motion_x&1); my = motion_y >>1; uvdxy = ((my & 1) << 1) | (mx & 1); uvsrc_x = s->mb_x* 8 + (mx >> 1); uvsrc_y = (s->mb_y<<(3-field_based)) + (my >> 1); }else{ uvdxy = dxy | (motion_y & 2) | ((motion_x & 2) >> 1); uvsrc_x = src_x>>1; uvsrc_y = src_y>>1; }else if(s->out_format == FMT_H261){ mx = motion_x / 4; my = motion_y / 4; uvdxy = 0; uvsrc_x = s->mb_x*8 + mx; uvsrc_y = s->mb_y*8 + my; } else { if(s->chroma_y_shift){ mx = motion_x / 2; my = motion_y / 2; uvdxy = ((my & 1) << 1) | (mx & 1); uvsrc_x = s->mb_x* 8 + (mx >> 1); uvsrc_y = (s->mb_y<<(3-field_based)) + (my >> 1); } else { if(s->chroma_x_shift){ mx = motion_x / 2; uvdxy = ((motion_y & 1) << 1) | (mx & 1); uvsrc_x = s->mb_x* 8 + (mx >> 1); uvsrc_y = src_y; } else { uvdxy = dxy; uvsrc_x = src_x; uvsrc_y = src_y; ptr_y = ref_picture[0] + src_y * linesize + src_x; ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x; ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x; if( (unsigned)src_x > s->h_edge_pos - (motion_x&1) - 16 || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){ if(s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MPEG1VIDEO){ av_log(s->avctx,AV_LOG_DEBUG,"MPEG motion vector out of boundary\n"); return ; ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos); ptr_y = s->edge_emu_buffer; if(!(s->flags&CODEC_FLAG_GRAY)){ uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize; ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1); ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1); ptr_cb= uvbuf; ptr_cr= uvbuf+16; if(bottom_field){ dest_y += s->linesize; dest_cb+= s->uvlinesize; dest_cr+= s->uvlinesize; if(field_select){ ptr_y += s->linesize; ptr_cb+= s->uvlinesize; ptr_cr+= s->uvlinesize; pix_op[0][dxy](dest_y, ptr_y, linesize, h); if(!(s->flags&CODEC_FLAG_GRAY)){ pix_op[s->chroma_x_shift][uvdxy](dest_cb, ptr_cb, uvlinesize, h >> s->chroma_y_shift); pix_op[s->chroma_x_shift][uvdxy](dest_cr, ptr_cr, uvlinesize, h >> s->chroma_y_shift);
1threat
FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name) { JNIEnv *env = NULL; FFAMediaCodec *codec = NULL; jstring codec_name = NULL; codec = av_mallocz(sizeof(FFAMediaCodec)); if (!codec) { return NULL; } codec->class = &amediacodec_class; env = ff_jni_get_env(codec); if (!env) { av_freep(&codec); return NULL; } if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) { goto fail; } codec_name = ff_jni_utf_chars_to_jstring(env, name, codec); if (!codec_name) { goto fail; } codec->object = (*env)->CallStaticObjectMethod(env, codec->jfields.mediacodec_class, codec->jfields.create_by_codec_name_id, codec_name); if (ff_jni_exception_check(env, 1, codec) < 0) { goto fail; } codec->object = (*env)->NewGlobalRef(env, codec->object); if (!codec->object) { goto fail; } if (codec_init_static_fields(codec) < 0) { goto fail; } if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) { codec->has_get_i_o_buffer = 1; } return codec; fail: ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); if (codec_name) { (*env)->DeleteLocalRef(env, codec_name); } av_freep(&codec); return NULL; }
1threat
static int adx_read_packet(AVFormatContext *s, AVPacket *pkt) { ADXDemuxerContext *c = s->priv_data; AVCodecContext *avctx = s->streams[0]->codec; int ret, size; size = BLOCK_SIZE * avctx->channels; pkt->pos = avio_tell(s->pb); pkt->stream_index = 0; ret = av_get_packet(s->pb, pkt, size); if (ret != size) { av_free_packet(pkt); return ret < 0 ? ret : AVERROR(EIO); if (AV_RB16(pkt->data) & 0x8000) { av_free_packet(pkt); return AVERROR_EOF; pkt->size = size; pkt->duration = 1; pkt->pts = (pkt->pos - c->header_size) / size; return 0;
1threat
Remove character from a string until a special character python : I have a string like this. config =\ {"status":"None", "numbers":["123", "123", "123"], "schedule":None, "data":{ "x": "y" } } I would like to remove the config=\ from the string and get a result like this. {"status":"None", "numbers":["123", "123", "123"], "schedule":None, "data":{ "x": "y" } } How can I get this using python regex? Would like to consider the multiline factor as well!!
0debug
static Visitor *visitor_input_test_init_raw(TestInputVisitorData *data, const char *json_string) { Visitor *v; data->obj = qobject_from_json(json_string); g_assert(data->obj != NULL); data->qiv = qmp_input_visitor_new(data->obj); g_assert(data->qiv != NULL); v = qmp_input_get_visitor(data->qiv); g_assert(v != NULL); return v; }
1threat
Angular-cli ng serve livereload not working : <p>I have created a sample project wiht Ng-cli, then i run ng serve in the source folder, the project loads correctly in the browser but livereload not working.</p> <p>npm -v : 3.10.9</p> <p>ng -v: angular-cli: 1.0.0-beta.19-3 node: 4.4.3 os: win32 x64</p> <p>Already searched a lot information on internet, and nothing solved the issue.</p>
0debug
Exception occurred when creating MZContentProviderUpload for provider. (1004) : <p>I tried to upload the app build using Xcode but I got this error <strong>"no accounts with itunes connect access"</strong> I then tried to upload the IPA using application loader and I got this error <strong>"Exception occurred when creating MZContentProviderUpload for provider. (1004)"</strong></p>
0debug
static inline uint16_t vring_avail_flags(VirtQueue *vq) { VRingMemoryRegionCaches *caches = atomic_rcu_read(&vq->vring.caches); hwaddr pa = offsetof(VRingAvail, flags); return virtio_lduw_phys_cached(vq->vdev, &caches->avail, pa); }
1threat
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
Can we run any user defined function before the main function? : <p>I want to run a user defined function before the main function in C. But I don't know how to do that. Is that possible?</p>
0debug
How to put space between switch button and its text in android? : <p>I have the following element:</p> <pre><code>&lt;Switch android:text="Data about client?" android:id="@+id/connected" /&gt; </code></pre> <p>But on designer the switch button and its text "Data about client?" are very glued together. I tried putting space between ? and " like that :</p> <pre><code>android:text="Data about client? " </code></pre> <p>But I don't like that type of solution very much</p>
0debug
How does Keras handle multilabel classification? : <p>I am unsure how to interpret the default behavior of Keras in the following situation:</p> <p>My Y (ground truth) was set up using scikit-learn's <code>MultilabelBinarizer</code>().</p> <p>Therefore, to give a random example, one row of my <code>y</code> column is one-hot encoded as such: <code>[0,0,0,1,0,1,0,0,0,0,1]</code>.</p> <p>So I have 11 classes that could be predicted, and more than one can be true; hence the multilabel nature of the problem. There are three labels for this particular sample.</p> <p>I train the model as I would for a non multilabel problem (business as usual) and I get no errors.</p> <pre><code>from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.optimizers import SGD model = Sequential() model.add(Dense(5000, activation='relu', input_dim=X_train.shape[1])) model.add(Dropout(0.1)) model.add(Dense(600, activation='relu')) model.add(Dropout(0.1)) model.add(Dense(y_train.shape[1], activation='softmax')) sgd = SGD(lr=0.01, decay=1e-6, momentum=0.9, nesterov=True) model.compile(loss='categorical_crossentropy', optimizer=sgd, metrics=['accuracy',]) model.fit(X_train, y_train,epochs=5,batch_size=2000) score = model.evaluate(X_test, y_test, batch_size=2000) score </code></pre> <p>What does Keras do when it encounters my <code>y_train</code> and sees that it is "multi" one-hot encoded, meaning there is more than one 'one' present in each row of <code>y_train</code>? Basically, does Keras automatically perform multilabel classification? Any differences in the interpretation of the scoring metrics?</p>
0debug
Enocuntered - "raise HTTPError(req.get_full_url(), code, msg, hdrs, fp) urllib2.HTTPError: HTTP Error 403: Forbidden" : import urllib2 import BeautifulSoup request = urllib2.Request("https://adexchanger.com/searchresults/?q=digital%20marketing") response = urllib2.urlopen(request) soup = BeautifulSoup.BeautifulSoup(response) for a in soup.findAll('a'): if 'digital marketing' in a['href']: print a
0debug
static uint32_t virtio_blk_get_features(VirtIODevice *vdev, uint32_t features) { VirtIOBlock *s = to_virtio_blk(vdev); features |= (1 << VIRTIO_BLK_F_SEG_MAX); features |= (1 << VIRTIO_BLK_F_GEOMETRY); features |= (1 << VIRTIO_BLK_F_TOPOLOGY); features |= (1 << VIRTIO_BLK_F_BLK_SIZE); features |= (1 << VIRTIO_BLK_F_SCSI); features |= (1 << VIRTIO_BLK_F_CONFIG_WCE); if (bdrv_enable_write_cache(s->bs)) features |= (1 << VIRTIO_BLK_F_WCE); if (bdrv_is_read_only(s->bs)) features |= 1 << VIRTIO_BLK_F_RO; return features; }
1threat
How to get button groups that span the full width of a parent in Bootstrap? : <p>In Bootstrap, how can I get a button group like the following that span the full width of a parent element? (like with the ".btn-block" class, but applied to a group <a href="http://getbootstrap.com/css/#buttons-sizes" rel="noreferrer">http://getbootstrap.com/css/#buttons-sizes</a> )</p> <pre><code>&lt;div class="btn-group" role="group" aria-label="..."&gt; &lt;button type="button" class="btn btn-default"&gt;Left&lt;/button&gt; &lt;button type="button" class="btn btn-default"&gt;Middle&lt;/button&gt; &lt;button type="button" class="btn btn-default"&gt;Right&lt;/button&gt; &lt;/div&gt; </code></pre>
0debug
static int64_t wrap_timestamp(AVStream *st, int64_t timestamp) { if (st->pts_wrap_behavior != AV_PTS_WRAP_IGNORE && st->pts_wrap_bits < 64 && st->pts_wrap_reference != AV_NOPTS_VALUE && timestamp != AV_NOPTS_VALUE) { if (st->pts_wrap_behavior == AV_PTS_WRAP_ADD_OFFSET && timestamp < st->pts_wrap_reference) return timestamp + (1LL<<st->pts_wrap_bits); else if (st->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET && timestamp >= st->pts_wrap_reference) return timestamp - (1LL<<st->pts_wrap_bits); } return timestamp; }
1threat
DISAS_INSN(shift_im) { TCGv reg; int tmp; TCGv shift; set_cc_op(s, CC_OP_FLAGS); reg = DREG(insn, 0); tmp = (insn >> 9) & 7; if (tmp == 0) tmp = 8; shift = tcg_const_i32(tmp); if (insn & 0x100) { gen_helper_shl_cc(reg, cpu_env, reg, shift); } else { if (insn & 8) { gen_helper_shr_cc(reg, cpu_env, reg, shift); } else { gen_helper_sar_cc(reg, cpu_env, reg, shift); } } }
1threat
void hmp_info_memdev(Monitor *mon, const QDict *qdict) { Error *err = NULL; MemdevList *memdev_list = qmp_query_memdev(&err); MemdevList *m = memdev_list; StringOutputVisitor *ov; char *str; int i = 0; while (m) { ov = string_output_visitor_new(false); visit_type_uint16List(string_output_get_visitor(ov), &m->value->host_nodes, NULL, NULL); monitor_printf(mon, "memory backend: %d\n", i); monitor_printf(mon, " size: %" PRId64 "\n", m->value->size); monitor_printf(mon, " merge: %s\n", m->value->merge ? "true" : "false"); monitor_printf(mon, " dump: %s\n", m->value->dump ? "true" : "false"); monitor_printf(mon, " prealloc: %s\n", m->value->prealloc ? "true" : "false"); monitor_printf(mon, " policy: %s\n", HostMemPolicy_lookup[m->value->policy]); str = string_output_get_string(ov); monitor_printf(mon, " host nodes: %s\n", str); g_free(str); string_output_visitor_cleanup(ov); m = m->next; i++; } monitor_printf(mon, "\n"); }
1threat
Can anyone help me with this loop : <p>I want my loop to count from 1 to 10 and then print to the document 1,2 and so on.</p> <p>I tried to nest a while loop within a for loop but it counts from 1 to 10 and then prints out 10 results</p> <pre><code>for (var i = 0; i &lt;= 10; i++) { var j=0; while(j &lt;=10){ document.write('&lt;br&gt;Number '+j); j++ } } </code></pre>
0debug
timer_write(void *opaque, target_phys_addr_t addr, uint64_t val64, unsigned int size) { struct etrax_timer *t = opaque; uint32_t value = val64; switch (addr) { case RW_TMR0_DIV: t->rw_tmr0_div = value; break; case RW_TMR0_CTRL: D(printf ("RW_TMR0_CTRL=%x\n", value)); t->rw_tmr0_ctrl = value; update_ctrl(t, 0); break; case RW_TMR1_DIV: t->rw_tmr1_div = value; break; case RW_TMR1_CTRL: D(printf ("RW_TMR1_CTRL=%x\n", value)); t->rw_tmr1_ctrl = value; update_ctrl(t, 1); break; case RW_INTR_MASK: D(printf ("RW_INTR_MASK=%x\n", value)); t->rw_intr_mask = value; timer_update_irq(t); break; case RW_WD_CTRL: timer_watchdog_update(t, value); break; case RW_ACK_INTR: t->rw_ack_intr = value; timer_update_irq(t); t->rw_ack_intr = 0; break; default: printf ("%s " TARGET_FMT_plx " %x\n", __func__, addr, value); break; } }
1threat
import re def remove_multiple_spaces(text1): return (re.sub(' +',' ',text1))
0debug
static int ram_load_postcopy(QEMUFile *f) { int flags = 0, ret = 0; bool place_needed = false; bool matching_page_sizes = qemu_host_page_size == TARGET_PAGE_SIZE; MigrationIncomingState *mis = migration_incoming_get_current(); void *postcopy_host_page = postcopy_get_tmp_page(mis); void *last_host = NULL; while (!ret && !(flags & RAM_SAVE_FLAG_EOS)) { ram_addr_t addr; void *host = NULL; void *page_buffer = NULL; void *place_source = NULL; uint8_t ch; bool all_zero = false; addr = qemu_get_be64(f); flags = addr & ~TARGET_PAGE_MASK; addr &= TARGET_PAGE_MASK; trace_ram_load_postcopy_loop((uint64_t)addr, flags); place_needed = false; if (flags & (RAM_SAVE_FLAG_COMPRESS | RAM_SAVE_FLAG_PAGE)) { host = host_from_stream_offset(f, addr, flags); if (!host) { error_report("Illegal RAM offset " RAM_ADDR_FMT, addr); ret = -EINVAL; break; } page_buffer = host; page_buffer = postcopy_host_page + ((uintptr_t)host & ~qemu_host_page_mask); if (!((uintptr_t)host & ~qemu_host_page_mask)) { all_zero = true; } else { if (host != (last_host + TARGET_PAGE_SIZE)) { error_report("Non-sequential target page %p/%p\n", host, last_host); ret = -EINVAL; break; } } place_needed = (((uintptr_t)host + TARGET_PAGE_SIZE) & ~qemu_host_page_mask) == 0; place_source = postcopy_host_page; } switch (flags & ~RAM_SAVE_FLAG_CONTINUE) { case RAM_SAVE_FLAG_COMPRESS: ch = qemu_get_byte(f); memset(page_buffer, ch, TARGET_PAGE_SIZE); if (ch) { all_zero = false; } break; case RAM_SAVE_FLAG_PAGE: all_zero = false; if (!place_needed || !matching_page_sizes) { qemu_get_buffer(f, page_buffer, TARGET_PAGE_SIZE); } else { qemu_get_buffer_in_place(f, (uint8_t **)&place_source, TARGET_PAGE_SIZE); } break; case RAM_SAVE_FLAG_EOS: break; default: error_report("Unknown combination of migration flags: %#x" " (postcopy mode)", flags); ret = -EINVAL; } if (place_needed) { if (all_zero) { ret = postcopy_place_page_zero(mis, host + TARGET_PAGE_SIZE - qemu_host_page_size); } else { ret = postcopy_place_page(mis, host + TARGET_PAGE_SIZE - qemu_host_page_size, place_source); } } if (!ret) { ret = qemu_file_get_error(f); } } return ret; }
1threat
static int qemu_shutdown_requested(void) { return atomic_xchg(&shutdown_requested, 0); }
1threat
static void gen_spr_amr (CPUPPCState *env) { #ifndef CONFIG_USER_ONLY spr_register(env, SPR_UAMR, "UAMR", &spr_read_uamr, &spr_write_uamr_pr, &spr_read_uamr, &spr_write_uamr, 0); spr_register_kvm(env, SPR_AMR, "AMR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, KVM_REG_PPC_AMR, 0xffffffffffffffffULL); spr_register_kvm(env, SPR_UAMOR, "UAMOR", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, KVM_REG_PPC_UAMOR, 0); #endif }
1threat
Can I use chinese iphone for debugging on xcode? : <p>Is there a way to use Chinese iPhone that running ios for debugging on xcode while developing apps instead of apple iphones that more expensive ?</p>
0debug
How to pass ajax sucess result to anather php page : $.ajax({ type: "POST", url : base_url+'front/searchresult', data: data, success: function (data){ alert("testt"); var val = $("#searchresults").html(data); window.location.assign("<?php echo base_url()?>front/search/" +val); } }); IN my above code i want display $("#searchresults").html(data) this result to other page.
0debug
static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg) { Picture *pic = NULL; int64_t pts; int i, display_picture_number = 0, ret; int encoding_delay = s->max_b_frames ? s->max_b_frames : (s->low_delay ? 0 : 1); int flush_offset = 1; int direct = 1; if (pic_arg) { pts = pic_arg->pts; display_picture_number = s->input_picture_number++; if (pts != AV_NOPTS_VALUE) { if (s->user_specified_pts != AV_NOPTS_VALUE) { int64_t last = s->user_specified_pts; if (pts <= last) { av_log(s->avctx, AV_LOG_ERROR, "Invalid pts (%"PRId64") <= last (%"PRId64")\n", pts, last); return AVERROR(EINVAL); } if (!s->low_delay && display_picture_number == 1) s->dts_delta = pts - last; } s->user_specified_pts = pts; } else { if (s->user_specified_pts != AV_NOPTS_VALUE) { s->user_specified_pts = pts = s->user_specified_pts + 1; av_log(s->avctx, AV_LOG_INFO, "Warning: AVFrame.pts=? trying to guess (%"PRId64")\n", pts); } else { pts = display_picture_number; } } if (!pic_arg->buf[0] || pic_arg->linesize[0] != s->linesize || pic_arg->linesize[1] != s->uvlinesize || pic_arg->linesize[2] != s->uvlinesize) direct = 0; if ((s->width & 15) || (s->height & 15)) direct = 0; if (((intptr_t)(pic_arg->data[0])) & (STRIDE_ALIGN-1)) direct = 0; if (s->linesize & (STRIDE_ALIGN-1)) direct = 0; ff_dlog(s->avctx, "%d %d %"PTRDIFF_SPECIFIER" %"PTRDIFF_SPECIFIER"\n", pic_arg->linesize[0], pic_arg->linesize[1], s->linesize, s->uvlinesize); i = ff_find_unused_picture(s->avctx, s->picture, direct); if (i < 0) return i; pic = &s->picture[i]; pic->reference = 3; if (direct) { if ((ret = av_frame_ref(pic->f, pic_arg)) < 0) return ret; } ret = alloc_picture(s, pic, direct); if (ret < 0) return ret; if (!direct) { if (pic->f->data[0] + INPLACE_OFFSET == pic_arg->data[0] && pic->f->data[1] + INPLACE_OFFSET == pic_arg->data[1] && pic->f->data[2] + INPLACE_OFFSET == pic_arg->data[2]) { } else { int h_chroma_shift, v_chroma_shift; av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift); for (i = 0; i < 3; i++) { int src_stride = pic_arg->linesize[i]; int dst_stride = i ? s->uvlinesize : s->linesize; int h_shift = i ? h_chroma_shift : 0; int v_shift = i ? v_chroma_shift : 0; int w = s->width >> h_shift; int h = s->height >> v_shift; uint8_t *src = pic_arg->data[i]; uint8_t *dst = pic->f->data[i]; int vpad = 16; if ( s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence && FFALIGN(s->height, 32) - s->height > 16) vpad = 32; if (!s->avctx->rc_buffer_size) dst += INPLACE_OFFSET; if (src_stride == dst_stride) memcpy(dst, src, src_stride * h); else { int h2 = h; uint8_t *dst2 = dst; while (h2--) { memcpy(dst2, src, w); dst2 += dst_stride; src += src_stride; } } if ((s->width & 15) || (s->height & (vpad-1))) { s->mpvencdsp.draw_edges(dst, dst_stride, w, h, 16 >> h_shift, vpad >> v_shift, EDGE_BOTTOM); } } } } ret = av_frame_copy_props(pic->f, pic_arg); if (ret < 0) return ret; pic->f->display_picture_number = display_picture_number; pic->f->pts = pts; } else { for (flush_offset = 0; flush_offset < encoding_delay + 1; flush_offset++) if (s->input_picture[flush_offset]) break; if (flush_offset <= 1) flush_offset = 1; else encoding_delay = encoding_delay - flush_offset + 1; } for (i = flush_offset; i < MAX_PICTURE_COUNT ; i++) s->input_picture[i - flush_offset] = s->input_picture[i]; s->input_picture[encoding_delay] = (Picture*) pic; return 0; }
1threat
PHP group multidimensional array : <p>I need help with grouping multidimensional PHP array. The array I have is :</p> <pre><code> Array ( [1385] =&gt; Array ( [product_id] =&gt; 1385 [product] =&gt; Tossed salad [category_ids] =&gt; Array ( [0] =&gt; 489 ) ) [1386] =&gt; Array ( [product_id] =&gt; 1386 [product] =&gt; Green salad [category_ids] =&gt; Array ( [0] =&gt; 489 ) ) [1387] =&gt; Array ( [product_id] =&gt; 1387 [product] =&gt; Milk Shake [category_ids] =&gt; Array ( [0] =&gt; 440 ) ) [1388] =&gt; Array ( [product_id] =&gt; 1388 [product] =&gt; Mango Juice [category_ids] =&gt; Array ( [0] =&gt; 440 ) ) [1389] =&gt; Array ( [product_id] =&gt; 1389 [product] =&gt; Orange Juice [category_ids] =&gt; Array ( [0] =&gt; 440 ) ) ) </code></pre> <p>I want to group the array in different way so I can list them categories. Something like this : </p> <pre><code>Array ( [category_ids] =&gt; 489, [products] =&gt; [0] =&gt; Array ( [product_id] =&gt; 1385 [product] =&gt; Tossed salad ) [1] =&gt; Array ( [product_id] =&gt; 1386 [product] =&gt; Green salad ) [category_ids] =&gt; 440, [products] =&gt; [0] =&gt; Array ( [product_id] =&gt; 1387 [product] =&gt; Milk Shake ) [1] =&gt; Array ( [product_id] =&gt; 1388 [product] =&gt; Mango Juice ) [2] =&gt; Array ( [product_id] =&gt; 1389 [product] =&gt; Orange Juice ) ) </code></pre> <p>The structure can be wrong because I just made it with my text editor. But yes I want something like this. List those products under <code>category_ids</code>, sometimes there could be more then one <code>category_ids</code> as well. There many other products fields also, I shorten to make it look less complicated. There are <code>product_price</code>, <code>company_id</code> and some has multidimensional array like <code>product_options</code>.</p>
0debug
Trying to convert from mysqli to pdo : <pre><code>try { $pdo = new PDO("mysql:host=$dbhost;dbname=$dbname", $dbusername, $dbpassword); } catch (PDOException $e){ exit('Datebase error.'); } // db login info is already defined, just didnt post it here $username = $_GET["user"]; $password = $_GET["passwd"]; //$data = mysqli_query($mysqli, "SELECT * FROM users WHERE username='".$username."'"); //$hash = mysqli_fetch_object($data); $query = "SELECT username, password, loginreqkey, banned FROM users WHERE username='$username'"; //if (password_verify('rasmuslerdorf', $hash)) { if ($stmt = $pdo-&gt;prepare($query)) { $stmt-&gt;execute(array($username, $password, $loginreqkey, $banned)); //$stmt-&gt;bind_result($username, $password, $loginreqkey, $gbanned); // $result = $stmt-&gt;fetch(PDO::FETCH_LAZY); //$dt = $stmt-&gt;fetchAll() ; //$query-&gt;execute(array($username, $password)); if (password_verify($password, $result['password'])) { while($r = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC)){ echo "{"; echo '"state": "success",'; echo '"loginreqkey": "' . $r['loginreqkey'] . '",'; echo '"banstatus": "' . $r['banned'] . '"'; echo "}"; } /* close statement */ $stmt = null; } else { die("fake pw lol"); } /* close connection */ $pdo = null; } //} </code></pre> <p>Trying to convert my code from MySQLi to PDO and having issues.. trying to get all the information in query and verify the user password then echo the rest of the information, (for an unreal project) tried a couple of solutions on php documentation and stackoverflow but they were usually just for sending information to the mysql server.</p>
0debug
how to install apt-cyg for Cygwin? : <p>taken form <a href="http://www.contrib.andrew.cmu.edu/~adbenson/setup.html" rel="noreferrer">here</a> - explaining how to install <code>apt-cyg</code> </p> <blockquote> <p>Install apt-cyg</p> <p>You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X)... .. .The analogous program for Cygwin is called apt-cyg.</p> <p>Installing apt-cyg is simple. First, save this file: <a href="https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg" rel="noreferrer">https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg</a> . Then, use File Explorer to find the file in your Downloads folder and move it into C:\cygwin\bin. Then, open Cygwin and enter "chmod +x /bin/apt-cyg". This tells Cygwin that you want to be able to execute the apt-cyg command. Lastly, enter "apt-cyg mirror <a href="ftp://sourceware.org/pub/cygwin" rel="noreferrer">ftp://sourceware.org/pub/cygwin</a>". This sets up apt-cyg to use the official repository when downloading programs. </p> </blockquote> <p>Sounds simple enough. But i have an error.</p> <p>This tutorial does not specify <strong>with what name and what extension to save that file</strong>. </p> <p>I save it as <code>apt-cyg.txt</code>, and move it into <code>C:\cygwin64\bin</code></p> <p>This does not work. When running <code>apt-cyg</code>, I get the error: <code>bad interpreter: No such file or directory</code></p> <p><a href="https://i.stack.imgur.com/k3r0N.png" rel="noreferrer"><img src="https://i.stack.imgur.com/k3r0N.png" alt="how to install apt-cyg for Cygwin? - error "></a></p> <p>My guess is that extension or filenames are bad. What name and extension should i use? </p> <p>Are there any more steps to this process?</p> <p><strong>Note:</strong> I just installed cygwin on a windows 10. Please don't assume i have other tools already installed. </p>
0debug
android studio 2.3.1 - Error : I am new to android programming. I have an issue, my pc shutdown while Iwa working ona program. When I turned it on I get all kinds of errors... I tried other programs which I created in my lesson (which I took from Internet) None of them work now. They all give me errors many of them... for example... [image code sample][1] [1]: https://i.stack.imgur.com/9Waei.jpg I think when the PC shutdown I might have lost something, but I unistalled ANdroid and reinstalled and I get the same thing... Thanks for any help .... Peter Fraga
0debug
read_help(void) { printf( "\n" " reads a range of bytes from the given offset\n" "\n" " Example:\n" " 'read -v 512 1k' - dumps 1 kilobyte read from 512 bytes into the file\n" "\n" " Reads a segment of the currently open file, optionally dumping it to the\n" " standard output stream (with -v option) for subsequent inspection.\n" " -p, -- use bdrv_pread to read the file\n" " -P, -- use a pattern to verify read data\n" " -C, -- report statistics in a machine parsable format\n" " -v, -- dump buffer to standard output\n" " -q, -- quite mode, do not show I/O statistics\n" "\n"); }
1threat
How find string after special character with preg_match : <p>i have string on the variable and question is how find any character after <code>search/node/</code> and print that ?</p> <p>String:</p> <pre><code>$var="search/node/Apartman"; </code></pre> <p>my Codes :</p> <pre><code>$var="search/node/Apartment"; //URL preg_match('/search/node/\K\d+/', $var,$newvar); $FinalVAR=$newvar[0]; print_r ($FinalVAR); </code></pre> <p>BUT NOT WORK</p> <p>THANKS FOR ANY HELP.</p>
0debug
static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) { HEVCLocalContext *lc = s->HEVClc; GetBitContext *gb = &lc->gb; int ctb_addr_ts, ret; *gb = nal->gb; s->nal_unit_type = nal->type; s->temporal_id = nal->temporal_id; switch (s->nal_unit_type) { case HEVC_NAL_VPS: ret = ff_hevc_decode_nal_vps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; case HEVC_NAL_SPS: ret = ff_hevc_decode_nal_sps(gb, s->avctx, &s->ps, s->apply_defdispwin); if (ret < 0) goto fail; break; case HEVC_NAL_PPS: ret = ff_hevc_decode_nal_pps(gb, s->avctx, &s->ps); if (ret < 0) goto fail; break; case HEVC_NAL_SEI_PREFIX: case HEVC_NAL_SEI_SUFFIX: ret = ff_hevc_decode_nal_sei(s); if (ret < 0) goto fail; break; case HEVC_NAL_TRAIL_R: case HEVC_NAL_TRAIL_N: case HEVC_NAL_TSA_N: case HEVC_NAL_TSA_R: case HEVC_NAL_STSA_N: case HEVC_NAL_STSA_R: case HEVC_NAL_BLA_W_LP: case HEVC_NAL_BLA_W_RADL: case HEVC_NAL_BLA_N_LP: case HEVC_NAL_IDR_W_RADL: case HEVC_NAL_IDR_N_LP: case HEVC_NAL_CRA_NUT: case HEVC_NAL_RADL_N: case HEVC_NAL_RADL_R: case HEVC_NAL_RASL_N: case HEVC_NAL_RASL_R: ret = hls_slice_header(s); if (ret < 0) return ret; if (s->max_ra == INT_MAX) { if (s->nal_unit_type == HEVC_NAL_CRA_NUT || IS_BLA(s)) { s->max_ra = s->poc; } else { if (IS_IDR(s)) s->max_ra = INT_MIN; } } if ((s->nal_unit_type == HEVC_NAL_RASL_R || s->nal_unit_type == HEVC_NAL_RASL_N) && s->poc <= s->max_ra) { s->is_decoded = 0; break; } else { if (s->nal_unit_type == HEVC_NAL_RASL_R && s->poc > s->max_ra) s->max_ra = INT_MIN; } if (s->sh.first_slice_in_pic_flag) { ret = hevc_frame_start(s); if (ret < 0) return ret; } else if (!s->ref) { av_log(s->avctx, AV_LOG_ERROR, "First slice in a frame missing.\n"); goto fail; } if (s->nal_unit_type != s->first_nal_type) { av_log(s->avctx, AV_LOG_ERROR, "Non-matching NAL types of the VCL NALUs: %d %d\n", s->first_nal_type, s->nal_unit_type); return AVERROR_INVALIDDATA; } if (!s->sh.dependent_slice_segment_flag && s->sh.slice_type != HEVC_SLICE_I) { ret = ff_hevc_slice_rpl(s); if (ret < 0) { av_log(s->avctx, AV_LOG_WARNING, "Error constructing the reference lists for the current slice.\n"); goto fail; } } if (s->sh.first_slice_in_pic_flag && s->avctx->hwaccel) { ret = s->avctx->hwaccel->start_frame(s->avctx, NULL, 0); if (ret < 0) goto fail; } if (s->avctx->hwaccel) { ret = s->avctx->hwaccel->decode_slice(s->avctx, nal->raw_data, nal->raw_size); if (ret < 0) goto fail; } else { if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0) ctb_addr_ts = hls_slice_data_wpp(s, nal); else ctb_addr_ts = hls_slice_data(s); if (ctb_addr_ts >= (s->ps.sps->ctb_width * s->ps.sps->ctb_height)) { s->is_decoded = 1; } if (ctb_addr_ts < 0) { ret = ctb_addr_ts; goto fail; } } break; case HEVC_NAL_EOS_NUT: case HEVC_NAL_EOB_NUT: s->seq_decode = (s->seq_decode + 1) & 0xff; s->max_ra = INT_MAX; break; case HEVC_NAL_AUD: case HEVC_NAL_FD_NUT: break; default: av_log(s->avctx, AV_LOG_INFO, "Skipping NAL unit %d\n", s->nal_unit_type); } return 0; fail: if (s->avctx->err_recognition & AV_EF_EXPLODE) return ret; return 0; }
1threat
firebase listener not getting called : > i want to check whether node is created or not i just implemented below called with toast but nothing toasting at all **note: firebase DataBase is Total null now** DatabaseReference reference = FirebaseDatabase.getInstance().getReference(); reference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Toast.makeText(RegisterActivity.this, dataSnapshot.getKey() + "", Toast.LENGTH_SHORT).show(); } @Override public void onCancelled(DatabaseError databaseError) { Toast.makeText(RegisterActivity.this, databaseError.toString() + "", Toast.LENGTH_SHORT).show(); } }); *secondly below code i tried but no luck* DatabaseReference reference = FirebaseDatabase.getInstance().getReference(); reference.child("device_id"); reference.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Toast.makeText(RegisterActivity.this, dataSnapshot.getKey() + "", Toast.LENGTH_SHORT).show(); } @Override public void onCancelled(DatabaseError databaseError) { Toast.makeText(RegisterActivity.this, databaseError.toString() + "", Toast.LENGTH_SHORT).show(); } });
0debug
void avpriv_solve_lls(LLSModel *m, double threshold, unsigned short min_order) { int i, j, k; double (*factor)[MAX_VARS_ALIGN] = (void *) &m->covariance[1][0]; double (*covar) [MAX_VARS_ALIGN] = (void *) &m->covariance[1][1]; double *covar_y = m->covariance[0]; int count = m->indep_count; for (i = 0; i < count; i++) { for (j = i; j < count; j++) { double sum = covar[i][j]; for (k = i - 1; k >= 0; k--) sum -= factor[i][k] * factor[j][k]; if (i == j) { if (sum < threshold) sum = 1.0; factor[i][i] = sqrt(sum); } else { factor[j][i] = sum / factor[i][i]; } } } for (i = 0; i < count; i++) { double sum = covar_y[i + 1]; for (k = i - 1; k >= 0; k--) sum -= factor[i][k] * m->coeff[0][k]; m->coeff[0][i] = sum / factor[i][i]; } for (j = count - 1; j >= min_order; j--) { for (i = j; i >= 0; i--) { double sum = m->coeff[0][i]; for (k = i + 1; k <= j; k++) sum -= factor[k][i] * m->coeff[j][k]; m->coeff[j][i] = sum / factor[i][i]; } m->variance[j] = covar_y[0]; for (i = 0; i <= j; i++) { double sum = m->coeff[j][i] * covar[i][i] - 2 * covar_y[i + 1]; for (k = 0; k < i; k++) sum += 2 * m->coeff[j][k] * covar[k][i]; m->variance[j] += m->coeff[j][i] * sum; } } }
1threat
How to we know user is enable or disable for notification service for our app in swift? : I using the Push notification in my application by using of Firebase. Here my problem is how to user is enable the notification service or not in his settings for our app. I want to fetch that data and send every time to backend. Any one give some idea on that.
0debug
Parse error: syntax error, unexpected end of file : <p>Its working at first but when I re-edit it since it looks messy, the result is now error, can somebody please help me. </p> <p>I think i already closed the braces and scripts, i dont know what's wrong with it.</p> <pre><code>&lt;?php session_start(); require("functions.php"); if(!isset($_GET['id'])&amp;&amp;isset($_SESSION['username'])) header("Location: ?id=".getId($_SESSION['username'])); ?&gt; &lt;!-- HEAD --&gt; &lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;System of Account&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;!-- Meta, title, CSS, favicons, etc. --&gt; &lt;meta charset="utf-8"&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;!-- Latest compiled and minified CSS --&gt; &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" &gt; &lt;!-- Latest compiled and minified JavaScript --&gt; &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" &gt;&lt;/script&gt; &lt;link rel="stylesheet" href="animate.css"&gt; &lt;link href="fonts/css/font-awesome.min.css" rel="stylesheet"&gt; &lt;link rel="shortcut icon" href="favicon.png"&gt; &lt;link href="css/animate.min.css" rel="stylesheet"&gt; &lt;link href="fonts/css/font-awesome.min.css" rel="stylesheet"&gt; &lt;link rel="stylesheet" type="text/css" media="print" href="print.css" /&gt; &lt;!--&lt;link type="text/css" rel="stylesheet" href="styles.css" /&gt;--&gt; &lt;style&gt; body{ margin: 0 auto; background-image:url("../clsimages/GG.jpg"); background-repeat: no-repeat; background-size: 100% 720px; -webkit-background-size:cover; -moz-background-size:cover; -o-background-size:cover; } .container{ width: 65%; height:615px; background-color: rgba(52, 73, 94, 0.3); margin-top: 50px; border-radius:4px; border: 2px solid black; } &lt;/style&gt; &lt;style&gt; table{ float:left; border: 1px solid ; } &lt;/style&gt; &lt;style&gt; ul { width: 70%; margin: auto; } &lt;/style&gt; &lt;style&gt; .div{ width: 250%; } .form-control{ border: 2px dashed #D1C7AC; width: 230px; color: #1E049E; onfocus="this.value='' font-weight: bold; font-size: 18px; font-family: "Times New Roman"; } &lt;/style&gt; &lt;script&gt; function printDiv(divID) { //Get the HTML of div var divElements = document.getElementById(divID).innerHTML; //Get the HTML of whole page var oldPage = document.body.innerHTML; //Reset the page's HTML with div's HTML only document.body.innerHTML = "&lt;nav&gt;" + divElements + "&lt;/nav&gt;"; //Print Page window.print(); //*Restore orignal HTML // document.body.innerHTML = oldPage; // window.location='print.php'; } &lt;/script&gt; &lt;/head&gt; &lt;!-- BODY --&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;?php if(!isset($_SESSION['username'])) { ?&gt; &lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt;&lt;/br&gt; &lt;center&gt; &lt;font color="black"&gt; &lt;h2 class="form-signin-heading"&gt; Please Login &lt;i class="fa fa-sign-in"&gt; &lt;/i&gt;&lt;/h2&gt; &lt;/font&gt; &lt;/br&gt;&lt;/br&gt; &lt;form action="authenticate.php" class="form-signin" method="POST"&gt; &lt;div class="input-group" style="margin-left:42%"&gt; &lt;span class="input-group-addon" id="basic-addon1"&gt;Username:&lt;/span&gt; &lt;input type="text" name="username" class="form-control" style="width:23%; height: 40px;" required&gt;&lt;br /&gt; &lt;/div&gt; &lt;/br&gt; &lt;div class="input-group" style="margin-left:42%"&gt; &lt;span class="input-group-addon" id="basic-addon1" &gt;Password:&lt;/span&gt; &lt;input type="password" name="password" id="inputPassword" class="form-control" placeholder="Enter Your Password" style="width:23%; height:40px;"required&gt; &lt;/div&gt; &lt;br /&gt; &lt;/br&gt; &lt;button class="btn btn-lg btn-primary btn-block" type="submit" style="width:25%;"&gt; Login &lt;i class="fa fa-sign-in"&gt; &lt;/i&gt; &lt;/button&gt; &lt;/center&gt; &lt;/form&gt; &lt;?php if(isset($_GET["feedback"])) echo $_GET["feedback"]; } ?&gt; &lt;!-- NEXT PAGE --&gt; &lt;?php if(isset($_SESSION['username'])) { $profileUsersData = getUsersData(mysql_real_escape_string($_GET['id'])); ?&gt; &lt;div id="menu"&gt; &lt;a class="button" href="logout.php"&gt;Logout&lt;/a&gt; &lt;/div&gt; &lt;?php if(userExists(mysql_real_escape_string($_GET['id']))){ ?&gt; &lt;!--Button print --&gt; &lt;button class="btn btn-default" onclick="javascript:printDiv('printablediv')" class = "btn btn-success" &gt;&lt;i class="fa fa-print"&gt; &lt;/i&gt; &lt;b&gt; Print the fees&lt;/b&gt;&lt;/button&gt; &lt;!-- End --&gt; &lt;!--PRINT --&gt; &lt;div class="" id="printablediv"&gt; &lt;p&gt;&lt;img src="clsimages/STATEMENT.png"&gt;&lt;/p&gt; &lt;div align="right"&gt; &lt;script&gt; var y = new Date(); var currentyear = y.getFullYear(); var nextyear= y.getFullYear() +1; document.write("&lt;p class='navbar-text pull-right'&gt;&lt;font style = 'Impact' color = 'black'&gt;&lt;h3&gt; SY:&lt;font color='blue'&gt; "+ currentyear +"-"+ nextyear +" &lt;/h3&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;"); &lt;/script&gt; &lt;/th&gt; &lt;/div&gt; &lt;br&gt; &lt;!-- Table --&gt; &lt;table border='1' style='border-collapse:collapse; width:100%; border-bottom: hidden;'&gt; &lt;col style='width:50%;'&gt; &lt;tr&gt; &lt;td&gt; &lt;ul&gt; &lt;p&gt;&lt;font size='2%' face='Arial'&gt; &lt;b&gt; &lt;/br&gt; &lt;?php if(isset($_SESSION['username'])) { $profileUsersData = getUsersData(mysql_real_escape_string($_GET['id'])); ?&gt; &lt;?php if(userExists(mysql_real_escape_string($_GET['id']))){ ?&gt; &lt;div id="header"&gt; &lt;?php echo 'STUDENT NAME: '. $profileUsersData['LastName'].", ".$profileUsersData['FirstName']. " ".$profileUsersData['MiddleName'].""; ?&gt; &lt;/br&gt;&lt;/br&gt; &lt;?php echo ' &lt;/br&gt; LEVEL: '. $profileUsersData['Level'].""; ?&gt; &lt;/b&gt; &lt;/ul&gt; &lt;/td&gt; &lt;td&gt; &lt;ul&gt; &lt;p&gt;&lt;font size="2%" face="Arial"&gt;&lt;b&gt; TELEPHONE: (63 2) 834-2915 &lt;/br&gt;&lt;/br&gt; EMAIL: christianloveschool@yahoo.com &lt;/p&gt; &lt;/b&gt; &lt;/ul&gt; &lt;/table&gt; &lt;table border="1" style="border-collapse:collapse; width:100%;"&gt; &lt;col style="width:50%;"&gt; &lt;tr&gt; &lt;td&gt; &lt;ul&gt; &lt;font size="2%" face="Arial"&gt; &lt;b&gt; &lt;?php echo ' &lt;/br&gt; DATE: '. $profileUsersData['TuitionDate'].""; ?&gt; &lt;b&gt; &lt;/br&gt; &lt;?php echo ' &lt;/br&gt; TUITION FEE: '. $profileUsersData['Tuition'].""; ?&gt; &lt;/br&gt; &lt;/br&gt; &lt;?php echo ' &lt;/br&gt; BOOKS: '. $profileUsersData['Books'].""; ?&gt; &lt;/br&gt; &lt;/br&gt; &lt;?php echo ' &lt;/br&gt; SCHOOL/ PE UNIFORM: '. $profileUsersData['Uniform'].""; ?&gt; &lt;/br&gt; &lt;/br&gt; &lt;?php echo ' &lt;/br&gt; OLD ACCOUNT: '. $profileUsersData['OldAcct'].""; ?&gt; &lt;/br&gt; &lt;/b&gt; &lt;/ul&gt; &lt;/td&gt; &lt;/font&gt; &lt;td&gt; &lt;font size="2%" face="Arial"&gt; &lt;ul&gt; &lt;b&gt; &lt;?php echo ' &lt;/br&gt; BALANCE: '. $profileUsersData['Balance'].""; ?&gt; &lt;/b&gt; &lt;/ul&gt; &lt;/td&gt; &lt;/font&gt; &lt;/tr&gt; &lt;/table&gt; &lt;?php } else echo "Invalid ID"; ?&gt; &lt;?php } ?&gt; &lt;!-- RULES OF PAYMENT --&gt; &lt;table border="1" style="border-collapse:collapse; width:100%; border-top:hidden;"&gt; &lt;tr&gt; &lt;td&gt; &lt;font size="3%" face="Arial"&gt; &lt;ul&gt; &lt;b&gt;&lt;u&gt;RULES ON PAYMENT:&lt;/u&gt;&lt;/b&gt; &lt;/font&gt; &lt;/br&gt;&lt;/br&gt; &lt;font size="2%" face="Arial"&gt; 1. Tuition fee payment must be made every 5th day of the scheduled payment scheme. &lt;/br&gt;&lt;/br&gt; 2.Payments should be made on time in order to take the exam needed. &lt;/br&gt;&lt;/br&gt; 3. Reservations and Miscellaneous fees are non-refundable. &lt;/br&gt;&lt;/br&gt; 4.A student who withdraws before the start of the school year shall be charged 50% on miscellaneous fee. &lt;/br&gt;&lt;/br&gt; 5. A student who transfers or otherswise withdraws within two weeks after the beginning of classes and has already paid the pertinent and other school fees in full may be charged to pay the whole amount of miscellaneous fees and the amount supposed tp be paid pertaining to tuition fee. &lt;/br&gt;&lt;/br&gt; 6. A student who transfers or withdraws within two weeks after the beginning of classes and has not yet paid the pertinent and other school fees shall be charged to pay the whole amount of miscellaneous fees in full and the amount supposed to be paid pertaining to tuition fee. &lt;/br&gt;&lt;/br&gt; 7. A student who withdraws any time after the second week of classes, full payment of tuition and miscellaneous fees shall be charged. &lt;/br&gt;&lt;/br&gt; 8. Discounts shall only be applied at the last payment. &lt;/br&gt;&lt;/br&gt; 9. Any discounts granted will be forfeited if the payment is delayed. &lt;/br&gt;&lt;/br&gt; 10. All fees should be paid in full before the end of the school year. &lt;/font&gt; &lt;/br&gt;&lt;/br&gt; &lt;hr&gt;&lt;/hr&gt; &lt;br&gt; &lt;table&gt; &lt;font size="3%"&gt; Any discount granted will be &lt;b&gt; forfeited &lt;/b&gt; if the payment is delayed. &lt;br&gt; &lt;u&gt; &lt;font color="red"&gt; &lt;b&gt; &lt;br&gt; Bring this notice upon payment and have the Examination Permit validated from the office. &lt;/font&gt; &lt;/u&gt; &lt;/table&gt; &lt;/br&gt;&lt;/br&gt; &lt;font color="blue" size="3%"&gt; Contact the school if payment has been made, thank you. &lt;/u&gt; &lt;/font&gt; &lt;/b&gt; &lt;/ul&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
0debug
static void slavio_check_interrupts(void *opaque) { CPUState *env; SLAVIO_INTCTLState *s = opaque; uint32_t pending = s->intregm_pending; unsigned int i, j, max = 0; pending &= ~s->intregm_disabled; if (pending && !(s->intregm_disabled & 0x80000000)) { for (i = 0; i < 32; i++) { if (pending & (1 << i)) { if (max < s->intbit_to_level[i]) max = s->intbit_to_level[i]; } } env = s->cpu_envs[s->target_cpu]; if (!env) { DPRINTF("No CPU %d, not triggered (pending %x)\n", s->target_cpu, pending); } else { if (env->halted) env->halted = 0; if (env->interrupt_index == 0) { DPRINTF("Triggered CPU %d pil %d\n", s->target_cpu, max); #ifdef DEBUG_IRQ_COUNT s->irq_count[max]++; #endif env->interrupt_index = TT_EXTINT | max; cpu_interrupt(env, CPU_INTERRUPT_HARD); } else DPRINTF("Not triggered (pending %x), pending exception %x\n", pending, env->interrupt_index); } } else DPRINTF("Not triggered (pending %x), disabled %x\n", pending, s->intregm_disabled); for (i = 0; i < MAX_CPUS; i++) { max = 0; env = s->cpu_envs[i]; if (!env) continue; for (j = 17; j < 32; j++) { if (s->intreg_pending[i] & (1 << j)) { if (max < j - 16) max = j - 16; } } if (max > 0) { if (env->halted) env->halted = 0; if (env->interrupt_index == 0) { DPRINTF("Triggered softint %d for cpu %d (pending %x)\n", max, i, pending); #ifdef DEBUG_IRQ_COUNT s->irq_count[max]++; #endif env->interrupt_index = TT_EXTINT | max; cpu_interrupt(env, CPU_INTERRUPT_HARD); } } } }
1threat
static void do_inject_mce(Monitor *mon, const QDict *qdict) { CPUState *cenv; int cpu_index = qdict_get_int(qdict, "cpu_index"); int bank = qdict_get_int(qdict, "bank"); uint64_t status = qdict_get_int(qdict, "status"); uint64_t mcg_status = qdict_get_int(qdict, "mcg_status"); uint64_t addr = qdict_get_int(qdict, "addr"); uint64_t misc = qdict_get_int(qdict, "misc"); int broadcast = qdict_get_try_bool(qdict, "broadcast", 0); for (cenv = first_cpu; cenv != NULL; cenv = cenv->next_cpu) { if (cenv->cpu_index == cpu_index && cenv->mcg_cap) { cpu_x86_inject_mce(cenv, bank, status, mcg_status, addr, misc, broadcast); break; } } }
1threat
Java Error invalid start : So I'm trying to get my display method to work... private static displayResults(String gender,int age,String rateResult); { System.out.Println("Thank you"); System.out.println("the "+ gender + " is " + age + " years old."); System.out.println("the rate class is: " + rateResult); } **My Error____ ps/ took out string but i get the same error.... what am i missing??** RentalRates.java:163: error: illegal start of expression private static String displayResults(gender,int age,rateResult); ^ RentalRates.java:163: error: illegal start of expression private static String displayResults(gender,int age,rateResult); ^ RentalRates.java:163: error: ';' expected private static String displayResults(gender,int age,rateResult); ^ RentalRates.java:163: error: '.class' expected private static String displayResults(gender,int age,rateResult); ^ RentalRates.java:163: error: ';' expected private static String displayResults(gender,int age,rateResult); ^ RentalRates.java:163: error: not a statement private static String displayResults(gender,int age,rateResult); ^ RentalRates.java:163: error: ';' expected private static String displayResults(gender,int age,rateResult); ^ RentalRates.java:169: error: reached end of file while parsing }
0debug
I'm falling to create a canvas : I write this code >>>code import turtle >>>t=turtle.pen()
0debug
Reading 10 csv file and storing it in database : <p>I am using JAVA 8 and Spring Boot.</p> <p>I have 10 files(.csv) with a million row each.What's the best to read the files and store it in Database?</p>
0debug
static int matroska_parse_tracks(AVFormatContext *s) { MatroskaDemuxContext *matroska = s->priv_data; MatroskaTrack *tracks = matroska->tracks.elem; AVStream *st; int i, j, ret; int k; for (i = 0; i < matroska->tracks.nb_elem; i++) { MatroskaTrack *track = &tracks[i]; enum AVCodecID codec_id = AV_CODEC_ID_NONE; EbmlList *encodings_list = &track->encodings; MatroskaTrackEncoding *encodings = encodings_list->elem; uint8_t *extradata = NULL; int extradata_size = 0; int extradata_offset = 0; uint32_t fourcc = 0; AVIOContext b; char* key_id_base64 = NULL; int bit_depth = -1; if (track->type != MATROSKA_TRACK_TYPE_VIDEO && track->type != MATROSKA_TRACK_TYPE_AUDIO && track->type != MATROSKA_TRACK_TYPE_SUBTITLE && track->type != MATROSKA_TRACK_TYPE_METADATA) { av_log(matroska->ctx, AV_LOG_INFO, "Unknown or unsupported track type %"PRIu64"\n", track->type); continue; } if (!track->codec_id) continue; if (track->audio.samplerate < 0 || track->audio.samplerate > INT_MAX || isnan(track->audio.samplerate)) { av_log(matroska->ctx, AV_LOG_WARNING, "Invalid sample rate %f, defaulting to 8000 instead.\n", track->audio.samplerate); track->audio.samplerate = 8000; } if (track->type == MATROSKA_TRACK_TYPE_VIDEO) { if (!track->default_duration && track->video.frame_rate > 0) track->default_duration = 1000000000 / track->video.frame_rate; if (track->video.display_width == -1) track->video.display_width = track->video.pixel_width; if (track->video.display_height == -1) track->video.display_height = track->video.pixel_height; if (track->video.color_space.size == 4) fourcc = AV_RL32(track->video.color_space.data); } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) { if (!track->audio.out_samplerate) track->audio.out_samplerate = track->audio.samplerate; } if (encodings_list->nb_elem > 1) { av_log(matroska->ctx, AV_LOG_ERROR, "Multiple combined encodings not supported"); } else if (encodings_list->nb_elem == 1) { if (encodings[0].type) { if (encodings[0].encryption.key_id.size > 0) { const int b64_size = AV_BASE64_SIZE(encodings[0].encryption.key_id.size); key_id_base64 = av_malloc(b64_size); if (key_id_base64 == NULL) return AVERROR(ENOMEM); av_base64_encode(key_id_base64, b64_size, encodings[0].encryption.key_id.data, encodings[0].encryption.key_id.size); } else { encodings[0].scope = 0; av_log(matroska->ctx, AV_LOG_ERROR, "Unsupported encoding type"); } } else if ( #if CONFIG_ZLIB encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_ZLIB && #endif #if CONFIG_BZLIB encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_BZLIB && #endif #if CONFIG_LZO encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_LZO && #endif encodings[0].compression.algo != MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP) { encodings[0].scope = 0; av_log(matroska->ctx, AV_LOG_ERROR, "Unsupported encoding type"); } else if (track->codec_priv.size && encodings[0].scope & 2) { uint8_t *codec_priv = track->codec_priv.data; int ret = matroska_decode_buffer(&track->codec_priv.data, &track->codec_priv.size, track); if (ret < 0) { track->codec_priv.data = NULL; track->codec_priv.size = 0; av_log(matroska->ctx, AV_LOG_ERROR, "Failed to decode codec private data\n"); } if (codec_priv != track->codec_priv.data) av_free(codec_priv); } } for (j = 0; ff_mkv_codec_tags[j].id != AV_CODEC_ID_NONE; j++) { if (!strncmp(ff_mkv_codec_tags[j].str, track->codec_id, strlen(ff_mkv_codec_tags[j].str))) { codec_id = ff_mkv_codec_tags[j].id; break; } } st = track->stream = avformat_new_stream(s, NULL); if (!st) { av_free(key_id_base64); return AVERROR(ENOMEM); } if (key_id_base64) { av_dict_set(&st->metadata, "enc_key_id", key_id_base64, 0); av_freep(&key_id_base64); } if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") && track->codec_priv.size >= 40 && track->codec_priv.data) { track->ms_compat = 1; bit_depth = AV_RL16(track->codec_priv.data + 14); fourcc = AV_RL32(track->codec_priv.data + 16); codec_id = ff_codec_get_id(ff_codec_bmp_tags, fourcc); if (!codec_id) codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc); extradata_offset = 40; } else if (!strcmp(track->codec_id, "A_MS/ACM") && track->codec_priv.size >= 14 && track->codec_priv.data) { int ret; ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, 0, NULL, NULL, NULL, NULL); ret = ff_get_wav_header(s, &b, st->codecpar, track->codec_priv.size, 0); if (ret < 0) return ret; codec_id = st->codecpar->codec_id; fourcc = st->codecpar->codec_tag; extradata_offset = FFMIN(track->codec_priv.size, 18); } else if (!strcmp(track->codec_id, "A_QUICKTIME") && (track->codec_priv.size >= 32) && (track->codec_priv.data)) { uint16_t sample_size; int ret = get_qt_codec(track, &fourcc, &codec_id); if (ret < 0) return ret; sample_size = AV_RB16(track->codec_priv.data + 26); if (fourcc == 0) { if (sample_size == 8) { fourcc = MKTAG('r','a','w',' '); codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc); } else if (sample_size == 16) { fourcc = MKTAG('t','w','o','s'); codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc); } } if ((fourcc == MKTAG('t','w','o','s') || fourcc == MKTAG('s','o','w','t')) && sample_size == 8) codec_id = AV_CODEC_ID_PCM_S8; } else if (!strcmp(track->codec_id, "V_QUICKTIME") && (track->codec_priv.size >= 21) && (track->codec_priv.data)) { int ret = get_qt_codec(track, &fourcc, &codec_id); if (ret < 0) return ret; if (codec_id == AV_CODEC_ID_NONE && AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI ")) { fourcc = MKTAG('S','V','Q','3'); codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc); } if (codec_id == AV_CODEC_ID_NONE) av_log(matroska->ctx, AV_LOG_ERROR, "mov FourCC not found %s.\n", av_fourcc2str(fourcc)); if (track->codec_priv.size >= 86) { bit_depth = AV_RB16(track->codec_priv.data + 82); ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, 0, NULL, NULL, NULL, NULL); if (ff_get_qtpalette(codec_id, &b, track->palette)) { bit_depth &= 0x1F; track->has_palette = 1; } } } else if (codec_id == AV_CODEC_ID_PCM_S16BE) { switch (track->audio.bitdepth) { case 8: codec_id = AV_CODEC_ID_PCM_U8; break; case 24: codec_id = AV_CODEC_ID_PCM_S24BE; break; case 32: codec_id = AV_CODEC_ID_PCM_S32BE; break; } } else if (codec_id == AV_CODEC_ID_PCM_S16LE) { switch (track->audio.bitdepth) { case 8: codec_id = AV_CODEC_ID_PCM_U8; break; case 24: codec_id = AV_CODEC_ID_PCM_S24LE; break; case 32: codec_id = AV_CODEC_ID_PCM_S32LE; break; } } else if (codec_id == AV_CODEC_ID_PCM_F32LE && track->audio.bitdepth == 64) { codec_id = AV_CODEC_ID_PCM_F64LE; } else if (codec_id == AV_CODEC_ID_AAC && !track->codec_priv.size) { int profile = matroska_aac_profile(track->codec_id); int sri = matroska_aac_sri(track->audio.samplerate); extradata = av_mallocz(5 + AV_INPUT_BUFFER_PADDING_SIZE); if (!extradata) return AVERROR(ENOMEM); extradata[0] = (profile << 3) | ((sri & 0x0E) >> 1); extradata[1] = ((sri & 0x01) << 7) | (track->audio.channels << 3); if (strstr(track->codec_id, "SBR")) { sri = matroska_aac_sri(track->audio.out_samplerate); extradata[2] = 0x56; extradata[3] = 0xE5; extradata[4] = 0x80 | (sri << 3); extradata_size = 5; } else extradata_size = 2; } else if (codec_id == AV_CODEC_ID_ALAC && track->codec_priv.size && track->codec_priv.size < INT_MAX - 12 - AV_INPUT_BUFFER_PADDING_SIZE) { extradata_size = 12 + track->codec_priv.size; extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!extradata) return AVERROR(ENOMEM); AV_WB32(extradata, extradata_size); memcpy(&extradata[4], "alac", 4); AV_WB32(&extradata[8], 0); memcpy(&extradata[12], track->codec_priv.data, track->codec_priv.size); } else if (codec_id == AV_CODEC_ID_TTA) { extradata_size = 30; extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!extradata) return AVERROR(ENOMEM); ffio_init_context(&b, extradata, extradata_size, 1, NULL, NULL, NULL, NULL); avio_write(&b, "TTA1", 4); avio_wl16(&b, 1); if (track->audio.channels > UINT16_MAX || track->audio.bitdepth > UINT16_MAX) { av_log(matroska->ctx, AV_LOG_WARNING, "Too large audio channel number %"PRIu64 " or bitdepth %"PRIu64". Skipping track.\n", track->audio.channels, track->audio.bitdepth); av_freep(&extradata); if (matroska->ctx->error_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; else continue; } avio_wl16(&b, track->audio.channels); avio_wl16(&b, track->audio.bitdepth); if (track->audio.out_samplerate < 0 || track->audio.out_samplerate > INT_MAX) return AVERROR_INVALIDDATA; avio_wl32(&b, track->audio.out_samplerate); avio_wl32(&b, av_rescale((matroska->duration * matroska->time_scale), track->audio.out_samplerate, AV_TIME_BASE * 1000)); } else if (codec_id == AV_CODEC_ID_RV10 || codec_id == AV_CODEC_ID_RV20 || codec_id == AV_CODEC_ID_RV30 || codec_id == AV_CODEC_ID_RV40) { extradata_offset = 26; } else if (codec_id == AV_CODEC_ID_RA_144) { track->audio.out_samplerate = 8000; track->audio.channels = 1; } else if ((codec_id == AV_CODEC_ID_RA_288 || codec_id == AV_CODEC_ID_COOK || codec_id == AV_CODEC_ID_ATRAC3 || codec_id == AV_CODEC_ID_SIPR) && track->codec_priv.data) { int flavor; ffio_init_context(&b, track->codec_priv.data, track->codec_priv.size, 0, NULL, NULL, NULL, NULL); avio_skip(&b, 22); flavor = avio_rb16(&b); track->audio.coded_framesize = avio_rb32(&b); avio_skip(&b, 12); track->audio.sub_packet_h = avio_rb16(&b); track->audio.frame_size = avio_rb16(&b); track->audio.sub_packet_size = avio_rb16(&b); if (flavor < 0 || track->audio.coded_framesize <= 0 || track->audio.sub_packet_h <= 0 || track->audio.frame_size <= 0 || track->audio.sub_packet_size <= 0 && codec_id != AV_CODEC_ID_SIPR) return AVERROR_INVALIDDATA; track->audio.buf = av_malloc_array(track->audio.sub_packet_h, track->audio.frame_size); if (!track->audio.buf) return AVERROR(ENOMEM); if (codec_id == AV_CODEC_ID_RA_288) { st->codecpar->block_align = track->audio.coded_framesize; track->codec_priv.size = 0; } else { if (codec_id == AV_CODEC_ID_SIPR && flavor < 4) { static const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 }; track->audio.sub_packet_size = ff_sipr_subpk_size[flavor]; st->codecpar->bit_rate = sipr_bit_rate[flavor]; } st->codecpar->block_align = track->audio.sub_packet_size; extradata_offset = 78; } } else if (codec_id == AV_CODEC_ID_FLAC && track->codec_priv.size) { ret = matroska_parse_flac(s, track, &extradata_offset); if (ret < 0) return ret; } else if (codec_id == AV_CODEC_ID_PRORES && track->codec_priv.size == 4) { fourcc = AV_RL32(track->codec_priv.data); } track->codec_priv.size -= extradata_offset; if (codec_id == AV_CODEC_ID_NONE) av_log(matroska->ctx, AV_LOG_INFO, "Unknown/unsupported AVCodecID %s.\n", track->codec_id); if (track->time_scale < 0.01) track->time_scale = 1.0; avpriv_set_pts_info(st, 64, matroska->time_scale * track->time_scale, 1000 * 1000 * 1000); track->codec_delay_in_track_tb = av_rescale_q(track->codec_delay, (AVRational){ 1, 1000000000 }, st->time_base); st->codecpar->codec_id = codec_id; if (strcmp(track->language, "und")) av_dict_set(&st->metadata, "language", track->language, 0); av_dict_set(&st->metadata, "title", track->name, 0); if (track->flag_default) st->disposition |= AV_DISPOSITION_DEFAULT; if (track->flag_forced) st->disposition |= AV_DISPOSITION_FORCED; if (!st->codecpar->extradata) { if (extradata) { st->codecpar->extradata = extradata; st->codecpar->extradata_size = extradata_size; } else if (track->codec_priv.data && track->codec_priv.size > 0) { if (ff_alloc_extradata(st->codecpar, track->codec_priv.size)) return AVERROR(ENOMEM); memcpy(st->codecpar->extradata, track->codec_priv.data + extradata_offset, track->codec_priv.size); } } if (track->type == MATROSKA_TRACK_TYPE_VIDEO) { MatroskaTrackPlane *planes = track->operation.combine_planes.elem; int display_width_mul = 1; int display_height_mul = 1; st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO; st->codecpar->codec_tag = fourcc; if (bit_depth >= 0) st->codecpar->bits_per_coded_sample = bit_depth; st->codecpar->width = track->video.pixel_width; st->codecpar->height = track->video.pixel_height; if (track->video.interlaced == MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED) st->codecpar->field_order = mkv_field_order(matroska, track->video.field_order); else if (track->video.interlaced == MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE) st->codecpar->field_order = AV_FIELD_PROGRESSIVE; if (track->video.stereo_mode && track->video.stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB) mkv_stereo_mode_display_mul(track->video.stereo_mode, &display_width_mul, &display_height_mul); if (track->video.display_unit < MATROSKA_VIDEO_DISPLAYUNIT_UNKNOWN) { av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, st->codecpar->height * track->video.display_width * display_width_mul, st->codecpar->width * track->video.display_height * display_height_mul, 255); } if (st->codecpar->codec_id != AV_CODEC_ID_HEVC) st->need_parsing = AVSTREAM_PARSE_HEADERS; if (track->default_duration) { av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, 1000000000, track->default_duration, 30000); #if FF_API_R_FRAME_RATE if ( st->avg_frame_rate.num < st->avg_frame_rate.den * 1000LL && st->avg_frame_rate.num > st->avg_frame_rate.den * 5LL) st->r_frame_rate = st->avg_frame_rate; #endif } if (track->video.stereo_mode && track->video.stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB) av_dict_set(&st->metadata, "stereo_mode", ff_matroska_video_stereo_mode[track->video.stereo_mode], 0); if (track->video.alpha_mode) av_dict_set(&st->metadata, "alpha_mode", "1", 0); for (j=0; j < track->operation.combine_planes.nb_elem; j++) { char buf[32]; if (planes[j].type >= MATROSKA_VIDEO_STEREO_PLANE_COUNT) continue; snprintf(buf, sizeof(buf), "%s_%d", ff_matroska_video_stereo_plane[planes[j].type], i); for (k=0; k < matroska->tracks.nb_elem; k++) if (planes[j].uid == tracks[k].uid && tracks[k].stream) { av_dict_set(&tracks[k].stream->metadata, "stereo_mode", buf, 0); break; } } if (track->video.stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB && track->video.stereo_mode != 10 && track->video.stereo_mode != 12) { int ret = ff_mkv_stereo3d_conv(st, track->video.stereo_mode); if (ret < 0) return ret; } ret = mkv_parse_video_color(st, track); if (ret < 0) return ret; ret = mkv_parse_video_projection(st, track); if (ret < 0) return ret; } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) { st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_tag = fourcc; st->codecpar->sample_rate = track->audio.out_samplerate; st->codecpar->channels = track->audio.channels; if (!st->codecpar->bits_per_coded_sample) st->codecpar->bits_per_coded_sample = track->audio.bitdepth; if (st->codecpar->codec_id == AV_CODEC_ID_MP3) st->need_parsing = AVSTREAM_PARSE_FULL; else if (st->codecpar->codec_id != AV_CODEC_ID_AAC) st->need_parsing = AVSTREAM_PARSE_HEADERS; if (track->codec_delay > 0) { st->codecpar->initial_padding = av_rescale_q(track->codec_delay, (AVRational){1, 1000000000}, (AVRational){1, st->codecpar->codec_id == AV_CODEC_ID_OPUS ? 48000 : st->codecpar->sample_rate}); } if (track->seek_preroll > 0) { st->codecpar->seek_preroll = av_rescale_q(track->seek_preroll, (AVRational){1, 1000000000}, (AVRational){1, st->codecpar->sample_rate}); } } else if (codec_id == AV_CODEC_ID_WEBVTT) { st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; if (!strcmp(track->codec_id, "D_WEBVTT/CAPTIONS")) { st->disposition |= AV_DISPOSITION_CAPTIONS; } else if (!strcmp(track->codec_id, "D_WEBVTT/DESCRIPTIONS")) { st->disposition |= AV_DISPOSITION_DESCRIPTIONS; } else if (!strcmp(track->codec_id, "D_WEBVTT/METADATA")) { st->disposition |= AV_DISPOSITION_METADATA; } } else if (track->type == MATROSKA_TRACK_TYPE_SUBTITLE) { st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE; if (st->codecpar->codec_id == AV_CODEC_ID_ASS) matroska->contains_ssa = 1; } } return 0; }
1threat
USBDevice *usb_msd_init(const char *filename) { MSDState *s; BlockDriverState *bdrv; BlockDriver *drv = NULL; const char *p1; char fmt[32]; p1 = strchr(filename, ':'); if (p1++) { const char *p2; if (strstart(filename, "format=", &p2)) { int len = MIN(p1 - p2, sizeof(fmt)); pstrcpy(fmt, len, p2); drv = bdrv_find_format(fmt); if (!drv) { printf("invalid format %s\n", fmt); return NULL; } } else if (*filename != ':') { printf("unrecognized USB mass-storage option %s\n", filename); return NULL; } filename = p1; } if (!*filename) { printf("block device specification needed\n"); return NULL; } s = qemu_mallocz(sizeof(MSDState)); bdrv = bdrv_new("usb"); if (bdrv_open2(bdrv, filename, 0, drv) < 0) goto fail; if (qemu_key_check(bdrv, filename)) goto fail; s->bs = bdrv; s->dev.speed = USB_SPEED_FULL; s->dev.handle_packet = usb_generic_handle_packet; s->dev.handle_reset = usb_msd_handle_reset; s->dev.handle_control = usb_msd_handle_control; s->dev.handle_data = usb_msd_handle_data; s->dev.handle_destroy = usb_msd_handle_destroy; snprintf(s->dev.devname, sizeof(s->dev.devname), "QEMU USB MSD(%.16s)", filename); s->scsi_dev = scsi_disk_init(bdrv, 0, usb_msd_command_complete, s); usb_msd_handle_reset((USBDevice *)s); return (USBDevice *)s; fail: qemu_free(s); return NULL; }
1threat
Adding a click() to a dynamically generated link : <p>I am trying to call a function from a dynamically generated button. However the click() function is not working when I click the link. Can't figure out why. </p> <pre><code>if ( hasCap === 'image' ) { caption = $(this).data('caption'); link = '&lt;a href="#" style="float: right; margin-top: -10px;" class="hidecaption"&gt;Hide Caption&lt;/a&gt;'; return link + (caption ? caption + '&lt;br /&gt;' : '') ; } $( ".hidecaption" ).click(function() { alert( "target called" ); }); </code></pre>
0debug
How to setup Kotlin on Android Studio? : <p>I have some troubles with the settings in Android Studio with Kotlin plugin? Someone can help me? I follow the documentation guide on the official page <a href="https://kotlinlang.org/" rel="nofollow noreferrer">https://kotlinlang.org/</a> , but have not effect.</p>
0debug
Is it possible to have a comment inside a es6 Template-String? : <p>Let's say we have a multiline es6 Template-String to describe e.g. some URL params for a request:</p> <pre><code>const fields = ` id, message, created_time, permalink_url, type `; </code></pre> <p>Is there any way to have comments inside that backtick Template-String? Like:</p> <pre><code>const fields = ` // post id id, // post status/message message, // ..... created_time, permalink_url, type `; </code></pre>
0debug
Is <html lang="en"> important? : <p>I just wanted to ask if the tag is really that important... Do I need to use it if I am developing a website? Will it affect my code if I don't put it?</p>
0debug
c++ recurisve function with calling a class using a templatefunction : i would like to have a function, that counts a value down to zero. in addition, i would like to call some code which class is passed as a template parameter. but this code doesn't work. please can someone help me? thanks a lot. template<size_t SIZE, class T> void foo() { T t; t.hello(SIZE); foo<SIZE-1, Hello_World>(); } template<class T> void foo<0,T>() { cout << "end." << endl; } int main() { foo<4,Hello_World>(); }
0debug
Remove text indentation from select (Windows) : <p>I need a cross-browser solution to remove padding/text indentation of native select fields. Using <code>padding: 0</code> doesn't seem to remove it entirely.</p> <p>Here's a screenshot of Chrome, with no text space on the left side:</p> <p><a href="https://i.stack.imgur.com/cGz6p.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cGz6p.png" alt="Chrome"></a></p> <p>And here's a screenshot of Firefox, which has some text space on the left side:</p> <p><a href="https://i.stack.imgur.com/RrEUC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RrEUC.png" alt="Firefox"></a></p> <p>However, it should also remove the padding in e.g. Edge/IE11/Safari, etc. So it shouldn't be a Firefox only solution, rather a cross-browser solution.</p> <p>Here's the code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>select { font-size: 18px; height: 38px; line-height: 38px; padding: 0; width: 100%; background-color: red; color: #000000; display: block; -webkit-appearance: none; -moz-appearance: none; appearance: none; outline: 0; border-color: #000000; border-width: 0 0 1px 0; border-style: solid; } option { padding: 0; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;select&gt; &lt;option value="test1"&gt;Test 1&lt;/option&gt; &lt;option value="test2"&gt;Test 2&lt;/option&gt; &lt;option value="test3"&gt;Test 3&lt;/option&gt; &lt;/select&gt;</code></pre> </div> </div> </p> <p><strong>Fiddle</strong>: <a href="https://jsfiddle.net/cbkopypv/1/" rel="noreferrer">https://jsfiddle.net/cbkopypv/1/</a></p>
0debug
static int dnxhd_mb_var_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr) { DNXHDEncContext *ctx = avctx->priv_data; int mb_y = jobnr, mb_x; ctx = ctx->thread[threadnr]; if (ctx->cid_table->bit_depth == 8) { uint8_t *pix = ctx->thread[0]->src[0] + ((mb_y<<4) * ctx->m.linesize); for (mb_x = 0; mb_x < ctx->m.mb_width; ++mb_x, pix += 16) { unsigned mb = mb_y * ctx->m.mb_width + mb_x; int sum = ctx->m.dsp.pix_sum(pix, ctx->m.linesize); int varc = (ctx->m.dsp.pix_norm1(pix, ctx->m.linesize) - (((unsigned)(sum*sum))>>8)+128)>>8; ctx->mb_cmp[mb].value = varc; ctx->mb_cmp[mb].mb = mb; } } else { int const linesize = ctx->m.linesize >> 1; for (mb_x = 0; mb_x < ctx->m.mb_width; ++mb_x) { uint16_t *pix = (uint16_t*)ctx->thread[0]->src[0] + ((mb_y << 4) * linesize) + (mb_x << 4); unsigned mb = mb_y * ctx->m.mb_width + mb_x; int sum = 0; int sqsum = 0; int mean, sqmean; int i, j; for (i = 0; i < 16; ++i) { for (j = 0; j < 16; ++j) { int const sample = (unsigned)pix[j] >> 6; sum += sample; sqsum += sample * sample; } pix += linesize; } mean = sum >> 8; sqmean = sqsum >> 8; ctx->mb_cmp[mb].value = sqmean - mean * mean; ctx->mb_cmp[mb].mb = mb; } } return 0; }
1threat
How to use resource dictionary in WPF : <p>I'm new to WPF and I don't understand well how resource dictionary works. I have Icons.xaml that looks like:</p> <pre><code>&lt;ResourceDictionary xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&gt; &lt;Canvas x:Key="appbar_3d_3ds" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0"&gt; &lt;Path Width="32" Height="40" Canvas.Left="23" Canvas.Top="18" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 27,18L 23,26L 33,30L 24,38L 33,46L 23,50L 27,58L 45,58L 55,38L 45,18L 27,18 Z "/&gt; &lt;/Canvas&gt; &lt;Canvas x:Key="appbar_3d_collada" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0"&gt; &lt;Path Width="44" Height="30.3735" Canvas.Left="15" Canvas.Top="21.6194" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 39.2598,21.6194C 47.9001,21.6194 55.3802,24.406 59,28.4646L 59,33.4834C 56.3537,29.575 49.2267,26.7756 40.85,26.7756C 30.2185,26.7756 21.6,31.285 21.6,36.8475C 21.6,40.4514 25.2176,43.6131 30.6564,45.3929C 22.7477,43.5121 17.2,39.1167 17.2,33.9944C 17.2,27.1599 27.0765,21.6194 39.2598,21.6194 Z M 35.8402,51.9929C 27.1999,51.9929 19.7198,49.2063 16.1,45.1478L 15,40.129C 17.6463,44.0373 25.8733,46.8367 34.25,46.8367C 44.8815,46.8367 53.5,42.3274 53.5,36.7648C 53.5,33.161 49.8824,29.9992 44.4436,28.2194C 52.3523,30.1002 57.9,34.4956 57.9,39.6179C 57.9,46.4525 48.0235,51.9929 35.8402,51.9929 Z "/&gt; &lt;/Canvas&gt; &lt;/ResourceDictionary&gt; </code></pre> <p>How can I use for example "app_3d_collada" in my xaml ? I have for example MenuItem and I would like to use this icon as my MenuItem icon.</p>
0debug
static int stellaris_enet_load(QEMUFile *f, void *opaque, int version_id) { stellaris_enet_state *s = (stellaris_enet_state *)opaque; int i; if (version_id != 1) return -EINVAL; s->ris = qemu_get_be32(f); s->im = qemu_get_be32(f); s->rctl = qemu_get_be32(f); s->tctl = qemu_get_be32(f); s->thr = qemu_get_be32(f); s->mctl = qemu_get_be32(f); s->mdv = qemu_get_be32(f); s->mtxd = qemu_get_be32(f); s->mrxd = qemu_get_be32(f); s->np = qemu_get_be32(f); s->tx_fifo_len = qemu_get_be32(f); qemu_get_buffer(f, s->tx_fifo, sizeof(s->tx_fifo)); for (i = 0; i < 31; i++) { s->rx[i].len = qemu_get_be32(f); qemu_get_buffer(f, s->rx[i].data, sizeof(s->rx[i].data)); } s->next_packet = qemu_get_be32(f); s->rx_fifo_offset = qemu_get_be32(f); return 0; }
1threat
Strectch div to fit background image : <p>Can I stretch a div to fit the background image's width and height using only CSS? And if yes, how?<br> Div has width and height unset. </p> <p>I am <strong>NOT</strong> asking how to scale the image into a div.<br> I am <strong>NOT</strong> asking how to scale the image into a div with specific width and height.</p> <p>ie.</p> <pre><code> &lt;div class="banner" styles="width: auto; height: auto; background-image: url(unknown-size-img.jpg)"&gt; &lt;/div&gt; </code></pre>
0debug
How do I fix having an endless loop for my output? : I am trying to read data from a text file and display it on screen. Later I will be attempting to re-order the lines by symbol and percent gain, but first I wanted to make the code simply read and display what is contained. The actual question I am trying to answer is: (Stock Market) Write a program to help a local stock trading company automate its systems. The company invests only in the stock market. At the end of each trading day, the company would like to generate and post the listing of its stocks so that investors can see how their holdings performed that day. We assume that the company invests in, say, 10 different stocks. The desired output is to produce two listings, one sorted by stock symbol and another sorted by percent gain from highest to lowest. The input data is provided in a file in the following format: symbol openingPrice closingPrice todayHigh todayLow prevClose volume For example, the sample data is: Develop this programming exercise in two steps. In the first step (part a), design and implement a stock object. In the second step (part b), design and implement an object to maintain a list of stocks. a. (Stock Object) Design and implement the stock object. Call the class that captures the various characteristics of a stock object stockType. The main components of a stock are the stock symbol, stock price, and number of shares. Moreover, we need to output the opening price, closing price, high price, low price, previous price, and the percent gain/loss for the day. These are also all the characteristics of a stock. Therefore, the stock object should store all this information. Perform the following operations on each stock object: i. Set the stock information. ii. Print the stock information. iii. Show the different prices. iv. Calculate and print the percent gain/loss. v. Show the number of shares. a.1. The natural ordering of the stock list is by stock symbol. Overload the relational operators to compare two stock objects by their symbols. a.2. Overload the insertion operator, <<, for easy output. a.3. Because the data is stored in a file, overload the stream extraction operator, >>, for easy input. For example, suppose infile is an ifstream object and the input file was opened using the object infile. Further suppose that myStock is a stock object. Then, the statement: infile >> myStock; reads the data from the input file and stores it in the object myStock. b. Now that you have designed and implemented the class stockType to implement a stock object in a program, it is time to create a list of stock objects. Let us call the class to implement a list of stock objects stockListType. The class stockListType must be derived from the class listType, which you designed and implemented in the previous exercise. However, the class stockListType is a very specific class, designed to create a list of stock objects. Therefore, the class stockListType is no longer a template. Add and/or overwrite the operations of the class listType to implement the necessary operations on a stock list. The following statement derives the class stockListType from the class listType. class stockListType: public listType { member list }; The member variables to hold the list elements, the length of the list, and the max listSize were declared as protected in the class listType. Therefore, these members can be directly accessed in the class stockListType. Because the company also requires you to produce the list ordered by the percent gain/loss, you need to sort the stock list by this component. However, you are not to physically sort the list by the component percent gain/loss. Instead, you will provide a logical ordering with respect to this component. To do so, add a member variable, an array, to hold the indices of the stock list ordered by the component percent gain/loss. Call this array sortIndicesGainLoss. When printing the list ordered by the component percent gain/loss, use the array sortIndicesGainLoss to print the list. The elements of the array sortIndicesGainLoss will tell which component of the stock list to print next. c. Write a program that uses these two classes to automate the company’s analysis of stock data. This may be my end goal but I am not attempting to do some of what it describes yet. The part I believe is causing the issue is somewhere in here: void printScreen(ifstream &infile) { stockType in; stockType out; int count = 0; string line; cout << "********* First Investor's Heaven *********" << endl; cout << "********* Financial Report *********" << endl; cout << "Stock Today Previous Percent" << endl; cout << "Symbol Open Close High Low Close Gain Volume" << endl; cout << "----- ----- ----- ----- ------ ------- -----" << endl; while (getline(infile, line)) { count++; } for (int i = 0; i < count; i++) { infile >> in; cout << out; } cout << "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*"; } My main function is: int main() { char repeat = ' '; string userSelection; int selection; ifstream infile; cout << "Please enter a filename of type .txt: "; cin >> userSelection; infile.open(userSelection); if (!infile) { cout << userSelection << " is not found. The program will now exect. Please ensure the filename is correct and the file is in the porper directory." << endl; exit(0); } do { selection = Menu(); switch (selection) { case 1: printScreen(infile); break; case 2: exit(0); break; default: cout << "An error has occured, the program will now exit." << endl; exit(0); } cout << "If you would like to enter another file enter y. Otherwise the system will conclude: "; cin >> repeat; } while (repeat = 'y'); infile.close(); return 0; } and I am attempting to utilize this: ostream& operator << (ostream& out, stockType& temp) { char tab = '\t'; out.imbue(locale("")); out << setprecision(2) << fixed; out << temp.getStockSymbol() << tab << setw(6) << temp.getOpeningPrice() << tab << setw(6) << temp.getClosingPrice() << tab << setw(7) << temp.getHighPrice() << tab << setw(8) << temp.getLowPrice() << setw(9) << temp.getPreviousPrice() << setw(10) << temp.getPercentGainLoss() << "%" << tab << setw(11) << temp.getStockShares() << endl; return out; } istream& operator>>(istream& in, stockType& obj) { string temp; double val; int x; in >> temp; obj.setStockSymbol(temp); in >> val; obj.setOpeningPrice(val); in >> val; obj.setClosingPrice(val); in >> val; obj.setHighPrice(val); in >> val; obj.setLowPrice(val); in >> val; obj.setPreviousPrice(val); in >> x; obj.setStockShares(x); return in; } My output should be ordered the same way as it is being read yet I am getting no output of the symbol and I am getting an endless loop that doesn't seem to be reading everything.
0debug
Nuxt.js: Include font files: use /static or /assets : <p>I know some posts in the nuxt.js github repo cover this a bit, but I would like to know what is the correct way to use font-files in nuxt.js.</p> <p>So far we had them in the <code>/static/fonts</code> directory, but other people use <code>assets</code> to store the font files. What are the differences? Is one of the options better and if so, why?</p> <p>Also there are different ways to include them. Would a path like this be correct:</p> <pre><code>@font-face { font-family: 'FontName'; font-weight: normal; src: url('~static/fonts/font.file.eot'); /* IE9 Compat Mode */ src: url('~static/fonts/font.file.woff') format('woff'), url('~static/fonts/font.file.otf') format('otf'), url('~static/fonts/font.file.eot') format('eot'); } </code></pre> <p>Thanks for some clarification here :D. cheers</p> <p>J</p>
0debug
how to connect strings and VAR in javascript : This is my script code : <script type="text/javascript"> <!---Calculation---> $(document).ready(function(){ var o = 0; o=o+0; for(o; o<=100; 0++){ var price=$("#price").html(); var i=1; var add; var subtr; var qty; $('#add').click(function(){ qty = $('#pro_qty').val(); add = Number(qty) + Number(i); result= Number(price)* (Number(qty) + Number(i)); $('#pro_qty').val(add); $('.result').html(result); }); $('#subtr').click(function(){ if(qty>1){ all_price=$('.result').text(); result=Number(all_price)- Number(price); qty=$('#pro_qty').val(); subtr = Number(qty)-1; $('.result').html(result); $('#pro_qty').val(subtr); }else{ $('#pro_qty').val(1); $('.result').html(price); } }); } }); </script> And now I want to connect Var S with the others in FOR loop For example : all_price=$('.result + s').text(); => and the result I want to have : all_price=$('.result1').text(); ,all_price=$('.result2').text(); ....... How can I do like that code ??? Thanks in advanced
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
The 'Apple Developer Program License Agreement' has been updated : <p>My Xcode automatically updated now I'm getting this error:</p> <blockquote> <p>The 'Apple Developer Program License Agreement' has been updated. In order to access certain membership resources, you must accept the latest license agreement.</p> </blockquote> <p>I feel so dumb. Where do I go to accept this?</p>
0debug
static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time) { char buf[1024]; AVBPrint buf_script; OutputStream *ost; AVFormatContext *oc; int64_t total_size; AVCodecContext *enc; int frame_number, vid, i; double bitrate; double speed; int64_t pts = INT64_MIN + 1; static int64_t last_time = -1; static int qp_histogram[52]; int hours, mins, secs, us; float t; if (!print_stats && !is_last_report && !progress_avio) return; if (!is_last_report) { if (last_time == -1) { last_time = cur_time; return; } if ((cur_time - last_time) < 500000) return; last_time = cur_time; } t = (cur_time-timer_start) / 1000000.0; oc = output_files[0]->ctx; total_size = avio_size(oc->pb); if (total_size <= 0) total_size = avio_tell(oc->pb); buf[0] = '\0'; vid = 0; av_bprint_init(&buf_script, 0, 1); for (i = 0; i < nb_output_streams; i++) { float q = -1; ost = output_streams[i]; enc = ost->enc_ctx; if (!ost->stream_copy) q = ost->quality / (float) FF_QP2LAMBDA; if (vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "q=%2.1f ", q); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); } if (!vid && enc->codec_type == AVMEDIA_TYPE_VIDEO) { float fps; frame_number = ost->frame_number; fps = t > 1 ? frame_number / t : 0; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "frame=%5d fps=%3.*f q=%3.1f ", frame_number, fps < 9.95, fps, q); av_bprintf(&buf_script, "frame=%d\n", frame_number); av_bprintf(&buf_script, "fps=%.1f\n", fps); av_bprintf(&buf_script, "stream_%d_%d_q=%.1f\n", ost->file_index, ost->index, q); if (is_last_report) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "L"); if (qp_hist) { int j; int qp = lrintf(q); if (qp >= 0 && qp < FF_ARRAY_ELEMS(qp_histogram)) qp_histogram[qp]++; for (j = 0; j < 32; j++) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%X", (int)lrintf(log2(qp_histogram[j] + 1))); } if ((enc->flags & AV_CODEC_FLAG_PSNR) && (ost->pict_type != AV_PICTURE_TYPE_NONE || is_last_report)) { int j; double error, error_sum = 0; double scale, scale_sum = 0; double p; char type[3] = { 'Y','U','V' }; snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "PSNR="); for (j = 0; j < 3; j++) { if (is_last_report) { error = enc->error[j]; scale = enc->width * enc->height * 255.0 * 255.0 * frame_number; } else { error = ost->error[j]; scale = enc->width * enc->height * 255.0 * 255.0; } if (j) scale /= 4; error_sum += error; scale_sum += scale; p = psnr(error / scale); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%c:%2.2f ", type[j], p); av_bprintf(&buf_script, "stream_%d_%d_psnr_%c=%2.2f\n", ost->file_index, ost->index, type[j] | 32, p); } p = psnr(error_sum / scale_sum); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "*:%2.2f ", psnr(error_sum / scale_sum)); av_bprintf(&buf_script, "stream_%d_%d_psnr_all=%2.2f\n", ost->file_index, ost->index, p); } vid = 1; } if (av_stream_get_end_pts(ost->st) != AV_NOPTS_VALUE) pts = FFMAX(pts, av_rescale_q(av_stream_get_end_pts(ost->st), ost->st->time_base, AV_TIME_BASE_Q)); if (is_last_report) nb_frames_drop += ost->last_dropped; } secs = FFABS(pts) / AV_TIME_BASE; us = FFABS(pts) % AV_TIME_BASE; mins = secs / 60; secs %= 60; hours = mins / 60; mins %= 60; bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1; speed = t != 0.0 ? (double)pts / AV_TIME_BASE / t : -1; if (total_size < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=N/A time="); else snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "size=%8.0fkB time=", total_size / 1024.0); if (pts < 0) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "-"); snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%02d:%02d:%02d.%02d ", hours, mins, secs, (100 * us) / AV_TIME_BASE); if (bitrate < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=N/A"); av_bprintf(&buf_script, "bitrate=N/A\n"); }else{ snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),"bitrate=%6.1fkbits/s", bitrate); av_bprintf(&buf_script, "bitrate=%6.1fkbits/s\n", bitrate); } if (total_size < 0) av_bprintf(&buf_script, "total_size=N/A\n"); else av_bprintf(&buf_script, "total_size=%"PRId64"\n", total_size); av_bprintf(&buf_script, "out_time_ms=%"PRId64"\n", pts); av_bprintf(&buf_script, "out_time=%02d:%02d:%02d.%06d\n", hours, mins, secs, us); if (nb_frames_dup || nb_frames_drop) snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " dup=%d drop=%d", nb_frames_dup, nb_frames_drop); av_bprintf(&buf_script, "dup_frames=%d\n", nb_frames_dup); av_bprintf(&buf_script, "drop_frames=%d\n", nb_frames_drop); if (speed < 0) { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf)," speed=N/A"); av_bprintf(&buf_script, "speed=N/A\n"); } else { snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf)," speed=%4.3gx", speed); av_bprintf(&buf_script, "speed=%4.3gx\n", speed); } if (print_stats || is_last_report) { const char end = is_last_report ? '\n' : '\r'; if (print_stats==1 && AV_LOG_INFO > av_log_get_level()) { fprintf(stderr, "%s %c", buf, end); } else av_log(NULL, AV_LOG_INFO, "%s %c", buf, end); fflush(stderr); } if (progress_avio) { av_bprintf(&buf_script, "progress=%s\n", is_last_report ? "end" : "continue"); avio_write(progress_avio, buf_script.str, FFMIN(buf_script.len, buf_script.size - 1)); avio_flush(progress_avio); av_bprint_finalize(&buf_script, NULL); if (is_last_report) { avio_closep(&progress_avio); } } if (is_last_report) print_final_stats(total_size); }
1threat
static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue, int ctrl) { VirtIODevice *vdev = VIRTIO_DEVICE(n); int i, max = multiqueue ? n->max_queues : 1; n->multiqueue = multiqueue; for (i = 2; i <= n->max_queues * 2 + 1; i++) { virtio_del_queue(vdev, i); } for (i = 1; i < max; i++) { n->vqs[i].rx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_rx); if (n->vqs[i].tx_timer) { n->vqs[i].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_timer); n->vqs[i].tx_timer = qemu_new_timer_ns(vm_clock, virtio_net_tx_timer, &n->vqs[i]); } else { n->vqs[i].tx_vq = virtio_add_queue(vdev, 256, virtio_net_handle_tx_bh); n->vqs[i].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[i]); } n->vqs[i].tx_waiting = 0; n->vqs[i].n = n; } if (ctrl) { n->ctrl_vq = virtio_add_queue(vdev, 64, virtio_net_handle_ctrl); } virtio_net_set_queues(n); }
1threat
static int decode_slice(AVCodecContext *avctx, void *tdata) { ProresThreadData *td = tdata; ProresContext *ctx = avctx->priv_data; int mb_x_pos = td->x_pos; int mb_y_pos = td->y_pos; int pic_num = ctx->pic_num; int slice_num = td->slice_num; int mbs_per_slice = td->slice_width; const uint8_t *buf; uint8_t *y_data, *u_data, *v_data, *a_data; AVFrame *pic = ctx->frame; int i, sf, slice_width_factor; int slice_data_size, hdr_size; int y_data_size, u_data_size, v_data_size, a_data_size; int y_linesize, u_linesize, v_linesize, a_linesize; int coff[4]; int ret; buf = ctx->slice_data[slice_num].index; slice_data_size = ctx->slice_data[slice_num + 1].index - buf; slice_width_factor = av_log2(mbs_per_slice); y_data = pic->data[0]; u_data = pic->data[1]; v_data = pic->data[2]; a_data = pic->data[3]; y_linesize = pic->linesize[0]; u_linesize = pic->linesize[1]; v_linesize = pic->linesize[2]; a_linesize = pic->linesize[3]; if (pic->interlaced_frame) { if (!(pic_num ^ pic->top_field_first)) { y_data += y_linesize; u_data += u_linesize; v_data += v_linesize; if (a_data) a_data += a_linesize; } y_linesize <<= 1; u_linesize <<= 1; v_linesize <<= 1; a_linesize <<= 1; } y_data += (mb_y_pos << 4) * y_linesize + (mb_x_pos << 5); u_data += (mb_y_pos << 4) * u_linesize + (mb_x_pos << ctx->mb_chroma_factor); v_data += (mb_y_pos << 4) * v_linesize + (mb_x_pos << ctx->mb_chroma_factor); if (a_data) a_data += (mb_y_pos << 4) * a_linesize + (mb_x_pos << 5); if (slice_data_size < 6) { av_log(avctx, AV_LOG_ERROR, "slice data too small\n"); return AVERROR_INVALIDDATA; } hdr_size = buf[0] >> 3; coff[0] = hdr_size; y_data_size = AV_RB16(buf + 2); coff[1] = coff[0] + y_data_size; u_data_size = AV_RB16(buf + 4); coff[2] = coff[1] + u_data_size; v_data_size = hdr_size > 7 ? AV_RB16(buf + 6) : slice_data_size - coff[2]; coff[3] = coff[2] + v_data_size; a_data_size = ctx->alpha_info ? slice_data_size - coff[3] : 0; if (v_data_size < 0 || a_data_size < 0 || hdr_size < 6) { av_log(avctx, AV_LOG_ERROR, "invalid data size\n"); return AVERROR_INVALIDDATA; } sf = av_clip(buf[1], 1, 224); sf = sf > 128 ? (sf - 96) << 2 : sf; if (ctx->qmat_changed || sf != td->prev_slice_sf) { td->prev_slice_sf = sf; for (i = 0; i < 64; i++) { td->qmat_luma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_luma[i] * sf; td->qmat_chroma_scaled[ctx->dsp.idct_permutation[i]] = ctx->qmat_chroma[i] * sf; } } ret = decode_slice_plane(ctx, td, buf + coff[0], y_data_size, (uint16_t*) y_data, y_linesize, mbs_per_slice, 4, slice_width_factor + 2, td->qmat_luma_scaled, 0); if (ret < 0) return ret; ret = decode_slice_plane(ctx, td, buf + coff[1], u_data_size, (uint16_t*) u_data, u_linesize, mbs_per_slice, ctx->num_chroma_blocks, slice_width_factor + ctx->chroma_factor - 1, td->qmat_chroma_scaled, 1); if (ret < 0) return ret; ret = decode_slice_plane(ctx, td, buf + coff[2], v_data_size, (uint16_t*) v_data, v_linesize, mbs_per_slice, ctx->num_chroma_blocks, slice_width_factor + ctx->chroma_factor - 1, td->qmat_chroma_scaled, 1); if (ret < 0) return ret; if (a_data && a_data_size) decode_alpha_plane(ctx, td, buf + coff[3], a_data_size, (uint16_t*) a_data, a_linesize, mbs_per_slice); return 0; }
1threat
Find the number of quadruplets with GCD equal to 1 : <p>Given a sequence of numbers from 1 to N, we have to find the number of quadruplets such that their Greatest Common Divisor (GCD) is 1.</p> <p><em>Constraints</em> : N &lt;= 10^5</p> <p><em>Example</em> : N=5. So the number of such quadruplets from {1,2,3,4,5} are :</p> <ul> <li>{1,2,3,4}</li> <li>{1,2,3,5}</li> <li>{1,2,4,5}</li> <li>{1,3,4,5}</li> <li>{2,3,4,5}</li> </ul> <p>So the answer in this case is 5.</p>
0debug
static int qemu_save_device_state(QEMUFile *f) { SaveStateEntry *se; qemu_put_be32(f, QEMU_VM_FILE_MAGIC); qemu_put_be32(f, QEMU_VM_FILE_VERSION); cpu_synchronize_all_states(); QTAILQ_FOREACH(se, &savevm_state.handlers, entry) { if (se->is_ram) { continue; } if ((!se->ops || !se->ops->save_state) && !se->vmsd) { continue; } save_section_header(f, se, QEMU_VM_SECTION_FULL); vmstate_save(f, se, NULL); } qemu_put_byte(f, QEMU_VM_EOF); return qemu_file_get_error(f); }
1threat
YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48be, PIX_FMT_RGB48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, rgb48le, PIX_FMT_RGB48LE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48be, PIX_FMT_BGR48BE) YUV2PACKED16WRAPPER(yuv2, rgb48, bgr48le, PIX_FMT_BGR48LE) static av_always_inline void yuv2rgb_write(uint8_t *_dest, int i, int Y1, int Y2, int U, int V, int A1, int A2, const void *_r, const void *_g, const void *_b, int y, enum PixelFormat target, int hasAlpha) { if (target == PIX_FMT_ARGB || target == PIX_FMT_RGBA || target == PIX_FMT_ABGR || target == PIX_FMT_BGRA) { uint32_t *dest = (uint32_t *) _dest; const uint32_t *r = (const uint32_t *) _r; const uint32_t *g = (const uint32_t *) _g; const uint32_t *b = (const uint32_t *) _b; #if CONFIG_SMALL int sh = hasAlpha ? ((target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24) : 0; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (hasAlpha ? A1 << sh : 0); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (hasAlpha ? A2 << sh : 0); #else if (hasAlpha) { int sh = (target == PIX_FMT_RGB32_1 || target == PIX_FMT_BGR32_1) ? 0 : 24; dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1] + (A1 << sh); dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2] + (A2 << sh); } else { dest[i * 2 + 0] = r[Y1] + g[Y1] + b[Y1]; dest[i * 2 + 1] = r[Y2] + g[Y2] + b[Y2]; } #endif } else if (target == PIX_FMT_RGB24 || target == PIX_FMT_BGR24) { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; #define r_b ((target == PIX_FMT_RGB24) ? r : b) #define b_r ((target == PIX_FMT_RGB24) ? b : r) dest[i * 6 + 0] = r_b[Y1]; dest[i * 6 + 1] = g[Y1]; dest[i * 6 + 2] = b_r[Y1]; dest[i * 6 + 3] = r_b[Y2]; dest[i * 6 + 4] = g[Y2]; dest[i * 6 + 5] = b_r[Y2]; #undef r_b #undef b_r } else if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565 || target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555 || target == PIX_FMT_RGB444 || target == PIX_FMT_BGR444) { uint16_t *dest = (uint16_t *) _dest; const uint16_t *r = (const uint16_t *) _r; const uint16_t *g = (const uint16_t *) _g; const uint16_t *b = (const uint16_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB565 || target == PIX_FMT_BGR565) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_4[ y & 1 ][0]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_4[ y & 1 ][1]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else if (target == PIX_FMT_RGB555 || target == PIX_FMT_BGR555) { dr1 = dither_2x2_8[ y & 1 ][0]; dg1 = dither_2x2_8[ y & 1 ][1]; db1 = dither_2x2_8[(y & 1) ^ 1][0]; dr2 = dither_2x2_8[ y & 1 ][1]; dg2 = dither_2x2_8[ y & 1 ][0]; db2 = dither_2x2_8[(y & 1) ^ 1][1]; } else { dr1 = dither_4x4_16[ y & 3 ][0]; dg1 = dither_4x4_16[ y & 3 ][1]; db1 = dither_4x4_16[(y & 3) ^ 3][0]; dr2 = dither_4x4_16[ y & 3 ][1]; dg2 = dither_4x4_16[ y & 3 ][0]; db2 = dither_4x4_16[(y & 3) ^ 3][1]; } dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } else { uint8_t *dest = (uint8_t *) _dest; const uint8_t *r = (const uint8_t *) _r; const uint8_t *g = (const uint8_t *) _g; const uint8_t *b = (const uint8_t *) _b; int dr1, dg1, db1, dr2, dg2, db2; if (target == PIX_FMT_RGB8 || target == PIX_FMT_BGR8) { const uint8_t * const d64 = dither_8x8_73[y & 7]; const uint8_t * const d32 = dither_8x8_32[y & 7]; dr1 = dg1 = d32[(i * 2 + 0) & 7]; db1 = d64[(i * 2 + 0) & 7]; dr2 = dg2 = d32[(i * 2 + 1) & 7]; db2 = d64[(i * 2 + 1) & 7]; } else { const uint8_t * const d64 = dither_8x8_73 [y & 7]; const uint8_t * const d128 = dither_8x8_220[y & 7]; dr1 = db1 = d128[(i * 2 + 0) & 7]; dg1 = d64[(i * 2 + 0) & 7]; dr2 = db2 = d128[(i * 2 + 1) & 7]; dg2 = d64[(i * 2 + 1) & 7]; } if (target == PIX_FMT_RGB4 || target == PIX_FMT_BGR4) { dest[i] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1] + ((r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]) << 4); } else { dest[i * 2 + 0] = r[Y1 + dr1] + g[Y1 + dg1] + b[Y1 + db1]; dest[i * 2 + 1] = r[Y2 + dr2] + g[Y2 + dg2] + b[Y2 + db2]; } } }
1threat
change the title color of keyboard toolbar objective c : i want to change the title color of keyboard toobar i.e(submit button), and the other is how can i add the image for keyboard toolbar. TIA UIToolbar *keyboardToolbar = [[UIToolbar alloc] init]; [keyboardToolbar sizeToFit]; keyboardToolbar.translucent=NO; //if you want it. keyboardToolbar.barTintColor = [UIColor lightGrayColor]; _txtCommentView.inputAccessoryView = keyboardToolbar; keyboardToolbar.items = [NSArray arrayWithObjects: [[UIBarButtonItem alloc]initWithTitle:@"Submit" style:UIBarButtonItemStyleBordered target:self action:@selector(submitClicked:)], nil];
0debug
Checkpointing in high availability : <p>In Hadoop high availability, Check pointing is done by which node? Is there a secondary name node in addition to the active and the stand-by nodes which does the check pointing?</p>
0debug
R: How to delete a particular row in a matrix? : <p>I have a matrix such as:</p> <pre><code>&gt; ex2 [,1] [,2] [,3] [,4] [,5] [1,] 1 1912 55.40000 49.06132 6.3386825 [2,] 9 1944 53.76998 46.90905 6.8609322 [3,] 10 1948 52.31764 48.65840 3.6592392 [4,] 11 1952 44.71056 50.34861 -5.6380584 [5,] 13 1960 50.08676 47.58916 2.4975960 [6,] 15 1968 49.59538 57.16136 -7.5659793 [7,] 17 1976 51.05214 43.28484 7.7672977 [8,] 18 1980 44.69676 57.55835 -12.8615819 [9,] 23 2000 50.26476 49.67494 0.5898139 [10,] 25 2008 53.68885 49.11433 4.5745194 </code></pre> <p>I want to delete the row with the values related to year 2000 (So, <em>in <strong>this</strong> case, I want to delete row 9</em>).</p> <p>The matrix does not necessarily contain the values for 2000. For example, it may be:</p> <pre><code>&gt; ex3 [,1] [,2] [,3] [,4] [,5] [1,] 13 1960 50.08676 43.08453 7.002226 [2,] 25 2008 53.68885 49.92650 3.762 </code></pre> <p>Thanks in advance.</p>
0debug
void usb_desc_attach(USBDevice *dev) { const USBDesc *desc = usb_device_get_usb_desc(dev); assert(desc != NULL); if (desc->super && (dev->port->speedmask & USB_SPEED_MASK_SUPER)) { dev->speed = USB_SPEED_SUPER; } else if (desc->high && (dev->port->speedmask & USB_SPEED_MASK_HIGH)) { dev->speed = USB_SPEED_HIGH; } else if (desc->full && (dev->port->speedmask & USB_SPEED_MASK_FULL)) { dev->speed = USB_SPEED_FULL; } else { return; } usb_desc_setdefaults(dev); }
1threat
Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored' : <p>Today, I face the error mentioned in this post: <a href="https://stackoverflow.com/questions/42144415/">Error retrieving parent for item: No resource found that matches the given name &#39;android:TextAppearance.Material.Widget.Button.Borderless.Colored&#39;</a></p> <p>The funny thing (and the difference) is - our application is 5 months in production and we've made hundreds of builds and APKs so far. We didn't change a single line of code for a week (neither any of library version) and the build has suddenly stopped working with this mentioned error.</p> <pre><code>Execution failed for task ':react-native-fbsdk:processReleaseResources' X:\app\node_modules\react-native-fbsdk\android\build\intermediates\res\merged\release\values-v24\values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. X:\app\node_modules\react-native-fbsdk\android\build\intermediates\res\merged\release\values-v24\values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. X:\app\node_modules\react-native-fbsdk\android\build\intermediates\res\merged\release\values-v24\values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. X:\app\node_modules\react-native-fbsdk\android\build\intermediates\res\merged\release\values-v24\values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. </code></pre> <p>Using these versions of libraries (package.json):</p> <pre><code>... "react": "15.3.2", "react-native": "0.37.0", ... "react-native-fbsdk": "~0.5.0", ... </code></pre> <p>Our build.gradle (not whole), which worked until now:</p> <pre><code> compileSdkVersion 24 buildToolsVersion '24.0.3' defaultConfig { applicationId "xxx" minSdkVersion 16 targetSdkVersion 23 versionCode 14 versionName "1.5.3" ndk { abiFilters "armeabi-v7a", "x86" } } dependencies { compile project(':react-native-device-info') compile project(':react-native-maps') compile project(':realm') compile project(':react-native-vector-icons') compile project(':react-native-image-picker') compile project(':react-native-fs') compile project(':react-native-share') compile project(':react-native-push-notification') compile project(':react-native-fbsdk') compile('com.google.android.gms:play-services-gcm:9.4.0') { force = true; } compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.0.1' compile 'com.facebook.react:react-native:+' compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.3' compile 'com.fasterxml.jackson.core:jackson-core:2.2.3' compile 'com.fasterxml.jackson.core:jackson-databind:2.2.3' } </code></pre> <p>Any ideas please?</p>
0debug
how to close a window using selenium in python with html as follows : I am using selenium in python to try to close a window, but the close button has html as follows, so what shall my driver selects to close it? html:<div class="close-button-container"><a href="#0" class="overlay-panel-close fg-close-tab-gtm">Close</a></div>
0debug
void xtensa_translate_init(void) { static const char * const regnames[] = { "ar0", "ar1", "ar2", "ar3", "ar4", "ar5", "ar6", "ar7", "ar8", "ar9", "ar10", "ar11", "ar12", "ar13", "ar14", "ar15", }; static const char * const fregnames[] = { "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", }; int i; cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env"); cpu_pc = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUXtensaState, pc), "pc"); for (i = 0; i < 16; i++) { cpu_R[i] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUXtensaState, regs[i]), regnames[i]); } for (i = 0; i < 16; i++) { cpu_FR[i] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUXtensaState, fregs[i]), fregnames[i]); } for (i = 0; i < 256; ++i) { if (sregnames[i]) { cpu_SR[i] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUXtensaState, sregs[i]), sregnames[i]); } } for (i = 0; i < 256; ++i) { if (uregnames[i]) { cpu_UR[i] = tcg_global_mem_new_i32(TCG_AREG0, offsetof(CPUXtensaState, uregs[i]), uregnames[i]); } } #define GEN_HELPER 2 #include "helper.h" }
1threat
Creating a leaderboard in python : i currently had no idea how to create a leaderboard using python. I have a txt file which looks like this: a 100 c 50 d 700 b 5 I want to sort the leaderboard by score so the output should be like this: b 5 c 50 a 100 d 700 Is it possible to do it with python?
0debug
Which of /usr/bin/perl or /usr/local/bin/perl should be used? : <p>If I have both <code>/usr/bin/perl</code> and <code>/usr/local/bin/perl</code> available on a system, which one should I use?</p>
0debug
Deleted anaconda to remove python3 in the hopes of going back to python2. : I installed python3 with anaconda when I did some of my ML stuff. Now I wanted to use python2 for a script I'm building but python defaults to python3 and I couldn't find any solution to switch or remove python3 so I deleted anaconda folder hoping python to revert back to python 2 since it won't be able to locate the python3 folder (inside anaconda). But instead I'm getting this error: -bash: //anaconda/bin/python: No such file or directory Does anyone know how to get python2 working again? I'm fine with uninstalling python3 and I'm on Mac btw. Thank you! :)
0debug
type_init(serial_register_types) static bool serial_isa_init(ISABus *bus, int index, CharDriverState *chr) { DeviceState *dev; ISADevice *isadev; isadev = isa_try_create(bus, TYPE_ISA_SERIAL); if (!isadev) { return false; } dev = DEVICE(isadev); qdev_prop_set_uint32(dev, "index", index); qdev_prop_set_chr(dev, "chardev", chr); if (qdev_init(dev) < 0) { return false; } return true; }
1threat
How to do memory implementation of Hoffman Agorithm? : What i mean is how to represent character with bits in memory. All Characters are 8 bits by default how to change their representation to 3 bit.(C/C++ language should be preferred for implementatiton)
0debug
Using moment.js to get number of days in current month : <p>How would one use moment.js to get the number of days in the current month? Preferably without temporary variables.</p>
0debug
unable to process zipfile send to sftp c# : <p>I have passed a zip file to SFTP server using Rensi.SSh. But the file is unable to process in SFTP. But when I manually copy the zip file, it is working fine. Can anyone help me on this. Zip file is compressed using IO.Compression.</p>
0debug
Am I able to complement a virtual function of subclasses? : <p>i have a question. Lets say i have this virtual function in main class:</p> <pre><code>virtual void h_w() { cout &lt;&lt; "Hello, wolrd!" &lt;&lt; endl; } </code></pre> <p>And Im doing with the same function that:</p> <pre><code>void h_w() { cout &lt;&lt; "Today is: " &lt;&lt; math.rand(); &lt;&lt; endl; } </code></pre> <p>Am I allowed to do that? I mean, can i change body of main function like I want in subclasses? Thanks.</p>
0debug
how to check checkbox when right click in jquary : [This is my working table][1] [1]: http://i.stack.imgur.com/00gtd.jpg There are check boxes in table.I want to check those row by row when right click on the row.
0debug
C# - Selecting SQL Table contends into textbox : Trying to get table contents into textBoxes seperately by the prefered ID number when button_click event occours. I've found some videos about the situation but dataGrids were used in those. I'm a complete newbie in C# btw, and i'm not even sure what i'm doing. Question is, i cant figure how to write a read-only object that is stated below in code into a textBox. I'm %90 sure that it's truly a simple thing, and i'm missing it. private void button2_Click(object sender, EventArgs e) { SqlCommand rcmd = new SqlCommand("SELECT ID, Column1, Column2 FROM [TEST].[dbo].[Table_1] where ID=@ID", connection); rcmd.Parameters.AddWithValue("@ID", textBox3.Text); connection.Open(); SqlDataReader reader = rcmd.ExecuteReader(); while (reader.Read()) { //reader["Column1"] = textBox4.Text; //reader["Column2"] = textBox5.Text; //These wont work, says reader["Column1"] and reader["Column2"] are read-only. What to do? } connection.Close(); Lines with error are intentionally commented. No mistake there. I was trying to figure something else while keeping those in my sight. Thanks in advance.
0debug
static void unref_picture(H264Context *h, Picture *pic) { int off = offsetof(Picture, tf) + sizeof(pic->tf); int i; if (!pic->f.data[0]) return; ff_thread_release_buffer(h->avctx, &pic->tf); av_buffer_unref(&pic->hwaccel_priv_buf); av_buffer_unref(&pic->qscale_table_buf); av_buffer_unref(&pic->mb_type_buf); for (i = 0; i < 2; i++) { av_buffer_unref(&pic->motion_val_buf[i]); av_buffer_unref(&pic->ref_index_buf[i]); } memset((uint8_t*)pic + off, 0, sizeof(*pic) - off); }
1threat
static void dump_cook_context(COOKContext *q, COOKextradata *e) { #define PRINT(a,b) av_log(NULL,AV_LOG_ERROR," %s = %d\n", a, b); av_log(NULL,AV_LOG_ERROR,"COOKextradata\n"); av_log(NULL,AV_LOG_ERROR,"cookversion=%x\n",e->cookversion); if (e->cookversion > MONO_COOK2) { PRINT("js_subband_start",e->js_subband_start); PRINT("js_vlc_bits",e->js_vlc_bits); } av_log(NULL,AV_LOG_ERROR,"COOKContext\n"); PRINT("nb_channels",q->nb_channels); PRINT("bit_rate",q->bit_rate); PRINT("sample_rate",q->sample_rate); PRINT("samples_per_channel",q->samples_per_channel); PRINT("samples_per_frame",q->samples_per_frame); PRINT("subbands",q->subbands); PRINT("random_state",q->random_state); PRINT("mlt_size",q->mlt_size); PRINT("js_subband_start",q->js_subband_start); PRINT("numvector_bits",q->numvector_bits); PRINT("numvector_size",q->numvector_size); PRINT("total_subbands",q->total_subbands); PRINT("frame_reorder_counter",q->frame_reorder_counter); PRINT("frame_reorder_index_size",q->frame_reorder_index_size); }
1threat
Debug and Finding error in Bean Shell in Andriod : I'm using paw server and bean shell scripting in html which return the data in json form somehow i cant get any data from the script and I am not able to debug the script . Here is the code <bsh> import android.net.Uri; import android.provider.Contacts.People; import android.provider.Contacts.Phones; import java.text.DateFormat; service = server.props.get("serviceContext"); delete = parameters.get("delete"); SMS_CONTENT_URI = Uri.parse("content://sms"); // ArrayList for thread information listThreads = new ArrayList(); URI = Uri.parse("content://sms"); // --- Thread IDs cur = service.getContentResolver().query(URI, new String[] {"DISTINCT thread_id"}, null, null, "date DESC"); threadIDs = new ArrayList(); if(cur.moveToFirst()) { do { threadIDs.add(cur.getInt(0)); } while(cur.moveToNext()); } cur.close(); print("["); //--- Get infos Integer it = 0; for(id : threadIDs) { // ArrayList for this thread information listThreadInfo = new ArrayList(); /* List content 0: Thread ID (int) 1: Address (String) 2: Name (might be null) (String) 3: Contact ID (might be 0) (int) 4: Date (Date) 5: Messages in Thread (int) 6: Body (String) 7: Unread messages (int) */ // -- Messages in thread cur = service.getContentResolver().query(URI, new String[] { "COUNT(thread_id)" }, "thread_id=?", new String[] { "" + id }, null); cur.moveToFirst(); count = cur.getInt(0); cur.close(); // -- Unread messages cur = service.getContentResolver().query(URI, new String[] { "COUNT(read)" }, "thread_id=? AND read == 0", new String[] { "" + id }, null); cur.moveToFirst(); unread = cur.getInt(0); cur.close(); cur = service.getContentResolver().query(URI, null, "thread_id=?", new String[] { "" + id }, "date DESC LIMIT 1"); if(cur.moveToFirst()) { do { contactId = cur.getInt(cur.getColumnIndex("person")); address = cur.getString(cur.getColumnIndex("address")); date = new Date(cur.getLong(cur.getColumnIndex("date"))); body = cur.getString(cur.getColumnIndex("body")); // Only if address != null. Otherwise it's a DRAFT if(address != null) { name = null; phones = service.getContentResolver().query( android.provider.ContactsContract.CommonDataKinds.Phone.CONTENT_URI, new String[] { android.provider.ContactsContract.CommonDataKinds.Phone.RAW_CONTACT_ID }, android.provider.ContactsContract.CommonDataKinds.Phone.NUMBER + "=?", new String[] { address }, null ); if(phones.moveToFirst()) { contactId = phones.getInt(0); } phones.close(); if(contactId != 0) { contact = service.getContentResolver().query( android.provider.ContactsContract.Data.CONTENT_URI, new String[]{android.provider.ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME }, android.provider.ContactsContract.Data.RAW_CONTACT_ID + "=? AND " + android.provider.ContactsContract.CommonDataKinds.StructuredName.MIMETYPE + "=?", new String[] { "" + contactId, android.provider.ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE }, null ); if(contact.moveToFirst()) { name = contact.getString(0); } contact.close(); } listThreadInfo.add(0, id); listThreadInfo.add(1, address); listThreadInfo.add(2, name); listThreadInfo.add(3, contactId); listThreadInfo.add(4, date); listThreadInfo.add(5, count); listThreadInfo.add(6, body); listThreadInfo.add(7, unread); body = body.replace("\n", "<br>").replace("\t", " ").replace("\"", "\\\""); print("{"); print("\t\"id\" : " + id + ","); print("\t\"addr\" : \"" + address + "\","); print("\t\"name\" : \"" + name + "\","); print("\t\"contactId\" : " + contactId+ ","); print("\t\"date\" : " + date.getTime() + ","); print("\t\"count\" : " + count + ","); print("\t\"body\" : \"" + body + "\","); print("\t\"img\" : \"graphics/seeContactImg.xhtml?contactId=" + contactId + "\","); print("\t\"unread\" : " + unread); print("}"); it++; if(it < threadIDs.size()) { print(","); } listThreads.add(listThreadInfo); } } while(cur.moveToNext()); } cur.close(); } print("]"); </bsh> The following code return sms in json form .There is something wrong in it but Im not able to debug because it is written in .xhtml form
0debug
static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu, V9fsFidState *fidp, uint32_t max_count) { V9fsPath path; V9fsStat v9stat; int len, err = 0; int32_t count = 0; struct stat stbuf; off_t saved_dir_pos; struct dirent *dent; saved_dir_pos = v9fs_co_telldir(pdu, fidp); if (saved_dir_pos < 0) { return saved_dir_pos; } while (1) { v9fs_path_init(&path); v9fs_readdir_lock(&fidp->fs.dir); err = v9fs_co_readdir(pdu, fidp, &dent); if (err || !dent) { break; } err = v9fs_co_name_to_path(pdu, &fidp->path, dent->d_name, &path); if (err < 0) { break; } err = v9fs_co_lstat(pdu, &path, &stbuf); if (err < 0) { break; } err = stat_to_v9stat(pdu, &path, dent->d_name, &stbuf, &v9stat); if (err < 0) { break; } len = pdu_marshal(pdu, 11 + count, "S", &v9stat); v9fs_readdir_unlock(&fidp->fs.dir); if ((len != (v9stat.size + 2)) || ((count + len) > max_count)) { v9fs_co_seekdir(pdu, fidp, saved_dir_pos); v9fs_stat_free(&v9stat); v9fs_path_free(&path); return count; } count += len; v9fs_stat_free(&v9stat); v9fs_path_free(&path); saved_dir_pos = dent->d_off; } v9fs_readdir_unlock(&fidp->fs.dir); v9fs_path_free(&path); if (err < 0) { return err; } return count; }
1threat
how to get the first column/td value of a foreach loop : I want to get the ID of a row which I want to use to generate the url. I am generating the table rows using following code. <? $sql="SELECT pID,pName,pBudget,pRate FROM projects ORDER BY id"; $result=mysqli_query($con,$sql); $projects = array(); while($row = mysqli_fetch_assoc($result)) { $projects[] = $row; } foreach ($projects as $row) { echo "<tr>"; foreach ($row as $element) { echo "<td>".$element."</td>"; } echo "<td class=\"actions\"> <a href=\"project.php?pID=$element[0]\"> Go to Project </a> </td>"; echo "</tr>"; } ?> All work fine except the last <td> of the row. (not sure I am using the correct wording.) Let's say my database table row is pID | pName | pBudget | pRate ----------------------------------------- 12345 | Create Website | 250 | hourly then I am getting the table rows like this in my page <tr> <td>12345</td> <td>Create Website</td> <td>250</td> <td>hourly</td> <td><a href="project.php?pID=h">Got to project</a></td> </tr> Why the last `<td>` does not have the `pID` value '12345' and why there is 'h' ? I want the last `<td>` to be: <td><a href="project.php?pID=12345">Got to project</a></td>
0debug