problem
stringlengths
26
131k
labels
class label
2 classes
Can't bind to 'ngModel' since it isn't a known property of 'mat-slide-toggle' : <p>I am trying to get the current value of a <code>mat-slide-toggle</code> but unfortunatly I will get an error:</p> <pre><code>Error: Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'mat-slide-toggle'. </code></pre> <p>I am using the toggle like this in the html part of my component:</p> <pre><code> &lt;mat-slide-toggle color="primary" [(ngModel)]="showInnerView"&gt; Default Slide Toggle &lt;/mat-slide-toggle&gt; </code></pre> <p>Corresponding property in my component:</p> <pre><code>showInnerView: boolean = false; </code></pre> <p>What I am doing wrong?</p> <hr> <p><a href="https://material.angular.io/components/slide-toggle/overview" rel="noreferrer">Documentation</a> of <code>mat-slide-toggle</code></p> <p><a href="https://github.com/angular/material2/blob/master/src/demo-app/slide-toggle/slide-toggle-demo.html" rel="noreferrer">Official example</a> of <code>mat-slide-toggle</code> together with <code>[(ngModel)]</code></p> <hr> <p>Used Versions: Angular: 5.2.4, Angular Material: 5.2.0</p>
0debug
How can i achieve the follwoing layout using Bootstrap css : [![Basically a background image with pattern overlay that only covers half of the image. On the pattern have some text and may be a link][1]][1] Basically a background image with pattern overlay that only covers half of the image. On the pattern have some text and may be a link [1]: https://i.stack.imgur.com/Qrjme.png
0debug
Detect when "Inspect Element" is open : <p>Samy Kamkar's website, <a href="http://samy.pl">http://samy.pl</a>, knows when the console is being opened and wipes the source/console when it does open.</p> <p><a href="https://i.stack.imgur.com/kag6U.jpg"><img src="https://i.stack.imgur.com/kag6U.jpg" alt="enter image description here"></a></p> <p>How does this work?</p>
0debug
Spring framework ERROR 10904 : <p>I was trying to build an application using the Spring framework but I got the following errors and am not sure why. Whenever I try to run the application I get the bellow errors. I did set up my Maven in C drive and my application in D drive due to space. Can that be an issue? </p> <p>What is causing the errors and how should I go about them?</p> <p><strong>ERROR 10904</strong> --- [ main] o.a.coyote.http11.Http11NioProtocol : Failed to start end point associated with ProtocolHandler ["http-nio-8080"]</p> <p><strong>ERROR 10904</strong> --- [ main] o.apache.catalina.core.StandardService : Failed to start connector [Connector[HTTP/1.1-8080]]</p> <p><strong>ERROR 10904</strong> --- [ main] o.s.boot.SpringApplication : Application startup failed</p> <p><strong>INFO 10904</strong> --- [ main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/D:/GITHUB/webappaws/target/classes/, file:/C:/Users/codeLearner/.m2/repository/org/springframework/boot/spring-boot-starter-thymeleaf/1.3.6.RELEASE/spring-boot-starter-thymeleaf-1.3.6.RELEASE.jar, file:/C:/Users/codeLearner/.m2/repository/org/springframework/boot/spring-boot-starter/1.3.6.RELEASE/spring-boot-starter-1.3.6.RELEASE.jar, file:/C:/Users/codeLearner/.m2/repository/org/springframework/boot/spring-boot/1.3.6.RELEASE/spring-boot-1.3.6.RELEASE.jar, file:/C:/Users/codeLearner/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.3.6.RELEASE/spring-boot-autoconfigure-1.3.6.RELEASE.jar, file:/C:/Users/codeLearner/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.3.6.RELEASE/spring-boot-starter-logging-1.3.6.RELEASE.jar, file:/C:/Users/codeLearner/.m2/repository/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar, file:/C:/Users/codeLearner/.m2/repository/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar, ...</p>
0debug
Learning scripting/programming (beginning) : <p>What I am asking can be a bit silly and weird by anyway, I decided to ask you.</p> <p>I am working as network security administrator and have knowledge and experience on cyber security as well. 2 month ago I Started my master degree on Cyber Security and now really want to continue my career on Cyber. Along with network and cyber skills I though having some programming languages in pocket will really benefit me. Shell scripting and Python are the only ones which really catch my interest. </p> <p>I started with bash scripting and just wrote couple of little scripts. I wonder do you know any source which can I use for exercising. I am usually used to learn when I am actually searching and doing something. Therefore if for instance there is any page where I can find tasks for bash scripts with what I can practice and try do find solution, myself.</p> <p>Thanks in advance!</p>
0debug
static always_inline void check_cp1_3d(CPUState *env, DisasContext *ctx) { if (unlikely(!(env->fpu->fcr0 & (1 << FCR0_3D)))) generate_exception(ctx, EXCP_RI); }
1threat
If and else statement in PHP inside of an echo : <p>I want to give the admin the ability to activate the user account so I have to status active and inactive When I run my code I get 4 status Active Inactive Active Inactive You will find here a screenshot to understand the problem I’m facing </p> <p><a href="http://i.imgur.com/2c0VcN7.png" rel="nofollow">http://i.imgur.com/2c0VcN7.png</a></p> <pre><code> if(isset($_GET['id_user'])){ include("conexion.php"); $rep=$db-&gt;query("select * from user WHERE id_user=" .$_GET['id_user'] ); while($l=$rep-&gt;fetch()){ echo " &lt;form class= mainSettingsForm add method='POST'&gt; &lt;label&gt;Numero utlisateur :&lt;/label&gt; &lt;input disabled='disabled' type='text' name='ref' value=' ".$l[0]." ' &gt;&lt;/input&gt; &lt;input name='id_user2' type='hidden' value='".$l[0]."' &gt;&lt;/input&gt; &lt;label&gt;Nom utlisateur : &lt;/label&gt; &lt;input type='text' name='username2' value='".$l[1]."' &gt; &lt;label&gt; nom : &lt;/label&gt; &lt;input type='text' name='nom2' value='".$l[3]."' &gt; &lt;label&gt; prenom : &lt;/label&gt; &lt;input type='text' name='prenom2' value='".$l[4]."' &gt; &lt;label&gt; Statut : &lt;/label&gt; &lt;select name=statut &gt; if ($l[6] ==active) { echo ' &lt;option value=active &gt;active&lt;/option&gt; &lt;option value=inactive &gt;inactive&lt;/option&gt; }' else { echo ' &lt;option value=inactive &gt;inactive&lt;/option&gt; &lt;option value=active &gt;active&lt;/option&gt; }' &lt;/select&gt; &lt;input class=btn-primary type='submit' name='enregistrer' value='enregistrer' &gt; &lt;/form&gt;"; // fin echo } } ?&gt; </code></pre>
0debug
int event_notifier_set(EventNotifier *e) { uint64_t value = 1; int r = write(e->fd, &value, sizeof(value)); return r == sizeof(value); }
1threat
void stream_start(BlockDriverState *bs, BlockDriverState *base, const char *backing_file_str, int64_t speed, BlockdevOnError on_error, BlockCompletionFunc *cb, void *opaque, Error **errp) { StreamBlockJob *s; s = block_job_create(&stream_job_driver, bs, speed, cb, opaque, errp); if (!s) { return; } s->base = base; s->backing_file_str = g_strdup(backing_file_str); s->on_error = on_error; s->common.co = qemu_coroutine_create(stream_run); trace_stream_start(bs, base, s, s->common.co, opaque); qemu_coroutine_enter(s->common.co, s); }
1threat
Possible regression in G++ 6.1.0 : <p>The following code</p> <pre><code>#include &lt;string&gt; #include &lt;map&gt; #include &lt;cassert&gt; struct AV { explicit AV(std::string const&amp;) {} }; #if 1 static void check_cache_item( std::map&lt;std::string, std::string&gt; const&amp; items) // FIXME remove { assert(!items.empty()); } #endif static void check_cache_item( std::map&lt;std::string, AV&gt; const&amp; items) { assert(!items.empty()); } int main() { check_cache_item({ { "id", "0" }, { "pk", "#0" } }); check_cache_item({ { "id", "0" }, { "pk", "#1" } }); check_cache_item({ { "id", AV{"0"} }, { "pk", AV{"#1"} } }); } </code></pre> <p>is accepted by g++ 4.8.4, g++ 5.3.0, clang++ 3.9.0; but g++ 6.1.0 gives an error:</p> <pre><code>cci.cc: In function ‘int main()’: cci.cc:25:55: error: call of overloaded ‘check_cache_item(&lt;brace-enclosed initializer list&gt;)’ is ambiguous check_cache_item({ { "id", "0" }, { "pk", "#0" } }); ^ cci.cc:10:17: note: candidate: void check_cache_item(const std::map&lt;std::__cxx11::basic_string&lt;char&gt;, std::__cxx11::basic_string&lt;char&gt; &gt;&amp;) static void check_cache_item( ^~~~~~~~~~~~~~~~ cci.cc:16:17: note: candidate: void check_cache_item(const std::map&lt;std::__cxx11::basic_string&lt;char&gt;, AV&gt;&amp;) static void check_cache_item( ^~~~~~~~~~~~~~~~ cci.cc:26:55: error: call of overloaded ‘check_cache_item(&lt;brace-enclosed initializer list&gt;)’ is ambiguous check_cache_item({ { "id", "0" }, { "pk", "#1" } }); ^ cci.cc:10:17: note: candidate: void check_cache_item(const std::map&lt;std::__cxx11::basic_string&lt;char&gt;, std::__cxx11::basic_string&lt;char&gt; &gt;&amp;) static void check_cache_item( ^~~~~~~~~~~~~~~~ cci.cc:16:17: note: candidate: void check_cache_item(const std::map&lt;std::__cxx11::basic_string&lt;char&gt;, AV&gt;&amp;) static void check_cache_item( ^~~~~~~~~~~~~~~~ cci.cc: At global scope: cci.cc:10:17: warning: ‘void check_cache_item(const std::map&lt;std::__cxx11::basic_string&lt;char&gt;, std::__cxx11::basic_string&lt;char&gt; &gt;&amp;)’ defined but not used [-Wunused-function] static void check_cache_item( ^~~~~~~~~~~~~~~~ </code></pre> <p>If I #ifdef out the first constructor, then every compiler throws an error (rightly, because the AV constructor is explicit).</p> <p>Is this a regression in G++ 6.1.0 ?</p>
0debug
¿How can I stop my number sequence from growing? : <p>I am trying to make a sequence of numbers that starts with number 10 and grows like 10...11...12...13 etc every two seconds. But lets say that I want it to stop when it reaches 100, how do i do it. So far I have this.Any ideas?</p> <pre><code>function conteo(num){ setInterval(function(){document.write(num++ + "..."); }, 2000); </code></pre> <p>}conteo(10)</p>
0debug
int Configure(void **ctxp, int argc, char *argv[]) { ContextInfo *ci; int c; *ctxp = av_mallocz(sizeof(ContextInfo)); ci = (ContextInfo *) *ctxp; optind = 1; ci->dir = "/tmp"; ci->threshold = 100; ci->file_limit = 100; ci->min_interval = 1000000; ci->inset = 10; while ((c = getopt(argc, argv, "w:i:dh:s:v:zl:t:D:")) > 0) { switch (c) { case 'h': dorange(optarg, &ci->dark.h, &ci->bright.h, 360); break; case 's': dorange(optarg, &ci->dark.s, &ci->bright.s, 255); break; case 'v': dorange(optarg, &ci->dark.v, &ci->bright.v, 255); break; case 'z': ci->zapping = 1; break; case 'l': ci->file_limit = atoi(optarg); break; case 'i': ci->min_interval = 1000000 * atof(optarg); break; case 't': ci->threshold = atof(optarg) * 1000; if (ci->threshold > 1000 || ci->threshold < 0) { av_log(NULL, AV_LOG_ERROR, "Invalid threshold value '%s' (range is 0-1)\n", optarg); return -1; } break; case 'w': ci->min_width = atoi(optarg); break; case 'd': ci->debug++; break; case 'D': ci->dir = av_strdup(optarg); break; default: av_log(NULL, AV_LOG_ERROR, "Unrecognized argument '%s'\n", argv[optind]); return -1; } } av_log(NULL, AV_LOG_INFO, "Fish detector configured:\n"); av_log(NULL, AV_LOG_INFO, " HSV range: %d,%d,%d - %d,%d,%d\n", ci->dark.h, ci->dark.s, ci->dark.v, ci->bright.h, ci->bright.s, ci->bright.v); av_log(NULL, AV_LOG_INFO, " Threshold is %d%% pixels\n", ci->threshold / 10); return 0; }
1threat
how I can resolve this issue? : hi I am writing filter program grouping kindergarten, preschool and school for ages I wrote if program but it outputs conditions wrong who is willing to take look at my program? #include<iostream> using namespace std; int main() { int input;// age int kindergarden , preschool , school; cin >> input; if (2 <= 4) { cout << "kindergarden" << "\n\n"; if (5 <= 6) { cout << "preschool" << "\n\n"; } else (7 <= 15); { cout << "school" << "\n\n"; } } }
0debug
laravel orm : How to treat obsessive-compulsive disorder : <p><strong>chinese description:</strong></p> <p>laravel orm的命名规范对强迫症来说简直是一种灾难,为什么会有这样的设计。。</p> <p>数据库字段设计成小写字母+下划线,例如order_item表中有个字段goods_name</p> <p>那么laravel代码中,就得这样写:$orderItem->goods_name</p> <p>驼峰和全小写混合,强迫症表示实在受不了啊。。。受不了。。。受不了。。。</p> <p><strong>english description:</strong> for example: I have a table named order_item and the table have a column named goods_name in laravel orm I will write code such as: $orderItem->goods_name</p> <p>the hump naming with the whole lower case,,,,</p> <p>why why why</p> <p>why the laravel design so。why not design like:$orderItem->goodsName</p> <p>I am going nuts.</p>
0debug
how to integrate firebase performance monitoring in Android : <p>Hi I need to monitor my methods and network calls performance in Android using Android Studio. Anyone help me out?</p>
0debug
PPC_OP(cmpi) { if (Ts0 < SPARAM(1)) { T0 = 0x08; } else if (Ts0 > SPARAM(1)) { T0 = 0x04; } else { T0 = 0x02; } RETURN(); }
1threat
DeviceState *qdev_create(BusState *bus, const char *name) { DeviceState *dev; dev = qdev_try_create(bus, name); if (!dev) { hw_error("Unknown device '%s' for bus '%s'\n", name, bus->info->name); } return dev; }
1threat
Remove all text from a specific tag using Javascript : I want to clear all list items in my body. So on a button press, the item text from all the lists are removed. No use of IDs or anything, just if there is an li tag, it's innerHTML is cleared out. I have tried a few different methods, but I cannot figure it out. Any help is appreciated, thank you!
0debug
static int hls_read_header(AVFormatContext *s) { void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; HLSContext *c = s->priv_data; int ret = 0, i; int highest_cur_seq_no = 0; c->ctx = s; c->interrupt_callback = &s->interrupt_callback; c->strict_std_compliance = s->strict_std_compliance; c->first_packet = 1; c->first_timestamp = AV_NOPTS_VALUE; c->cur_timestamp = AV_NOPTS_VALUE; if (u) { update_options(&c->user_agent, "user-agent", u); update_options(&c->cookies, "cookies", u); update_options(&c->headers, "headers", u); update_options(&c->http_proxy, "http_proxy", u); } if ((ret = parse_playlist(c, s->filename, NULL, s->pb)) < 0) goto fail; if ((ret = save_avio_options(s)) < 0) goto fail; av_dict_set(&c->avio_opts, "seekable", "0", 0); if (c->n_variants == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } if (c->n_playlists > 1 || c->playlists[0]->n_segments == 0) { for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; if ((ret = parse_playlist(c, pls->url, pls, NULL)) < 0) goto fail; } } if (c->variants[0]->playlists[0]->n_segments == 0) { av_log(NULL, AV_LOG_WARNING, "Empty playlist\n"); ret = AVERROR_EOF; goto fail; } if (c->variants[0]->playlists[0]->finished) { int64_t duration = 0; for (i = 0; i < c->variants[0]->playlists[0]->n_segments; i++) duration += c->variants[0]->playlists[0]->segments[i]->duration; s->duration = duration; } for (i = 0; i < c->n_variants; i++) { struct variant *var = c->variants[i]; if (var->audio_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_AUDIO, var->audio_group); if (var->video_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_VIDEO, var->video_group); if (var->subtitles_group[0]) add_renditions_to_variant(c, var, AVMEDIA_TYPE_SUBTITLE, var->subtitles_group); } for (i = 0; i < c->n_variants; i++) { struct variant *v = c->variants[i]; AVProgram *program; program = av_new_program(s, i); if (!program) goto fail; av_dict_set_int(&program->metadata, "variant_bitrate", v->bandwidth, 0); } for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; if (pls->n_segments == 0) continue; pls->cur_seq_no = select_cur_seq_no(c, pls); highest_cur_seq_no = FFMAX(highest_cur_seq_no, pls->cur_seq_no); } for (i = 0; i < c->n_playlists; i++) { struct playlist *pls = c->playlists[i]; AVInputFormat *in_fmt = NULL; if (!(pls->ctx = avformat_alloc_context())) { ret = AVERROR(ENOMEM); goto fail; } if (pls->n_segments == 0) continue; pls->index = i; pls->needed = 1; pls->parent = s; if (!pls->finished && pls->cur_seq_no == highest_cur_seq_no - 1 && highest_cur_seq_no < pls->start_seq_no + pls->n_segments) { pls->cur_seq_no = highest_cur_seq_no; } pls->read_buffer = av_malloc(INITIAL_BUFFER_SIZE); if (!pls->read_buffer){ ret = AVERROR(ENOMEM); avformat_free_context(pls->ctx); pls->ctx = NULL; goto fail; } ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls, read_data, NULL, NULL); pls->pb.seekable = 0; ret = av_probe_input_buffer(&pls->pb, &in_fmt, pls->segments[0]->url, NULL, 0, 0); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Error when loading first segment '%s'\n", pls->segments[0]->url); avformat_free_context(pls->ctx); pls->ctx = NULL; goto fail; } pls->ctx->pb = &pls->pb; pls->ctx->io_open = nested_io_open; if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) goto fail; ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, NULL); if (ret < 0) goto fail; if (pls->id3_deferred_extra && pls->ctx->nb_streams == 1) { ff_id3v2_parse_apic(pls->ctx, &pls->id3_deferred_extra); avformat_queue_attached_pictures(pls->ctx); ff_id3v2_free_extra_meta(&pls->id3_deferred_extra); pls->id3_deferred_extra = NULL; } pls->ctx->ctx_flags &= ~AVFMTCTX_NOHEADER; ret = avformat_find_stream_info(pls->ctx, NULL); if (ret < 0) goto fail; if (pls->is_id3_timestamped == -1) av_log(s, AV_LOG_WARNING, "No expected HTTP requests have been made\n"); ret = update_streams_from_subdemuxer(s, pls); if (ret < 0) goto fail; add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_AUDIO); add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_VIDEO); add_metadata_from_renditions(s, pls, AVMEDIA_TYPE_SUBTITLE); } return 0; fail: free_playlist_list(c); free_variant_list(c); free_rendition_list(c); return ret; }
1threat
Python3 strange float rounding : <p>Can someone explain me why i do not get 166.9 (i know there is a round() function) i just would like to understand. :)</p> <pre><code>&gt;&gt;&gt; 165.0 + 1.45 + 0.45 166.89999999999998 </code></pre>
0debug
static int decode_vol_header(Mpeg4DecContext *ctx, GetBitContext *gb) { MpegEncContext *s = &ctx->m; int width, height, vo_ver_id; skip_bits(gb, 1); s->vo_type = get_bits(gb, 8); if (get_bits1(gb) != 0) { vo_ver_id = get_bits(gb, 4); skip_bits(gb, 3); } else { vo_ver_id = 1; s->aspect_ratio_info = get_bits(gb, 4); if (s->aspect_ratio_info == FF_ASPECT_EXTENDED) { s->avctx->sample_aspect_ratio.num = get_bits(gb, 8); s->avctx->sample_aspect_ratio.den = get_bits(gb, 8); } else { s->avctx->sample_aspect_ratio = ff_h263_pixel_aspect[s->aspect_ratio_info]; if ((s->vol_control_parameters = get_bits1(gb))) { int chroma_format = get_bits(gb, 2); if (chroma_format != CHROMA_420) av_log(s->avctx, AV_LOG_ERROR, "illegal chroma format\n"); s->low_delay = get_bits1(gb); if (get_bits1(gb)) { get_bits(gb, 15); skip_bits1(gb); get_bits(gb, 15); skip_bits1(gb); get_bits(gb, 15); skip_bits1(gb); get_bits(gb, 3); get_bits(gb, 11); skip_bits1(gb); get_bits(gb, 15); skip_bits1(gb); } else { if (s->picture_number == 0) s->low_delay = 0; ctx->shape = get_bits(gb, 2); if (ctx->shape != RECT_SHAPE) av_log(s->avctx, AV_LOG_ERROR, "only rectangular vol supported\n"); if (ctx->shape == GRAY_SHAPE && vo_ver_id != 1) { av_log(s->avctx, AV_LOG_ERROR, "Gray shape not supported\n"); skip_bits(gb, 4); check_marker(gb, "before time_increment_resolution"); s->avctx->time_base.den = get_bits(gb, 16); if (!s->avctx->time_base.den) { av_log(s->avctx, AV_LOG_ERROR, "time_base.den==0\n"); s->avctx->time_base.num = 0; return -1; ctx->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; if (ctx->time_increment_bits < 1) ctx->time_increment_bits = 1; check_marker(gb, "before fixed_vop_rate"); if (get_bits1(gb) != 0) s->avctx->time_base.num = get_bits(gb, ctx->time_increment_bits); else s->avctx->time_base.num = 1; ctx->t_frame = 0; if (ctx->shape != BIN_ONLY_SHAPE) { if (ctx->shape == RECT_SHAPE) { check_marker(gb, "before width"); width = get_bits(gb, 13); check_marker(gb, "before height"); height = get_bits(gb, 13); check_marker(gb, "after height"); if (width && height && !(s->width && s->codec_tag == AV_RL32("MP4S"))) { if (s->width && s->height && (s->width != width || s->height != height)) s->context_reinit = 1; s->width = width; s->height = height; s->progressive_sequence = s->progressive_frame = get_bits1(gb) ^ 1; s->interlaced_dct = 0; if (!get_bits1(gb) && (s->avctx->debug & FF_DEBUG_PICT_INFO)) av_log(s->avctx, AV_LOG_INFO, "MPEG4 OBMC not supported (very likely buggy encoder)\n"); if (vo_ver_id == 1) ctx->vol_sprite_usage = get_bits1(gb); else ctx->vol_sprite_usage = get_bits(gb, 2); if (ctx->vol_sprite_usage == STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "Static Sprites not supported\n"); if (ctx->vol_sprite_usage == STATIC_SPRITE || ctx->vol_sprite_usage == GMC_SPRITE) { if (ctx->vol_sprite_usage == STATIC_SPRITE) { skip_bits(gb, 13); skip_bits1(gb); skip_bits(gb, 13); skip_bits1(gb); skip_bits(gb, 13); skip_bits1(gb); skip_bits(gb, 13); skip_bits1(gb); ctx->num_sprite_warping_points = get_bits(gb, 6); if (ctx->num_sprite_warping_points > 3) { av_log(s->avctx, AV_LOG_ERROR, "%d sprite_warping_points\n", ctx->num_sprite_warping_points); ctx->num_sprite_warping_points = 0; return -1; s->sprite_warping_accuracy = get_bits(gb, 2); ctx->sprite_brightness_change = get_bits1(gb); if (ctx->vol_sprite_usage == STATIC_SPRITE) skip_bits1(gb); if (get_bits1(gb) == 1) { s->quant_precision = get_bits(gb, 4); if (get_bits(gb, 4) != 8) av_log(s->avctx, AV_LOG_ERROR, "N-bit not supported\n"); if (s->quant_precision != 5) av_log(s->avctx, AV_LOG_ERROR, "quant precision %d\n", s->quant_precision); if (s->quant_precision<3 || s->quant_precision>9) { s->quant_precision = 5; } else { s->quant_precision = 5; if ((s->mpeg_quant = get_bits1(gb))) { int i, v; for (i = 0; i < 64; i++) { int j = s->dsp.idct_permutation[i]; v = ff_mpeg4_default_intra_matrix[i]; s->intra_matrix[j] = v; s->chroma_intra_matrix[j] = v; v = ff_mpeg4_default_non_intra_matrix[i]; s->inter_matrix[j] = v; s->chroma_inter_matrix[j] = v; if (get_bits1(gb)) { int last = 0; for (i = 0; i < 64; i++) { int j; v = get_bits(gb, 8); if (v == 0) break; last = v; j = s->dsp.idct_permutation[ff_zigzag_direct[i]]; s->intra_matrix[j] = last; s->chroma_intra_matrix[j] = last; for (; i < 64; i++) { int j = s->dsp.idct_permutation[ff_zigzag_direct[i]]; s->intra_matrix[j] = last; s->chroma_intra_matrix[j] = last; if (get_bits1(gb)) { int last = 0; for (i = 0; i < 64; i++) { int j; v = get_bits(gb, 8); if (v == 0) break; last = v; j = s->dsp.idct_permutation[ff_zigzag_direct[i]]; s->inter_matrix[j] = v; s->chroma_inter_matrix[j] = v; for (; i < 64; i++) { int j = s->dsp.idct_permutation[ff_zigzag_direct[i]]; s->inter_matrix[j] = last; s->chroma_inter_matrix[j] = last; if (vo_ver_id != 1) s->quarter_sample = get_bits1(gb); else s->quarter_sample = 0; if (!get_bits1(gb)) { int pos = get_bits_count(gb); int estimation_method = get_bits(gb, 2); if (estimation_method < 2) { if (!get_bits1(gb)) { ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); if (!get_bits1(gb)) { ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_p += 8 * get_bits1(gb); ctx->cplx_estimation_trash_p += 8 * get_bits1(gb); ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); if (!check_marker(gb, "in complexity estimation part 1")) { skip_bits_long(gb, pos - get_bits_count(gb)); goto no_cplx_est; if (!get_bits1(gb)) { ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_i += 4 * get_bits1(gb); if (!get_bits1(gb)) { ctx->cplx_estimation_trash_p += 8 * get_bits1(gb); ctx->cplx_estimation_trash_p += 8 * get_bits1(gb); ctx->cplx_estimation_trash_b += 8 * get_bits1(gb); ctx->cplx_estimation_trash_p += 8 * get_bits1(gb); ctx->cplx_estimation_trash_p += 8 * get_bits1(gb); ctx->cplx_estimation_trash_p += 8 * get_bits1(gb); if (!check_marker(gb, "in complexity estimation part 2")) { skip_bits_long(gb, pos - get_bits_count(gb)); goto no_cplx_est; if (estimation_method == 1) { ctx->cplx_estimation_trash_i += 8 * get_bits1(gb); ctx->cplx_estimation_trash_p += 8 * get_bits1(gb); } else av_log(s->avctx, AV_LOG_ERROR, "Invalid Complexity estimation method %d\n", estimation_method); } else { no_cplx_est: ctx->cplx_estimation_trash_i = ctx->cplx_estimation_trash_p = ctx->cplx_estimation_trash_b = 0; ctx->resync_marker = !get_bits1(gb); s->data_partitioning = get_bits1(gb); if (s->data_partitioning) ctx->rvlc = get_bits1(gb); if (vo_ver_id != 1) { ctx->new_pred = get_bits1(gb); if (ctx->new_pred) { av_log(s->avctx, AV_LOG_ERROR, "new pred not supported\n"); skip_bits(gb, 2); skip_bits1(gb); if (get_bits1(gb)) av_log(s->avctx, AV_LOG_ERROR, "reduced resolution VOP not supported\n"); } else { ctx->new_pred = 0; ctx->scalability = get_bits1(gb); if (ctx->scalability) { GetBitContext bak = *gb; int h_sampling_factor_n; int h_sampling_factor_m; int v_sampling_factor_n; int v_sampling_factor_m; skip_bits1(gb); skip_bits(gb, 4); skip_bits1(gb); h_sampling_factor_n = get_bits(gb, 5); h_sampling_factor_m = get_bits(gb, 5); v_sampling_factor_n = get_bits(gb, 5); v_sampling_factor_m = get_bits(gb, 5); ctx->enhancement_type = get_bits1(gb); if (h_sampling_factor_n == 0 || h_sampling_factor_m == 0 || v_sampling_factor_n == 0 || v_sampling_factor_m == 0) { ctx->scalability = 0; *gb = bak; } else av_log(s->avctx, AV_LOG_ERROR, "scalability not supported\n"); if (s->avctx->debug&FF_DEBUG_PICT_INFO) { av_log(s->avctx, AV_LOG_DEBUG, "tb %d/%d, tincrbits:%d, qp_prec:%d, ps:%d, %s%s%s%s\n", s->avctx->time_base.num, s->avctx->time_base.den, ctx->time_increment_bits, s->quant_precision, s->progressive_sequence, ctx->scalability ? "scalability " :"" , s->quarter_sample ? "qpel " : "", s->data_partitioning ? "partition " : "", ctx->rvlc ? "rvlc " : "" ); return 0;
1threat
Create a diffrent table in html : I want to create a table with less rows but with large columns where every 4th column right boundary is 2times thick of other boundary. Example: ``` | | | | || | | | || | | | || | | | || | | | | || | | | || | | | || | | | || | | | | || | | | || | | | || | | | || ``` consider "||" as double width of "|"
0debug
static int flic_decode_frame_8BPP(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *buf, int buf_size) { FlicDecodeContext *s = avctx->priv_data; GetByteContext g2; int pixel_ptr; int palette_ptr; unsigned char palette_idx1; unsigned char palette_idx2; unsigned int frame_size; int num_chunks; unsigned int chunk_size; int chunk_type; int i, j, ret; int color_packets; int color_changes; int color_shift; unsigned char r, g, b; int lines; int compressed_lines; int starting_line; signed short line_packets; int y_ptr; int byte_run; int pixel_skip; int pixel_countdown; unsigned char *pixels; unsigned int pixel_limit; bytestream2_init(&g2, buf, buf_size); if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; pixels = s->frame.data[0]; pixel_limit = s->avctx->height * s->frame.linesize[0]; if (buf_size < 16 || buf_size > INT_MAX - (3 * 256 + FF_INPUT_BUFFER_PADDING_SIZE)) return AVERROR_INVALIDDATA; frame_size = bytestream2_get_le32(&g2); if (frame_size > buf_size) frame_size = buf_size; bytestream2_skip(&g2, 2); num_chunks = bytestream2_get_le16(&g2); bytestream2_skip(&g2, 8); frame_size -= 16; while ((frame_size >= 6) && (num_chunks > 0)) { int stream_ptr_after_chunk; chunk_size = bytestream2_get_le32(&g2); if (chunk_size > frame_size) { av_log(avctx, AV_LOG_WARNING, "Invalid chunk_size = %u > frame_size = %u\n", chunk_size, frame_size); chunk_size = frame_size; } stream_ptr_after_chunk = bytestream2_tell(&g2) - 4 + chunk_size; chunk_type = bytestream2_get_le16(&g2); switch (chunk_type) { case FLI_256_COLOR: case FLI_COLOR: if ((chunk_type == FLI_256_COLOR) && (s->fli_type != FLC_MAGIC_CARPET_SYNTHETIC_TYPE_CODE)) color_shift = 0; else color_shift = 2; color_packets = bytestream2_get_le16(&g2); palette_ptr = 0; for (i = 0; i < color_packets; i++) { palette_ptr += bytestream2_get_byte(&g2); color_changes = bytestream2_get_byte(&g2); if (color_changes == 0) color_changes = 256; if (bytestream2_tell(&g2) + color_changes * 3 > stream_ptr_after_chunk) break; for (j = 0; j < color_changes; j++) { unsigned int entry; if ((unsigned)palette_ptr >= 256) palette_ptr = 0; r = bytestream2_get_byte(&g2) << color_shift; g = bytestream2_get_byte(&g2) << color_shift; b = bytestream2_get_byte(&g2) << color_shift; entry = 0xFFU << 24 | r << 16 | g << 8 | b; if (color_shift == 2) entry |= entry >> 6 & 0x30303; if (s->palette[palette_ptr] != entry) s->new_palette = 1; s->palette[palette_ptr++] = entry; } } break; case FLI_DELTA: y_ptr = 0; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; line_packets = bytestream2_get_le16(&g2); if ((line_packets & 0xC000) == 0xC000) { line_packets = -line_packets; y_ptr += line_packets * s->frame.linesize[0]; } else if ((line_packets & 0xC000) == 0x4000) { av_log(avctx, AV_LOG_ERROR, "Undefined opcode (%x) in DELTA_FLI\n", line_packets); } else if ((line_packets & 0xC000) == 0x8000) { pixel_ptr= y_ptr + s->frame.linesize[0] - 1; CHECK_PIXEL_PTR(0); pixels[pixel_ptr] = line_packets & 0xff; } else { compressed_lines--; pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; for (i = 0; i < line_packets; i++) { if (bytestream2_tell(&g2) + 2 > stream_ptr_after_chunk) break; pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = bytestream2_get_byte(&g2); palette_idx2 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run * 2); for (j = 0; j < byte_run; j++, pixel_countdown -= 2) { pixels[pixel_ptr++] = palette_idx1; pixels[pixel_ptr++] = palette_idx2; } } else { CHECK_PIXEL_PTR(byte_run * 2); if (bytestream2_tell(&g2) + byte_run * 2 > stream_ptr_after_chunk) break; for (j = 0; j < byte_run * 2; j++, pixel_countdown--) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); } } } y_ptr += s->frame.linesize[0]; } } break; case FLI_LC: starting_line = bytestream2_get_le16(&g2); y_ptr = 0; y_ptr += starting_line * s->frame.linesize[0]; compressed_lines = bytestream2_get_le16(&g2); while (compressed_lines > 0) { pixel_ptr = y_ptr; CHECK_PIXEL_PTR(0); pixel_countdown = s->avctx->width; if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; line_packets = bytestream2_get_byte(&g2); if (line_packets > 0) { for (i = 0; i < line_packets; i++) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; pixel_skip = bytestream2_get_byte(&g2); pixel_ptr += pixel_skip; pixel_countdown -= pixel_skip; byte_run = sign_extend(bytestream2_get_byte(&g2),8); if (byte_run > 0) { CHECK_PIXEL_PTR(byte_run); if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; for (j = 0; j < byte_run; j++, pixel_countdown--) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); } } else if (byte_run < 0) { byte_run = -byte_run; palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++, pixel_countdown--) { pixels[pixel_ptr++] = palette_idx1; } } } } y_ptr += s->frame.linesize[0]; compressed_lines--; } break; case FLI_BLACK: memset(pixels, 0, s->frame.linesize[0] * s->avctx->height); break; case FLI_BRUN: y_ptr = 0; for (lines = 0; lines < s->avctx->height; lines++) { pixel_ptr = y_ptr; bytestream2_skip(&g2, 1); pixel_countdown = s->avctx->width; while (pixel_countdown > 0) { if (bytestream2_tell(&g2) + 1 > stream_ptr_after_chunk) break; byte_run = sign_extend(bytestream2_get_byte(&g2), 8); if (!byte_run) { av_log(avctx, AV_LOG_ERROR, "Invalid byte run value.\n"); return AVERROR_INVALIDDATA; } if (byte_run > 0) { palette_idx1 = bytestream2_get_byte(&g2); CHECK_PIXEL_PTR(byte_run); for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = palette_idx1; pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } else { byte_run = -byte_run; CHECK_PIXEL_PTR(byte_run); if (bytestream2_tell(&g2) + byte_run > stream_ptr_after_chunk) break; for (j = 0; j < byte_run; j++) { pixels[pixel_ptr++] = bytestream2_get_byte(&g2); pixel_countdown--; if (pixel_countdown < 0) av_log(avctx, AV_LOG_ERROR, "pixel_countdown < 0 (%d) at line %d\n", pixel_countdown, lines); } } } y_ptr += s->frame.linesize[0]; } break; case FLI_COPY: if (chunk_size - 6 != s->avctx->width * s->avctx->height) { av_log(avctx, AV_LOG_ERROR, "In chunk FLI_COPY : source data (%d bytes) " \ "has incorrect size, skipping chunk\n", chunk_size - 6); bytestream2_skip(&g2, chunk_size - 6); } else { for (y_ptr = 0; y_ptr < s->frame.linesize[0] * s->avctx->height; y_ptr += s->frame.linesize[0]) { bytestream2_get_buffer(&g2, &pixels[y_ptr], s->avctx->width); } } break; case FLI_MINI: break; default: av_log(avctx, AV_LOG_ERROR, "Unrecognized chunk type: %d\n", chunk_type); break; } if (stream_ptr_after_chunk - bytestream2_tell(&g2) > 0) bytestream2_skip(&g2, stream_ptr_after_chunk - bytestream2_tell(&g2)); frame_size -= chunk_size; num_chunks--; } if (bytestream2_get_bytes_left(&g2) > 2) av_log(avctx, AV_LOG_ERROR, "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n", buf_size, buf_size - bytestream2_get_bytes_left(&g2)); memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE); if (s->new_palette) { s->frame.palette_has_changed = 1; s->new_palette = 0; } if ((ret = av_frame_ref(data, &s->frame)) < 0) return ret; *got_frame = 1; return buf_size; }
1threat
split with regex is not returning correct repsonse : <p>I have a string </p> <pre><code>var str3 = "[a,b,c] there [s,b,c] how are u"; </code></pre> <p>What i want is <code>[there, how are u]</code> but I am getting <code>["", "how are u"]</code>, when splitting with <code>str3.split(/\[.*\]/);</code></p> <p>Any idea how i shud do it?</p>
0debug
static int mpl2_probe(AVProbeData *p) { int i; char c; int64_t start, end; const unsigned char *ptr = p->buf; const unsigned char *ptr_end = ptr + p->buf_size; for (i = 0; i < 2; i++) { if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", &start, &end, &c) != 3 && sscanf(ptr, "[%"SCNd64"][]%c", &start, &c) != 2) return 0; ptr += strcspn(ptr, "\n") + 1; if (ptr >= ptr_end) return 0; } return AVPROBE_SCORE_MAX; }
1threat
static int concat_read_packet(AVFormatContext *avf, AVPacket *pkt) { ConcatContext *cat = avf->priv_data; int ret; int64_t delta; while (1) { if ((ret = av_read_frame(cat->avf, pkt)) != AVERROR_EOF || (ret = open_next_file(avf)) < 0) break; } delta = av_rescale_q(cat->cur_file->start_time - cat->avf->start_time, AV_TIME_BASE_Q, cat->avf->streams[pkt->stream_index]->time_base); if (pkt->pts != AV_NOPTS_VALUE) pkt->pts += delta; if (pkt->dts != AV_NOPTS_VALUE) pkt->dts += delta; }
1threat
static void scsi_cancel_io(SCSIRequest *req) { SCSIDiskReq *r = DO_UPCAST(SCSIDiskReq, req, req); DPRINTF("Cancel tag=0x%x\n", req->tag); if (r->req.aiocb) { bdrv_aio_cancel(r->req.aiocb); scsi_req_unref(&r->req); } r->req.aiocb = NULL; }
1threat
Background color and scroll issue. : <p>I need some help here. My final project is due tomorrow and the mobile responsive view of the app is completely off. I don't know how else to explain it other than just giving you the link to the URL. </p> <p><a href="https://venpresath.github.io/FinalProject/#!/home" rel="nofollow noreferrer">https://venpresath.github.io/FinalProject/#!/home</a></p> <p>It appears that the animation that I put onto the spinning record is making the width of the screen larger than the background is. </p> <p>I tried overflow: Hidden; but it didn't correct the issue. </p>
0debug
How to convert string to array of string in golang : ---------- I am trying to convert string `'["211007@it_4","211008@it_4"]'` which is saved in mysql database to array of string to use it as index value. I can not find a good option to do this in golang.
0debug
Why wont this work ? Dynamic memory beginner program : enter code here int main() { //FILE *out = fopen("keimeno.txt", "w+"); FILE *in = fopen("keimeno.txt", "r"); int fullbufflen=0 , i; char buffer[100]; fgets(buffer, 100, in); int bufflen = strlen(buffer); char *text; text =calloc(bufflen,sizeof(char)); char *strcat(text, buffer); // printf("line of \"keimeno.txt\": %s", buffer); // printf("size of line \"keimeno.txt\": %i\n\n", bufflen); fullbufflen = bufflen; while(fgets(buffer, 100, in)!=NULL) { // printf("line of \"keimeno.txt\": %s", buffer); // printf("size of line \"keimeno.txt\": %i\n\n", bufflen); text =realloc(text,bufflen*sizeof(char)); char *strcat(text, buffer); fullbufflen = bufflen + fullbufflen ; } for (i = 0;i<fullbufflen;i++) { printf("%c\n",text[i]); } } I am trying to copy the full text file (keimeno.txt) into a dynamic memory array,with a buffer of 100 character at most everytime .To test it at the end i tried to prinf the results .And i just cant get it to work .Dont know if there is a problem on the printf at the end,or the whole program is just wrong.(also the dynamic array is supposed to have 0 size at the beggining ,so if someone could tell me how to do that too ,it would be welcome .)Thanks in advance.
0debug
Notepad++ Search Window disappeared : <p>I'm working with NotePad++ text editor, the 'Search Results' window does not show up anymore, i've tried to open it from the menu (Search Result Window F7), but it does not seem to have any effect, how can i restore it?</p>
0debug
How to implement a deep bidirectional LSTM with Keras? : <p>I am trying to implement a LSTM based speech recognizer. So far I could set up bidirectional LSTM (i think it is working as a bidirectional LSTM) by following the example in Merge layer. Now I want to try it with another bidirectional LSTM layer, which make it a deep bidirectional LSTM. But I am unable to figure out how to connect the output of the previously merged two layers into a second set of LSTM layers. I don't know whether it is possible with Keras. Hope someone can help me with this.</p> <p>Code for my single layer bidirectional LSTM is as follows</p> <pre><code>left = Sequential() left.add(LSTM(output_dim=hidden_units, init='uniform', inner_init='uniform', forget_bias_init='one', return_sequences=True, activation='tanh', inner_activation='sigmoid', input_shape=(99, 13))) right = Sequential() right.add(LSTM(output_dim=hidden_units, init='uniform', inner_init='uniform', forget_bias_init='one', return_sequences=True, activation='tanh', inner_activation='sigmoid', input_shape=(99, 13), go_backwards=True)) model = Sequential() model.add(Merge([left, right], mode='sum')) model.add(TimeDistributedDense(nb_classes)) model.add(Activation('softmax')) sgd = SGD(lr=0.1, decay=1e-5, momentum=0.9, nesterov=True) model.compile(loss='categorical_crossentropy', optimizer=sgd) print("Train...") model.fit([X_train, X_train], Y_train, batch_size=1, nb_epoch=nb_epoches, validation_data=([X_test, X_test], Y_test), verbose=1, show_accuracy=True) </code></pre> <p>Dimensions of my x and y values are as follows.</p> <pre><code>(100, 'train sequences') (20, 'test sequences') ('X_train shape:', (100, 99, 13)) ('X_test shape:', (20, 99, 13)) ('y_train shape:', (100, 99, 11)) ('y_test shape:', (20, 99, 11)) </code></pre>
0debug
static inline void terminate_compression_threads(void) { int idx, thread_count; thread_count = migrate_compress_threads(); quit_comp_thread = true; for (idx = 0; idx < thread_count; idx++) { qemu_mutex_lock(&comp_param[idx].mutex); qemu_cond_signal(&comp_param[idx].cond); qemu_mutex_unlock(&comp_param[idx].mutex); } }
1threat
Working in Eclipse IDE, values that should equal not equal : <p>I am reasonably experienced with programming, but not specifically in Java. I am coming across the following error when working in eclipse. My code is the following:</p> <p><a href="https://i.stack.imgur.com/5gqc3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5gqc3.png" alt="My code"></a></p> <p>I have used the debug function, and it reports that carbonPrefix is pent, but that carbon stays at 0 throughout. Like I said, I am a novice to Java and Eclipse, so I may not be using the debug function to it's full extent. </p> <p>For anybody that's interested, this the start of code where you input the name of an alkane and it tells you the formula. It worked in Javascript and I'm just trying to translate it into Java.</p> <p>Thank you all so much!</p>
0debug
static void mips_cps_realize(DeviceState *dev, Error **errp) { MIPSCPSState *s = MIPS_CPS(dev); CPUMIPSState *env; MIPSCPU *cpu; int i; Error *err = NULL; target_ulong gcr_base; bool itu_present = false; for (i = 0; i < s->num_vp; i++) { cpu = cpu_mips_init(s->cpu_model); if (cpu == NULL) { error_setg(errp, "%s: CPU initialization failed", __func__); return; } cpu_mips_irq_init_cpu(cpu); cpu_mips_clock_init(cpu); env = &cpu->env; if (cpu_mips_itu_supported(env)) { itu_present = true; env->itc_tag = mips_itu_get_tag_region(&s->itu); } qemu_register_reset(main_cpu_reset, cpu); } cpu = MIPS_CPU(first_cpu); env = &cpu->env; if (itu_present) { object_initialize(&s->itu, sizeof(s->itu), TYPE_MIPS_ITU); qdev_set_parent_bus(DEVICE(&s->itu), sysbus_get_default()); object_property_set_int(OBJECT(&s->itu), 16, "num-fifo", &err); object_property_set_int(OBJECT(&s->itu), 16, "num-semaphores", &err); object_property_set_bool(OBJECT(&s->itu), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } memory_region_add_subregion(&s->container, 0, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->itu), 0)); } object_initialize(&s->cpc, sizeof(s->cpc), TYPE_MIPS_CPC); qdev_set_parent_bus(DEVICE(&s->cpc), sysbus_get_default()); object_property_set_int(OBJECT(&s->cpc), s->num_vp, "num-vp", &err); object_property_set_int(OBJECT(&s->cpc), 1, "vp-start-running", &err); object_property_set_bool(OBJECT(&s->cpc), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } memory_region_add_subregion(&s->container, 0, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->cpc), 0)); object_initialize(&s->gic, sizeof(s->gic), TYPE_MIPS_GIC); qdev_set_parent_bus(DEVICE(&s->gic), sysbus_get_default()); object_property_set_int(OBJECT(&s->gic), s->num_vp, "num-vp", &err); object_property_set_int(OBJECT(&s->gic), 128, "num-irq", &err); object_property_set_bool(OBJECT(&s->gic), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } memory_region_add_subregion(&s->container, 0, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gic), 0)); gcr_base = env->CP0_CMGCRBase << 4; object_initialize(&s->gcr, sizeof(s->gcr), TYPE_MIPS_GCR); qdev_set_parent_bus(DEVICE(&s->gcr), sysbus_get_default()); object_property_set_int(OBJECT(&s->gcr), s->num_vp, "num-vp", &err); object_property_set_int(OBJECT(&s->gcr), 0x800, "gcr-rev", &err); object_property_set_int(OBJECT(&s->gcr), gcr_base, "gcr-base", &err); object_property_set_link(OBJECT(&s->gcr), OBJECT(&s->gic.mr), "gic", &err); object_property_set_link(OBJECT(&s->gcr), OBJECT(&s->cpc.mr), "cpc", &err); object_property_set_bool(OBJECT(&s->gcr), true, "realized", &err); if (err != NULL) { error_propagate(errp, err); return; } memory_region_add_subregion(&s->container, gcr_base, sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->gcr), 0)); }
1threat
dplyr mutate/transmute: drop only the columns used in the formula : <p>Suppose my data frame has columns A, B, C, D, E.</p> <p>I want to produce a data frame with columns A, B, C, X, where X = D * E.</p> <p>Obviously I can use <code>%&gt;% mutate(X = D * E) %&gt;% select (-D, -E)</code>, but for more elaborate situations, is there a way to do it in a single command? Like <code>transmute()</code>, but only discarding the columns that were mentioned.</p> <p>Silly, but I keep wishing for this bit of conciseness.</p>
0debug
static void test_visitor_in_wrong_type(TestInputVisitorData *data, const void *unused) { TestStruct *p = NULL; Visitor *v; strList *q = NULL; int64_t i; Error *err = NULL; v = visitor_input_test_init(data, "[]"); visit_type_TestStruct(v, NULL, &p, &err); error_free_or_abort(&err); g_assert(!p); v = visitor_input_test_init(data, "{}"); visit_type_strList(v, NULL, &q, &err); error_free_or_abort(&err); assert(!q); v = visitor_input_test_init(data, "1"); visit_type_TestStruct(v, NULL, &p, &err); error_free_or_abort(&err); g_assert(!p); v = visitor_input_test_init(data, "{}"); visit_type_int(v, NULL, &i, &err); error_free_or_abort(&err); v = visitor_input_test_init(data, "1"); visit_type_strList(v, NULL, &q, &err); error_free_or_abort(&err); assert(!q); v = visitor_input_test_init(data, "[]"); visit_type_int(v, NULL, &i, &err); error_free_or_abort(&err); }
1threat
How can I debug my Quarkus application that is running in dev mode? : <p>I have launched my application using the Quarkus dev mode (<code>mvn quarkus:dev</code>) and I would like to be able to debug it.</p> <p>How can do that?</p>
0debug
Indent/format code in Visual Studio code on MAC : <p>i'm trying to indent my code in visual studio code. I searched and i found that ctrl + F + K should be work, but it doesn't. I tried cmd + k + f too, but it still not working. I hope you can help me!</p>
0debug
static av_cold int X264_close(AVCodecContext *avctx) { X264Context *x4 = avctx->priv_data; av_freep(&avctx->extradata); av_free(x4->sei); if (x4->enc) x264_encoder_close(x4->enc); av_frame_free(&avctx->coded_frame); return 0; }
1threat
void OPPROTO op_divw_AX_T0(void) { unsigned int num, den, q, r; num = (EAX & 0xffff) | ((EDX & 0xffff) << 16); den = (T0 & 0xffff); if (den == 0) { raise_exception(EXCP00_DIVZ); } q = (num / den) & 0xffff; r = (num % den) & 0xffff; EAX = (EAX & ~0xffff) | q; EDX = (EDX & ~0xffff) | r; }
1threat
How to convert milliseconds to date string in swift 3 : <p>I am trying to convert milliseconds to date string in swift 3,i tried by setting date fomatter but i am not getting current date string.</p> <pre><code>var milliseconds=1477593000000 let date = NSDate(timeIntervalSince1970: TimeInterval(milliseconds)) let formatter = DateFormatter() formatter.dateFormat = "dd-MM-yyyy HH:mm:ss" formatter.locale = NSLocale(localeIdentifier: "en_US") as Locale! print(formatter.string(from: date as Date)) output: 22-01-48793 01:30:00 </code></pre>
0debug
how to make select drop down list read only and unchangeable : Here is a link of js fiddle [select drop down example][1] i make select dropdown read only but when i click on it it shows me the drop down option which should not show and it is changeable Can you suggest a solution [1]: https://jsfiddle.net/7Lcf533c/1/
0debug
Where to use empty character constant '' in C++? : <p>The empty character constant '' can not be cout or assigned to character in C++. The compiler will say "error: expected expression". Can we put it in C++ source code? If not, what's the usage of ''? (empty character constant '' is one ' followed with another ') </p>
0debug
static int mov_write_single_packet(AVFormatContext *s, AVPacket *pkt) { MOVMuxContext *mov = s->priv_data; MOVTrack *trk = &mov->tracks[pkt->stream_index]; AVCodecParameters *par = trk->par; int64_t frag_duration = 0; int size = pkt->size; int ret = check_pkt(s, pkt); if (ret < 0) return ret; if (mov->flags & FF_MOV_FLAG_FRAG_DISCONT) { int i; for (i = 0; i < s->nb_streams; i++) mov->tracks[i].frag_discont = 1; mov->flags &= ~FF_MOV_FLAG_FRAG_DISCONT; } if (!pkt->size) { if (trk->start_dts == AV_NOPTS_VALUE && trk->frag_discont) { trk->start_dts = pkt->dts; if (pkt->pts != AV_NOPTS_VALUE) trk->start_cts = pkt->pts - pkt->dts; else trk->start_cts = 0; } if (trk->par->codec_id == AV_CODEC_ID_MP4ALS || trk->par->codec_id == AV_CODEC_ID_FLAC) { int side_size = 0; uint8_t *side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); if (side && side_size > 0 && (side_size != par->extradata_size || memcmp(side, par->extradata, side_size))) { void *newextra = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!newextra) return AVERROR(ENOMEM); av_free(par->extradata); par->extradata = newextra; memcpy(par->extradata, side, side_size); par->extradata_size = side_size; mov->need_rewrite_extradata = 1; } } return 0; } if (trk->entry && pkt->stream_index < s->nb_streams) frag_duration = av_rescale_q(pkt->dts - trk->cluster[0].dts, s->streams[pkt->stream_index]->time_base, AV_TIME_BASE_Q); if ((mov->max_fragment_duration && frag_duration >= mov->max_fragment_duration) || (mov->max_fragment_size && mov->mdat_size + size >= mov->max_fragment_size) || (mov->flags & FF_MOV_FLAG_FRAG_KEYFRAME && par->codec_type == AVMEDIA_TYPE_VIDEO && trk->entry && pkt->flags & AV_PKT_FLAG_KEY)) { if (frag_duration >= mov->min_fragment_duration) { trk->track_duration = pkt->dts - trk->start_dts; if (pkt->pts != AV_NOPTS_VALUE) trk->end_pts = pkt->pts; else trk->end_pts = pkt->dts; trk->end_reliable = 1; mov_auto_flush_fragment(s, 0); } } return ff_mov_write_packet(s, pkt); }
1threat
How to connect mysql workbench with putty using python language : I have database in mysql workbench and Im using 'Putty' SSH shell to connect to my database using python language. But I am unable to import mysql.connector or mysqlDb ( got this suggestion form w3school) So I am unable to connect to my database. Can Any one please help me with that.
0debug
static int shall_we_drop(AVFormatContext *s) { struct dshow_ctx *ctx = s->priv_data; static const uint8_t dropscore[] = {62, 75, 87, 100}; const int ndropscores = FF_ARRAY_ELEMS(dropscore); unsigned int buffer_fullness = (ctx->curbufsize*100)/s->max_picture_buffer; if(dropscore[++ctx->video_frame_num%ndropscores] <= buffer_fullness) { av_log(s, AV_LOG_ERROR, "real-time buffer %d%% full! frame dropped!\n", buffer_fullness); return 1; } return 0; }
1threat
static void gen_msa(CPUMIPSState *env, DisasContext *ctx) { uint32_t opcode = ctx->opcode; check_insn(ctx, ASE_MSA); check_msa_access(ctx); switch (MASK_MSA_MINOR(opcode)) { case OPC_MSA_I8_00: case OPC_MSA_I8_01: case OPC_MSA_I8_02: gen_msa_i8(env, ctx); break; case OPC_MSA_I5_06: case OPC_MSA_I5_07: gen_msa_i5(env, ctx); break; case OPC_MSA_BIT_09: case OPC_MSA_BIT_0A: gen_msa_bit(env, ctx); break; case OPC_MSA_3R_0D: case OPC_MSA_3R_0E: case OPC_MSA_3R_0F: case OPC_MSA_3R_10: case OPC_MSA_3R_11: case OPC_MSA_3R_12: case OPC_MSA_3R_13: case OPC_MSA_3R_14: case OPC_MSA_3R_15: gen_msa_3r(env, ctx); break; case OPC_MSA_ELM: gen_msa_elm(env, ctx); break; case OPC_MSA_3RF_1A: case OPC_MSA_3RF_1B: case OPC_MSA_3RF_1C: gen_msa_3rf(env, ctx); break; case OPC_MSA_VEC: gen_msa_vec(env, ctx); break; case OPC_LD_B: case OPC_LD_H: case OPC_LD_W: case OPC_LD_D: case OPC_ST_B: case OPC_ST_H: case OPC_ST_W: case OPC_ST_D: { int32_t s10 = sextract32(ctx->opcode, 16, 10); uint8_t rs = (ctx->opcode >> 11) & 0x1f; uint8_t wd = (ctx->opcode >> 6) & 0x1f; uint8_t df = (ctx->opcode >> 0) & 0x3; TCGv_i32 tdf = tcg_const_i32(df); TCGv_i32 twd = tcg_const_i32(wd); TCGv_i32 trs = tcg_const_i32(rs); TCGv_i32 ts10 = tcg_const_i32(s10); switch (MASK_MSA_MINOR(opcode)) { case OPC_LD_B: case OPC_LD_H: case OPC_LD_W: case OPC_LD_D: save_cpu_state(ctx, 1); gen_helper_msa_ld_df(cpu_env, tdf, twd, trs, ts10); break; case OPC_ST_B: case OPC_ST_H: case OPC_ST_W: case OPC_ST_D: save_cpu_state(ctx, 1); gen_helper_msa_st_df(cpu_env, tdf, twd, trs, ts10); break; } tcg_temp_free_i32(twd); tcg_temp_free_i32(tdf); tcg_temp_free_i32(trs); tcg_temp_free_i32(ts10); } break; default: MIPS_INVAL("MSA instruction"); generate_exception(ctx, EXCP_RI); break; } }
1threat
Invalid configuration object in webpack : <p>I am following <a href="https://www.lynda.com/React-js-tutorials/React-js-Essential-Training/496905-2.html" rel="noreferrer">Lynda.com - React.js essential training</a> by Eve Porcello. In the video "Building with Webpack", I followed the steps author described exactly, but the "webpack" command failed giving the following error,</p> <p><strong>Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.output.path: The provided value "dist/assets" is not an absolute path!</strong></p> <p>Following are my webpack.config.js and package.json files.</p> <p><strong>webpack.config.js</strong></p> <pre><code>var webpack = require("webpack"); module.exports = { entry: "./src/index.js", output: { path: "dist/assets", filename: "bundle.js", publicPath: "assets" }, devServer: { inline: true, contentBase: "./dist", port: 3000 }, module: { loaders: [ { test: /\.js$/, exclude: /(node_modules)/, loader: "babel-loader", query: { presets: ["latest", "stage-0", "react"] } } ] } } </code></pre> <p><strong>package.json</strong></p> <pre><code>{ "name": "react-essential", "version": "1.0.0", "description": "A project focusing on React and related tools", "main": "index.js", "scripts": { "start": "httpster -d ./dist -p 3000" }, "author": "Indu Pillai", "license": "MIT", "devDependencies": { "babel-cli": "^6.18.0", "babel-loader": "^6.4.1", "babel-preset-latest": "^6.16.0", "babel-preset-react": "^6.16.0", "babel-preset-stage-0": "^6.16.0", "webpack": "^2.3.2", "webpack-dev-server": "^2.4.2" } } </code></pre> <p>I repeated the steps again and again, but it's not working. I'm pretty new to this webpack thing, so I'm not able to find out what the problem really is, and what kind of absolute path it requires. I also tried an absolute path suggested by some answer to another (similar) question, but that didn't work.</p> <p>Thank you!</p>
0debug
I am getting lost inside my own code : <p>I have noticed I am getting lost more often than not when writing more than one screen of code. Most of my code is C++ which tends to be lengthy, and I am using a Mac with Xcode9.</p> <p>I haven't found a solution like a minimap for Xcode (the ones I have found seem deprecated). I am using comments for almost everything but they tend to look similar so it doesn't seem to help much....</p> <p>Does anyone have any suggestions? Good practices or anything?</p> <p>Thanks</p>
0debug
Why the output of 5u and -5u are different? : <pre><code>cout&lt;&lt;-5u </code></pre> <p>It give output: 65531 why? </p> <pre><code>cout&lt;&lt;5u </code></pre> <p>It just give output 5 Then why the outputs are different why -5u cant give -5 output. </p>
0debug
onCreateView dialogfragment : So i created an fragment and there's a button inside it when clicked it pop an dialogfragment, so my problem is it crashed when i run it public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.fragment_one, container, false); Button off = (Button) getActivity().findViewById(R.id.btnOff); off.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { OneFragment.this.onOff(View v);//error here } }); return view; } public void onOff(View v){ new OffButton().show(getFragmentManager(),"off"); }
0debug
static int create_vorbis_context(vorbis_enc_context *venc, AVCodecContext *avctx) { vorbis_enc_floor *fc; vorbis_enc_residue *rc; vorbis_enc_mapping *mc; int i, book, ret; venc->channels = avctx->channels; venc->sample_rate = avctx->sample_rate; venc->log2_blocksize[0] = venc->log2_blocksize[1] = 11; venc->ncodebooks = FF_ARRAY_ELEMS(cvectors); venc->codebooks = av_malloc(sizeof(vorbis_enc_codebook) * venc->ncodebooks); if (!venc->codebooks) return AVERROR(ENOMEM); for (book = 0; book < venc->ncodebooks; book++) { vorbis_enc_codebook *cb = &venc->codebooks[book]; int vals; cb->ndimensions = cvectors[book].dim; cb->nentries = cvectors[book].real_len; cb->min = cvectors[book].min; cb->delta = cvectors[book].delta; cb->lookup = cvectors[book].lookup; cb->seq_p = 0; cb->lens = av_malloc_array(cb->nentries, sizeof(uint8_t)); cb->codewords = av_malloc_array(cb->nentries, sizeof(uint32_t)); if (!cb->lens || !cb->codewords) return AVERROR(ENOMEM); memcpy(cb->lens, cvectors[book].clens, cvectors[book].len); memset(cb->lens + cvectors[book].len, 0, cb->nentries - cvectors[book].len); if (cb->lookup) { vals = cb_lookup_vals(cb->lookup, cb->ndimensions, cb->nentries); cb->quantlist = av_malloc_array(vals, sizeof(int)); if (!cb->quantlist) return AVERROR(ENOMEM); for (i = 0; i < vals; i++) cb->quantlist[i] = cvectors[book].quant[i]; } else { cb->quantlist = NULL; } if ((ret = ready_codebook(cb)) < 0) return ret; } venc->nfloors = 1; venc->floors = av_malloc(sizeof(vorbis_enc_floor) * venc->nfloors); if (!venc->floors) return AVERROR(ENOMEM); fc = &venc->floors[0]; fc->partitions = NUM_FLOOR_PARTITIONS; fc->partition_to_class = av_malloc(sizeof(int) * fc->partitions); if (!fc->partition_to_class) return AVERROR(ENOMEM); fc->nclasses = 0; for (i = 0; i < fc->partitions; i++) { static const int a[] = {0, 1, 2, 2, 3, 3, 4, 4}; fc->partition_to_class[i] = a[i]; fc->nclasses = FFMAX(fc->nclasses, fc->partition_to_class[i]); } fc->nclasses++; fc->classes = av_malloc_array(fc->nclasses, sizeof(vorbis_enc_floor_class)); if (!fc->classes) return AVERROR(ENOMEM); for (i = 0; i < fc->nclasses; i++) { vorbis_enc_floor_class * c = &fc->classes[i]; int j, books; c->dim = floor_classes[i].dim; c->subclass = floor_classes[i].subclass; c->masterbook = floor_classes[i].masterbook; books = (1 << c->subclass); c->books = av_malloc_array(books, sizeof(int)); if (!c->books) return AVERROR(ENOMEM); for (j = 0; j < books; j++) c->books[j] = floor_classes[i].nbooks[j]; } fc->multiplier = 2; fc->rangebits = venc->log2_blocksize[0] - 1; fc->values = 2; for (i = 0; i < fc->partitions; i++) fc->values += fc->classes[fc->partition_to_class[i]].dim; fc->list = av_malloc_array(fc->values, sizeof(vorbis_floor1_entry)); if (!fc->list) return AVERROR(ENOMEM); fc->list[0].x = 0; fc->list[1].x = 1 << fc->rangebits; for (i = 2; i < fc->values; i++) { static const int a[] = { 93, 23,372, 6, 46,186,750, 14, 33, 65, 130,260,556, 3, 10, 18, 28, 39, 55, 79, 111,158,220,312,464,650,850 }; fc->list[i].x = a[i - 2]; } if (ff_vorbis_ready_floor1_list(avctx, fc->list, fc->values)) return AVERROR_BUG; venc->nresidues = 1; venc->residues = av_malloc(sizeof(vorbis_enc_residue) * venc->nresidues); if (!venc->residues) return AVERROR(ENOMEM); rc = &venc->residues[0]; rc->type = 2; rc->begin = 0; rc->end = 1600; rc->partition_size = 32; rc->classifications = 10; rc->classbook = 15; rc->books = av_malloc(sizeof(*rc->books) * rc->classifications); if (!rc->books) return AVERROR(ENOMEM); { static const int8_t a[10][8] = { { -1, -1, -1, -1, -1, -1, -1, -1, }, { -1, -1, 16, -1, -1, -1, -1, -1, }, { -1, -1, 17, -1, -1, -1, -1, -1, }, { -1, -1, 18, -1, -1, -1, -1, -1, }, { -1, -1, 19, -1, -1, -1, -1, -1, }, { -1, -1, 20, -1, -1, -1, -1, -1, }, { -1, -1, 21, -1, -1, -1, -1, -1, }, { 22, 23, -1, -1, -1, -1, -1, -1, }, { 24, 25, -1, -1, -1, -1, -1, -1, }, { 26, 27, 28, -1, -1, -1, -1, -1, }, }; memcpy(rc->books, a, sizeof a); } if ((ret = ready_residue(rc, venc)) < 0) return ret; venc->nmappings = 1; venc->mappings = av_malloc(sizeof(vorbis_enc_mapping) * venc->nmappings); if (!venc->mappings) return AVERROR(ENOMEM); mc = &venc->mappings[0]; mc->submaps = 1; mc->mux = av_malloc(sizeof(int) * venc->channels); if (!mc->mux) return AVERROR(ENOMEM); for (i = 0; i < venc->channels; i++) mc->mux[i] = 0; mc->floor = av_malloc(sizeof(int) * mc->submaps); mc->residue = av_malloc(sizeof(int) * mc->submaps); if (!mc->floor || !mc->residue) return AVERROR(ENOMEM); for (i = 0; i < mc->submaps; i++) { mc->floor[i] = 0; mc->residue[i] = 0; } mc->coupling_steps = venc->channels == 2 ? 1 : 0; mc->magnitude = av_malloc(sizeof(int) * mc->coupling_steps); mc->angle = av_malloc(sizeof(int) * mc->coupling_steps); if (!mc->magnitude || !mc->angle) return AVERROR(ENOMEM); if (mc->coupling_steps) { mc->magnitude[0] = 0; mc->angle[0] = 1; } venc->nmodes = 1; venc->modes = av_malloc(sizeof(vorbis_enc_mode) * venc->nmodes); if (!venc->modes) return AVERROR(ENOMEM); venc->modes[0].blockflag = 0; venc->modes[0].mapping = 0; venc->have_saved = 0; venc->saved = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1]) / 2); venc->samples = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1])); venc->floor = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1]) / 2); venc->coeffs = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1]) / 2); venc->scratch = av_malloc_array(sizeof(float) * venc->channels, (1 << venc->log2_blocksize[1]) / 2); if (!venc->saved || !venc->samples || !venc->floor || !venc->coeffs || !venc->scratch) return AVERROR(ENOMEM); if ((ret = dsp_init(avctx, venc)) < 0) return ret; return 0; }
1threat
How can I switch to Swift 4.0 in Xcode 9.3? : <p>It seems like I have only options to go to 3.3, or unspecified:</p> <p><a href="https://i.stack.imgur.com/hR8ZK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hR8ZK.png" alt="enter image description here"></a></p> <p>Can I switch to 4.0 somehow?</p>
0debug
How are Pointer Expressions in C are solved? Ex: ((4* (-(*p2)))/(*p1)+10 where *p1=12 ,*p2=4 : <p>I want to solve pointer problems.</p> <p>The code was taken from book &amp; I want to know how it was compiled</p> <p>Ex: ((4* (-(*p2)))/(*p1)+10 where *p1=12 ,*p2=4</p> <p>expected output is 9 but why?</p>
0debug
Python: How to change a "penny" image color (copper) to different gray levels? Example given in image : [penny image in different gray levels][1] https://i.stack.imgur.com/Cb2Jk.png
0debug
whois lookup shows correct ip but why my browser cant find ip of domain? : I am facing very strange situation. my website suddenly stooped working. when i search for the domain name in WHOIS websites its showing the correct server ip address and correct DNS IP address. I can reach the website by its IP address but somehow when i am trying domain name in browser its not working and its showing "This site can’t be reached"!! There is no error in my server log. I tried different browser and different system and its same issue. I am really confused. even when i am sending GET request with Postman to my domain it not reachable but sending request to IP is working!
0debug
How to restrict file type (e.g. .pdf) using thymeleaf? : How to restrict file type (e.g. .pdf) using thymeleaf? The accept tag does not serve the purpose fully, as I can type some other file type and the file gets uploaded. The field is of input type "file". Is there any thymeleaf tag that can serve the purpose?
0debug
Single instance of class in Python : <p>I am creating a Python application that includes socket communication with a server. I would like to have a module which can be used throughout my entire application (several other modules). Currently my module look like this:</p> <pre><code>class SocketCommunication: def __init__(self): self.socketIO = SocketIO(settings.ADDRESS, settings.PORT, Namespace) def emit(self, message, data): json_data = json.dumps(data.__dict__) self.socketIO.emit(message, json_data) class Namespace(BaseNamespace): def on_connect(self): print '[Connected]' def on_disconnect(self): print "[Disconnected]" </code></pre> <p>When I use this in other modules I do the following:</p> <pre><code>import SocketCommunication self.sc = SocketCommunication() </code></pre> <p>The problem is that every time I do this, a new connection is created which will be displayed as a new client on the server, and that is undesirable. From what I can read, Singletons should be avoided in Python and therefore I am curious about what is best practice for this type of problem? </p>
0debug
Get selected radio item true OR false : <p>I was trying to get weather the radio button is selected or not by Jquery, but it always returns me false even if the id is checked</p> <p>So far i tried this:</p> <pre><code>$("#opt_34709").prop('checked'); </code></pre> <p>This is my HTML:</p> <pre><code>&lt;input type="radio" id="opt_34709" value="119740" name="options[34709][]"&gt; </code></pre>
0debug
void tcg_dump_ops(TCGContext *s) { char buf[128]; TCGOp *op; int oi; for (oi = s->gen_op_buf[0].next; oi != 0; oi = op->next) { int i, k, nb_oargs, nb_iargs, nb_cargs; const TCGOpDef *def; TCGOpcode c; int col = 0; op = &s->gen_op_buf[oi]; c = op->opc; def = &tcg_op_defs[c]; if (c == INDEX_op_insn_start) { col += qemu_log("%s ----", oi != s->gen_op_buf[0].next ? "\n" : ""); for (i = 0; i < TARGET_INSN_START_WORDS; ++i) { target_ulong a; #if TARGET_LONG_BITS > TCG_TARGET_REG_BITS a = deposit64(op->args[i * 2], 32, 32, op->args[i * 2 + 1]); #else a = op->args[i]; #endif col += qemu_log(" " TARGET_FMT_lx, a); } } else if (c == INDEX_op_call) { nb_oargs = op->callo; nb_iargs = op->calli; nb_cargs = def->nb_cargs; col += qemu_log(" %s %s,$0x%" TCG_PRIlx ",$%d", def->name, tcg_find_helper(s, op->args[nb_oargs + nb_iargs]), op->args[nb_oargs + nb_iargs + 1], nb_oargs); for (i = 0; i < nb_oargs; i++) { col += qemu_log(",%s", tcg_get_arg_str(s, buf, sizeof(buf), op->args[i])); } for (i = 0; i < nb_iargs; i++) { TCGArg arg = op->args[nb_oargs + i]; const char *t = "<dummy>"; if (arg != TCG_CALL_DUMMY_ARG) { t = tcg_get_arg_str(s, buf, sizeof(buf), arg); } col += qemu_log(",%s", t); } } else { col += qemu_log(" %s ", def->name); nb_oargs = def->nb_oargs; nb_iargs = def->nb_iargs; nb_cargs = def->nb_cargs; k = 0; for (i = 0; i < nb_oargs; i++) { if (k != 0) { col += qemu_log(","); } col += qemu_log("%s", tcg_get_arg_str(s, buf, sizeof(buf), op->args[k++])); } for (i = 0; i < nb_iargs; i++) { if (k != 0) { col += qemu_log(","); } col += qemu_log("%s", tcg_get_arg_str(s, buf, sizeof(buf), op->args[k++])); } switch (c) { case INDEX_op_brcond_i32: case INDEX_op_setcond_i32: case INDEX_op_movcond_i32: case INDEX_op_brcond2_i32: case INDEX_op_setcond2_i32: case INDEX_op_brcond_i64: case INDEX_op_setcond_i64: case INDEX_op_movcond_i64: if (op->args[k] < ARRAY_SIZE(cond_name) && cond_name[op->args[k]]) { col += qemu_log(",%s", cond_name[op->args[k++]]); } else { col += qemu_log(",$0x%" TCG_PRIlx, op->args[k++]); } i = 1; break; case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_st_i32: case INDEX_op_qemu_ld_i64: case INDEX_op_qemu_st_i64: { TCGMemOpIdx oi = op->args[k++]; TCGMemOp op = get_memop(oi); unsigned ix = get_mmuidx(oi); if (op & ~(MO_AMASK | MO_BSWAP | MO_SSIZE)) { col += qemu_log(",$0x%x,%u", op, ix); } else { const char *s_al, *s_op; s_al = alignment_name[(op & MO_AMASK) >> MO_ASHIFT]; s_op = ldst_name[op & (MO_BSWAP | MO_SSIZE)]; col += qemu_log(",%s%s,%u", s_al, s_op, ix); } i = 1; } break; default: i = 0; break; } switch (c) { case INDEX_op_set_label: case INDEX_op_br: case INDEX_op_brcond_i32: case INDEX_op_brcond_i64: case INDEX_op_brcond2_i32: col += qemu_log("%s$L%d", k ? "," : "", arg_label(op->args[k])->id); i++, k++; break; default: break; } for (; i < nb_cargs; i++, k++) { col += qemu_log("%s$0x%" TCG_PRIlx, k ? "," : "", op->args[k]); } } if (op->life) { unsigned life = op->life; for (; col < 48; ++col) { putc(' ', qemu_logfile); } if (life & (SYNC_ARG * 3)) { qemu_log(" sync:"); for (i = 0; i < 2; ++i) { if (life & (SYNC_ARG << i)) { qemu_log(" %d", i); } } } life /= DEAD_ARG; if (life) { qemu_log(" dead:"); for (i = 0; life; ++i, life >>= 1) { if (life & 1) { qemu_log(" %d", i); } } } } qemu_log("\n"); } }
1threat
Javascrip for loop not working : Can anyone tell me why this loop is not working when I put the start value of 2 in but it works when I do 1 or 10. var button = document.getElementById('generate'); var resultsDiv = document.getElementById('results'); var start; var end; button.onclick = function(){ resultsDiv.innerHTML = ""; start = document.getElementById('start').value; end = document.getElementById('end').value; generateTags(start,end); }; function generateTags(start, stop){ for(i=start; i<=stop; i++){ console.log(i); } }
0debug
Publising Failed - We are unable to create an authentication session : <p>I am trying to upload an iOS App to the App Store in Visual Studio on my Mac.</p> <p>However, I am getting this error shown in the image.</p> <p><a href="https://i.stack.imgur.com/PjRsI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PjRsI.png" alt="enter image description here"></a></p> <p>Any idea how to fix this problem?</p>
0debug
int av_write_header(AVFormatContext *s) { int ret, i; AVStream *st; if (s->nb_streams == 0) { av_log(s, AV_LOG_ERROR, "no streams\n"); return AVERROR(EINVAL); } for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; switch (st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: if(st->codec->sample_rate<=0){ av_log(s, AV_LOG_ERROR, "sample rate not set\n"); return AVERROR(EINVAL); } if(!st->codec->block_align) st->codec->block_align = st->codec->channels * av_get_bits_per_sample(st->codec->codec_id) >> 3; break; case AVMEDIA_TYPE_VIDEO: if(st->codec->time_base.num<=0 || st->codec->time_base.den<=0){ av_log(s, AV_LOG_ERROR, "time base not set\n"); return AVERROR(EINVAL); } if((st->codec->width<=0 || st->codec->height<=0) && !(s->oformat->flags & AVFMT_NODIMENSIONS)){ av_log(s, AV_LOG_ERROR, "dimensions not set\n"); return AVERROR(EINVAL); } if(av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)){ av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between encoder and muxer layer\n"); return AVERROR(EINVAL); } break; } if(s->oformat->codec_tag){ if(st->codec->codec_tag && st->codec->codec_id == CODEC_ID_RAWVIDEO && av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id) == 0 && !validate_codec_tag(s, st)){ st->codec->codec_tag= 0; } if(st->codec->codec_tag){ if (!validate_codec_tag(s, st)) { char tagbuf[32]; av_get_codec_tag_string(tagbuf, sizeof(tagbuf), st->codec->codec_tag); av_log(s, AV_LOG_ERROR, "Tag %s/0x%08x incompatible with output codec '%s'\n", tagbuf, st->codec->codec_tag, st->codec->codec->name); return AVERROR_INVALIDDATA; } }else st->codec->codec_tag= av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id); } if(s->oformat->flags & AVFMT_GLOBALHEADER && !(st->codec->flags & CODEC_FLAG_GLOBAL_HEADER)) av_log(s, AV_LOG_WARNING, "Codec for stream %d does not use global headers but container format requires global headers\n", i); } if (!s->priv_data && s->oformat->priv_data_size > 0) { s->priv_data = av_mallocz(s->oformat->priv_data_size); if (!s->priv_data) return AVERROR(ENOMEM); } #if LIBAVFORMAT_VERSION_MAJOR < 53 ff_metadata_mux_compat(s); #endif if (!(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { AVMetadata *m; AVMetadataTag *t; if (!(m = av_mallocz(sizeof(AVMetadata)))) return AVERROR(ENOMEM); av_metadata_set2(&m, "encoder", LIBAVFORMAT_IDENT, 0); metadata_conv(&m, s->oformat->metadata_conv, NULL); if ((t = av_metadata_get(m, "", NULL, AV_METADATA_IGNORE_SUFFIX))) av_metadata_set2(&s->metadata, t->key, t->value, 0); av_metadata_free(&m); } if(s->oformat->write_header){ ret = s->oformat->write_header(s); if (ret < 0) return ret; } for(i=0;i<s->nb_streams;i++) { int64_t den = AV_NOPTS_VALUE; st = s->streams[i]; switch (st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: den = (int64_t)st->time_base.num * st->codec->sample_rate; break; case AVMEDIA_TYPE_VIDEO: den = (int64_t)st->time_base.num * st->codec->time_base.den; break; default: break; } if (den != AV_NOPTS_VALUE) { if (den <= 0) return AVERROR_INVALIDDATA; av_frac_init(&st->pts, 0, 0, den); } } return 0; }
1threat
How can I extract date from since time component : <p>I have to extract date in the format MM-dd-yyyy in java from the since time value. Since time is the time at which the doucment is created. For example, if since time is <strong>1452413972759</strong>, date would be "<strong>Sun, 10 Jan 2016 08:19:32 GMT</strong>" (Calculated from <a href="http://www.epochconverter.com/" rel="nofollow">http://www.epochconverter.com/</a>) . From this, I could get date in desired format but I am unable to code for the first step i.e., converting since time to date. Can someone help me?</p> <p>I tried </p> <pre><code>DateFormat df = new SimpleDateFormat("MM/dd/yyyy"); java.util.Date date = df.parse("1452320105343"); String DATE_FORMAT = "MM/dd/yyyy"; SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); System.out.println("Today is " + sdf.format(date)); </code></pre> <p>But it gives parse exception.</p>
0debug
static int32_t ide_nop_int32(IDEDMA *dma, int x) { return 0; }
1threat
How do I pass an expression as a function keyword in Python : <p>I am trying to be pythonic with my code but can't figure out how to do:</p> <pre><code>dfSort.assign(i+5=pd.Series(dfWork)) </code></pre> <p>where dfSort is a Dataframe and pd is pandas import. Of course the <code>i+5</code> is an expression and therefore cannot be passed as a column name. But I want to assign a column name dynamically in code (called <code>i+5</code>). The only way to do this otherwise is (this can get cumbersome):</p> <pre><code>if (i+5)== 5: dfSort = dfSort.assign(a=pd.Series(dfWork, index=dfSort.index.values)) elif (i+5)==6: dfSort = dfSort.assign(b=pd.Series(dfWork, index=dfSort.index.values)) elif (i+5)==7: dfSort = dfSort.assign(c=pd.Series(dfWork, index=dfSort.index.values)) elif (i+5)==8: dfSort = dfSort.assign(d=pd.Series(dfWork, index=dfSort.index.values)) </code></pre> <p>Is there a way to do this like the first code block without the if statements?</p> <p>This doesn't work:</p> <pre><code>Colname = {5: 'a',6 : 'b', 7 : 'c', 8 : 'd'} dfSort = dfSort.assign(Colname[i+5]=pd.Series(dfWork) ) </code></pre>
0debug
static ExitStatus gen_call_pal(DisasContext *ctx, int palcode) { if (palcode >= 0x80 && palcode < 0xC0) { switch (palcode) { case 0x86: break; case 0x9E: tcg_gen_mov_i64(cpu_ir[IR_V0], cpu_unique); break; case 0x9F: tcg_gen_mov_i64(cpu_unique, cpu_ir[IR_A0]); break; default: return gen_excp(ctx, EXCP_CALL_PAL, palcode & 0xbf); } return NO_EXIT; } #ifndef CONFIG_USER_ONLY if (palcode < 0x40 && (ctx->tb->flags & TB_FLAGS_USER_MODE) == 0) { switch (palcode) { case 0x01: break; case 0x02: break; case 0x2D: tcg_gen_st_i64(cpu_ir[IR_A0], cpu_env, offsetof(CPUAlphaState, vptptr)); break; case 0x31: tcg_gen_mov_i64(cpu_sysval, cpu_ir[IR_A0]); break; case 0x32: tcg_gen_mov_i64(cpu_ir[IR_V0], cpu_sysval); break; case 0x35: { TCGv tmp; tcg_gen_ld8u_i64(cpu_ir[IR_V0], cpu_env, offsetof(CPUAlphaState, ps)); tmp = tcg_temp_new(); tcg_gen_andi_i64(tmp, cpu_ir[IR_A0], PS_INT_MASK); tcg_gen_st8_i64(tmp, cpu_env, offsetof(CPUAlphaState, ps)); tcg_temp_free(tmp); break; } case 0x36: tcg_gen_ld8u_i64(cpu_ir[IR_V0], cpu_env, offsetof(CPUAlphaState, ps)); break; case 0x38: tcg_gen_mov_i64(cpu_usp, cpu_ir[IR_A0]); break; case 0x3A: tcg_gen_mov_i64(cpu_ir[IR_V0], cpu_usp); break; case 0x3C: tcg_gen_ld32s_i64(cpu_ir[IR_V0], cpu_env, -offsetof(AlphaCPU, env) + offsetof(CPUState, cpu_index)); break; default: return gen_excp(ctx, EXCP_CALL_PAL, palcode & 0x3f); } return NO_EXIT; } #endif return gen_invalid(ctx); }
1threat
How do I convert 000041933, a string, to 41933, an integer in Python? : <p>I know how to convert a string to an integer, but what I really am having trouble with is removing the leading zeros. Any help?</p>
0debug
How to add a cut string in the list with javascript? : <p>I have a small problem with the JavaScript. I would like to add the string (format:one-two-three) the list, but this cut the sign ("-") and every elements tag add. I try solve this problem, unfortunatelly don't succeeded. Here my function:</p> <p>function listAdd(){</p> <pre><code>var string = document.forms["form1"].elements["stringAdd"].value; if(string != ""){ var array = string.split(""); var eredmeny = array.some(function(v) { return v == "-";}); if(eredmeny){ for(var i = 0; i &lt;array.length; i++){ if(array[i] != "-"){ var newElement = document.createElement('li'); array[i] = array.toString(); newElement.textContent = array[i]; var list = document.getElementById("gyumi"); list.appendChild(list.createTextNode(array[i])); } } } else{ var newElement = document.createElement('li'); newElement.textContent = szoveg; var list = document.getElementById("gyumi"); list.appendChild(newElement); } } </code></pre> <p>}</p> <p>Sorry, poor my English and this is the first question to me.</p>
0debug
Make the heart move up/down/left/right : <p>I was able to make a heart in matlab as:</p> <pre><code>n=100; x=linspace(-3,3,n); y=linspace(-3,3,n); z=linspace(-3,3,n); [X,Y,Z]=ndgrid(x,y,z); F=((-(X.^2) .* (Z.^3) -(9/80).*(Y.^2).*(Z.^3)) + ((X.^2) + (9/4).* (Y.^2) + (Z.^2)-1).^3); isosurface(F,0) lighting phong axis equal </code></pre> <p>Let's say I would like to move it up just a moment (i.e. 1s) after showing the figure. I mean, 1st step is to show the heart and 2nd step is to move it ,i.e. up (or down/left/right). What approach could be taken?</p>
0debug
How to give Sort option to the hierarchy(List of Elements) in the Windows Form : I am using EA with C# Add-in and MDG Technology, From C# Add-in I have created few list of elements in that windows form. In this Window i have a hierarchy to display. And now i want to give Sort option to that list/tree/flow in that window. Sort based on Alphabetical order. Please suggest me how to fetch this in the coding.
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
Function on a variable declaration : <p>I'm reading the C Programming Language (chapter 5), and I'm confused by this example:</p> <pre><code>int n, array[SIZE], getint(int *); </code></pre> <p>Why is this function call in here like that? Is this just some tricky example and invalid code?</p>
0debug
static AVBufferRef *dxva2_pool_alloc(void *opaque, int size) { AVHWFramesContext *ctx = (AVHWFramesContext*)opaque; DXVA2FramesContext *s = ctx->internal->priv; AVDXVA2FramesContext *hwctx = ctx->hwctx; if (s->nb_surfaces_used < hwctx->nb_surfaces) { s->nb_surfaces_used++; return av_buffer_create((uint8_t*)s->surfaces_internal[s->nb_surfaces_used - 1], sizeof(*hwctx->surfaces), NULL, 0, 0); } return NULL; }
1threat
Java script for json object nothing shows in the html page? : I'm following a JS tuto , and I've faced a problem the list is not showing on my browser . I checked the script part but It's all okay. I did'nt find the error in my code. The output on my page's browser should be somthing like this list : *facebook:... *instagram:... <html> <head> <meta charset="utf-8"/> <title> JS-JSON </title> </head> <body> <script> var info= { "full_name": "tim berner ", "tile": "staff author", "links": [ {"facebook":"https://web.facebook.com/"} , {"instagram":"https://www.instagram.com/"} ]}; //var output = ""; //for (key in info.links) { //if (info.links.hasOwnProperty(key)) //{ output += '<li>' + //'<a href = "' + info.links[key] + //'">' + key + '</a>'+ //'</li>'; //}// if the links has the key property //} //for ...go through each link var output = '' ; for (var i = 0; i<= info.length; i++){ for (key in info.links[i]){ if (info.links[i].hasOwnProperty(key)){ output += '<li>' + '<a href= "' + info.links[i] [key] + ' ">' + key + '</a> ' + '</li>' ; }//hasOwnProperty }//for each object }//for each array element var update = document.getElementById('links'); update.innerHTML = output; </script> </body> </html>
0debug
How to generate Signature in AWS from Java : <p>When I invoke API endpoints from REST client, I got error by concerning with Signature.</p> <p>Request:</p> <blockquote> <p><strong>Host</strong>: <a href="https://xxx.execute-api.ap-southeast-1.amazonaws.com/latest/api/name" rel="noreferrer">https://xxx.execute-api.ap-southeast-1.amazonaws.com/latest/api/name</a></p> <p><strong>Authorization</strong>: AWS4-HMAC-SHA256 Credential=<code>{AWSKEY}</code>/20160314/ap-southeast-1/execute-api/aws4_request,SignedHeaders=host;range;x-amz-date,Signature=<code>{signature}</code></p> <p><strong>X-Amz-Date</strong>: 20160314T102915Z</p> </blockquote> <p>Response:</p> <pre><code>{ "message": "The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details. The Canonical String for this request should have been 'xxx' " } </code></pre> <p>From Java code, I followed AWS reference of how to generate Signature.</p> <pre><code> String secretKey = "{mysecretkey}"; String dateStamp = "20160314"; String regionName = "ap-southeast-1"; String serviceName = "execute-api"; byte[] signature = getSignatureKey(secretKey, dateStamp, regionName, serviceName); System.out.println("Signature : " + Hex.encodeHexString(signature)); static byte[] HmacSHA256(String data, byte[] key) throws Exception { String algorithm="HmacSHA256"; Mac mac = Mac.getInstance(algorithm); mac.init(new SecretKeySpec(key, algorithm)); return mac.doFinal(data.getBytes("UTF8")); } static byte[] getSignatureKey(String key, String dateStamp, String regionName, String serviceName) throws Exception { byte[] kSecret = ("AWS4" + key).getBytes("UTF8"); byte[] kDate = HmacSHA256(dateStamp, kSecret); byte[] kRegion = HmacSHA256(regionName, kDate); byte[] kService = HmacSHA256(serviceName, kRegion); byte[] kSigning = HmacSHA256("aws4_request", kService); return kSigning; } </code></pre> <p>May I know what I was wrong while generating Signature?</p> <p>Reference how to generate Signature : <a href="http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-java" rel="noreferrer">http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html#signature-v4-examples-java</a></p>
0debug
static av_cold int ape_decode_init(AVCodecContext * avctx) { APEContext *s = avctx->priv_data; int i; if (avctx->extradata_size != 6) { av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n"); return -1; } if (avctx->bits_per_coded_sample != 16) { av_log(avctx, AV_LOG_ERROR, "Only 16-bit samples are supported\n"); return -1; } if (avctx->channels > 2) { av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n"); return -1; } s->avctx = avctx; s->channels = avctx->channels; s->fileversion = AV_RL16(avctx->extradata); s->compression_level = AV_RL16(avctx->extradata + 2); s->flags = AV_RL16(avctx->extradata + 4); av_log(avctx, AV_LOG_DEBUG, "Compression Level: %d - Flags: %d\n", s->compression_level, s->flags); if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE) { av_log(avctx, AV_LOG_ERROR, "Incorrect compression level %d\n", s->compression_level); return -1; } s->fset = s->compression_level / 1000 - 1; for (i = 0; i < APE_FILTER_LEVELS; i++) { if (!ape_filter_orders[s->fset][i]) break; s->filterbuf[i] = av_malloc((ape_filter_orders[s->fset][i] * 3 + HISTORY_SIZE) * 4); } dsputil_init(&s->dsp, avctx); avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; return 0; }
1threat
static void gmc_mmx(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) { const int w = 8; const int ix = ox >> (16 + shift); const int iy = oy >> (16 + shift); const int oxs = ox >> 4; const int oys = oy >> 4; const int dxxs = dxx >> 4; const int dxys = dxy >> 4; const int dyxs = dyx >> 4; const int dyys = dyy >> 4; const uint16_t r4[4] = { r, r, r, r }; const uint16_t dxy4[4] = { dxys, dxys, dxys, dxys }; const uint16_t dyy4[4] = { dyys, dyys, dyys, dyys }; const uint64_t shift2 = 2 * shift; #define MAX_STRIDE 4096U #define MAX_H 8U uint8_t edge_buf[(MAX_H + 1) * MAX_STRIDE]; int x, y; const int dxw = (dxx - (1 << (16 + shift))) * (w - 1); const int dyh = (dyy - (1 << (16 + shift))) * (h - 1); const int dxh = dxy * (h - 1); const int dyw = dyx * (w - 1); int need_emu = (unsigned) ix >= width - w || (unsigned) iy >= height - h; if ( ((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) | (oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift) || (dxx | dxy | dyx | dyy) & 15 || (need_emu && (h > MAX_H || stride > MAX_STRIDE))) { ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, shift, r, width, height); return; } src += ix + iy * stride; if (need_emu) { ff_emulated_edge_mc_8(edge_buf, src, stride, stride, w + 1, h + 1, ix, iy, width, height); src = edge_buf; } __asm__ volatile ( "movd %0, %%mm6 \n\t" "pxor %%mm7, %%mm7 \n\t" "punpcklwd %%mm6, %%mm6 \n\t" "punpcklwd %%mm6, %%mm6 \n\t" :: "r" (1 << shift)); for (x = 0; x < w; x += 4) { uint16_t dx4[4] = { oxs - dxys + dxxs * (x + 0), oxs - dxys + dxxs * (x + 1), oxs - dxys + dxxs * (x + 2), oxs - dxys + dxxs * (x + 3) }; uint16_t dy4[4] = { oys - dyys + dyxs * (x + 0), oys - dyys + dyxs * (x + 1), oys - dyys + dyxs * (x + 2), oys - dyys + dyxs * (x + 3) }; for (y = 0; y < h; y++) { __asm__ volatile ( "movq %0, %%mm4 \n\t" "movq %1, %%mm5 \n\t" "paddw %2, %%mm4 \n\t" "paddw %3, %%mm5 \n\t" "movq %%mm4, %0 \n\t" "movq %%mm5, %1 \n\t" "psrlw $12, %%mm4 \n\t" "psrlw $12, %%mm5 \n\t" : "+m" (*dx4), "+m" (*dy4) : "m" (*dxy4), "m" (*dyy4)); __asm__ volatile ( "movq %%mm6, %%mm2 \n\t" "movq %%mm6, %%mm1 \n\t" "psubw %%mm4, %%mm2 \n\t" "psubw %%mm5, %%mm1 \n\t" "movq %%mm2, %%mm0 \n\t" "movq %%mm4, %%mm3 \n\t" "pmullw %%mm1, %%mm0 \n\t" "pmullw %%mm5, %%mm3 \n\t" "pmullw %%mm5, %%mm2 \n\t" "pmullw %%mm4, %%mm1 \n\t" "movd %4, %%mm5 \n\t" "movd %3, %%mm4 \n\t" "punpcklbw %%mm7, %%mm5 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "pmullw %%mm5, %%mm3 \n\t" "pmullw %%mm4, %%mm2 \n\t" "movd %2, %%mm5 \n\t" "movd %1, %%mm4 \n\t" "punpcklbw %%mm7, %%mm5 \n\t" "punpcklbw %%mm7, %%mm4 \n\t" "pmullw %%mm5, %%mm1 \n\t" "pmullw %%mm4, %%mm0 \n\t" "paddw %5, %%mm1 \n\t" "paddw %%mm3, %%mm2 \n\t" "paddw %%mm1, %%mm0 \n\t" "paddw %%mm2, %%mm0 \n\t" "psrlw %6, %%mm0 \n\t" "packuswb %%mm0, %%mm0 \n\t" "movd %%mm0, %0 \n\t" : "=m" (dst[x + y * stride]) : "m" (src[0]), "m" (src[1]), "m" (src[stride]), "m" (src[stride + 1]), "m" (*r4), "m" (shift2)); src += stride; } src += 4 - h * stride; } }
1threat
def sum(a,b): sum = 0 for i in range (1,min(a,b)): if (a % i == 0 and b % i == 0): sum += i return sum
0debug
PPC_OP(mulhwu) { T0 = ((uint64_t)T0 * (uint64_t)T1) >> 32; RETURN(); }
1threat
void ppce500_init(MachineState *machine, PPCE500Params *params) { MemoryRegion *address_space_mem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); PCIBus *pci_bus; CPUPPCState *env = NULL; uint64_t elf_entry; uint64_t elf_lowaddr; hwaddr entry=0; hwaddr loadaddr=UIMAGE_LOAD_BASE; target_long kernel_size=0; target_ulong dt_base = 0; target_ulong initrd_base = 0; target_long initrd_size = 0; target_ulong cur_base = 0; int i; unsigned int pci_irq_nrs[PCI_NUM_PINS] = {1, 2, 3, 4}; qemu_irq **irqs, *mpic; DeviceState *dev; CPUPPCState *firstenv = NULL; MemoryRegion *ccsr_addr_space; SysBusDevice *s; PPCE500CCSRState *ccsr; if (machine->cpu_model == NULL) { machine->cpu_model = "e500v2_v30"; } irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *)); irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB); for (i = 0; i < smp_cpus; i++) { PowerPCCPU *cpu; CPUState *cs; qemu_irq *input; cpu = cpu_ppc_init(machine->cpu_model); if (cpu == NULL) { fprintf(stderr, "Unable to initialize CPU!\n"); exit(1); } env = &cpu->env; cs = CPU(cpu); if (!firstenv) { firstenv = env; } irqs[i] = irqs[0] + (i * OPENPIC_OUTPUT_NB); input = (qemu_irq *)env->irq_inputs; irqs[i][OPENPIC_OUTPUT_INT] = input[PPCE500_INPUT_INT]; irqs[i][OPENPIC_OUTPUT_CINT] = input[PPCE500_INPUT_CINT]; env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i; env->mpic_iack = MPC8544_CCSRBAR_BASE + MPC8544_MPIC_REGS_OFFSET + 0xa0; ppc_booke_timers_init(cpu, 400000000, PPC_TIMER_E500); if (!i) { struct boot_info *boot_info; boot_info = g_malloc0(sizeof(struct boot_info)); qemu_register_reset(ppce500_cpu_reset, cpu); env->load_info = boot_info; } else { qemu_register_reset(ppce500_cpu_reset_sec, cpu); } } env = firstenv; ram_size &= ~(RAM_SIZES_ALIGN - 1); machine->ram_size = ram_size; memory_region_init_ram(ram, NULL, "mpc8544ds.ram", ram_size); vmstate_register_ram_global(ram); memory_region_add_subregion(address_space_mem, 0, ram); dev = qdev_create(NULL, "e500-ccsr"); object_property_add_child(qdev_get_machine(), "e500-ccsr", OBJECT(dev), NULL); qdev_init_nofail(dev); ccsr = CCSR(dev); ccsr_addr_space = &ccsr->ccsr_space; memory_region_add_subregion(address_space_mem, MPC8544_CCSRBAR_BASE, ccsr_addr_space); mpic = ppce500_init_mpic(params, ccsr_addr_space, irqs); if (serial_hds[0]) { serial_mm_init(ccsr_addr_space, MPC8544_SERIAL0_REGS_OFFSET, 0, mpic[42], 399193, serial_hds[0], DEVICE_BIG_ENDIAN); } if (serial_hds[1]) { serial_mm_init(ccsr_addr_space, MPC8544_SERIAL1_REGS_OFFSET, 0, mpic[42], 399193, serial_hds[1], DEVICE_BIG_ENDIAN); } dev = qdev_create(NULL, "mpc8544-guts"); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); memory_region_add_subregion(ccsr_addr_space, MPC8544_UTIL_OFFSET, sysbus_mmio_get_region(s, 0)); dev = qdev_create(NULL, "e500-pcihost"); qdev_prop_set_uint32(dev, "first_slot", params->pci_first_slot); qdev_prop_set_uint32(dev, "first_pin_irq", pci_irq_nrs[0]); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); for (i = 0; i < PCI_NUM_PINS; i++) { sysbus_connect_irq(s, i, mpic[pci_irq_nrs[i]]); } memory_region_add_subregion(ccsr_addr_space, MPC8544_PCI_REGS_OFFSET, sysbus_mmio_get_region(s, 0)); pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci.0"); if (!pci_bus) printf("couldn't create PCI controller!\n"); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, MPC8544_PCI_IO); if (pci_bus) { for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], pci_bus, "virtio", NULL); } } sysbus_create_simple("e500-spin", MPC8544_SPIN_BASE, NULL); if (machine->kernel_filename) { kernel_size = load_uimage(machine->kernel_filename, &entry, &loadaddr, NULL); if (kernel_size < 0) { kernel_size = load_elf(machine->kernel_filename, NULL, NULL, &elf_entry, &elf_lowaddr, NULL, 1, ELF_MACHINE, 0); entry = elf_entry; loadaddr = elf_lowaddr; } if (kernel_size < 0) { fprintf(stderr, "qemu: could not load kernel '%s'\n", machine->kernel_filename); exit(1); } cur_base = loadaddr + kernel_size; dt_base = (cur_base + DTC_LOAD_PAD) & ~DTC_PAD_MASK; cur_base += DTB_MAX_SIZE; } if (machine->initrd_filename) { initrd_base = (cur_base + INITRD_LOAD_PAD) & ~INITRD_PAD_MASK; initrd_size = load_image_targphys(machine->initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { fprintf(stderr, "qemu: could not load initial ram disk '%s'\n", machine->initrd_filename); exit(1); } cur_base = initrd_base + initrd_size; } if (machine->kernel_filename) { struct boot_info *boot_info; int dt_size; dt_size = ppce500_prep_device_tree(machine, params, dt_base, initrd_base, initrd_size); if (dt_size < 0) { fprintf(stderr, "couldn't load device tree\n"); exit(1); } assert(dt_size < DTB_MAX_SIZE); boot_info = env->load_info; boot_info->entry = entry; boot_info->dt_base = dt_base; boot_info->dt_size = dt_size; } if (kvm_enabled()) { kvmppc_init(); } }
1threat
Questions needs to asked before we need upgrade TFS 2013 upgrade to TFS 2018 upgrade? : One of our client wants to move from TFS 2013 to TFS 2018. We don't have much information about the current TFS setup at client's end. Can anyone please guide with what questions we need to ask to client to get the information regarding the current TFS setup system before we start with upgrade process. Also share if there is any process document regarding upgrading the TFS 2013 to TFS 2018. Thanks in advance. Regards, Pravin Kumbhar
0debug
Please help out : Hello coders i am trying to display an array using angularjs and type script but their is an error i am not understanding. Please help. I am learning Angular js an type script [When i move my cursor to the The Goal that red lined it shows this: Type '{ id: number; name: string; }[]' is missing the following properties from type 'Goal': id, name][1] Visual studio shows a red line on Goal saying this: Type '{ id: number; name: string; }[]' is missing the following properties from type 'Goal': id, name Can any coder show me exactly what to do? [1]: https://i.stack.imgur.com/AcHNP.png
0debug
Get rid of "warning: command substitution: ignored null byte in input" : <p>I'm getting <code>-bash: warning: command substitution: ignored null byte in input</code> when I run <code>model=$(cat /proc/device-tree/model)</code></p> <pre><code>bash --version GNU bash, version 4.4.12(1)-release (arm-unknown-linux-gnueabihf) </code></pre> <p>With bash version 4.3.30 it's all OK</p> <p>I understand the problem is the terminating <code>\0</code> character in the file, but how can I suppress this stupid message? My whole script is messed up since I'm on bash 4.4</p>
0debug
static inline void idct4col_put(uint8_t *dest, int line_size, const DCTELEM *col) { int c0, c1, c2, c3, a0, a1, a2, a3; const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; a0 = col[8*0]; a1 = col[8*2]; a2 = col[8*4]; a3 = col[8*6]; c0 = ((a0 + a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); c1 = a1 * C1 + a3 * C2; c3 = a1 * C2 - a3 * C1; dest[0] = cm[(c0 + c1) >> C_SHIFT]; dest += line_size; dest[0] = cm[(c2 + c3) >> C_SHIFT]; dest += line_size; dest[0] = cm[(c2 - c3) >> C_SHIFT]; dest += line_size; dest[0] = cm[(c0 - c1) >> C_SHIFT]; }
1threat
static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq) { SCSIBus *bus = sreq->bus; VirtIOSCSI *s = container_of(bus, VirtIOSCSI, bus); VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s); VirtIOSCSIReq *req; uint32_t n; req = g_malloc(sizeof(*req)); qemu_get_be32s(f, &n); assert(n < vs->conf.num_queues); qemu_get_buffer(f, (unsigned char *)&req->elem, sizeof(req->elem)); virtio_scsi_parse_req(s, vs->cmd_vqs[n], req); scsi_req_ref(sreq); req->sreq = sreq; if (req->sreq->cmd.mode != SCSI_XFER_NONE) { int req_mode = (req->elem.in_num > 1 ? SCSI_XFER_FROM_DEV : SCSI_XFER_TO_DEV); assert(req->sreq->cmd.mode == req_mode); } return req; }
1threat
static int ff_sctp_send(int s, const void *msg, size_t len, const struct sctp_sndrcvinfo *sinfo, int flags) { struct msghdr outmsg; struct iovec iov; outmsg.msg_name = NULL; outmsg.msg_namelen = 0; outmsg.msg_iov = &iov; iov.iov_base = msg; iov.iov_len = len; outmsg.msg_iovlen = 1; outmsg.msg_controllen = 0; if (sinfo) { char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))]; struct cmsghdr *cmsg; outmsg.msg_control = outcmsg; outmsg.msg_controllen = sizeof(outcmsg); outmsg.msg_flags = 0; cmsg = CMSG_FIRSTHDR(&outmsg); cmsg->cmsg_level = IPPROTO_SCTP; cmsg->cmsg_type = SCTP_SNDRCV; cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo)); outmsg.msg_controllen = cmsg->cmsg_len; memcpy(CMSG_DATA(cmsg), sinfo, sizeof(struct sctp_sndrcvinfo)); } return sendmsg(s, &outmsg, flags | MSG_NOSIGNAL); }
1threat
How can I parse the xml? : <p>In my project, the url return the xml data,and How can I parse the xml? <a href="https://i.stack.imgur.com/TlxzU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TlxzU.png" alt="enter image description here"></a></p>
0debug
static int ipvideo_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; IpvideoContext *s = avctx->priv_data; AVFrame *frame = data; int ret; if (buf_size < 2) return AVERROR_INVALIDDATA; s->decoding_map_size = AV_RL16(avpkt->data); if (buf_size < s->decoding_map_size + 2) return buf_size; if (av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, NULL)) { av_frame_unref(s->last_frame); av_frame_unref(s->second_last_frame); } s->decoding_map = buf + 2; bytestream2_init(&s->stream_ptr, buf + 2 + s->decoding_map_size, buf_size - s->decoding_map_size); if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; if (!s->is_16bpp) { int size; const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, &size); if (pal && size == AVPALETTE_SIZE) { frame->palette_has_changed = 1; memcpy(s->pal, pal, AVPALETTE_SIZE); } else if (pal) { av_log(avctx, AV_LOG_ERROR, "Palette size %d is wrong\n", size); } } ipvideo_decode_opcodes(s, frame); *got_frame = 1; av_frame_unref(s->second_last_frame); FFSWAP(AVFrame*, s->second_last_frame, s->last_frame); if ((ret = av_frame_ref(s->last_frame, frame)) < 0) return ret; return buf_size; }
1threat
Serving mp3 files using the webpack file loader : <p>I have a problem with getting my mp3 files to work using the webpack file loader.</p> <p>This is the issue:</p> <p>I have a mp3 file on my harddisk, that if I open using chrome by for example "c:\somefolder\somemp3file.mp3" opens up in a tab in the browser and plays just fine.</p> <p>However, when I serve the exact same file using webpack it does not work. I have configured the loader in webpack like this:</p> <pre><code>{ test: /\.(gif|jpg|png|mp3|aac|ogg)$/, loader: 'file' } </code></pre> <p>Then, when I'm trying to link to the file I require it inside my javascript, like this:</p> <pre><code>require('file!./../content/somemp3file.mp3'); </code></pre> <p>this correctly returns me the url for the mp3 file.</p> <p>If I try to manually go to <code>localhost:8080</code> followed by the url returned by require, the mp3 player in Chrome pops up like I expect it to, but the file cannot be played, and it's not possible to click on the play button like the file is corrupted or something. </p> <p>Anyone knows what I'm doing wrong here?</p>
0debug
static void spr_write_dbatu (void *opaque, int sprn) { DisasContext *ctx = opaque; gen_op_store_dbatu((sprn - SPR_DBAT0U) / 2); RET_STOP(ctx); }
1threat
int fw_cfg_add_bytes(FWCfgState *s, uint16_t key, uint8_t *data, uint32_t len) { int arch = !!(key & FW_CFG_ARCH_LOCAL); key &= FW_CFG_ENTRY_MASK; if (key >= FW_CFG_MAX_ENTRY) return 0; s->entries[arch][key].data = data; s->entries[arch][key].len = len; return 1; }
1threat
What happends in this simple Recursion code : I can't seem to understand why does the following code prints 00 1 10 1 by how i see it,it should print the premutations of 2 binary digits please,dont fix my code. i want an explanation of why it works the way it is right now.thanks ahead public static String addZ(int n) { String str =""; if(n==0) return ""; str += "0" + addZ(n-1)+"\n"; str += "1" + addZ(n-1); return str; }
0debug
static int asf_read_value(AVFormatContext *s, uint8_t *name, uint16_t name_len, uint16_t val_len, int type, AVDictionary **met) { int ret; uint8_t *value; uint16_t buflen = 2 * val_len + 1; AVIOContext *pb = s->pb; value = av_malloc(buflen); if (!value) return AVERROR(ENOMEM); if (type == ASF_UNICODE) { if ((ret = get_asf_string(pb, val_len, value, buflen)) < 0) goto failed; if (av_dict_set(met, name, value, 0) < 0) av_log(s, AV_LOG_WARNING, "av_dict_set failed.\n"); } else { char buf[256]; if (val_len > sizeof(buf)) { ret = AVERROR_INVALIDDATA; goto failed; } if ((ret = avio_read(pb, value, val_len)) < 0) goto failed; if (ret < 2 * val_len) value[ret] = '\0'; else value[2 * val_len - 1] = '\0'; snprintf(buf, sizeof(buf), "%s", value); if (av_dict_set(met, name, buf, 0) < 0) av_log(s, AV_LOG_WARNING, "av_dict_set failed.\n"); } av_freep(&value); return 0; failed: av_freep(&value); return ret; }
1threat
download file 1Gb : I am having difficulty downloading files with a size of 1 GB. Smaller files works fine. I've tried some options. My file is a zip folder that contais some pdf files. I've tried some options like use WebClient namespace This is my code that works just smaller files. byte[] fileBytes = System.IO.File.ReadAllBytes(sPath); string fileName = System.IO.Path.GetFileName(sPath); return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName); my fileBytes variable stay like this = byte[1099288209] and I get a "Overflow or underflow in the arithmetic operation." But when my file has 1Gb size or greater it isn't works. If a use the WebClient namespace I have the follow error: wClient.DownloadFile("https://site/folder/", sPath); "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.127.1.180:8080" my fileBytes variable stay like this = byte[1099288209] and I get a "Overflow or underflow in the arithmetic operation." Using webClient I get an error like this "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 10.127.1.180:8080"
0debug
static int read_quant_tables(RangeCoder *c, int16_t quant_table[MAX_CONTEXT_INPUTS][256]) { int i; int context_count = 1; for (i = 0; i < 5; i++) { context_count *= read_quant_table(c, quant_table[i], context_count); if (context_count > 32768U) { return AVERROR_INVALIDDATA; } } return (context_count + 1) / 2; }
1threat
css image masonry grid in a square space : How can I make masonry grid of only 4 images, that will always look like this: [image of a grid][1] [1]: https://i.stack.imgur.com/pM3Dw.jpg I need this alignment to stay on every screen sizes. And to form a square. Is this possible. I tried a lot of CSS combinations and nothing seems to work for all screens. thank you for your help.
0debug
static void rm_read_audio_stream_info(AVFormatContext *s, AVStream *st, int read_all) { RMContext *rm = s->priv_data; ByteIOContext *pb = &s->pb; char buf[256]; uint32_t version; int i; version = get_be32(pb); if (((version >> 16) & 0xff) == 3) { int64_t startpos = url_ftell(pb); for(i = 0; i < 14; i++) get_byte(pb); get_str8(pb, s->title, sizeof(s->title)); get_str8(pb, s->author, sizeof(s->author)); get_str8(pb, s->copyright, sizeof(s->copyright)); get_str8(pb, s->comment, sizeof(s->comment)); if ((startpos + (version & 0xffff)) >= url_ftell(pb) + 2) { get_byte(pb); get_str8(pb, buf, sizeof(buf)); } if ((startpos + (version & 0xffff)) > url_ftell(pb)) url_fskip(pb, (version & 0xffff) + startpos - url_ftell(pb)); st->codec->sample_rate = 8000; st->codec->channels = 1; st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_RA_144; } else { int flavor, sub_packet_h, coded_framesize, sub_packet_size; get_be32(pb); get_be32(pb); get_be16(pb); get_be32(pb); flavor= get_be16(pb); rm->coded_framesize = coded_framesize = get_be32(pb); get_be32(pb); get_be32(pb); get_be32(pb); rm->sub_packet_h = sub_packet_h = get_be16(pb); st->codec->block_align= get_be16(pb); rm->sub_packet_size = sub_packet_size = get_be16(pb); get_be16(pb); if (((version >> 16) & 0xff) == 5) { get_be16(pb); get_be16(pb); get_be16(pb); } st->codec->sample_rate = get_be16(pb); get_be32(pb); st->codec->channels = get_be16(pb); if (((version >> 16) & 0xff) == 5) { get_be32(pb); buf[0] = get_byte(pb); buf[1] = get_byte(pb); buf[2] = get_byte(pb); buf[3] = get_byte(pb); buf[4] = 0; } else { get_str8(pb, buf, sizeof(buf)); get_str8(pb, buf, sizeof(buf)); } st->codec->codec_type = CODEC_TYPE_AUDIO; if (!strcmp(buf, "dnet")) { st->codec->codec_id = CODEC_ID_AC3; } else if (!strcmp(buf, "28_8")) { st->codec->codec_id = CODEC_ID_RA_288; st->codec->extradata_size= 0; rm->audio_framesize = st->codec->block_align; st->codec->block_align = coded_framesize; if(rm->audio_framesize >= UINT_MAX / sub_packet_h){ av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n"); return -1; } rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h); } else if (!strcmp(buf, "cook")) { int codecdata_length, i; get_be16(pb); get_byte(pb); if (((version >> 16) & 0xff) == 5) get_byte(pb); codecdata_length = get_be32(pb); if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); return -1; } st->codec->codec_id = CODEC_ID_COOK; st->codec->extradata_size= codecdata_length; st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); for(i = 0; i < codecdata_length; i++) ((uint8_t*)st->codec->extradata)[i] = get_byte(pb); rm->audio_framesize = st->codec->block_align; st->codec->block_align = rm->sub_packet_size; if(rm->audio_framesize >= UINT_MAX / sub_packet_h){ av_log(s, AV_LOG_ERROR, "rm->audio_framesize * sub_packet_h too large\n"); return -1; } rm->audiobuf = av_malloc(rm->audio_framesize * sub_packet_h); } else if (!strcmp(buf, "raac") || !strcmp(buf, "racp")) { int codecdata_length, i; get_be16(pb); get_byte(pb); if (((version >> 16) & 0xff) == 5) get_byte(pb); st->codec->codec_id = CODEC_ID_AAC; codecdata_length = get_be32(pb); if (codecdata_length >= 1) { st->codec->extradata_size = codecdata_length - 1; st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_byte(pb); for(i = 0; i < st->codec->extradata_size; i++) ((uint8_t*)st->codec->extradata)[i] = get_byte(pb); } } else { st->codec->codec_id = CODEC_ID_NONE; pstrcpy(st->codec->codec_name, sizeof(st->codec->codec_name), buf); } if (read_all) { get_byte(pb); get_byte(pb); get_byte(pb); get_str8(pb, s->title, sizeof(s->title)); get_str8(pb, s->author, sizeof(s->author)); get_str8(pb, s->copyright, sizeof(s->copyright)); get_str8(pb, s->comment, sizeof(s->comment)); } } }
1threat
static int qemu_savevm_state(QEMUFile *f) { SaveStateEntry *se; int len, ret; int64_t cur_pos, len_pos, total_len_pos; qemu_put_be32(f, QEMU_VM_FILE_MAGIC); qemu_put_be32(f, QEMU_VM_FILE_VERSION); total_len_pos = qemu_ftell(f); qemu_put_be64(f, 0); for(se = first_se; se != NULL; se = se->next) { if (se->save_state == NULL) continue; len = strlen(se->idstr); qemu_put_byte(f, len); qemu_put_buffer(f, (uint8_t *)se->idstr, len); qemu_put_be32(f, se->instance_id); qemu_put_be32(f, se->version_id); len_pos = qemu_ftell(f); qemu_put_be32(f, 0); se->save_state(f, se->opaque); cur_pos = qemu_ftell(f); len = cur_pos - len_pos - 4; qemu_fseek(f, len_pos, SEEK_SET); qemu_put_be32(f, len); qemu_fseek(f, cur_pos, SEEK_SET); } cur_pos = qemu_ftell(f); qemu_fseek(f, total_len_pos, SEEK_SET); qemu_put_be64(f, cur_pos - total_len_pos - 8); qemu_fseek(f, cur_pos, SEEK_SET); ret = 0; return ret; }
1threat