problem
stringlengths
26
131k
labels
class label
2 classes
Android How to make a forum like this : What's the easiest way to create a forum like this with xml? [![Uber's driver forum][1]][1] [1]: https://i.stack.imgur.com/J02Ya.gif
0debug
Area of a circle segment on sphere (Earth) given central coordinates (lat / long), radius (meters) and central angle (degrees) : <h2>Situation</h2> <p>I have a circle segment and some information about the circle it belongs to.</p> <p>Given Information:</p> <ul> <li><strong>coordinates of the center</strong> of the circle (latitude / longitude)</li> <li><strong>radius</strong> of the circle in meters</li> <li><strong>central angle</strong> in degrees</li> </ul> <p>I need to calculate the <strong><code>area</code></strong> of the circle segment in JavaScript. But it should also depend on the radius of the Earth <em>(like <a href="https://en.wikipedia.org/wiki/Great-circle_distance" rel="nofollow noreferrer">great-circle distance</a>)</em>.</p> <h2>Problem</h2> <p>I have no idea how to do that and couldn't found any algorithms.</p> <p>Thanks for help</p>
0debug
Cannot find namespace NodeJS after webpack upgrade : <p>I have Angular2 application that is built with WebPack. I upgraded WebPack from v1.8 to v2, and everything seems to be working fine. The only problem is that the old code has the following:</p> <pre><code>import Timer = NodeJS.Timer; .... apptInterval: Timer; .... this.apptInterval = setInterval(() =&gt; { ... }, 1000); </code></pre> <p>After the upgrade this gives me an error: <code>TS2503: Cannot find namespace 'NodeJS'.</code></p> <p>tsconfig.json looks like this:</p> <pre><code>{ "compilerOptions": { "target": "es5", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": ["es2015", "dom"], "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true } } </code></pre> <p>The docs for Angular/Webpack no longer have <code>typings.json</code>; however, even if I copy from Webpack 1 directory, it doesn't help. The content is typings.json is</p> <pre><code>{ "globalDependencies": { "jasmine": "registry:dt/jasmine#2.2.0+20160621224255", "node": "registry:dt/node" } } </code></pre> <p>Interesting that if I remove references to NodeJS, everything works fine. Like this:</p> <pre><code>apptInterval: any; .... this.apptInterval = setInterval(() =&gt; { ... }, 1000); </code></pre> <p>If I look under F12 debugger, the type of apptInterval is <code>ZoneTask</code>. I am sure there is a way to make it strong-typed, but it escapes me. The only suggestion I found was to run <code>typings install dt~node --global --save-dev</code> (which essentially updates typings.json, but doesn't help.</p>
0debug
int do_snapshot_blkdev(Monitor *mon, const QDict *qdict, QObject **ret_data) { const char *device = qdict_get_str(qdict, "device"); const char *filename = qdict_get_try_str(qdict, "snapshot_file"); const char *format = qdict_get_try_str(qdict, "format"); BlockDriverState *bs; BlockDriver *drv, *proto_drv; int ret = 0; int flags; if (!filename) { qerror_report(QERR_MISSING_PARAMETER, "snapshot_file"); ret = -1; goto out; } bs = bdrv_find(device); if (!bs) { qerror_report(QERR_DEVICE_NOT_FOUND, device); ret = -1; goto out; } if (!format) { format = "qcow2"; } drv = bdrv_find_format(format); if (!drv) { qerror_report(QERR_INVALID_BLOCK_FORMAT, format); ret = -1; goto out; } proto_drv = bdrv_find_protocol(filename); if (!proto_drv) { qerror_report(QERR_INVALID_BLOCK_FORMAT, format); ret = -1; goto out; } ret = bdrv_img_create(filename, format, bs->filename, bs->drv->format_name, NULL, -1, bs->open_flags); if (ret) { goto out; } qemu_aio_flush(); bdrv_flush(bs); flags = bs->open_flags; bdrv_close(bs); ret = bdrv_open(bs, filename, flags, drv); if (ret != 0) { abort(); } out: if (ret) { ret = -1; } return ret; }
1threat
java.lang.IncompatibleClassChangeError: Implementing class with ScalaCheck and ScalaTest : <p>I'm facing a nasty exception when trying to write a test using ScalaCheck and ScalaTest. Here's my dependencies:</p> <pre><code>libraryDependencies ++= Seq( "org.scalatest" %% "scalatest" % "2.2.6" % "test", "org.scalacheck" %% "scalacheck" % "1.13.0" % "test" ) </code></pre> <p>Here's my test:</p> <pre><code>import org.scalatest.PropSpec import org.scalatest.prop.Checkers class MyPropSpec extends PropSpec with Checkers { property("List.concat") { check((a: List[Int], b: List[Int]) =&gt; a.size + b.size == (a ::: b).size) } } </code></pre> <p>When I try to run this I'm getting:</p> <pre><code>DeferredAbortedSuite: Exception encountered when attempting to run a suite with class name: org.scalatest.DeferredAbortedSuite *** ABORTED *** java.lang.IncompatibleClassChangeError: Implementing class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ... java.lang.IncompatibleClassChangeError: Implementing class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:760) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... </code></pre> <p>What am I missing here?</p>
0debug
Ubuntu 18.04 - firewall : <p>Can someone tell me which firewall is better to use for ubuntu 18.04? On previus version I used firestarter. Maybe is alternativ firewall? Firewall must have function for sharing the internet.</p> <p>Best regards, Jure</p>
0debug
static av_always_inline void hl_decode_mb_idct_luma(const H264Context *h, H264SliceContext *sl, int mb_type, int simple, int transform_bypass, int pixel_shift, const int *block_offset, int linesize, uint8_t *dest_y, int p) { void (*idct_add)(uint8_t *dst, int16_t *block, int stride); int i; block_offset += 16 * p; if (!IS_INTRA4x4(mb_type)) { if (IS_INTRA16x16(mb_type)) { if (transform_bypass) { if (h->sps.profile_idc == 244 && (sl->intra16x16_pred_mode == VERT_PRED8x8 || sl->intra16x16_pred_mode == HOR_PRED8x8)) { h->hpc.pred16x16_add[sl->intra16x16_pred_mode](dest_y, block_offset, sl->mb + (p * 256 << pixel_shift), linesize); } else { for (i = 0; i < 16; i++) if (sl->non_zero_count_cache[scan8[i + p * 16]] || dctcoef_get(sl->mb, pixel_shift, i * 16 + p * 256)) h->h264dsp.h264_add_pixels4_clear(dest_y + block_offset[i], sl->mb + (i * 16 + p * 256 << pixel_shift), linesize); } } else { h->h264dsp.h264_idct_add16intra(dest_y, block_offset, sl->mb + (p * 256 << pixel_shift), linesize, sl->non_zero_count_cache + p * 5 * 8); } } else if (sl->cbp & 15) { if (transform_bypass) { const int di = IS_8x8DCT(mb_type) ? 4 : 1; idct_add = IS_8x8DCT(mb_type) ? h->h264dsp.h264_add_pixels8_clear : h->h264dsp.h264_add_pixels4_clear; for (i = 0; i < 16; i += di) if (sl->non_zero_count_cache[scan8[i + p * 16]]) idct_add(dest_y + block_offset[i], sl->mb + (i * 16 + p * 256 << pixel_shift), linesize); } else { if (IS_8x8DCT(mb_type)) h->h264dsp.h264_idct8_add4(dest_y, block_offset, sl->mb + (p * 256 << pixel_shift), linesize, sl->non_zero_count_cache + p * 5 * 8); else h->h264dsp.h264_idct_add16(dest_y, block_offset, sl->mb + (p * 256 << pixel_shift), linesize, sl->non_zero_count_cache + p * 5 * 8); } } } }
1threat
static int ehci_execute(EHCIQueue *q) { USBPort *port; USBDevice *dev; int ret; int i; int endp; int devadr; if ( !(q->qh.token & QTD_TOKEN_ACTIVE)) { fprintf(stderr, "Attempting to execute inactive QH\n"); return USB_RET_PROCERR; } q->tbytes = (q->qh.token & QTD_TOKEN_TBYTES_MASK) >> QTD_TOKEN_TBYTES_SH; if (q->tbytes > BUFF_SIZE) { fprintf(stderr, "Request for more bytes than allowed\n"); return USB_RET_PROCERR; } q->pid = (q->qh.token & QTD_TOKEN_PID_MASK) >> QTD_TOKEN_PID_SH; switch(q->pid) { case 0: q->pid = USB_TOKEN_OUT; break; case 1: q->pid = USB_TOKEN_IN; break; case 2: q->pid = USB_TOKEN_SETUP; break; default: fprintf(stderr, "bad token\n"); break; } if ((q->tbytes && q->pid != USB_TOKEN_IN) && (ehci_buffer_rw(q, q->tbytes, 0) != 0)) { return USB_RET_PROCERR; } endp = get_field(q->qh.epchar, QH_EPCHAR_EP); devadr = get_field(q->qh.epchar, QH_EPCHAR_DEVADDR); ret = USB_RET_NODEV; for(i = 0; i < NB_PORTS; i++) { port = &q->ehci->ports[i]; dev = port->dev; if (!(q->ehci->portsc[i] &(PORTSC_CONNECT))) { DPRINTF("Port %d, no exec, not connected(%08X)\n", i, q->ehci->portsc[i]); continue; } q->packet.pid = q->pid; q->packet.devaddr = devadr; q->packet.devep = endp; q->packet.data = q->buffer; q->packet.len = q->tbytes; ret = usb_handle_packet(dev, &q->packet); DPRINTF("submit: qh %x next %x qtd %x pid %x len %d (total %d) endp %x ret %d\n", q->qhaddr, q->qh.next, q->qtdaddr, q->pid, q->packet.len, q->tbytes, endp, ret); if (ret != USB_RET_NODEV) { break; } } if (ret > BUFF_SIZE) { fprintf(stderr, "ret from usb_handle_packet > BUFF_SIZE\n"); return USB_RET_PROCERR; } return ret; }
1threat
static ssize_t nbd_receive_request(int csock, struct nbd_request *request) { uint8_t buf[4 + 4 + 8 + 8 + 4]; uint32_t magic; if (read_sync(csock, buf, sizeof(buf)) != sizeof(buf)) { LOG("read failed"); errno = EINVAL; return -1; } magic = be32_to_cpup((uint32_t*)buf); request->type = be32_to_cpup((uint32_t*)(buf + 4)); request->handle = be64_to_cpup((uint64_t*)(buf + 8)); request->from = be64_to_cpup((uint64_t*)(buf + 16)); request->len = be32_to_cpup((uint32_t*)(buf + 24)); TRACE("Got request: " "{ magic = 0x%x, .type = %d, from = %" PRIu64" , len = %u }", magic, request->type, request->from, request->len); if (magic != NBD_REQUEST_MAGIC) { LOG("invalid magic (got 0x%x)", magic); errno = EINVAL; return -1; } return 0; }
1threat
Calling another class method with local variable as parameter - Ruby : Hi I have this scenario: File a.rb class a def methodA variable = secureRandom.hex(4) #do some things b(variable) end end File b.rb class b def methodB(parameter) puts parameter end end I avoid details about includes but suppose that everything is ok. "variable" its a simple string and I just want to pass that string in a variable to a method from another class. Just the value, but things goes wrong! This code generates the following error: "Undefined local variable or method `randomName' " I am a newbie in Ruby, what am I doing wrong? I have read a lot about variable scopes I have a huge confusion.
0debug
When to use types (vs interface) in TS : <p>I cannot determine understand when, if ever, you'd want to use a <code>type</code> instead of an <code>interface</code> for a variable in typescript. Assume the following two:</p> <pre><code>type User = { id: string; name: string; type: string; } interface User { id: string; name: string; type: string; } </code></pre> <p>I can define a variable with both exactly the same was <code>const user: User = ...</code>. However, here are all the things I can do with <code>interface</code> that I cannot do with <code>types</code>:</p> <pre><code>// Extension: interface AdminUser extends User { permissions: string[]; role: string; } // Using in abstract method: abstract class Home { abstract login(user: User): void; } class AdminHome extends Home { login(user: AdminUser) { ... } } </code></pre> <p>Just to name a few.</p> <p>So my question is: when would you ever want to use a <code>type</code>?</p>
0debug
I have 2 CTE.When i try to join them i get an error message "ORA-01789: ".how can i merge the 2 CTE.Is there any other way to get the desired result : WITH IMPORT_CTE AS ((select A.* FROM IMPORT_REGISTRY_ERROR_LOG_1 A INNER JOIN (select distinct POD_ID,CONFLICTED_POD_ID,ERROR_CODE FROM IMPORT_REGISTRY_ERROR_LOG_1 GROUP BY POD_ID,CONFLICTED_POD_ID,ERROR_CODE HAVING COUNT(*) > 1) B on A.POD_ID = B.POD_ID AND A.CONFLICTED_POD_ID = B.CONFLICTED_POD_ID AND A.ERROR_CODE = B.ERROR_CODE ) order by a.pod_id desc) select t1.* from IMPORT_CTE t1 where t1.insert_date =(select max(t2.insert_date) from IMPORT_CTE t2 where t2.POD_ID =t1.POD_ID) WITH IMPORT_CTE1 AS ((select A.* FROM IMPORT_REGISTRY_ERROR_LOG_1 A INNER JOIN (select distinct POD_ID,CONFLICTED_POD_ID,ERROR_CODE FROM IMPORT_REGISTRY_ERROR_LOG_1 GROUP BY POD_ID,CONFLICTED_POD_ID,ERROR_CODE HAVING COUNT(*) > 1) B on A.POD_ID = B.POD_ID AND A.CONFLICTED_POD_ID = B.CONFLICTED_POD_ID AND A.ERROR_CODE = B.ERROR_CODE ) order by a.pod_id desc) select t1.insert_date from IMPORT_CTE1 t1 where t1.insert_date =(select min(t2.insert_date) from IMPORT_CTE1 t2 where t2.POD_ID =t1.POD_ID)
0debug
Storage of ASCII values of a string in an integral array in C : <p>How can i store <strong>ASCII</strong> values of a <strong>string</strong> in an <strong>integral array</strong> and not <strong>print</strong> them in <strong><em>C</em></strong>? For example: I input "<em>ABab</em>" and i have an array of a[4] then how can i store a[0]=67, a[1]=66, a[2]=97, a[3]=98?</p>
0debug
static void aflat(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column) { const int plane = s->desc->comp[component].plane; const int mirror = s->mirror; const int c0_linesize = in->linesize[ plane + 0 ]; const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; const int d0_linesize = out->linesize[ plane + 0 ]; const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; const int d2_linesize = out->linesize[(plane + 2) % s->ncomp]; const int max = 255 - intensity; const int src_h = in->height; const int src_w = in->width; int x, y; if (column) { const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); const int d2_signed_linesize = d2_linesize * (mirror == 1 ? -1 : 1); for (x = 0; x < src_w; x++) { const uint8_t *c0_data = in->data[plane + 0]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset * d0_linesize; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset * d1_linesize; uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset * d2_linesize; uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); uint8_t * const d2_bottom_line = d2_data + d2_linesize * (s->size - 1); uint8_t * const d2 = (mirror ? d2_bottom_line : d2_data); for (y = 0; y < src_h; y++) { const int c0 = c0_data[x] + 128; const int c1 = c1_data[x] - 128; const int c2 = c2_data[x] - 128; uint8_t *target; int p; target = d0 + x + d0_signed_linesize * c0; update(target, max, intensity); for (p = c0 + c1; p < c0; p++) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } for (p = c0 + c1 - 1; p > c0; p--) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } for (p = c0 + c2; p < c0; p++) { target = d2 + x + d2_signed_linesize * p; update(target, max, 1); } for (p = c0 + c2 - 1; p > c0; p--) { target = d2 + x + d2_signed_linesize * p; update(target, max, 1); } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; d2_data += d2_linesize; } } } else { const uint8_t *c0_data = in->data[plane]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset; uint8_t *d2_data = out->data[(plane + 2) % s->ncomp] + offset; if (mirror) { d0_data += s->size - 1; d1_data += s->size - 1; d2_data += s->size - 1; } for (y = 0; y < src_h; y++) { for (x = 0; x < src_w; x++) { const int c0 = c0_data[x] + 128; const int c1 = c1_data[x] - 128; const int c2 = c2_data[x] - 128; uint8_t *target; int p; if (mirror) target = d0_data - c0; else target = d0_data + c0; update(target, max, intensity); for (p = c0 + c1; p < c0; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } for (p = c0 + 1; p < c0 + c1; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } for (p = c0 + c2; p < c0; p++) { if (mirror) target = d2_data - p; else target = d2_data + p; update(target, max, 1); } for (p = c0 + 1; p < c0 + c2; p++) { if (mirror) target = d2_data - p; else target = d2_data + p; update(target, max, 1); } } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; d2_data += d2_linesize; } } envelope(s, out, plane, (plane + 0) % s->ncomp); envelope(s, out, plane, (plane + 1) % s->ncomp); envelope(s, out, plane, (plane + 2) % s->ncomp); }
1threat
how can i set circular image view on toolbar left side and when we slide a tab the Textview changes on toolbar like twitter : [how can I set Circular image view and when we slide a tab Textview changes ][1] [1]: https://i.stack.imgur.com/jm0wF.jpg
0debug
Postgres: check if array field contains value? : <p>I'm sure this is a duplicate question in the sense that the answer is out there somewhere, but I haven't been able to find the answer after Googling for 10 minutes, so I'd appeal to the editors not to close it on the basis that it might well be useful for other people. </p> <p>I'm using Postgres 9.5. This is my table:</p> <pre><code> Column β”‚ Type β”‚ Modifiers ─────────────────────────┼───────────────────────────┼───────────────────────────────────────────────────────────────────────── id β”‚ integer β”‚ not null default nextval('mytable_id_seq'::regclass) pmid β”‚ character varying(200) β”‚ pub_types β”‚ character varying(2000)[] β”‚ not null </code></pre> <p>I want to find all the rows with "Journal" in <code>pub_types</code>.</p> <p>I've found the docs and googled and this is what I've tried:</p> <pre><code>select * from mytable where ("Journal") IN pub_types; select * from mytable where "Journal" IN pub_types; select * from mytable where pub_types=ANY("Journal"); select * from mytable where pub_types IN ("Journal"); select * from mytable where where pub_types contains "Journal"; </code></pre> <p>I've scanned <a href="https://www.postgresql.org/docs/9.1/static/arrays.html" rel="noreferrer">the postgres array docs</a> but can't see a simple example of how to run a query, and StackOverflow questions all seem to be based around more complicated examples. </p>
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
Problems with scaling a recyclerView Item : I'm new to Android and made a layout with a RecyclerView where each item is a ImageView with a TextView under it with a shape under it to add borders to the item. The problem is on portrait the image dont fit the entire space while it does in landscape. [portrait Example][1] [landscape Example][2] How do i fix it so the portrait appears like the landscape? Thx. [1]: https://i.stack.imgur.com/kqyT3.png [2]: https://i.stack.imgur.com/vFQx0.png
0debug
How to enable / setup Dependency Caches for apt-get on BitBucket Pipelines : <p>I am using the following code in my <code>bitbucket-pipelines.yml</code> files to remotely deply code to a staging server.</p> <pre><code>image: php:7.1.1 pipelines: default: - step: script: # install ssh - apt-get update &amp;&amp; apt-get install -y openssh-client # get the latest code - ssh user@domain.com -F ~/.ssh/config "cd /path/to/code &amp;&amp; git pull" # update composer - ssh user@domain.com -F ~/.ssh/config "cd /path/to/code &amp;&amp; composer update --no-scripts" # optimise files - ssh user@domain.com -F ~/.ssh/config "cd /path/to/code &amp;&amp; php artisan optimize" </code></pre> <p>This all works, except that each time the pipeline is run, the ssh client is downloaded and installed everything (adding ~30 seconds to the build time). Is there way I can cache this step?</p> <p>And how can I go about caching the <code>apt-get</code> step?</p> <p>For example, would something like this work (or what changes are needed to make the following work):</p> <pre><code>pipelines: default: - step: caches: - aptget script: - apt-get update &amp;&amp; apt-get install -y openssh-client definitions: caches: aptget: which ssh </code></pre>
0debug
static void mxf_packet_timestamps(MXFContext *mxf, AVPacket *pkt) { int64_t last_ofs = -1, next_ofs; MXFIndexTable *t = &mxf->index_tables[0]; if (mxf->nb_index_tables <= 0) return; for (;;) { if (mxf_edit_unit_absolute_offset(mxf, t, mxf->current_edit_unit + 1, NULL, &next_ofs, 0) < 0) break; if (next_ofs <= last_ofs) { av_log(mxf->fc, AV_LOG_ERROR, "next_ofs didn't change. not deriving packet timestamps\n"); return; } if (next_ofs > pkt->pos) break; last_ofs = next_ofs; mxf->current_edit_unit++; } if (mxf->current_edit_unit >= t->nb_ptses) return; pkt->dts = mxf->current_edit_unit + t->first_dts; pkt->pts = t->ptses[mxf->current_edit_unit]; }
1threat
Xpath Expression to match text correctly, but trim leading and trailing whitespace : <p>I need an xpath expression for my selenium tests to get this element:</p> <pre><code>&lt;td class="label"&gt; Order Date &lt;/td&gt; </code></pre> <p>but not this one:</p> <pre><code>&lt;td class="label"&gt; Order Dates &lt;/td&gt; </code></pre> <p>I tried these two: </p> <pre><code>"//*[text() = 'Order Date']" "//*[text()[contains(.,'Order Date')]]" </code></pre> <p>But the exact match expression doesn't take the whitespace into account, and the contains expression also targets the element with an <code>s</code>. </p>
0debug
while doing upcasting how the below code will execute : <p>When I execute it method portion is overriding nd giving subclass statement as o/p but variable is giving superclass value?also can u explain memory allocation for this?</p> <pre><code>public class demo { public static void main(String[] args) { aaa bb=new b(); System.out.println(bb.a); int c=bb.eat(); System.out.println(c); } } class aaa{ int a=30; int eat() {int x=60; System.out.println("CHEWING"); return x; } } class b extends aaa{ int a=23; int eat() { //super.eat(); int x=70; System.out.println("EaTING"); return x; } } </code></pre>
0debug
Asp.Net Core: Program does not contain a static 'Main' method suitable for an entry point : <p>I am trying to port my Asp.Net WebApi project, based on the Onion Architecture design approach, over to Asp.Net Core. However, when I build my class libraries, the compiler is looking for the static Main method in Program.cs and I am getting: </p> <blockquote> <p>C:\Projects\Some\src\Some.Core\error CS5001: Program does not contain a static 'Main' method suitable for an entry point</p> </blockquote> <p>I am assuming that there should be only one Program.cs / entry point for the overall solution, and that is sitting inside of my WebApi project. Am I incorrect? Otherwise, how do I resolve this error? I falsely assumed that <code>"emitEntryPoint": true</code> served this purpose. </p> <p>Here is an example of my class library's project.json:</p> <pre><code>{ "version": "1.0.0-*", "description": "Some.Core Class Library", "buildOptions": { "emitEntryPoint": true }, "dependencies": { "Microsoft.AspNetCore.Diagnostics": "1.0.0", "Microsoft.AspNetCore.Authentication.JwtBearer": "1.0.0", "Microsoft.AspNetCore.Mvc": "1.0.0", "Microsoft.AspNetCore.Routing": "1.0.0", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0", "Microsoft.AspNetCore.Identity": "1.0.0", "Microsoft.Extensions.Configuration": "1.0.0", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0", "Microsoft.Extensions.Logging": "1.0.0", "Microsoft.Extensions.Logging.Console": "1.0.0", "Microsoft.Extensions.Logging.Debug": "1.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0" }, "frameworks": { "netstandard1.6": { "dependencies": { "NETStandard.Library": "1.6.0" } } }, "runtimes": { "win7-x64": {} } } </code></pre> <p>Suggestions appreciated.</p>
0debug
if_start(void) { struct mbuf *ifm, *ifqt; DEBUG_CALL("if_start"); if (if_queued == 0) return; again: if (!slirp_can_output()) return; if (if_fastq.ifq_next != &if_fastq) { ifm = if_fastq.ifq_next; } else { if (next_m != &if_batchq) ifm = next_m; else ifm = if_batchq.ifq_next; next_m = ifm->ifq_next; } ifqt = ifm->ifq_prev; remque(ifm); --if_queued; if (ifm->ifs_next != ifm) { insque(ifm->ifs_next, ifqt); ifs_remque(ifm); } if (ifm->ifq_so) { if (--ifm->ifq_so->so_queued == 0) ifm->ifq_so->so_nqueued = 0; } if_encap(ifm->m_data, ifm->m_len); m_free(ifm); if (if_queued) goto again; }
1threat
static int handle_packet(MpegTSContext *ts, const uint8_t *packet) { MpegTSFilter *tss; int len, pid, cc, expected_cc, cc_ok, afc, is_start, is_discontinuity, has_adaptation, has_payload; const uint8_t *p, *p_end; int64_t pos; pid = AV_RB16(packet + 1) & 0x1fff; if (pid && discard_pid(ts, pid)) return 0; is_start = packet[1] & 0x40; tss = ts->pids[pid]; if (ts->auto_guess && !tss && is_start) { add_pes_stream(ts, pid, -1); tss = ts->pids[pid]; if (!tss) return 0; ts->current_pid = pid; afc = (packet[3] >> 4) & 3; if (afc == 0) return 0; has_adaptation = afc & 2; has_payload = afc & 1; is_discontinuity = has_adaptation && packet[4] != 0 && (packet[5] & 0x80); cc = (packet[3] & 0xf); expected_cc = has_payload ? (tss->last_cc + 1) & 0x0f : tss->last_cc; cc_ok = pid == 0x1FFF || is_discontinuity || tss->last_cc < 0 || expected_cc == cc; tss->last_cc = cc; if (!cc_ok) { av_log(ts->stream, AV_LOG_DEBUG, "Continuity check failed for pid %d expected %d got %d\n", pid, expected_cc, cc); p = packet + 4; if (has_adaptation) { int64_t pcr_h; int pcr_l; if (parse_pcr(&pcr_h, &pcr_l, packet) == 0) tss->last_pcr = pcr_h * 300 + pcr_l; p += p[0] + 1; p_end = packet + TS_PACKET_SIZE; if (p >= p_end || !has_payload) return 0; pos = avio_tell(ts->stream->pb); if (pos >= 0) { av_assert0(pos >= TS_PACKET_SIZE); ts->pos47_full = pos - TS_PACKET_SIZE; if (tss->type == MPEGTS_SECTION) { if (is_start) { len = *p++; if (len > p_end - p) return 0; if (len && cc_ok) { write_section_data(ts, tss, p, len, 0); if (!ts->pids[pid]) return 0; p += len; if (p < p_end) { write_section_data(ts, tss, p, p_end - p, 1); } else { if (cc_ok) { write_section_data(ts, tss, p, p_end - p, 0); if (ts->stream->ctx_flags & AVFMTCTX_NOHEADER && ts->scan_all_pmts <= 0) { int i; for (i = 0; i < ts->nb_prg; i++) { if (!ts->prg[i].pmt_found) break; if (i == ts->nb_prg && ts->nb_prg > 0) { int types = 0; for (i = 0; i < ts->stream->nb_streams; i++) { AVStream *st = ts->stream->streams[i]; if (st->codecpar->codec_type >= 0) types |= 1<<st->codecpar->codec_type; if ((types & (1<<AVMEDIA_TYPE_AUDIO) && types & (1<<AVMEDIA_TYPE_VIDEO)) || pos > 100000) { av_log(ts->stream, AV_LOG_DEBUG, "All programs have pmt, headers found\n"); ts->stream->ctx_flags &= ~AVFMTCTX_NOHEADER; } else { int ret; if ((ret = tss->u.pes_filter.pes_cb(tss, p, p_end - p, is_start, pos - ts->raw_packet_size)) < 0) return ret; return 0;
1threat
Image preprocessing in deep learning : <p>I am experimenting with deep learning on images. I have about ~4000 images from different cameras with different light conditions, image resolutions and view angle. </p> <p>My question is: <strong>What kind of image preprocessing would be helpful for improving object detection?</strong> (For example: contrast/color normalization, denoising, etc.) </p>
0debug
C# computer owner name : <p>I have one problem.. I have image converting program so if one user converting image file then his computer name going into file name.'</p> <p>Something like this I need: <code>John-Doe.23-07-2016.JPG</code></p> <p>But at the moment taking computer name like this: <code>John-Doe/John-Doe.23-07-2016.JPG</code></p> <p>My code:</p> <pre><code>string user = File.GetAccessControl(textBox1.Text).GetOwner(typeof(NTAccount)).ToString(); </code></pre> <p>textBox1.Text is place where program choosing folder where is image files.</p>
0debug
HTML Form Output Formatting (with Java) : First post and HTML project but wanted to give big thanks to the community, been very helpful so far. I want to make an HTML form that churns out formatted email signatures. - I want the output on 1) separate lines and 2) have each line of be formatted uniquely. So, first line bold and blue, second like non-bold and grey font, etc. like typical email signatures. So far it all appears in one long identically formatted output. - Eventually I'd like blank entries to be omitted and to add an automatic copy function, but I can tackle those later. Spent a few dozen hours on this and can't get it, so hoping for some guidance. Big thanks! Matt <!DOCTYPE html> <html lang = "en-US"> <title>Email Signature</title> <head> <body> <font face="century gothic"> <h3>Creating Signature</h3> <p>Enter you information<p> <form> Name<br> <input type="text" name="wholename" ><br> <br>Position</br> <input type="text" name="pos"><br> <br>Position 2</br> <input type="text" name="pospos"><br> <br>Phone 1</br> <input type="text" name="phone"><br> <br>Phone 2</br> <input type="text" name="phonephone"><br> <p>Select Location<p> <input type="radio" name="location" value="Redding" checked>Redding<br> <input type="radio" name="location" value="San Francisco" checked> San Francisco<br> <input type="radio" name="location" value="Woodland Hills" checked> Los Angeles<br><br> <input type="checkbox" name="billingtoo" onclick="FillBilling(this.form)"> <em>Check this box when you're all set</em> <p> <b>Your Custom Signature:</b><br><br> <textarea type="textarea" id="billingname" style="font-family:century gothic;font-size:1.2em;color:rgb(126,128,130)" rows="10" cols="40" ></textarea><br> <script type="text/javascript"> function copyText(){ document.getElementById("billingname").select(); document.execCommand('copy'); } function FillBilling(f) { f.billingname.value = f.wholename.value + " " + f.pos.value + " | " + f.pospos.value + "" + f.phone.value + " " + f.phonephone.value + " " + f.location.value;} if(f.billingtoo.checked == true) {} </script> </form> <br><br><br><br> </font face> </head> </body>
0debug
result of arithmetic operation like: 1/3 in C float variable : <p>I am writing simple program where I am doing operation like 1/3, 1/5 . But while printing o/p it prints 0.00 .. </p> <pre><code>int main() { float res = 0.0; int no1 =1 ; int no2 = 3; res = (no1) / (no2) ; printf("Res:[%f] ",res); } </code></pre> <p>~ </p> <p>ideally it should print 0.3 but it prints 0.0000.</p>
0debug
i have integer want convert it to Special format : I'm a numeric value. And I want to transform it into a format similar example. In what way can I use? example : input: 500000 $ output: 500.000 $
0debug
Can I create .ipa file and send it to my customer without apple developer program in xcode 8.2 : I am new to ios programming and want to clear some question and problem which I am facing while extrating ipa file. >1. Can I extract .ipa file throw xcode without having developer program but i have developer id and create .ipa file throw PayLoad Process? 2. How much I am able to do without apple Developer Program? 3. I want to show progress to my customer, what is the solution? 4. I am getting Signing Certificate and auto-generate provisioning profiles errors while extracting .ipa file, Are these problem coming because of not having developer programming? 5. Can I send ipa file to anyone to install and check?
0debug
static void icp_pit_write(void *opaque, hwaddr offset, uint64_t value, unsigned size) { icp_pit_state *s = (icp_pit_state *)opaque; int n; n = offset >> 8; if (n > 2) { qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad timer %d\n", __func__, n); } arm_timer_write(s->timer[n], offset & 0xff, value); }
1threat
custom image when blob does not exist (404) : <p>I have a php page that has blobs from my database</p> <p>i need 404 image to display when there is no blob</p> <p><a href="https://i.imgur.com/gp0Q2kQ.jpg" rel="nofollow noreferrer">https://i.imgur.com/gp0Q2kQ.jpg</a> <a href="https://i.imgur.com/XgGDExK.jpg" rel="nofollow noreferrer">https://i.imgur.com/XgGDExK.jpg</a></p> <pre><code>&lt;?php $host = "localhost"; $username = "root"; $password = "12345678"; $db = "sis"; $PicNum = $_GET["PicNum"]; mysql_connect($host,$username,$password) or die("ImpossΓ­vel conectar ao banco."); @mysql_select_db($db) or die("ImpossΓ­vel conectar ao banco."); $result=mysql_query("SELECT * FROM usuarios WHERE id=$PicNum") or die("ImpossΓ­vel executar a query "); $row=mysql_fetch_object($result); Header("Content-type: image/gif"); echo $row-&gt;avatar;?&gt; </code></pre>
0debug
Firebase remote config cache expiration time in release : <p>I'm trying to setup firebase remote config for release mode by setting developer mode to <code>false</code>. But with cache expiration time less then 3000(may be a bit less, determined it experimentally) seconds, it fails to fetch data. It throws <code>FirebaseRemoteConfigFetchThrottledException</code></p> <pre><code>FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder() .setDeveloperModeEnabled(false) .build(); </code></pre> <p>And with <code>.setDeveloperModeEnabled(true)</code> it allows me to set any time even 0 and works well. </p> <p>Here is whole hunk:</p> <pre><code>new Handler().postDelayed(new Runnable() { @Override public void run() { mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); FirebaseRemoteConfigSettings configSettings = new FirebaseRemoteConfigSettings.Builder() .setDeveloperModeEnabled(false) .build(); mFirebaseRemoteConfig.setConfigSettings(configSettings); mFirebaseRemoteConfig.setDefaults(R.xml.remote_config_defaults); mFirebaseRemoteConfig.fetch(CACHE_EXPIRATION) .addOnSuccessListener(new OnSuccessListener&lt;Void&gt;() { @Override public void onSuccess(Void aVoid) { Log.i("info32", "remote config succeeded"); mFirebaseRemoteConfig.activateFetched(); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { Log.i("info32", "remote config failed"); } }); } }, 0); </code></pre> <p>Could you please explain what the issue is?</p>
0debug
Is there a better way to set a gcloud project in a directory? : <p>I work on multiple appengine projects in any given week. i.e. assume multiple clients. Earlier I could set <code>application</code> in <code>app.yaml</code>. So whenever I did <code>appcfg.py update....</code> it would ensure deployment to the right project.</p> <p>When deploying, the application variable throws an error with <code>gcloud deploy</code>. I had to use <code>gcloud app deploy --project [YOUR_PROJECT_ID]</code>. So what used to be a directory level setting for a project, is now going into our build tooling. And missing out that simple detail can push a project code to the wrong customer. i.e. if I did <code>gcloud config set project proj1</code> and then somehow did a <code>gcloud app deploy</code> in proj2, it would deploy to proj1. Production deployments are done after detailed verification on the build tools and hence it is less of an issue there because we still use the <code>--project</code> flag.</p> <p>But its hard to do similar stuff on the development environment. <code>dev_appserver.py</code> doesn't have a <code>--project</code> flag. When starting <code>dev_appserver.py</code> I've to do <code>gcloud config set project &lt;project-id&gt;</code> before I start the server. This is important when I using stuff like PubSub or GCS (in dev topics or dev buckets). </p> <p>Unfortunately, missing out a simple configuration like setting a project ID in a dev environment can result into uploading blobs/messages/etc into the wrong dev gcs bucket or wrong dev pubsub topic (not using emulators). And this has happened quite a few times especially when starting new projects.</p> <p>I find the above solutions as hackish-workarounds. Is there a good way to ensure that we do not deploy or develop in a wrong project when working from a certain directory?</p>
0debug
import math def first_Digit(n) : fact = 1 for i in range(2,n + 1) : fact = fact * i while (fact % 10 == 0) : fact = int(fact / 10) while (fact >= 10) : fact = int(fact / 10) return math.floor(fact)
0debug
Show alert when checkbox check : <p>I am working on getting the data from php and populate the check box but i want the jquery so that i can show each selected value when checkbox checked</p> <p>code</p> <pre><code>&lt;input type='checkbox' class='messageCheckbox' name='emergency2[]' value='$rowspecial[category_id]' $checked $disableattr&gt; $rowspecial[category_name] </code></pre>
0debug
Array is printing each letter of a word on seperate line, how to fix? : Heyo! So I'm currently working on an assignment for school and the objective is to have the user input n amount of lines and then print them in reverse. For example: "Please enter number of lines: " 3 "Please enter the lines: " Hi Hey Howdy Desired Output: Howdy Hey Hi My output: H o w d y H e y H i I'm not sure what's wrong and I'd really like some help, here is my code: import java.util.Scanner; public class ReverseOrder { public static void main(String[] args) { Scanner kb = new Scanner(System.in); System.out.println("Please enter the number of lines: "); int numberOfLines = kb.nextInt() + 1; String inputLines[] = new String[numberOfLines]; System.out.println("Please enter the lines: "); for(int i=0; i<numberOfLines; i++){ inputLines[i] = kb.nextLine(); } System.out.println("Lines in reverse: "); for(int i = numberOfLines - 1 ; i>=0; i--){ for(int j=0; j<=inputLines[i].length() - 1; j++){ System.out.println(inputLines[i].charAt(j)); } } kb.close(); } } Thanks so much!
0debug
static void decode_pitch_lag_low(int *lag_int, int *lag_frac, int pitch_index, uint8_t *base_lag_int, int subframe, enum Mode mode) { if (subframe == 0 || (subframe == 2 && mode != MODE_6k60)) { if (pitch_index < 116) { *lag_int = (pitch_index + 69) >> 1; *lag_frac = (pitch_index - (*lag_int << 1) + 68) << 1; } else { *lag_int = pitch_index - 24; *lag_frac = 0; } *base_lag_int = av_clip(*lag_int - 8 - (*lag_frac < 0), AMRWB_P_DELAY_MIN, AMRWB_P_DELAY_MAX - 15); } else { *lag_int = (pitch_index + 1) >> 1; *lag_frac = (pitch_index - (*lag_int << 1)) << 1; *lag_int += *base_lag_int; } }
1threat
How do I Set Timer Control According to User entry in C# windows application? : <p>I need help regarding timer control, I wanted to set time after user entry i.e. after form run's user enter in textbox 10:30 AM then timer on label will start from 10:30 AM to continue..</p>
0debug
What are the errors inside this random walking code? : <p>I am having unexpected outputs with the following code:</p> <pre><code>import random N = 30 # number of steps n = random.random() # generate a random number x = 0 y = 0 z = 0 count = 0 while count &lt;= N: if n &lt; 1/3: x = x + 1 # move east n = random.random() # generate a new random number if n &gt;= 1/3 and n &lt; 2/3: y = y + 1 # move north n = random.random() # generate a new random number if n &gt;= 2/3: z = z + 1 # move up n = random.random() # generate a new random number print("(%d,%d,%d)" % (x,y,z)) count = count + 1 </code></pre> <p>When I run the code, the problem is:</p> <ul> <li>Code output displays 31 coordinates, 1 more than the number of steps (N) variable.</li> <li>Each iteration for 1 step should take only 1 step but it sometimes take multiple steps.</li> </ul> <p>When I tested the code, the problem is ensured. To test the code, I assigned N = 1, and saw the following output:</p> <ul> <li><p>(-1,0,1) This should be the initial step, but it took multiple steps (both x-1 and z+1), how could this happen?</p></li> <li><p>(-2,0,1) Number of step variable (N) = 1 but this is the second output, why was it displayed? Thanks for helping</p></li> </ul>
0debug
invalid syntax def python 3.5.2 : <p>Please help I cannot figure out the problem with this. I am trying to PixelSearch. Using Python 3.5.2 and when trying to run it from Shell it comes up with syntax error on def.</p> <pre><code>import ImageGrab import os import time import win32api, win32con # Globals # ------------------ x_pad = 464 y_pad = 244 def screenGrab(): box = (x_pad+1, y_pad+1, x_pad+639, y_pad+477) im = ImageGrab.grab(box) im.save(os.getcwd() + '\\full_snap__' + str(int(time.time())) + ('.png', 'PNG') def leftClick(): win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0) time.sleep(.1) win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0) print ("Click.") #completely optional. But nice for debugging purposes. def leftDown(): win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0) time.sleep(.1) print ('left Down') def leftUp(): win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0) time.sleep(.1) print ('left release') def mousePos(cord): win32api.SetCursorPos((x_pad + cord[0], y_pad + cord[1]) def get_cords(): x,y = win32api.GetCursorPos(): x = x - x_pad y = y - y_pad print (x,y) def main(): pass if __name__ == '__main__': main() </code></pre> <p>I am new to programming so any help is greatly appreciated.</p>
0debug
Should I use `registerOnChange` or `valueChanges` on a form control : <p>It seems that I can listen to changes on the control using <code>registerOnChange</code> or <code>valueChanges</code> method. I'm confused as to when to use what. <code>valueChanges</code> returns observable, so it makes sense to work with it as it provides many handy methods. When to use <code>registerOnChange</code> then?</p>
0debug
static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { TTAContext *c = s->priv_data; AVStream *st = s->streams[stream_index]; int index = av_index_search_timestamp(st, timestamp, flags); if (index < 0) return -1; c->currentframe = index; avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); return 0; }
1threat
Sass @use not loading partial : <p>I'm trying to import a sass partial (<code>_variables.scss</code>) to use in my main stylesheet (<code>global.scss</code>), but I keep getting the <code>Error: Undefined variable.</code> on sass compiling.</p> <p>Directory structure:</p> <pre><code>app └─public └─styles β”‚ global.css (output for sass compiling is here). └─sass └─_variables.scss └─global.scss </code></pre> <p>_variables.scss</p> <pre><code>$font-text: 'lato', sans-serif; </code></pre> <p>global.scss</p> <pre><code>@use '_variables'; body { font-family: $font-text; } </code></pre> <p>Looking at the <a href="https://sass-lang.com/documentation/at-rules/import" rel="noreferrer">Sass documentation</a>, I understand to use <code>@use</code> instead of <code>@import</code> (which works) because they are phasing it out.</p> <p>What am I doing wrong here? Thanks.</p>
0debug
Are multidimensional arrays in java useful? : <p>I am trying to figure out where you would use a multidimensional array. For example where would you ever need to use an array such as</p> <p>int x [][][][] ? </p>
0debug
static always_inline void gen_op_subfeo_64 (void) { gen_op_move_T2_T0(); gen_op_subfe_64(); gen_op_check_subfo_64(); }
1threat
Set weight and bias tensors of tensorflow conv2d operation : <p>I have been given a trained neural network in torch and I need to rebuild it exactly in tensorflow. I believe I have correctly defined the network's architecture in tensorflow but I am having trouble transferring the weight and bias tensors. Using a third party package, I converted all the weight and bias tensors from the torch network to numpy arrays then wrote them to disk. I can load them back into my python program but I cannot figure out a way to assign them to the corresponding layers in my tensorflow network. </p> <p>For instance, I have a convolution layer defined in tensorflow as</p> <pre><code>kernel_1 = tf.Variable(tf.truncated_normal([11,11,3,64], stddev=0.1)) conv_kernel_1 = tf.nn.conv2d(input, kernel_1, [1,4,4,1], padding='SAME') biases_1 = tf.Variable(tf.zeros[64]) bias_layer_1 = tf.nn_add(conv_kernel_1, biases_1) </code></pre> <p>According to the tensorflow documentation, the tf.nn.conv2d operation uses the shape defined in the kernel_1 variable to construct the weight tensor. However, I cannot figure out how to access that weight tensor to set it to the weight array I have loaded from file. </p> <p><strong>Is it possible to explicitly set the weight tensor? And if so, how?</strong> </p> <p>(The same question applies to bias tensor.)</p>
0debug
Non-standard file/directory found at top level: 'README.Rmd' persists even after implementing suggested solutions : <p>I am working on a package and running <code>R CMD CHECK</code> on it using <code>devtools::check()</code> produces the following <code>NOTE</code>:</p> <pre><code>&gt; checking top-level files ... NOTE Non-standard file/directory found at top level: 'README.Rmd' </code></pre> <p>A variant of this question has been raised before (<a href="https://stackoverflow.com/questions/44113759/note-or-warning-from-package-check-when-readme-md-includes-images">NOTE or WARNING from package check when README.md includes images</a>), but that solution provided therein hasn't worked for me. </p> <p>Here is my <code>.Rbuildignore</code> file. As has been suggested, I have included <code>^README-.*\.png$</code>:</p> <pre><code>^.*\.Rproj$ ^\.Rproj\.user$ ^CONDUCT\.md$ ^\.travis\.yml$ ^README-.*\.png$ ^cran-comments\.md$ </code></pre> <p>Additionally, my <code>README.Rmd</code> document has the following chunk, which saves all figures in <code>/man/figures/</code></p> <pre><code>{r, echo = FALSE} knitr::opts_chunk$set( collapse = TRUE, comment = "#&gt;", fig.path = "man/figures/README-" ) </code></pre> <p>If you need more details about the <code>.Rmd</code> file, it's here: <a href="https://github.com/IndrajeetPatil/ggstatsplot/blob/master/README.Rmd" rel="noreferrer">https://github.com/IndrajeetPatil/ggstatsplot/blob/master/README.Rmd</a></p> <p>Given that it's better to get rid of all possible <code>NOTES</code> to successfully pass CRAN's <code>R CMD CHECK</code>, how can I avoid this particular <code>NOTE</code>?</p>
0debug
static int opt_map(OptionsContext *o, const char *opt, const char *arg) { StreamMap *m = NULL; int i, negative = 0, file_idx; int sync_file_idx = -1, sync_stream_idx; char *p, *sync; char *map; if (*arg == '-') { negative = 1; arg++; } map = av_strdup(arg); if (sync = strchr(map, ',')) { *sync = 0; sync_file_idx = strtol(sync + 1, &sync, 0); if (sync_file_idx >= nb_input_files || sync_file_idx < 0) { av_log(NULL, AV_LOG_FATAL, "Invalid sync file index: %d.\n", sync_file_idx); exit_program(1); } if (*sync) sync++; for (i = 0; i < input_files[sync_file_idx].nb_streams; i++) if (check_stream_specifier(input_files[sync_file_idx].ctx, input_files[sync_file_idx].ctx->streams[i], sync) == 1) { sync_stream_idx = i; break; } if (i == input_files[sync_file_idx].nb_streams) { av_log(NULL, AV_LOG_FATAL, "Sync stream specification in map %s does not " "match any streams.\n", arg); exit_program(1); } } file_idx = strtol(map, &p, 0); if (file_idx >= nb_input_files || file_idx < 0) { av_log(NULL, AV_LOG_FATAL, "Invalid input file index: %d.\n", file_idx); exit_program(1); } if (negative) for (i = 0; i < o->nb_stream_maps; i++) { m = &o->stream_maps[i]; if (file_idx == m->file_index && check_stream_specifier(input_files[m->file_index].ctx, input_files[m->file_index].ctx->streams[m->stream_index], *p == ':' ? p + 1 : p) > 0) m->disabled = 1; } else for (i = 0; i < input_files[file_idx].nb_streams; i++) { if (check_stream_specifier(input_files[file_idx].ctx, input_files[file_idx].ctx->streams[i], *p == ':' ? p + 1 : p) <= 0) continue; o->stream_maps = grow_array(o->stream_maps, sizeof(*o->stream_maps), &o->nb_stream_maps, o->nb_stream_maps + 1); m = &o->stream_maps[o->nb_stream_maps - 1]; m->file_index = file_idx; m->stream_index = i; if (sync_file_idx >= 0) { m->sync_file_index = sync_file_idx; m->sync_stream_index = sync_stream_idx; } else { m->sync_file_index = file_idx; m->sync_stream_index = i; } } if (!m) { av_log(NULL, AV_LOG_FATAL, "Stream map '%s' matches no streams.\n", arg); exit_program(1); } av_freep(&map); return 0; }
1threat
static void calc_scales(DCAEncContext *c) { int band, ch; for (band = 0; band < 32; band++) for (ch = 0; ch < c->fullband_channels; ch++) c->scale_factor[band][ch] = calc_one_scale(c->peak_cb[band][ch], c->abits[band][ch], &c->quant[band][ch]); if (c->lfe_channel) c->lfe_scale_factor = calc_one_scale(c->lfe_peak_cb, 11, &c->lfe_quant); }
1threat
C# - Concantenate inside a loop : Is it possible to concatenate inside a C# loop? Below is my sample code: for (int i = 0; i <= metricCount; i++) { if (m.metrictNumber == i) { aggrgt.Add(new PlainBrgDataSummaryChartAggrgt { scoreWk6 = scoresPerDuration.scoresPerDuration.scoreWk6.metricScore1, scoreWk5 = scoresPerDuration.scoresPerDuration.scoreWk5.metricScore1, scoreWk4 = scoresPerDuration.scoresPerDuration.scoreWk4.metricScore1, scoreWk3 = scoresPerDuration.scoresPerDuration.scoreWk3.metricScore1, scoreWk2 = scoresPerDuration.scoresPerDuration.scoreWk2.metricScore1, scoreWk1 = scoresPerDuration.scoresPerDuration.scoreWk1.metricScore1 }); } } What I want is to concantename metricScore1. Something like this: scoreWk6 = scoresPerDuration.scoresPerDuration.scoreWk6.metricScore + i, Is that possible?
0debug
static void nbd_refresh_limits(BlockDriverState *bs, Error **errp) { bs->bl.max_pdiscard = NBD_MAX_BUFFER_SIZE; bs->bl.max_pwrite_zeroes = NBD_MAX_BUFFER_SIZE; bs->bl.max_transfer = NBD_MAX_BUFFER_SIZE; }
1threat
static void spapr_phb_reset(DeviceState *qdev) { SysBusDevice *s = SYS_BUS_DEVICE(qdev); sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s); spapr_tce_reset(sphb->tcet); }
1threat
static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size) { struct xlx_ethlite *s = qemu_get_nic_opaque(nc); unsigned int rxbase = s->rxbuf * (0x800 / 4); if (!(buf[0] & 0x80) && memcmp(&s->conf.macaddr.a[0], buf, 6)) return size; if (s->regs[rxbase + R_RX_CTRL0] & CTRL_S) { D(qemu_log("ethlite lost packet %x\n", s->regs[R_RX_CTRL0])); D(qemu_log("%s %zd rxbase=%x\n", __func__, size, rxbase)); memcpy(&s->regs[rxbase + R_RX_BUF0], buf, size); s->regs[rxbase + R_RX_CTRL0] |= CTRL_S; if (s->regs[R_RX_CTRL0] & CTRL_I) { eth_pulse_irq(s); s->rxbuf ^= s->c_rx_pingpong; return size;
1threat
read all images in folder python : I am trying to execute this code to read a set of images present in a folder with python language but I have a problem if you can help me patient_uids = train_annotations.seriesuid.unique() patients_processed_files = glob.glob(OUTPUT_FOLDER + '[0-9\.]*_X.npy') patients_processed = set() for filename in patients_processed_files: m = re.match(r'([0-9\.]*)_X.npy', os.path.basename(filename)) patients_processed.add(m.group(1)) print(len(patient_uids)) graph = tf.Graph() with graph.as_default(): img_chunk = tf.placeholder(tf.float32, shape=[CHUNK_SIZE, CHUNK_SIZE, CHUNK_SIZE], name='img_chunk') img_flipped_up_down = tf.image.flip_up_down(img_chunk) img_flipped_left_right = tf.image.flip_left_right(img_chunk) img_rot_90 = tf.image.rot90(img_chunk) img_trans = tf.image.transpose_image(img_chunk) weird_chunks = {} for patient_uid in patient_uids: if patient_uid in patients_processed: print('Skipping already processed patient {}'.format(patient_uid)) continue print('Processing patient {}'.format(patient_uid)) patient_annotations = train_annotations[train_annotations.seriesuid == patient_uid] patient_scans_path = glob.glob(DATA_PATH + 'subset?/{}.mhd'.format(patient_uid))[0] img, origin, spacing = load_itk(patient_scans_path) but the execution of my code returns me: IndexError: list index out of range
0debug
How to retry loading video again once it fails : <p>In my page i am showing a Video loaded from Sprout this way </p> <p>In case , if something went wrong , means video is not loaded due to <strong>404 , or 403 http status</strong> , how can i retry for 4 times ? (waiting for 5 seconds each time )</p> <p>This is my code</p> <pre><code>&lt;video id="video" width="200" height="200" controls&gt; &lt;source id='currentVID' src="" type="video/mp4"&gt; &lt;/video&gt; var actualvideo = 'https://api-files.sproutvideo.com/file/7c9adbb51915e2cdf4/b6e4822661adad1aremovethis/240.mp4'; if (actualvideo !== '') { var video = document.getElementById('video'); $('video source').last().on('error', function() { alert('something went wrong'); }); video.pause(); var source = document.getElementById('currentVID'); source.setAttribute('src', actualvideo); video.appendChild(source); } </code></pre> <p><a href="https://jsfiddle.net/o2gxgz9r/9974/" rel="noreferrer">https://jsfiddle.net/o2gxgz9r/9974/</a></p>
0debug
Unit Testing Azure Function with Change Feed Trigger : <p>I'm trying to write a unit test for an Azure Function with Change Feed Trigger.</p> <p>Is it possible to trigger the function using document db emulator?</p> <p>or </p> <p>Should I call onto the function directly?</p> <p>e.g., FunctionClass.Run(documents, null);</p> <p>Also, is there any example on creating unit test for azure function?</p> <p>I wasn't able to find any examples for similar cases.</p> <p>Thanks</p>
0debug
using try catch causing errors; : <pre><code>import java.util.Scanner; import java.util.InputMismatchException; public class divide { public static void main(String[] args) { Scanner kb = new Scanner (System.in); int a,b; try{ System.out.println("enter 2 number "); a = kb.nextInt(); b = kb.nextInt(); int c = a/b; System.out.println("div="+c); } catch(ArithmeticException e) { System.out.println("please enter non 0 in deno"); } catch (InputMismatchException e2) { System.out.println("please input int only"); System.exit(0); } int d= a+b; System.out.println("sum="+d); } } </code></pre> <p>error </p> <p>divide.java:38: error: variable a might not have been initialized int d= a+b; ^ divide.java:38: error: variable b might not have been initialized int d= a+b;</p>
0debug
Angular custom style to mat-dialog : <p>I am trying to customize the default "mat-dialog" in Angular 5. What I want to achieve is having a toolbar in the upper part of the dialog, which should cover the whole width. However, the mat-dialog-container has a fixed padding of 24px which I could not override. I tried to style both the h1 and the mat-dialog-container.</p> <pre><code>@Component({ selector: 'error-dialog', template: ` &lt;h1 mat-dialog-title&gt; ERRORE &lt;/h1&gt; &lt;div mat-dialog-content&gt; {{data.error}} &lt;/div&gt; &lt;div mat-dialog-actions&gt; &lt;button mat-button (click)="onClick()"&gt;Ok&lt;/button&gt; &lt;/div&gt;`, styles: [ 'h1 { background: #E60000; color: white; }', // 'myDialogStyle .mat-dialog-container { padding: 1px !important;}' ]}) export class ErrorDialog { constructor( public dialogRef: MatDialogRef&lt;ErrorDialog&gt;, @Inject(MAT_DIALOG_DATA) public data: any) { } onClick(): void { this.dialogRef.close(); } } openErrorDialog(errore: string): void{ let dialogRef = this.dialog.open(ErrorDialog, { width: '80%', data: { error: errore } //panelClass: 'myDialogStyle' }); } </code></pre>
0debug
av_cold void ff_h264_pred_init(H264PredContext *h, int codec_id, const int bit_depth, const int chroma_format_idc) { #undef FUNC #undef FUNCC #define FUNC(a, depth) a ## _ ## depth #define FUNCC(a, depth) a ## _ ## depth ## _c #define FUNCD(a) a ## _c #define H264_PRED(depth) \ if(codec_id != AV_CODEC_ID_RV40){\ if(codec_id == AV_CODEC_ID_VP8) {\ h->pred4x4[VERT_PRED ]= FUNCD(pred4x4_vertical_vp8);\ h->pred4x4[HOR_PRED ]= FUNCD(pred4x4_horizontal_vp8);\ } else {\ h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ }\ h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ if(codec_id == AV_CODEC_ID_SVQ3)\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_svq3);\ else\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred4x4_down_left , depth);\ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ if (codec_id == AV_CODEC_ID_VP8) {\ h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_vp8);\ } else\ h->pred4x4[VERT_LEFT_PRED ]= FUNCC(pred4x4_vertical_left , depth);\ h->pred4x4[HOR_UP_PRED ]= FUNCC(pred4x4_horizontal_up , depth);\ if(codec_id != AV_CODEC_ID_VP8) {\ h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ } else {\ h->pred4x4[TM_VP8_PRED ]= FUNCD(pred4x4_tm_vp8);\ h->pred4x4[DC_127_PRED ]= FUNCC(pred4x4_127_dc , depth);\ h->pred4x4[DC_129_PRED ]= FUNCC(pred4x4_129_dc , depth);\ h->pred4x4[VERT_VP8_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_VP8_PRED ]= FUNCC(pred4x4_horizontal , depth);\ }\ }else{\ h->pred4x4[VERT_PRED ]= FUNCC(pred4x4_vertical , depth);\ h->pred4x4[HOR_PRED ]= FUNCC(pred4x4_horizontal , depth);\ h->pred4x4[DC_PRED ]= FUNCC(pred4x4_dc , depth);\ h->pred4x4[DIAG_DOWN_LEFT_PRED ]= FUNCD(pred4x4_down_left_rv40);\ h->pred4x4[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred4x4_down_right , depth);\ h->pred4x4[VERT_RIGHT_PRED ]= FUNCC(pred4x4_vertical_right , depth);\ h->pred4x4[HOR_DOWN_PRED ]= FUNCC(pred4x4_horizontal_down , depth);\ h->pred4x4[VERT_LEFT_PRED ]= FUNCD(pred4x4_vertical_left_rv40);\ h->pred4x4[HOR_UP_PRED ]= FUNCD(pred4x4_horizontal_up_rv40);\ h->pred4x4[LEFT_DC_PRED ]= FUNCC(pred4x4_left_dc , depth);\ h->pred4x4[TOP_DC_PRED ]= FUNCC(pred4x4_top_dc , depth);\ h->pred4x4[DC_128_PRED ]= FUNCC(pred4x4_128_dc , depth);\ h->pred4x4[DIAG_DOWN_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_down_left_rv40_nodown);\ h->pred4x4[HOR_UP_PRED_RV40_NODOWN]= FUNCD(pred4x4_horizontal_up_rv40_nodown);\ h->pred4x4[VERT_LEFT_PRED_RV40_NODOWN]= FUNCD(pred4x4_vertical_left_rv40_nodown);\ }\ \ h->pred8x8l[VERT_PRED ]= FUNCC(pred8x8l_vertical , depth);\ h->pred8x8l[HOR_PRED ]= FUNCC(pred8x8l_horizontal , depth);\ h->pred8x8l[DC_PRED ]= FUNCC(pred8x8l_dc , depth);\ h->pred8x8l[DIAG_DOWN_LEFT_PRED ]= FUNCC(pred8x8l_down_left , depth);\ h->pred8x8l[DIAG_DOWN_RIGHT_PRED]= FUNCC(pred8x8l_down_right , depth);\ h->pred8x8l[VERT_RIGHT_PRED ]= FUNCC(pred8x8l_vertical_right , depth);\ h->pred8x8l[HOR_DOWN_PRED ]= FUNCC(pred8x8l_horizontal_down , depth);\ h->pred8x8l[VERT_LEFT_PRED ]= FUNCC(pred8x8l_vertical_left , depth);\ h->pred8x8l[HOR_UP_PRED ]= FUNCC(pred8x8l_horizontal_up , depth);\ h->pred8x8l[LEFT_DC_PRED ]= FUNCC(pred8x8l_left_dc , depth);\ h->pred8x8l[TOP_DC_PRED ]= FUNCC(pred8x8l_top_dc , depth);\ h->pred8x8l[DC_128_PRED ]= FUNCC(pred8x8l_128_dc , depth);\ \ if (chroma_format_idc <= 1) {\ h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x8_vertical , depth);\ h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x8_horizontal , depth);\ } else {\ h->pred8x8[VERT_PRED8x8 ]= FUNCC(pred8x16_vertical , depth);\ h->pred8x8[HOR_PRED8x8 ]= FUNCC(pred8x16_horizontal , depth);\ }\ if (codec_id != AV_CODEC_ID_VP8) {\ if (chroma_format_idc <= 1) {\ h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x8_plane , depth);\ } else {\ h->pred8x8[PLANE_PRED8x8]= FUNCC(pred8x16_plane , depth);\ }\ } else\ h->pred8x8[PLANE_PRED8x8]= FUNCD(pred8x8_tm_vp8);\ if(codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP8){\ if (chroma_format_idc <= 1) {\ h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x8_dc , depth);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x8_left_dc , depth);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x8_top_dc , depth);\ h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l0t, depth);\ h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0lt, depth);\ h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_l00, depth);\ h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x8_mad_cow_dc_0l0, depth);\ } else {\ h->pred8x8[DC_PRED8x8 ]= FUNCC(pred8x16_dc , depth);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCC(pred8x16_left_dc , depth);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCC(pred8x16_top_dc , depth);\ h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l0t, depth);\ h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0lt, depth);\ h->pred8x8[ALZHEIMER_DC_L00_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_l00, depth);\ h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8 ]= FUNC(pred8x16_mad_cow_dc_0l0, depth);\ }\ }else{\ h->pred8x8[DC_PRED8x8 ]= FUNCD(pred8x8_dc_rv40);\ h->pred8x8[LEFT_DC_PRED8x8]= FUNCD(pred8x8_left_dc_rv40);\ h->pred8x8[TOP_DC_PRED8x8 ]= FUNCD(pred8x8_top_dc_rv40);\ if (codec_id == AV_CODEC_ID_VP8) {\ h->pred8x8[DC_127_PRED8x8]= FUNCC(pred8x8_127_dc , depth);\ h->pred8x8[DC_129_PRED8x8]= FUNCC(pred8x8_129_dc , depth);\ }\ }\ if (chroma_format_idc <= 1) {\ h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x8_128_dc , depth);\ } else {\ h->pred8x8[DC_128_PRED8x8 ]= FUNCC(pred8x16_128_dc , depth);\ }\ \ h->pred16x16[DC_PRED8x8 ]= FUNCC(pred16x16_dc , depth);\ h->pred16x16[VERT_PRED8x8 ]= FUNCC(pred16x16_vertical , depth);\ h->pred16x16[HOR_PRED8x8 ]= FUNCC(pred16x16_horizontal , depth);\ switch(codec_id){\ case AV_CODEC_ID_SVQ3:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_svq3);\ break;\ case AV_CODEC_ID_RV40:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_plane_rv40);\ break;\ case AV_CODEC_ID_VP8:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCD(pred16x16_tm_vp8);\ h->pred16x16[DC_127_PRED8x8]= FUNCC(pred16x16_127_dc , depth);\ h->pred16x16[DC_129_PRED8x8]= FUNCC(pred16x16_129_dc , depth);\ break;\ default:\ h->pred16x16[PLANE_PRED8x8 ]= FUNCC(pred16x16_plane , depth);\ break;\ }\ h->pred16x16[LEFT_DC_PRED8x8]= FUNCC(pred16x16_left_dc , depth);\ h->pred16x16[TOP_DC_PRED8x8 ]= FUNCC(pred16x16_top_dc , depth);\ h->pred16x16[DC_128_PRED8x8 ]= FUNCC(pred16x16_128_dc , depth);\ \ \ h->pred4x4_add [VERT_PRED ]= FUNCC(pred4x4_vertical_add , depth);\ h->pred4x4_add [ HOR_PRED ]= FUNCC(pred4x4_horizontal_add , depth);\ h->pred8x8l_add [VERT_PRED ]= FUNCC(pred8x8l_vertical_add , depth);\ h->pred8x8l_add [ HOR_PRED ]= FUNCC(pred8x8l_horizontal_add , depth);\ if (chroma_format_idc <= 1) {\ h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x8_vertical_add , depth);\ h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x8_horizontal_add , depth);\ } else {\ h->pred8x8_add [VERT_PRED8x8]= FUNCC(pred8x16_vertical_add , depth);\ h->pred8x8_add [ HOR_PRED8x8]= FUNCC(pred8x16_horizontal_add , depth);\ }\ h->pred16x16_add[VERT_PRED8x8]= FUNCC(pred16x16_vertical_add , depth);\ h->pred16x16_add[ HOR_PRED8x8]= FUNCC(pred16x16_horizontal_add , depth);\ switch (bit_depth) { case 9: H264_PRED(9) break; case 10: H264_PRED(10) break; default: H264_PRED(8) break; } if (ARCH_ARM) ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc); if (ARCH_X86) ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc); }
1threat
Instant Run performed a full build and install since the installation on the device does not match the local build on disk : <p>Android Studio gives error when running application with instant run enabled. I have updated my android studio to 2.3 today and since then its showing me above information.</p>
0debug
Phalcon -ΒΏBeforeSave not receive data before saving? : I want to validate before saving if the variable "$ CONT_CEDULA" meets the requirements otherwise not be saved. But when saving is as if the variable "$ CONT_CEDULA" not send data. I want to know if I'm doing well or some other event or function. The "echo" Initial no data > Blockquote public function beforeSave() { echo $this->$CONT_CEDULA; switch (strlen($this->$CONT_CEDULA)) { case 10: return validarCI($this->$CONT_CEDULA); break; case 13: return validarRUC($this->$CONT_CEDULA); break; default: echo "Numero de caracteres invalidos" ; return FALSE; } <pre> <?php class SpmContacto extends \Phalcon\Mvc\Model { public $CONT_CODIGO; public $CONT_CEDULA; public $CONT_RUCIDE; public $CONT_NOMBRE; public $CON_ESTADO; public $CONT_TELEFO; public $CONT_DIRECC; public $CONT_AREA; public $CONT_CARGO; public $CONT_TIPOXX; public $CONT_EMAIL; public $CONT_USUARIO; public $CONT_CLAVE; public $CONT_CLAVEE; public $CONT_FECNACI; public $CONT_FECINSC; public $CONT_TIPOCODIGO; /** * Initialize method for model. */ public function initialize() { $this->setSchema("SPOLS"); $this->hasMany('CONT_CODIGO', 'SPMREFERENCIA', 'CONT_CODIGO', array('alias' => 'SPMREFERENCIA')); $this->hasMany('CONT_CODIGO', 'SPTDETALLE', 'CONT_CODIGO', array('alias' => 'SPTDETALLE')); $this->hasMany('CONT_CODIGO', 'SPTENCABEZADO', 'CONT_CODIGO', array('alias' => 'SPTENCABEZADO')); } function validarCI($strCedula) { $suma = 0; $strOriginal = $strCedula; $intProvincia = substr($strCedula, 0, 2); $intTercero = $strCedula[2]; $intUltimo = $strCedula[9]; if (!settype($strCedula, "float")) return FALSE; if ((int) $intProvincia < 1 || (int) $intProvincia > 23) return FALSE; if ((int) $intTercero == 7 || (int) $intTercero == 8) return FALSE; for ($indice = 0; $indice < 9; $indice++) { //echo $strOriginal[$indice],'</br>'; switch ($indice) { case 0: case 2: case 4: case 6: case 8: $arrProducto[$indice] = $strOriginal[$indice] * 2; if ($arrProducto[$indice] >= 10) $arrProducto[$indice] -= 9; //echo $arrProducto[$indice],'</br>'; break; case 1: case 3: case 5: case 7: $arrProducto[$indice] = $strOriginal[$indice] * 1; if ($arrProducto[$indice] >= 10) $arrProducto[$indice] -= 9; //echo $arrProducto[$indice],'</br>'; break; } } foreach ($arrProducto as $indice => $producto) $suma += $producto; $residuo = $suma % 10; $intVerificador = $residuo == 0 ? 0 : 10 - $residuo; return ($intVerificador == $intUltimo ? TRUE : FALSE); } function validarRUC($strRUC) { if (strlen($strRUC) != 13) return FALSE; $suma = 0; $strOriginal = $strRUC; $intProvincia = substr($strRUC, 0, 2); $intTercero = $strRUC[2]; if (!settype($strRUC, "float")) return FALSE; if ((int) $intProvincia < 1 || (int) $intProvincia > 23) return FALSE; if ((int) $intTercero != 6 && (int) $intTercero != 9) { if (substr($strRUC, 10, 3) == '001') return validarCI(substr($strRUC, 0, 10)); return FALSE; } if ((int) $intTercero == 6) { $intUltimo = $strOriginal[8]; for ($indice = 0; $indice < 9; $indice++) { //echo $strOriginal[$indice],'</br>'; switch ($indice) { case 0: $arrProducto[$indice] = $strOriginal[$indice] * 3; break; case 1: $arrProducto[$indice] = $strOriginal[$indice] * 2; break; case 2: $arrProducto[$indice] = $strOriginal[$indice] * 7; break; case 3: $arrProducto[$indice] = $strOriginal[$indice] * 6; break; case 4: $arrProducto[$indice] = $strOriginal[$indice] * 5; break; case 5: $arrProducto[$indice] = $strOriginal[$indice] * 4; break; case 6: $arrProducto[$indice] = $strOriginal[$indice] * 3; break; case 7: $arrProducto[$indice] = $strOriginal[$indice] * 2; break; case 8: $arrProducto[$indice] = 0; break; } } } else { $intUltimo = $strOriginal[9]; for ($indice = 0; $indice < 9; $indice++) { //echo $strOriginal[$indice],'</br>'; switch ($indice) { case 0: $arrProducto[$indice] = $strOriginal[$indice] * 4; break; case 1: $arrProducto[$indice] = $strOriginal[$indice] * 3; break; case 2: $arrProducto[$indice] = $strOriginal[$indice] * 2; break; case 3: $arrProducto[$indice] = $strOriginal[$indice] * 7; break; case 4: $arrProducto[$indice] = $strOriginal[$indice] * 6; break; case 5: $arrProducto[$indice] = $strOriginal[$indice] * 5; break; case 6: $arrProducto[$indice] = $strOriginal[$indice] * 4; break; case 7: $arrProducto[$indice] = $strOriginal[$indice] * 3; break; case 8: $arrProducto[$indice] = $strOriginal[$indice] * 2; break; } } } foreach ($arrProducto as $indice => $producto) $suma += $producto; $residuo = $suma % 11; $intVerificador = $residuo == 0 ? 0 : 11 - $residuo; //echo "$intVerificador == $intUltimo"; return ($intVerificador == $intUltimo ? TRUE : FALSE); } function validarID($strId) { switch (strlen($strId)) { case 10: return validarCI($strId); break; case 13: return validarRUC($strId); break; default: return FALSE; } } public function beforeSave() { echo $this->$CONT_CEDULA; switch (strlen($this->$CONT_CEDULA)) { case 10: return validarCI($this->$CONT_CEDULA); break; case 13: return validarRUC($this->$CONT_CEDULA); break; default: echo "Numero de caracteres invalidos"; return FALSE; } //echo $op; } public function getSource() { return 'SPM_CONTACTO'; } public static function find($parameters = null) { return parent::find($parameters); } public static function findFirst($parameters = null) { return parent::findFirst($parameters); } </pre>
0debug
Angular js ng-model description with example? : What is the exact role of ng-model in angular js? can anyone explain with example ? and when we can use ng-model?
0debug
static int decode_rle(CamtasiaContext *c) { unsigned char *src = c->decomp_buf; unsigned char *output; int p1, p2, line=c->height, pos=0, i; output = c->pic.data[0] + (c->height - 1) * c->pic.linesize[0]; while(src < c->decomp_buf + c->decomp_size) { p1 = *src++; if(p1 == 0) { p2 = *src++; if(p2 == 0) { output = c->pic.data[0] + (--line) * c->pic.linesize[0]; pos = 0; continue; } else if(p2 == 1) { return 0; } else if(p2 == 2) { p1 = *src++; p2 = *src++; line -= p2; pos += p1; output = c->pic.data[0] + line * c->pic.linesize[0] + pos * (c->bpp / 8); continue; } for(i = 0; i < p2 * (c->bpp / 8); i++) { *output++ = *src++; } if(c->bpp == 8 && (p2 & 1)) { src++; } pos += p2; } else { int pix[3]; switch(c->bpp){ case 8: pix[0] = *src++; break; case 16: pix[0] = *src++; pix[1] = *src++; break; case 24: pix[0] = *src++; pix[1] = *src++; pix[2] = *src++; break; } for(i = 0; i < p1; i++) { switch(c->bpp){ case 8: *output++ = pix[0]; break; case 16: *output++ = pix[0]; *output++ = pix[1]; break; case 24: *output++ = pix[0]; *output++ = pix[1]; *output++ = pix[2]; break; } } pos += p1; } } av_log(c->avctx, AV_LOG_ERROR, "Camtasia warning: no End-of-picture code\n"); return 1; }
1threat
static void virtio_ccw_notify(DeviceState *d, uint16_t vector) { VirtioCcwDevice *dev = to_virtio_ccw_dev_fast(d); SubchDev *sch = dev->sch; uint64_t indicators; if (vector >= 128) { return; } if (vector < VIRTIO_PCI_QUEUE_MAX) { if (!dev->indicators) { return; } if (sch->thinint_active) { uint64_t ind_bit = dev->routes.adapter.ind_offset; virtio_set_ind_atomic(sch, dev->indicators->addr + (ind_bit + vector) / 8, 0x80 >> ((ind_bit + vector) % 8)); if (!virtio_set_ind_atomic(sch, dev->summary_indicator->addr, 0x01)) { css_adapter_interrupt(dev->thinint_isc); } } else { indicators = address_space_ldq(&address_space_memory, dev->indicators->addr, MEMTXATTRS_UNSPECIFIED, NULL); indicators |= 1ULL << vector; address_space_stq(&address_space_memory, dev->indicators->addr, indicators, MEMTXATTRS_UNSPECIFIED, NULL); css_conditional_io_interrupt(sch); } } else { if (!dev->indicators2) { return; } vector = 0; indicators = address_space_ldq(&address_space_memory, dev->indicators2->addr, MEMTXATTRS_UNSPECIFIED, NULL); indicators |= 1ULL << vector; address_space_stq(&address_space_memory, dev->indicators2->addr, indicators, MEMTXATTRS_UNSPECIFIED, NULL); css_conditional_io_interrupt(sch); } }
1threat
why is out.println as short as you can go? : <p>why is it that you can shorten java's system.out.println to out.println via static import of java.lang.system.out, but you cannot shorten it further to simply println?</p>
0debug
Input Data is not loading into Database : I am encountering the folowing problem: I have a program which is supposed to load the data into a database and it is not working. No errors popping out, it just does not load. Here is the connection code: public Conexion() { string dataSource = ".\\SQLEXPRESS"; string rutaBase = HostingEnvironment.MapPath(@"/App_Data/Database1.mdf"); cadenaConexion = "Data Source=" + dataSource + ";AttachDbFilename=\"" + rutaBase + "\";Integrated Security=true;User Instance=True"; }
0debug
void sample_dump(int fnum, int32_t *tab, int n) { static FILE *files[16], *f; char buf[512]; int i; int32_t v; f = files[fnum]; if (!f) { snprintf(buf, sizeof(buf), "/tmp/out%d.%s.pcm", fnum, #ifdef USE_HIGHPRECISION "hp" #else "lp" #endif ); f = fopen(buf, "w"); if (!f) return; files[fnum] = f; } if (fnum == 0) { static int pos = 0; printf("pos=%d\n", pos); for(i=0;i<n;i++) { printf(" %0.4f", (double)tab[i] / FRAC_ONE); if ((i % 18) == 17) printf("\n"); } pos += n; } for(i=0;i<n;i++) { v = tab[i] << (23 - FRAC_BITS); fwrite(&v, 1, sizeof(int32_t), f); } }
1threat
static void x86_cpuid_set_apic_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { X86CPU *cpu = X86_CPU(obj); DeviceState *dev = DEVICE(obj); const int64_t min = 0; const int64_t max = UINT32_MAX; Error *error = NULL; int64_t value; if (dev->realized) { error_setg(errp, "Attempt to set property '%s' on '%s' after " "it was realized", name, object_get_typename(obj)); return; } visit_type_int(v, name, &value, &error); if (error) { error_propagate(errp, error); return; } if (value < min || value > max) { error_setg(errp, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" , object_get_typename(obj), name, value, min, max); return; } if ((value != cpu->apic_id) && cpu_exists(value)) { error_setg(errp, "CPU with APIC ID %" PRIi64 " exists", value); return; } cpu->apic_id = value; }
1threat
static void unix_accept_incoming_migration(void *opaque) { struct sockaddr_un addr; socklen_t addrlen = sizeof(addr); int s = (unsigned long)opaque; QEMUFile *f; int c, ret; do { c = accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && socket_error() == EINTR); dprintf("accepted migration\n"); if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); return; } f = qemu_fopen_socket(c); if (f == NULL) { fprintf(stderr, "could not qemu_fopen socket\n"); goto out; } ret = qemu_loadvm_state(f); if (ret < 0) { fprintf(stderr, "load of migration failed\n"); goto out_fopen; } qemu_announce_self(); dprintf("successfully loaded vm state\n"); qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL); close(s); out_fopen: qemu_fclose(f); out: close(c); }
1threat
How to crawl an ajax generate web page? : <p>i have try to crawl <a href="https://world.taobao.com/search/search.htm?cat=50008090&amp;_ksTS=1461999216322_20&amp;spm=a21bp.7806943.banner_XX_cat.13.UxfRzO&amp;_input_charset=utf-8&amp;navigator=all&amp;json=on&amp;callback=__jsonp_cb&amp;cna=CKNtDjuNxTgCAdIGQMzvfvwH&amp;abtest=_AB-LR517-LR854-LR895-PR517-PR854-PV895_2462" rel="nofollow">https://world.taobao.com/search/search.htm?cat=50008090&amp;_ksTS=1461999216322_20&amp;spm=a21bp.7806943.banner_XX_cat.13.UxfRzO&amp;_input_charset=utf-8&amp;navigator=all&amp;json=on&amp;callback=__jsonp_cb&amp;cna=CKNtDjuNxTgCAdIGQMzvfvwH&amp;abtest=_AB-LR517-LR854-LR895-PR517-PR854-PV895_2462</a></p> <p>but not success, the reponse page source not match the view page,any one know how to do?Thanks</p>
0debug
Javascript Error: 'missing ) after argument list : <p>I have the following <code>StringBuilder</code> and inside of it I want to append my html, I have the following code but I am getting this error: <code>Javascript Error: 'missing ) after argument list</code></p> <p>Although in stackoverflow there are dozens of question with this same title, I checked all of them and could not solve my error.</p> <pre><code>StringBuilder emplDiv = new StringBuilder(); emplDiv.Append("$('.ulEmployeeSearch').append('&lt;div class='col-lg-3 col-md-4 col-sm-6 col-xs-12'&gt;&lt;p&gt;test&lt;p&gt;&lt;/div&gt;')"); </code></pre> <p>Please help me.</p>
0debug
How to remove docker completely from ubuntu 14.04 : <p>I installed Docker in Ubuntu while back but when I tried to remove the Docker still exist in the system. I followed this <a href="https://stackoverflow.com/a/31313851/2340159">https://stackoverflow.com/a/31313851/2340159</a> but didn't work.</p>
0debug
Compare 2 csv files with numaric values : Compare two csv files and required result need to be shared like diff in numaric values, field value type, count of records etc. input file A (XYZ_20190908.csv): Name,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10 K1 data,8470,37609,18413,13799,24946,27870,376,24573,27247,41569,687 Total VoLte Traffic,130944.126111,689417.554722,208189.652500,196002.846944,223558.256111,501265.626667,2508.617222,200054.686389,174738.403056,394327.636389,2017.576667 K2 Data,11163.201111,52680.898056,19920.813333,15878.103611,18247.582222,40295.689444,264.738333,17732.341111,15486.259444,32662.475833,199.080278 K3 Data,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN K4 Data,11163.201111,52680.898056,19920.813333,15878.103611,18247.582222,40295.689444,264.738333,17732.341111,15486.259444,32662.475833,199.080278 input file B (XYZ_20190909.csv): Name,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10 Calculation,CHN,GUJ,HR,KOL,MAH,MUM,PJB,ROB,TN,UPE,UPW K1 data,8467,37622,18418,14138,24943,27914,370,24621,27310,41565,687 K2 Data,199379.472222,NaN,241390.289167,264378.881667,292310.146944,774915.508056,3560.825278,212203.013611,213419.833611,403226.574444,2023.039167 K3 Data,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN K4 Data,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN Output 1. difference in each value for the corresponding fields. 2. if all the values are "NaN" error 3. compare value in file A with file B, if the value corresponding to the position in both file with different data have different data type (like file A having 52680.898056 and in file B the value is NaN) should display error need help
0debug
static int vmdk_create(const char *filename, QEMUOptionParameter *options, Error **errp) { int fd, idx = 0; char desc[BUF_SIZE]; int64_t total_size = 0, filesize; const char *adapter_type = NULL; const char *backing_file = NULL; const char *fmt = NULL; int flags = 0; int ret = 0; bool flat, split, compress; char ext_desc_lines[BUF_SIZE] = ""; char path[PATH_MAX], prefix[PATH_MAX], postfix[PATH_MAX]; const int64_t split_size = 0x80000000; const char *desc_extent_line; char parent_desc_line[BUF_SIZE] = ""; uint32_t parent_cid = 0xffffffff; uint32_t number_heads = 16; bool zeroed_grain = false; const char desc_template[] = "# Disk DescriptorFile\n" "version=1\n" "CID=%x\n" "parentCID=%x\n" "createType=\"%s\"\n" "%s" "\n" "# Extent description\n" "%s" "\n" "# The Disk Data Base\n" "#DDB\n" "\n" "ddb.virtualHWVersion = \"%d\"\n" "ddb.geometry.cylinders = \"%" PRId64 "\"\n" "ddb.geometry.heads = \"%d\"\n" "ddb.geometry.sectors = \"63\"\n" "ddb.adapterType = \"%s\"\n"; if (filename_decompose(filename, path, prefix, postfix, PATH_MAX, errp)) { return -EINVAL; } while (options && options->name) { if (!strcmp(options->name, BLOCK_OPT_SIZE)) { total_size = options->value.n; } else if (!strcmp(options->name, BLOCK_OPT_ADAPTER_TYPE)) { adapter_type = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) { backing_file = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_COMPAT6)) { flags |= options->value.n ? BLOCK_FLAG_COMPAT6 : 0; } else if (!strcmp(options->name, BLOCK_OPT_SUBFMT)) { fmt = options->value.s; } else if (!strcmp(options->name, BLOCK_OPT_ZEROED_GRAIN)) { zeroed_grain |= options->value.n; } options++; } if (!adapter_type) { adapter_type = "ide"; } else if (strcmp(adapter_type, "ide") && strcmp(adapter_type, "buslogic") && strcmp(adapter_type, "lsilogic") && strcmp(adapter_type, "legacyESX")) { error_setg(errp, "Unknown adapter type: '%s'", adapter_type); return -EINVAL; } if (strcmp(adapter_type, "ide") != 0) { number_heads = 255; } if (!fmt) { fmt = "monolithicSparse"; } else if (strcmp(fmt, "monolithicFlat") && strcmp(fmt, "monolithicSparse") && strcmp(fmt, "twoGbMaxExtentSparse") && strcmp(fmt, "twoGbMaxExtentFlat") && strcmp(fmt, "streamOptimized")) { error_setg(errp, "Unknown subformat: '%s'", fmt); return -EINVAL; } split = !(strcmp(fmt, "twoGbMaxExtentFlat") && strcmp(fmt, "twoGbMaxExtentSparse")); flat = !(strcmp(fmt, "monolithicFlat") && strcmp(fmt, "twoGbMaxExtentFlat")); compress = !strcmp(fmt, "streamOptimized"); if (flat) { desc_extent_line = "RW %lld FLAT \"%s\" 0\n"; } else { desc_extent_line = "RW %lld SPARSE \"%s\"\n"; } if (flat && backing_file) { error_setg(errp, "Flat image can't have backing file"); return -ENOTSUP; } if (flat && zeroed_grain) { error_setg(errp, "Flat image can't enable zeroed grain"); return -ENOTSUP; } if (backing_file) { BlockDriverState *bs = bdrv_new(""); ret = bdrv_open(bs, backing_file, NULL, 0, NULL, errp); if (ret != 0) { bdrv_unref(bs); return ret; } if (strcmp(bs->drv->format_name, "vmdk")) { bdrv_unref(bs); return -EINVAL; } parent_cid = vmdk_read_cid(bs, 0); bdrv_unref(bs); snprintf(parent_desc_line, sizeof(parent_desc_line), "parentFileNameHint=\"%s\"", backing_file); } filesize = total_size; while (filesize > 0) { char desc_line[BUF_SIZE]; char ext_filename[PATH_MAX]; char desc_filename[PATH_MAX]; int64_t size = filesize; if (split && size > split_size) { size = split_size; } if (split) { snprintf(desc_filename, sizeof(desc_filename), "%s-%c%03d%s", prefix, flat ? 'f' : 's', ++idx, postfix); } else if (flat) { snprintf(desc_filename, sizeof(desc_filename), "%s-flat%s", prefix, postfix); } else { snprintf(desc_filename, sizeof(desc_filename), "%s%s", prefix, postfix); } snprintf(ext_filename, sizeof(ext_filename), "%s%s", path, desc_filename); if (vmdk_create_extent(ext_filename, size, flat, compress, zeroed_grain)) { return -EINVAL; } filesize -= size; snprintf(desc_line, sizeof(desc_line), desc_extent_line, size / 512, desc_filename); pstrcat(ext_desc_lines, sizeof(ext_desc_lines), desc_line); } snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL), parent_cid, fmt, parent_desc_line, ext_desc_lines, (flags & BLOCK_FLAG_COMPAT6 ? 6 : 4), total_size / (int64_t)(63 * number_heads * 512), number_heads, adapter_type); if (split || flat) { fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, 0644); } else { fd = qemu_open(filename, O_WRONLY | O_BINARY | O_LARGEFILE, 0644); } if (fd < 0) { return -errno; } if (!split && !flat && 0x200 != lseek(fd, 0x200, SEEK_SET)) { ret = -errno; goto exit; } ret = qemu_write_full(fd, desc, strlen(desc)); if (ret != strlen(desc)) { ret = -errno; goto exit; } ret = 0; exit: qemu_close(fd); return ret; }
1threat
target_ulong spapr_rtas_call(PowerPCCPU *cpu, sPAPREnvironment *spapr, uint32_t token, uint32_t nargs, target_ulong args, uint32_t nret, target_ulong rets) { if ((token >= TOKEN_BASE) && ((token - TOKEN_BASE) < TOKEN_MAX)) { struct rtas_call *call = rtas_table + (token - TOKEN_BASE); if (call->fn) { call->fn(cpu, spapr, token, nargs, args, nret, rets); return H_SUCCESS; } } if (token == 0xa) { rtas_display_character(cpu, spapr, 0xa, nargs, args, nret, rets); return H_SUCCESS; } hcall_dprintf("Unknown RTAS token 0x%x\n", token); rtas_st(rets, 0, RTAS_OUT_PARAM_ERROR); return H_PARAMETER; }
1threat
how to know when a button has been clicked a second time : <p>Hey I have a button called next and when it is clicked the first time it creates a textbox and label but I want to make it create another textbox when it is clicked the second time and then remove the button.</p>
0debug
replace string using delimator in python : I have a string like s = "2+3-5+sqrt(6)+5 I have to make it to s = "2+3-5+(6 ** 0.5)+5 How can I replace **sqrt(num)** with **(num ** 0.5)** in Python?
0debug
My Script Node JS response this error: error: Forever detected script was killed by signal: SIGKILL error: Script restart attempt #15 : <--- Last few GCs ---> [11266:0x2890040] 75587 ms: Mark-sweep 1363.8 (1424.5) -> 1363.5 (1423.5) MB, 1341.2 / 4.2 ms (average mu = 0.168, current mu = 0.119) allocation failure scavenge might not succeed [11266:0x2890040] 75605 ms: Scavenge 1364.1 (1423.5) -> 1363.8 (1424.0) MB, 11.4 / 0.0 ms (average mu = 0.168, current mu = 0.119) allocation failure [11266:0x2890040] 75621 ms: Scavenge 1364.4 (1424.0) -> 1364.2 (1425.0) MB, 10.6 / 0.0 ms (average mu = 0.168, current mu = 0.119) allocation failure <--- JS stacktrace ---> ==== JS stack trace ========================================= 0: ExitFrame [pc: 0x2b010e34fb5d] 1: StubFrame [pc: 0x2b010e350eca] Security context: 0x17ee2c91d969 2: normalizeString(aka normalizeString) [0x47fafaaaf01] [path.js:~57] [pc=0x2b010e58d424](this=0x2202476025b1 ,0x3086a38e3169 ,0x220247602801 ,0x10ca23627b19 ,0x047fafaaaf41 ) 3: /* anonymous */(aka... FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 0x90af00 node::Abort() [node] 2: 0x90af4c [node] 3: 0xb05f9e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [node] 4: 0xb061d4 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [node] 5: 0xf0c6f2 [node] 6: 0xf0c7f8 v8::internal::Heap::CheckIneffectiveMarkCompact(unsigned long, double) [node] 7: 0xf18f88 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [node] 8: 0xf19b1b v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [node] 9: 0xf1c851 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationSpace, v8::internal::AllocationAlignment) [node] 10: 0xee6834 v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationSpace) [node] 11: 0x11a0672 v8::internal::Runtime_AllocateInNewSpace(int, v8::internal::Object**, v8::internal::Isolate*) [node] 12: 0x2b010e34fb5d Aborted (core dumped)
0debug
static int coroutine_fn v9fs_complete_rename(V9fsPDU *pdu, V9fsFidState *fidp, int32_t newdirfid, V9fsString *name) { char *end; int err = 0; V9fsPath new_path; V9fsFidState *tfidp; V9fsState *s = pdu->s; V9fsFidState *dirfidp = NULL; char *old_name, *new_name; v9fs_path_init(&new_path); if (newdirfid != -1) { dirfidp = get_fid(pdu, newdirfid); if (dirfidp == NULL) { err = -ENOENT; goto out_nofid; } BUG_ON(dirfidp->fid_type != P9_FID_NONE); v9fs_co_name_to_path(pdu, &dirfidp->path, name->data, &new_path); } else { old_name = fidp->path.data; end = strrchr(old_name, '/'); if (end) { end++; } else { end = old_name; } new_name = g_malloc0(end - old_name + name->size + 1); strncat(new_name, old_name, end - old_name); strncat(new_name + (end - old_name), name->data, name->size); v9fs_co_name_to_path(pdu, NULL, new_name, &new_path); g_free(new_name); } err = v9fs_co_rename(pdu, &fidp->path, &new_path); if (err < 0) { goto out; } for (tfidp = s->fid_list; tfidp; tfidp = tfidp->next) { if (v9fs_path_is_ancestor(&fidp->path, &tfidp->path)) { v9fs_fix_path(&tfidp->path, &new_path, strlen(fidp->path.data)); } } out: if (dirfidp) { put_fid(pdu, dirfidp); } v9fs_path_free(&new_path); out_nofid: return err; }
1threat
petalogix_s3adsp1800_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *cpu_model = machine->cpu_model; DeviceState *dev; MicroBlazeCPU *cpu; DriveInfo *dinfo; int i; hwaddr ddr_base = MEMORY_BASEADDR; MemoryRegion *phys_lmb_bram = g_new(MemoryRegion, 1); MemoryRegion *phys_ram = g_new(MemoryRegion, 1); qemu_irq irq[32]; MemoryRegion *sysmem = get_system_memory(); if (cpu_model == NULL) { cpu_model = "microblaze"; } cpu = cpu_mb_init(cpu_model); memory_region_init_ram(phys_lmb_bram, NULL, "petalogix_s3adsp1800.lmb_bram", LMB_BRAM_SIZE, &error_abort); vmstate_register_ram_global(phys_lmb_bram); memory_region_add_subregion(sysmem, 0x00000000, phys_lmb_bram); memory_region_init_ram(phys_ram, NULL, "petalogix_s3adsp1800.ram", ram_size, &error_abort); vmstate_register_ram_global(phys_ram); memory_region_add_subregion(sysmem, ddr_base, phys_ram); dinfo = drive_get(IF_PFLASH, 0, 0); pflash_cfi01_register(FLASH_BASEADDR, NULL, "petalogix_s3adsp1800.flash", FLASH_SIZE, dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, (64 * 1024), FLASH_SIZE >> 16, 1, 0x89, 0x18, 0x0000, 0x0, 1); dev = qdev_create(NULL, "xlnx.xps-intc"); qdev_prop_set_uint32(dev, "kind-of-intr", 1 << ETHLITE_IRQ | 1 << UARTLITE_IRQ); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, INTC_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, qdev_get_gpio_in(DEVICE(cpu), MB_CPU_IRQ)); for (i = 0; i < 32; i++) { irq[i] = qdev_get_gpio_in(dev, i); } sysbus_create_simple("xlnx.xps-uartlite", UARTLITE_BASEADDR, irq[UARTLITE_IRQ]); dev = qdev_create(NULL, "xlnx.xps-timer"); qdev_prop_set_uint32(dev, "one-timer-only", 0); qdev_prop_set_uint32(dev, "clock-frequency", 62 * 1000000); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, TIMER_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[TIMER_IRQ]); qemu_check_nic_model(&nd_table[0], "xlnx.xps-ethernetlite"); dev = qdev_create(NULL, "xlnx.xps-ethernetlite"); qdev_set_nic_properties(dev, &nd_table[0]); qdev_prop_set_uint32(dev, "tx-ping-pong", 0); qdev_prop_set_uint32(dev, "rx-ping-pong", 0); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, ETHLITE_BASEADDR); sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[ETHLITE_IRQ]); microblaze_load_kernel(cpu, ddr_base, ram_size, machine->initrd_filename, BINARY_DEVICE_TREE_FILE, machine_cpu_reset); }
1threat
static void do_video_out(AVFormatContext *s, OutputStream *ost, AVFrame *next_picture, double sync_ipts) { int ret, format_video_sync; AVPacket pkt; AVCodecContext *enc = ost->enc_ctx; AVCodecContext *mux_enc = ost->st->codec; int nb_frames, nb0_frames, i; double delta, delta0; double duration = 0; int frame_size = 0; InputStream *ist = NULL; AVFilterContext *filter = ost->filter->filter; if (ost->source_index >= 0) ist = input_streams[ost->source_index]; if (filter->inputs[0]->frame_rate.num > 0 && filter->inputs[0]->frame_rate.den > 0) duration = 1/(av_q2d(filter->inputs[0]->frame_rate) * av_q2d(enc->time_base)); if(ist && ist->st->start_time != AV_NOPTS_VALUE && ist->st->first_dts != AV_NOPTS_VALUE && ost->frame_rate.num) duration = FFMIN(duration, 1/(av_q2d(ost->frame_rate) * av_q2d(enc->time_base))); if (!ost->filters_script && !ost->filters && next_picture && ist && lrintf(av_frame_get_pkt_duration(next_picture) * av_q2d(ist->st->time_base) / av_q2d(enc->time_base)) > 0) { duration = lrintf(av_frame_get_pkt_duration(next_picture) * av_q2d(ist->st->time_base) / av_q2d(enc->time_base)); } if (!next_picture) { nb0_frames = nb_frames = mid_pred(ost->last_nb0_frames[0], ost->last_nb0_frames[1], ost->last_nb0_frames[2]); } else { delta0 = sync_ipts - ost->sync_opts; delta = delta0 + duration; nb0_frames = 0; nb_frames = 1; format_video_sync = video_sync_method; if (format_video_sync == VSYNC_AUTO) { if(!strcmp(s->oformat->name, "avi")) { format_video_sync = VSYNC_VFR; } else format_video_sync = (s->oformat->flags & AVFMT_VARIABLE_FPS) ? ((s->oformat->flags & AVFMT_NOTIMESTAMPS) ? VSYNC_PASSTHROUGH : VSYNC_VFR) : VSYNC_CFR; if ( ist && format_video_sync == VSYNC_CFR && input_files[ist->file_index]->ctx->nb_streams == 1 && input_files[ist->file_index]->input_ts_offset == 0) { format_video_sync = VSYNC_VSCFR; } if (format_video_sync == VSYNC_CFR && copy_ts) { format_video_sync = VSYNC_VSCFR; } } if (delta0 < 0 && delta > 0 && format_video_sync != VSYNC_PASSTHROUGH && format_video_sync != VSYNC_DROP) { double cor = FFMIN(-delta0, duration); if (delta0 < -0.6) { av_log(NULL, AV_LOG_WARNING, "Past duration %f too large\n", -delta0); } else av_log(NULL, AV_LOG_DEBUG, "Cliping frame in rate conversion by %f\n", -delta0); sync_ipts += cor; duration -= cor; delta0 += cor; } switch (format_video_sync) { case VSYNC_VSCFR: if (ost->frame_number == 0 && delta - duration >= 0.5) { av_log(NULL, AV_LOG_DEBUG, "Not duplicating %d initial frames\n", (int)lrintf(delta - duration)); delta = duration; delta0 = 0; ost->sync_opts = lrint(sync_ipts); } case VSYNC_CFR: if (frame_drop_threshold && delta < frame_drop_threshold && ost->frame_number) { nb_frames = 0; } else if (delta < -1.1) nb_frames = 0; else if (delta > 1.1) { nb_frames = lrintf(delta); if (delta0 > 1.1) nb0_frames = lrintf(delta0 - 0.6); } break; case VSYNC_VFR: if (delta <= -0.6) nb_frames = 0; else if (delta > 0.6) ost->sync_opts = lrint(sync_ipts); break; case VSYNC_DROP: case VSYNC_PASSTHROUGH: ost->sync_opts = lrint(sync_ipts); break; default: av_assert0(0); } } nb_frames = FFMIN(nb_frames, ost->max_frames - ost->frame_number); nb0_frames = FFMIN(nb0_frames, nb_frames); memmove(ost->last_nb0_frames + 1, ost->last_nb0_frames, sizeof(ost->last_nb0_frames[0]) * (FF_ARRAY_ELEMS(ost->last_nb0_frames) - 1)); ost->last_nb0_frames[0] = nb0_frames; if (nb0_frames == 0 && ost->last_droped) { nb_frames_drop++; av_log(NULL, AV_LOG_VERBOSE, "*** dropping frame %d from stream %d at ts %"PRId64"\n", ost->frame_number, ost->st->index, ost->last_frame->pts); } if (nb_frames > (nb0_frames && ost->last_droped) + (nb_frames > nb0_frames)) { if (nb_frames > dts_error_threshold * 30) { av_log(NULL, AV_LOG_ERROR, "%d frame duplication too large, skipping\n", nb_frames - 1); nb_frames_drop++; return; } nb_frames_dup += nb_frames - (nb0_frames && ost->last_droped) - (nb_frames > nb0_frames); av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1); } ost->last_droped = nb_frames == nb0_frames && next_picture; for (i = 0; i < nb_frames; i++) { AVFrame *in_picture; av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; if (i < nb0_frames && ost->last_frame) { in_picture = ost->last_frame; } else in_picture = next_picture; if (!in_picture) return; in_picture->pts = ost->sync_opts; #if 1 if (!check_recording_time(ost)) #else if (ost->frame_number >= ost->max_frames) #endif return; if (s->oformat->flags & AVFMT_RAWPICTURE && enc->codec->id == AV_CODEC_ID_RAWVIDEO) { if (in_picture->interlaced_frame) mux_enc->field_order = in_picture->top_field_first ? AV_FIELD_TB:AV_FIELD_BT; else mux_enc->field_order = AV_FIELD_PROGRESSIVE; pkt.data = (uint8_t *)in_picture; pkt.size = sizeof(AVPicture); pkt.pts = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base); pkt.flags |= AV_PKT_FLAG_KEY; write_frame(s, &pkt, ost); } else { int got_packet, forced_keyframe = 0; double pts_time; if (enc->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) && ost->top_field_first >= 0) in_picture->top_field_first = !!ost->top_field_first; if (in_picture->interlaced_frame) { if (enc->codec->id == AV_CODEC_ID_MJPEG) mux_enc->field_order = in_picture->top_field_first ? AV_FIELD_TT:AV_FIELD_BB; else mux_enc->field_order = in_picture->top_field_first ? AV_FIELD_TB:AV_FIELD_BT; } else mux_enc->field_order = AV_FIELD_PROGRESSIVE; in_picture->quality = enc->global_quality; in_picture->pict_type = 0; pts_time = in_picture->pts != AV_NOPTS_VALUE ? in_picture->pts * av_q2d(enc->time_base) : NAN; if (ost->forced_kf_index < ost->forced_kf_count && in_picture->pts >= ost->forced_kf_pts[ost->forced_kf_index]) { ost->forced_kf_index++; forced_keyframe = 1; } else if (ost->forced_keyframes_pexpr) { double res; ost->forced_keyframes_expr_const_values[FKF_T] = pts_time; res = av_expr_eval(ost->forced_keyframes_pexpr, ost->forced_keyframes_expr_const_values, NULL); ff_dlog(NULL, "force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n", ost->forced_keyframes_expr_const_values[FKF_N], ost->forced_keyframes_expr_const_values[FKF_N_FORCED], ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N], ost->forced_keyframes_expr_const_values[FKF_T], ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T], res); if (res) { forced_keyframe = 1; ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_N] = ost->forced_keyframes_expr_const_values[FKF_N]; ost->forced_keyframes_expr_const_values[FKF_PREV_FORCED_T] = ost->forced_keyframes_expr_const_values[FKF_T]; ost->forced_keyframes_expr_const_values[FKF_N_FORCED] += 1; } ost->forced_keyframes_expr_const_values[FKF_N] += 1; } else if ( ost->forced_keyframes && !strncmp(ost->forced_keyframes, "source", 6) && in_picture->key_frame==1) { forced_keyframe = 1; } if (forced_keyframe) { in_picture->pict_type = AV_PICTURE_TYPE_I; av_log(NULL, AV_LOG_DEBUG, "Forced keyframe at time %f\n", pts_time); } update_benchmark(NULL); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder <- type:video " "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n", av_ts2str(in_picture->pts), av_ts2timestr(in_picture->pts, &enc->time_base), enc->time_base.num, enc->time_base.den); } ost->frames_encoded++; ret = avcodec_encode_video2(enc, &pkt, in_picture, &got_packet); update_benchmark("encode_video %d.%d", ost->file_index, ost->index); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } if (got_packet) { if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:video " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &enc->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &enc->time_base)); } if (pkt.pts == AV_NOPTS_VALUE && !(enc->codec->capabilities & AV_CODEC_CAP_DELAY)) pkt.pts = ost->sync_opts; av_packet_rescale_ts(&pkt, enc->time_base, ost->st->time_base); if (debug_ts) { av_log(NULL, AV_LOG_INFO, "encoder -> type:video " "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n", av_ts2str(pkt.pts), av_ts2timestr(pkt.pts, &ost->st->time_base), av_ts2str(pkt.dts), av_ts2timestr(pkt.dts, &ost->st->time_base)); } frame_size = pkt.size; write_frame(s, &pkt, ost); if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } } } ost->sync_opts++; ost->frame_number++; if (vstats_filename && frame_size) do_video_stats(ost, frame_size); } if (!ost->last_frame) ost->last_frame = av_frame_alloc(); av_frame_unref(ost->last_frame); if (next_picture && ost->last_frame) av_frame_ref(ost->last_frame, next_picture); else av_frame_free(&ost->last_frame); }
1threat
def re_arrange_tuples(test_list, ord_list): temp = dict(test_list) res = [(key, temp[key]) for key in ord_list] return (res)
0debug
How to disable default Widget splash effect in Flutter? : <p>How can I disable the default splash/ripple/ink effect on a Widget? Sometimes the effect is unwanted, such as in the following TextField case:</p> <p><img src="https://i.imgur.com/drMJsNi.png" alt=""></p>
0debug
Homework gone wild : "Cannot create a generic array of AbstractChain<T>" : <p>So this is an exercice given by my teacher. We're creating a SkipList, aka a "LinkedList" with shortcuts. He gave us a class diagram with one interface (AbstractLink) and three class (StartLink and EndLink implement AbstractLink while Link extends StartLink). He also gave us a huge part of the code but i find it surprising that the interface is empty, i dont really understand why it is and he doesn't look like we need to fill it. Anyhow, in the StartLink, he told us to write the constructor.</p> <p>So i tried to initialize nexts, which is an array of AbstractLink (???), with the parameter n. As far as I searched, it's impossible to do it because the type of the AbstractLink is not defined. But it leaves me clueless with what i have to change ...</p> <pre class="lang-java prettyprint-override"><code>public interface AbstractLink&lt;T extends Comparable&lt;T&gt;&gt; extends Comparable&lt;AbstractLink&lt;T&gt;&gt; { } </code></pre> <pre class="lang-java prettyprint-override"><code>public class StartLink&lt;T extends Comparable&lt;T&gt;&gt; implements AbstractLink&lt;T&gt; { final AbstractLink&lt;T&gt;[] nexts; public StartLink(int n){ this.nexts = new AbstractLink&lt;T&gt;[n]; //my line } </code></pre> <p>And Eclipse gives me this : Cannot create a generic array of ChainonAbstrait</p> <p>Thanks in advance</p>
0debug
Modify value in dictionary | Python : Im learning python. trying to make my first software. If someone can help me : Code > : > > dict = {} > flag = True > while True: > length = raw_input('enter length') > amount = raw_input('enter amount') > if (length == 'quit') or (amount == 'quit'): > flag = False > continue > > # I want to add code so: if key in dict >>> previous value + amount >> insert the new value to the key > else : > dict[length] = amount for example: my inputs are : 13000,2 than : 12000 : 2 and again : 13,000 : 2 so dict will inclued : 13000:4 , 12000:2 # adding the length + amount to the dict. dict[length] = amount Sorry if i wasnt so clear. hope you help. Thank you
0debug
Luigi LocalTarget binary file : <p>I am having troubles to write a binary <code>LocalTarget</code> in a Luigi pipeline in my project. I isolated the problem here:</p> <pre><code>class LuigiTest(luigi.Task): def output(self): return luigi.LocalTarget('test.npz') def run(self): with self.output().open('wb') as fout: np.savez_compressed(fout, array=np.asarray([1, 2, 3])) </code></pre> <p>I tried opening as <code>'w'</code> and <code>'wb'</code> but I keep getting the following error:</p> <pre><code>TypeError: write() argument must be str, not bytes </code></pre> <p>I am using python 3.5.1 and my version of luigi is 2.1.1</p>
0debug
How i can convert a list to a dictionary in pytho34 : How i can convert a list of, >> print(row) >> [text:'Data 1', text:'Data 27'] # this is list but i want a dic to something like >> print(row) >> {'text':'Data 1', 'text':'data 27'} # this is how i want my list to be i tried like every possible aswer that i found while googling this.
0debug
TypeError: sally is undefined : <p>Help me please, i have error "TypeError: sally is undefined"; I don`t understand why.</p> <pre><code>function Person(name,age) { this.name = name; this.age = age; this.species = "Homo Sapiens"; }; var sally = Person("Sally Bowles", 39); var holden = Person("Holden Bowles", 16); console.log("sally's species is " + sally.species + " and she is " + sally.age); console.log("holden's species is " + holden.species + " and he is " + holden.age); </code></pre>
0debug
Difference Between Remove and Uninstall WindowsFeature : <p>I am running Windows Server 2016, and added a Windows Feature via the Powershell command:</p> <pre><code>Add-WindowsFeature NET-WCF-MSMQ-Activation45 </code></pre> <p>If I were to remove/uninstall it, which should I be using?</p> <pre><code>Remove-WindowsFeature NET-WCF-MSMQ-Activation45 Uninstall-WindowsFeature NET-WCF-MSMQ-Activation45 </code></pre> <hr> <p>Also, will a server restart be required after the change?</p> <p>Thank you.</p>
0debug
JSON Atribute response is unidentified : This is getting me crazy... var _my_obj = my_function(); // Connects to a server and gets data formated as JSON. console.log(_my_obj); // Shows me the Object and all its attributes. console.log(_myobj.count); // Shows me "unidentified". And I am sure "count " attribute exists. Any Ideas???
0debug
How can I find the exact rand() used in a C library? : <p>As a part of my coursework I need to find and re-code a rand() random number generator which outputs the same numbers as the original. The starting sequence is 1804289383 846930886 1681692777 1714636915 1957747793 424238335 719885386 1649760492 596516649 1189641421 1025202362 and can be generated at <a href="http://ideone.com/H7tsSI" rel="nofollow noreferrer">http://ideone.com/H7tsSI</a></p> <pre><code>#include &lt;stdlib.h&gt; /* rand */ #include &lt;iostream&gt; using namespace std; int main () { for (int i = 0 ; i&lt; 10 ; i++) { cout &lt;&lt; rand() &lt;&lt; " "; } cout &lt;&lt; rand(); return 0; } </code></pre> <p>My issue is that I can't find the original source of this generator, and I don't know how I can figure out the way the generator works from the full sequence of the generator, which is 100 numbers long. Could someone help me either find the original generator or teach me how I can find a generator from its sequence? Thanks!</p>
0debug
I face database connection error when I try to connect data base with the latest version of PHP : <p>Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() show this errror:</p> <pre><code>// returns true or false function _pconnect($argHostname, $argUsername, $argPassword, $argDatabasename) { if (ADODB_PHPVER &gt;= 0x4300) $this-&gt;_connectionID = mysql_pconnect($argHostname,$argUsername,$argPassword,$this-&gt;clientFlags); else $this-&gt;_connectionID = mysql_pconnect($argHostname,$argUsername,$argPassword); if ($this-&gt;_connectionID === false) return false; if ($this-&gt;autoRollback) $this-&gt;RollbackTrans(); if ($argDatabasename) return $this-&gt;SelectDB($argDatabasename); return true; } </code></pre> <p>show error in mysql_connect () so how to fix this and how to remove deprecation in the latest version of PHP.</p>
0debug
static void virtio_ccw_device_realize(VirtioCcwDevice *dev, Error **errp) { VirtIOCCWDeviceClass *k = VIRTIO_CCW_DEVICE_GET_CLASS(dev); CcwDevice *ccw_dev = CCW_DEVICE(dev); CCWDeviceClass *ck = CCW_DEVICE_GET_CLASS(ccw_dev); DeviceState *parent = DEVICE(ccw_dev); BusState *qbus = qdev_get_parent_bus(parent); VirtualCssBus *cbus = VIRTUAL_CSS_BUS(qbus); SubchDev *sch; Error *err = NULL; sch = css_create_sch(ccw_dev->devno, true, cbus->squash_mcss, errp); if (!sch) { return; } if (!virtio_ccw_rev_max(dev) && dev->force_revision_1) { error_setg(&err, "Invalid value of property max_rev " "(is %d expected >= 1)", virtio_ccw_rev_max(dev)); goto out_err; } sch->driver_data = dev; sch->ccw_cb = virtio_ccw_cb; sch->disable_cb = virtio_sch_disable_cb; sch->id.reserved = 0xff; sch->id.cu_type = VIRTIO_CCW_CU_TYPE; sch->do_subchannel_work = do_subchannel_work_virtual; ccw_dev->sch = sch; dev->indicators = NULL; dev->revision = -1; css_sch_build_virtual_schib(sch, 0, VIRTIO_CCW_CHPID_TYPE); trace_virtio_ccw_new_device( sch->cssid, sch->ssid, sch->schid, sch->devno, ccw_dev->devno.valid ? "user-configured" : "auto-configured"); if (!kvm_eventfds_enabled()) { dev->flags &= ~VIRTIO_CCW_FLAG_USE_IOEVENTFD; } if (k->realize) { k->realize(dev, &err); if (err) { goto out_err; } } ck->realize(ccw_dev, &err); if (err) { goto out_err; } return; out_err: error_propagate(errp, err); css_subch_assign(sch->cssid, sch->ssid, sch->schid, sch->devno, NULL); ccw_dev->sch = NULL; g_free(sch); }
1threat
JSF: How to sort the dropdown list before displaying in dropdown box : [This is drop down list][1] The below image will show the code for that drop down box. It will return a list of object, after that I'm creating new SelectItem object. Is there any way to sort the list of object before I'm creating new SelectItem object. [Java Code for Drop Down box[2] Sorry, I'm not able to send the entire code, due to confidential [1]: https://i.stack.imgur.com/xo6Du.png [2]: https://i.stack.imgur.com/Y9L0W.png
0debug
static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; int ret; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams - 1]; sc = st->priv_data; avio_r8(pb); avio_rb24(pb); sc->stsd_count = avio_rb32(pb); sc->extradata = av_mallocz_array(sc->stsd_count, sizeof(*sc->extradata)); if (!sc->extradata) return AVERROR(ENOMEM); sc->extradata_size = av_mallocz_array(sc->stsd_count, sizeof(*sc->extradata_size)); if (!sc->extradata_size) return AVERROR(ENOMEM); ret = ff_mov_read_stsd_entries(c, pb, sc->stsd_count); if (ret < 0) return ret; av_freep(&st->codecpar->extradata); st->codecpar->extradata_size = sc->extradata_size[0]; if (sc->extradata_size[0]) { st->codecpar->extradata = av_mallocz(sc->extradata_size[0] + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codecpar->extradata) return AVERROR(ENOMEM); memcpy(st->codecpar->extradata, sc->extradata[0], sc->extradata_size[0]); } return 0; }
1threat
Code for how to prevent user from refreshing the page either by using refresh button of browser or CTRL+F5 in angular js : <p>Code for how to prevent user from refreshing the page either by using refresh button of browser or CTRL+F5 in angular js</p>
0debug
static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) { MpegTSContext *ts = filter->u.section_filter.opaque; MpegTSSectionFilter *tssf = &filter->u.section_filter; SectionHeader h1, *h = &h1; PESContext *pes; AVStream *st; const uint8_t *p, *p_end, *desc_list_end; int program_info_length, pcr_pid, pid, stream_type; int desc_list_len; uint32_t prog_reg_desc = 0; int mp4_descr_count = 0; Mp4Descr mp4_descr[MAX_MP4_DESCR_COUNT] = { { 0 } }; int i; av_log(ts->stream, AV_LOG_TRACE, "PMT: len %i\n", section_len); hex_dump_debug(ts->stream, section, section_len); p_end = section + section_len - 4; p = section; if (parse_section_header(h, &p, p_end) < 0) return; if (h->version == tssf->last_ver) return; tssf->last_ver = h->version; av_log(ts->stream, AV_LOG_TRACE, "sid=0x%x sec_num=%d/%d version=%d\n", h->id, h->sec_num, h->last_sec_num, h->version); if (h->tid != PMT_TID) return; if (!ts->scan_all_pmts && ts->skip_changes) return; if (!ts->skip_clear) clear_program(ts, h->id); pcr_pid = get16(&p, p_end); if (pcr_pid < 0) return; pcr_pid &= 0x1fff; add_pid_to_pmt(ts, h->id, pcr_pid); set_pcr_pid(ts->stream, h->id, pcr_pid); av_log(ts->stream, AV_LOG_TRACE, "pcr_pid=0x%x\n", pcr_pid); program_info_length = get16(&p, p_end); if (program_info_length < 0) return; program_info_length &= 0xfff; while (program_info_length >= 2) { uint8_t tag, len; tag = get8(&p, p_end); len = get8(&p, p_end); av_log(ts->stream, AV_LOG_TRACE, "program tag: 0x%02x len=%d\n", tag, len); if (len > program_info_length - 2) break; program_info_length -= len + 2; if (tag == 0x1d) { get8(&p, p_end); get8(&p, p_end); len -= 2; mp4_read_iods(ts->stream, p, len, mp4_descr + mp4_descr_count, &mp4_descr_count, MAX_MP4_DESCR_COUNT); } else if (tag == 0x05 && len >= 4) { prog_reg_desc = bytestream_get_le32(&p); len -= 4; } p += len; } p += program_info_length; if (p >= p_end) goto out; if (!ts->stream->nb_streams) ts->stop_parse = 2; set_pmt_found(ts, h->id); for (;;) { st = 0; pes = NULL; stream_type = get8(&p, p_end); if (stream_type < 0) break; pid = get16(&p, p_end); if (pid < 0) goto out; pid &= 0x1fff; if (pid == ts->current_pid) goto out; if (ts->pids[pid] && ts->pids[pid]->type == MPEGTS_PES) { pes = ts->pids[pid]->u.pes_filter.opaque; if (!pes->st) { pes->st = avformat_new_stream(pes->stream, NULL); if (!pes->st) goto out; pes->st->id = pes->pid; } st = pes->st; } else if (stream_type != 0x13) { if (ts->pids[pid]) mpegts_close_filter(ts, ts->pids[pid]); pes = add_pes_stream(ts, pid, pcr_pid); if (pes) { st = avformat_new_stream(pes->stream, NULL); if (!st) goto out; st->id = pes->pid; } } else { int idx = ff_find_stream_index(ts->stream, pid); if (idx >= 0) { st = ts->stream->streams[idx]; } else { st = avformat_new_stream(ts->stream, NULL); if (!st) goto out; st->id = pid; st->codec->codec_type = AVMEDIA_TYPE_DATA; } } if (!st) goto out; if (pes && !pes->stream_type) mpegts_set_stream_info(st, pes, stream_type, prog_reg_desc); add_pid_to_pmt(ts, h->id, pid); ff_program_add_stream_index(ts->stream, h->id, st->index); desc_list_len = get16(&p, p_end); if (desc_list_len < 0) goto out; desc_list_len &= 0xfff; desc_list_end = p + desc_list_len; if (desc_list_end > p_end) goto out; for (;;) { if (ff_parse_mpeg2_descriptor(ts->stream, st, stream_type, &p, desc_list_end, mp4_descr, mp4_descr_count, pid, ts) < 0) break; if (pes && prog_reg_desc == AV_RL32("HDMV") && stream_type == 0x83 && pes->sub_st) { ff_program_add_stream_index(ts->stream, h->id, pes->sub_st->index); pes->sub_st->codec->codec_tag = st->codec->codec_tag; } } p = desc_list_end; } if (!ts->pids[pcr_pid]) mpegts_open_pcr_filter(ts, pcr_pid); out: for (i = 0; i < mp4_descr_count; i++) av_free(mp4_descr[i].dec_config_descr); }
1threat
Android Device Monitor "data" folder is empty : <p>I have tested creating, inserting and retrieving data into my apps db, and know it works through usage of Log statements. </p> <p>However, I wish to expedite testing and use the Android Device Monitor. However, though the db exists and data is stored, when accessing below, the <code>data</code> folder is empty:</p> <p><a href="https://i.stack.imgur.com/2y1zs.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2y1zs.png" alt="enter image description here"></a></p> <p>Why would this be the case? How can this be configured to show the db file and contents?</p>
0debug