problem
stringlengths
26
131k
labels
class label
2 classes
After ruby update to 2.5.0, require 'bundler/setup' raise exception : <p>Call <code>rake</code> from rails app after ruby 2.5.0 update, does not work.</p> <pre><code>$ rake Traceback (most recent call last): 22: from ./bin/rake:4:in `&lt;main&gt;' 21: from ./bin/rake:4:in `require_relative' 20: from /Users/user/work/hw/relocations_app/config/boot.rb:5:in `&lt;top (required)&gt;' 19: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require' 18: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require' 17: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require' 16: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/setup.rb:10:in `&lt;top (required)&gt;' 15: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup' 14: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:20:in `setup' 13: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:108:in `block in definition_method' 12: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:226:in `requested_specs' 11: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:237:in `specs_for' 10: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:170:in `specs' 9: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:247:in `resolve' 8: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:806:in `converge_locked_specs' 7: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:874:in `expand_dependencies' 6: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:874:in `each' 5: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:887:in `block in expand_dependencies' 4: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:887:in `each' 3: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/bundler-1.16.1/lib/bundler/definition.rb:888:in `block (2 levels) in expand_dependencies' 2: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require' 1: from /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require' /Users/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- bundler/dep_proxy (LoadError) </code></pre> <p>config/boot.rb</p> <pre><code># frozen_string_literal: true ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. </code></pre> <p><code>bundler/setup</code> can not be required.</p> <p>A same problem is with passenger, to start rails app with that:</p> <pre><code>Error ID: 309814d3 Error details saved to: /tmp/passenger-error-yCUWSg.html Message from application: cannot load such file -- bundler/setup (LoadError) /var/www/vhosts/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require' /var/www/vhosts/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require' /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:456:in `activate_gem' /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:323:in `block in run_load_path_setup_code' /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:461:in `running_bundler' /usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:322:in `run_load_path_setup_code' /usr/share/passenger/helper-scripts/rack-preloader.rb:100:in `preload_app' /usr/share/passenger/helper-scripts/rack-preloader.rb:156:in `&lt;module:App&gt;' /usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `&lt;module:PhusionPassenger&gt;' /usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `&lt;main&gt;' </code></pre> <p>Have anybody a same problem with ruby 2.5.0?</p>
0debug
static bool invalid_qmp_mode(const Monitor *mon, const mon_cmd_t *cmd) { bool is_cap = cmd->mhandler.cmd_new == do_qmp_capabilities; if (is_cap && qmp_cmd_mode(mon)) { qerror_report(ERROR_CLASS_COMMAND_NOT_FOUND, "Capabilities negotiation is already complete, command " "'%s' ignored", cmd->name); return true; } if (!is_cap && !qmp_cmd_mode(mon)) { qerror_report(ERROR_CLASS_COMMAND_NOT_FOUND, "Expecting capabilities negotiation with " "'qmp_capabilities' before command '%s'", cmd->name); return true; } return false; }
1threat
static av_always_inline void mc_luma_scaled(VP9Context *s, vp9_scaled_mc_func smc, vp9_mc_func (*mc)[2], uint8_t *dst, ptrdiff_t dst_stride, const uint8_t *ref, ptrdiff_t ref_stride, ThreadFrame *ref_frame, ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv, int px, int py, int pw, int ph, int bw, int bh, int w, int h, int bytesperpixel, const uint16_t *scale, const uint8_t *step) { if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width && s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) { mc_luma_unscaled(s, mc, dst, dst_stride, ref, ref_stride, ref_frame, y, x, in_mv, bw, bh, w, h, bytesperpixel); } else { #define scale_mv(n, dim) (((int64_t)(n) * scale[dim]) >> 14) int mx, my; int refbw_m1, refbh_m1; int th; VP56mv mv; mv.x = av_clip(in_mv->x, -(x + pw - px + 4) * 8, (s->cols * 8 - x + px + 3) * 8); mv.y = av_clip(in_mv->y, -(y + ph - py + 4) * 8, (s->rows * 8 - y + py + 3) * 8); mx = scale_mv(mv.x * 2, 0) + scale_mv(x * 16, 0); my = scale_mv(mv.y * 2, 1) + scale_mv(y * 16, 1); y = my >> 4; x = mx >> 4; ref += y * ref_stride + x * bytesperpixel; mx &= 15; my &= 15; refbw_m1 = ((bw - 1) * step[0] + mx) >> 4; refbh_m1 = ((bh - 1) * step[1] + my) >> 4; th = (y + refbh_m1 + 4 + 7) >> 6; ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0); if (x < 3 || y < 3 || x + 4 >= w - refbw_m1 || y + 4 >= h - refbh_m1) { s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ref - 3 * ref_stride - 3 * bytesperpixel, 288, ref_stride, refbw_m1 + 8, refbh_m1 + 8, x - 3, y - 3, w, h); ref = s->edge_emu_buffer + 3 * 288 + 3 * bytesperpixel; ref_stride = 288; } smc(dst, dst_stride, ref, ref_stride, bh, mx, my, step[0], step[1]); } }
1threat
pic_read(void *opaque, target_phys_addr_t addr, unsigned int size) { struct etrax_pic *fs = opaque; uint32_t rval; rval = fs->regs[addr >> 2]; D(printf("%s %x=%x\n", __func__, addr, rval)); return rval; }
1threat
No network interfaces on Debian 8 Lenovo install : <p>So I recently got the Lenovo x270, and installed Debian on it instead of the default Windows OS. I've come to find out WiFi, as well as ethernet are both shipped not working. I've tried to fix it, but nothing has worked so far. I switched from straight Debian 8 to Kali to see if it was just a problem in base Debian, but it wasn't. Laptop specs related to issue:</p> <ul> <li><p>Intel® Dual Band Wireless-AC 8265</p></li> <li><p>Kali Linux (Kernel 4.0.0)</p></li> <li><p>1 Ethernet port</p></li> </ul> <p>I installed the Intel drivers needed for the 8265 (<a href="http://www.intel.com/content/www/us/en/support/network-and-i-o/wireless-networking/000005511.html" rel="nofollow noreferrer">http://www.intel.com/content/www/us/en/support/network-and-i-o/wireless-networking/000005511.html</a>). However, this requires a kernel version of 4.6, which it doesn't seem I can get without apt-get which I can't use because I don't have internet.</p> <p>I also attempted to manually add the ethernet using <a href="https://wiki.debian.org/NetworkConfiguration#Setting_up_an_Ethernet_Interface" rel="nofollow noreferrer">https://wiki.debian.org/NetworkConfiguration#Setting_up_an_Ethernet_Interface</a> and a few other sources I've now lost, but that didn't work either. The main problem I'm having is it seems you need internet to be able to install various packages that allow you to get internet, so I'm not sure what to do. Any ideas would be a great help. </p> <p>Thank you.</p>
0debug
int64_t av_get_channel_layout(const char *name) { int i = 0; do { if (!strcmp(channel_layout_map[i].name, name)) return channel_layout_map[i].layout; i++; } while (channel_layout_map[i].name); return 0; }
1threat
static int qemu_chr_open_stdio(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; if (stdio_nb_clients >= STDIO_MAX_CLIENTS) { return -EBUSY; } if (stdio_nb_clients == 0) { old_fd0_flags = fcntl(0, F_GETFL); tcgetattr (0, &oldtty); fcntl(0, F_SETFL, O_NONBLOCK); atexit(term_exit); } chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; chr->chr_set_echo = qemu_chr_set_echo_stdio; qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); stdio_nb_clients++; stdio_allow_signal = qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC); qemu_chr_fe_set_echo(chr, false); *_chr = chr; return 0; }
1threat
uint64_t helper_fre (uint64_t arg) { CPU_DoubleU fone, farg; fone.ll = 0x3FF0000000000000ULL; farg.ll = arg; if (unlikely(float64_is_signaling_nan(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); } else if (unlikely(float64_is_zero(farg.d))) { farg.ll = float_zero_divide_excp(fone.d, farg.d); } else if (likely(isnormal(farg.d))) { farg.d = float64_div(fone.d, farg.d, &env->fp_status); } else { if (farg.ll == 0x8000000000000000ULL) { farg.ll = 0xFFF0000000000000ULL; } else if (farg.ll == 0x0000000000000000ULL) { farg.ll = 0x7FF0000000000000ULL; } else if (float64_is_nan(farg.d)) { farg.ll = 0x7FF8000000000000ULL; } else if (float64_is_neg(farg.d)) { farg.ll = 0x8000000000000000ULL; } else { farg.ll = 0x0000000000000000ULL; } } return farg.d; }
1threat
Unable to login with email or mobile.Any help please? : I am trying to login with email or mobile(in php and mysql).But I am unable to login.Could anyone help me?Here is my code $sql = "SELECT * FROM tb_users WHERE (email='$loginEmailOrMobile' AND password='$loginPassword') OR (mobile_number='$loginEmailOrMobile' AND password='$loginPassword')"; $mysql = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($mysql) == 1) { echo "login successful"; $user = mysql_fetch_object($mysql); echo $user->username; } else { die(mysql_error()); }
0debug
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) { int ret = 0; AVDictionary *tmp = NULL; if (avcodec_is_open(avctx)) return 0; if ((!codec && !avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2().\n"); return AVERROR(EINVAL); } if ((codec && avctx->codec && codec != avctx->codec)) { av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, " "but %s passed to avcodec_open2().\n", avctx->codec->name, codec->name); return AVERROR(EINVAL); } if (!codec) codec = avctx->codec; if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) return AVERROR(EINVAL); if (options) av_dict_copy(&tmp, *options, 0); if (ff_lockmgr_cb) { if ((*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) return -1; } entangled_thread_counter++; if(entangled_thread_counter != 1){ av_log(avctx, AV_LOG_ERROR, "insufficient thread locking around avcodec_open/close()\n"); ret = -1; goto end; } avctx->internal = av_mallocz(sizeof(AVCodecInternal)); if (!avctx->internal) { ret = AVERROR(ENOMEM); goto end; } if (codec->priv_data_size > 0) { if(!avctx->priv_data){ avctx->priv_data = av_mallocz(codec->priv_data_size); if (!avctx->priv_data) { ret = AVERROR(ENOMEM); goto end; } if (codec->priv_class) { *(const AVClass**)avctx->priv_data= codec->priv_class; av_opt_set_defaults(avctx->priv_data); } } if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) goto free_and_end; } else { avctx->priv_data = NULL; } if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) goto free_and_end; if (codec->capabilities & CODEC_CAP_EXPERIMENTAL) if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(avctx, AV_LOG_ERROR, "Codec is experimental but experimental codecs are not enabled, try -strict -2\n"); ret = -1; goto free_and_end; } if(!( avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && avctx->codec_id == CODEC_ID_H264)){ if(avctx->coded_width && avctx->coded_height) avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); else if(avctx->width && avctx->height) avcodec_set_dimensions(avctx, avctx->width, avctx->height); } if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { av_log(avctx, AV_LOG_WARNING, "ignoring invalid width/height values\n"); avcodec_set_dimensions(avctx, 0, 0); } if (av_codec_is_decoder(codec)) av_freep(&avctx->subtitle_header); #define SANE_NB_CHANNELS 128U if (avctx->channels > SANE_NB_CHANNELS) { ret = AVERROR(EINVAL); goto free_and_end; } avctx->codec = codec; if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && avctx->codec_id == CODEC_ID_NONE) { avctx->codec_type = codec->type; avctx->codec_id = codec->id; } if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n"); ret = AVERROR(EINVAL); goto free_and_end; } avctx->frame_number = 0; if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && (!avctx->time_base.num || !avctx->time_base.den)) { avctx->time_base.num = 1; avctx->time_base.den = avctx->sample_rate; } if (!HAVE_THREADS) av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); if (HAVE_THREADS && !avctx->thread_opaque) { ret = ff_thread_init(avctx); if (ret < 0) { goto free_and_end; } } if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) avctx->thread_count = 1; if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", avctx->codec->max_lowres); ret = AVERROR(EINVAL); goto free_and_end; } if (av_codec_is_encoder(avctx->codec)) { int i; if (avctx->codec->sample_fmts) { for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) break; if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n"); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->pix_fmts) { for (i = 0; avctx->codec->pix_fmts[i] != PIX_FMT_NONE; i++) if (avctx->pix_fmt == avctx->codec->pix_fmts[i]) break; if (avctx->codec->pix_fmts[i] == PIX_FMT_NONE && !((avctx->codec_id == CODEC_ID_MJPEG || avctx->codec_id == CODEC_ID_LJPEG) && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) { av_log(avctx, AV_LOG_ERROR, "Specified pix_fmt is not supported\n"); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->supported_samplerates) { for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) break; if (avctx->codec->supported_samplerates[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified sample_rate is not supported\n"); ret = AVERROR(EINVAL); goto free_and_end; } } if (avctx->codec->channel_layouts) { if (!avctx->channel_layout) { av_log(avctx, AV_LOG_WARNING, "channel_layout not specified\n"); } else { for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) if (avctx->channel_layout == avctx->codec->channel_layouts[i]) break; if (avctx->codec->channel_layouts[i] == 0) { av_log(avctx, AV_LOG_ERROR, "Specified channel_layout is not supported\n"); ret = AVERROR(EINVAL); goto free_and_end; } } } if (avctx->channel_layout && avctx->channels) { if (av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { av_log(avctx, AV_LOG_ERROR, "channel layout does not match number of channels\n"); ret = AVERROR(EINVAL); goto free_and_end; } } else if (avctx->channel_layout) { avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); } } avctx->pts_correction_num_faulty_pts = avctx->pts_correction_num_faulty_dts = 0; avctx->pts_correction_last_pts = avctx->pts_correction_last_dts = INT64_MIN; if(avctx->codec->init && !(avctx->active_thread_type&FF_THREAD_FRAME)){ ret = avctx->codec->init(avctx); if (ret < 0) { goto free_and_end; } } ret=0; if (av_codec_is_decoder(avctx->codec)) { if (!avctx->bit_rate) avctx->bit_rate = get_bit_rate(avctx); if (avctx->channel_layout && av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { av_log(avctx, AV_LOG_WARNING, "channel layout does not match number of channels\n"); avctx->channel_layout = 0; } } end: entangled_thread_counter--; if (ff_lockmgr_cb) { (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); } if (options) { av_dict_free(options); *options = tmp; } return ret; free_and_end: av_dict_free(&tmp); av_freep(&avctx->priv_data); av_freep(&avctx->internal); avctx->codec= NULL; goto end; }
1threat
Node.js - What does “socket hang up” mean in simple words? : <p>I would like to know what socket hang up means in very simple words. </p>
0debug
Difference between vert.x and RxJava : <p>We are evaluating reactive programming frameworks for one of our projects. I just went through vert.x tutorials. I checked RxJava presentation a bit. RxJava seemed more close to CompletableFuture. But despite the underlying patterns, both RxJava and Vert.x give access to non blocking programming. I am confused as to what is the difference between them. I will appreciate any help in this regard.</p>
0debug
each letter is node in linked-list, unknown size of word retrieved from user : program is supposed to take word from user (of unknown lenght) then create linked-list, each node should contain one character. It works with pre-declarated word but i am having a problem with "Stack around the variable 'str' was corrupted." if i try to simply cin>>word; Any help would be welcome. #include <iostream> #include <iomanip> #include <stdio.h> using namespace std; struct slistEl { slistEl * next; char data; }; unsigned l_size(slistEl * head) { unsigned c = 0; slistEl * p = head; if (p) do { c++; p = p->next; } while (p != head); return c; } void l_printl(slistEl * head) { slistEl * p; cout << setw(3) << l_size(head) << " ["; p = head; if (p) do { p = p->next; cout << " " << p->data; } while (p != head); cout << " ]\n\n"; } void l_push(slistEl * & head, char v) { slistEl * p = new slistEl; p->data = v; if (head) { p->next = head->next; head->next = p; } else p->next = p; head = p; } void l_pop(slistEl * & head) { if (head) { slistEl * p = head->next; head->next = p->next; if (p->next == p) head = NULL; delete p; } } int main() { slistEl * head = NULL; char str[] = "abcdefgh"; // pre-declarated word //cin >> str; //program should take word from user for (int i = 0; str[i] != '\0'; i++) { l_push(head, str[i]); l_printl(head); } system("PAUSE"); return 0; }
0debug
Prevent decimal and numbers after from being removed when using (int)$var : I have a JSON object with order information in. Within this object is an amount for example `"amount" : "82.95"` I have this within a variable called `$amount` and I am using it within an array by doing `(int)$amoun`t. The problem with this is that it is removing the `.95` which is required. How can I get this value as an integer not string but retain the `.95`? Example: $amount = 82.95; echo (int)$amount; // Result = 82
0debug
Where is redux store saved? : <p>I was looking into how secure a redux application can be, I am storing certain values in redux store i.e. user token etc.. and tried to see if someone else could gain access to them via an xss attack for example, I checked sessionStorage, localStorage, cookies and it is not there, as well as it is not inside my app.js file (my bundle file), hence my question.</p>
0debug
static int virtio_blk_load_device(VirtIODevice *vdev, QEMUFile *f, int version_id) { VirtIOBlock *s = VIRTIO_BLK(vdev); while (qemu_get_sbyte(f)) { unsigned nvqs = s->conf.num_queues; unsigned vq_idx = 0; VirtIOBlockReq *req; if (nvqs > 1) { vq_idx = qemu_get_be32(f); if (vq_idx >= nvqs) { error_report("Invalid virtqueue index in request list: %#x", vq_idx); return -EINVAL; } } req = qemu_get_virtqueue_element(f, sizeof(VirtIOBlockReq)); virtio_blk_init_request(s, virtio_get_queue(vdev, vq_idx), req); req->next = s->rq; s->rq = req; } return 0; }
1threat
In unity, how do I make it so that when all of my capsules (collectables) have been collected, my UI button appears? : I really need to do this this evening or a failing grade awaits. but part of the exercise im doing requires it I have these objects that the should be able to walk into, and once they've collected all 5 of them, the UI button on the grey box in the top left corner of their screen appears. ive been spending ages trying to figure it out but I cant I have the coding experience of an absolute beginner. this literally is my first coding experience
0debug
static int audio_validate_settings (audsettings_t *as) { int invalid; invalid = as->nchannels != 1 && as->nchannels != 2; invalid |= as->endianness != 0 && as->endianness != 1; switch (as->fmt) { case AUD_FMT_S8: case AUD_FMT_U8: case AUD_FMT_S16: case AUD_FMT_U16: case AUD_FMT_S32: case AUD_FMT_U32: break; default: invalid = 1; break; } invalid |= as->freq <= 0; return invalid ? -1 : 0; }
1threat
DriveInfo *add_init_drive(const char *optstr) { DriveInfo *dinfo; QemuOpts *opts; MachineClass *mc; opts = drive_def(optstr); if (!opts) return NULL; mc = MACHINE_GET_CLASS(current_machine); dinfo = drive_new(opts, mc->block_default_type); if (!dinfo) { qemu_opts_del(opts); return NULL; } return dinfo; }
1threat
static int coroutine_fn bdrv_co_do_readv(BlockDriverState *bs, int64_t sector_num, int nb_sectors, QEMUIOVector *qiov, BdrvRequestFlags flags) { if (nb_sectors < 0 || nb_sectors > (UINT_MAX >> BDRV_SECTOR_BITS)) { return -EINVAL; } return bdrv_co_do_preadv(bs, sector_num << BDRV_SECTOR_BITS, nb_sectors << BDRV_SECTOR_BITS, qiov, flags); }
1threat
How to show html string in text widget flutter : <p>How to show html tag string in flutter, i have tried a plugin and its not working. </p> <pre><code>new HtmlView( data: html, baseURL: "", // optional, type String onLaunchFail: (url) { // optional, type Function print("launch $url failed"); } </code></pre> <p>This is my html </p> <pre><code>“Follow&lt;a class='sup'&gt;&lt;sup&gt;pl&lt;/sup&gt;&lt;/a&gt; what was sent down to you from your Lord, and do not follow other guardians apart from Him. Little do &lt;span class='h'&gt;you remind yourselves&lt;/span&gt;&lt;a class='f'&gt;&lt;sup f=2437&gt;1&lt;/sup&gt;&lt;/a&gt;.” </code></pre> <p>i user flutter_html_view: "^0.5.10" this plugin</p>
0debug
What does .equals() not work : I printed the 2 strings and they are literally identical, no whitespaces cause i replaced it. https://ideone.com/cw07LG Here it is compiled public class Palindrome{ public static boolean isPalindrome(String word){ int length; String oppositeWord =""; word = word.replace(" ",""); word = word.toLowerCase(); length = word.length(); for(int i=length-1;i>=0;i--){ if(Character.isLetter(word.charAt(i))){ oppositeWord +=word.charAt(i); }else{ word = word.replace(word.charAt(i),'\0'); } } System.out.println(oppositeWord); System.out.println(word); return oppositeWord.equals(word); } public static void main(String[]args){ System.out.println(isPalindrome("Madam, I'm Adam")); } }
0debug
int fw_cfg_add_file(FWCfgState *s, const char *filename, uint8_t *data, uint32_t len) { int i, index; if (!s->files) { int dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS; s->files = g_malloc0(dsize); fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, (uint8_t*)s->files, dsize); } index = be32_to_cpu(s->files->count); if (index == FW_CFG_FILE_SLOTS) { fprintf(stderr, "fw_cfg: out of file slots\n"); return 0; } fw_cfg_add_bytes(s, FW_CFG_FILE_FIRST + index, data, len); pstrcpy(s->files->f[index].name, sizeof(s->files->f[index].name), filename); for (i = 0; i < index; i++) { if (strcmp(s->files->f[index].name, s->files->f[i].name) == 0) { trace_fw_cfg_add_file_dupe(s, s->files->f[index].name); return 1; } } s->files->f[index].size = cpu_to_be32(len); s->files->f[index].select = cpu_to_be16(FW_CFG_FILE_FIRST + index); trace_fw_cfg_add_file(s, index, s->files->f[index].name, len); s->files->count = cpu_to_be32(index+1); return 1; }
1threat
what will be the logic in shell scripting : i have a test file. and suppose content is like this. i want to put this into an array separated by "semicolon" in shell script History is the discovery, collection, organization, analysis, and presentation of information about past events. History can also mean a continuous typically; chronological record of important or public events or of a particular trend or institution. Scholars who write about history are called historians. It is a field of knowledge which uses a narrative to examine and analyse the sequence of events; and it sometimes attempts to objectively investigate the patterns of cause and effect that determine events; expected output: array[0] should print: History is the discovery, collection, organization, analysis, and presentation of information about past events. History can also mean a continuous typically; array[1] should print: chronological record of important or public events or of a particular trend or institution. Scholars who write about history are called historians. It is a field of knowledge which uses a narrative to examine and analyse the sequence of events; array[3] should print: and it sometimes attempts to objectively investigate the patterns of cause and effect that determine events; like this way.... what will be the logic....
0debug
How to change docker installation directory in centos 7 with docker 1.13 version : <p>I have enclosed the docker details below,</p> <p>$ docker info</p> <pre><code>Containers: 3 Running: 3 Paused: 0 Stopped: 0 Images: 26 Server Version: 1.13.0 Storage Driver: overlay Backing Filesystem: xfs Supports d_type: false Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host macvlan null overlay Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e init version: 949e6fa Security Options: seccomp Profile: default Kernel Version: 3.10.0-514.6.1.el7.x86_64 Operating System: CentOS Linux 7 (Core) OSType: linux Architecture: x86_64 CPUs: 8 Total Memory: 15.51 GiB Name: docker ID: WYAF:SDYL:LVAU:OKDP:O6K2:ZLG6:RMIB:SET4:SWGN:6TBR:ST6K:4W55 Docker Root Dir: /var/lib/docker Debug Mode (client): false Debug Mode (server): false Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: 127.0.0.0/8 Live Restore Enabled: false </code></pre> <p>$ docker system df </p> <pre><code>TYPE TOTAL ACTIVE SIZE RECLAIMABLE Images 4 3 4.441 GB -1.644e+09 B (-37%) Containers 3 3 6.867 GB 0 B (0%) Local Volumes 0 0 0 B 0 B </code></pre> <p>$ df -h</p> <pre><code>Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 14G 14G 647M 96% / devtmpfs 7.8G 0 7.8G 0% /dev tmpfs 7.8G 0 7.8G 0% /dev/shm tmpfs 7.8G 25M 7.8G 1% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sda1 497M 216M 281M 44% /boot /dev/sdb 296G 65M 281G 1% /mnt overlay 14G 14G 647M 96% /var/lib/docker/overlay/dfa0c4e618c259bf046b454b27a7963fb31b9d4e95cc745ed28696b0791e3166/merged shm 64M 0 64M 0% /var/lib/docker/containers/6e978cecc472322ef984cdb73117ed0243eb88c30d37c93827084bec88dcf15a/shm overlay 14G 14G 647M 96% /var/lib/docker/overlay/9cdd3dc933f93febccaa7e06ba2f86023d3dd655614be5d9e636ab75f21873f4/merged shm 64M 0 64M 0% /var/lib/docker/containers/ed44174945e331246f622e42a6ea646504075a91e4922168d895ed295cd24109/shm overlay 14G 14G 647M 96% /var/lib/docker/overlay/c2bc2c73f0f3b0e717f8ea134aad8554ebb6b77c2dcfd85e8035a645bf75d074/merged shm 64M 0 64M 0% /var/lib/docker/containers/26fd8e67dc7da80f6047add17aaddd7f67f763966d4a6b65d08680ac41774a28/shm tmpfs 1.6G 0 1.6G 0% /run/user/0 </code></pre> <p>As we can see the space in root directory is filled up, so i would like to mount the docker installation directory to <code>/mnt</code>. Many suggested to include the -g option, but i couldnt able to provide that option.</p> <p>Could anyone please help me how to mount to /mnt directory and where to make those changes. I am using centos 7 and i have installed docker with the help of below link and i have followed exactly the same steps, </p> <p><a href="https://docs.docker.com/engine/installation/linux/centos/" rel="noreferrer">https://docs.docker.com/engine/installation/linux/centos/</a></p> <p>And followed the steps provided here <a href="https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169" rel="noreferrer">https://forums.docker.com/t/how-do-i-change-the-docker-image-installation-directory/1169</a></p> <p>I couldnt find a docker file in <code>/etc/sysconfig</code> or in <code>/etc/default</code>. Please suggest where to change this</p>
0debug
c# open another form from current form button click : <p>I want to open another form on button click and it is image viewer form and i want to enter data on first form with reference as second form but not working, all controls are there on second form itself even in minimization , after closing that form only allowing to enter data on first form.</p>
0debug
Find regions of similar color in image : <p>I've been working on this problem for some time now with little promising results. I am trying to split up an image into connected regions of similar color. (basically split a list of all the pixels into multiple groups (each group containing the coordinates of the pixels that belong to it and share a similar color).</p> <p>For example: <a href="http://unsplash.com/photos/SoC1ex6sI4w/" rel="noreferrer">http://unsplash.com/photos/SoC1ex6sI4w/</a></p> <p>In this image the dark clouds at the top would probably fall into one group. Some of the grey rock on the mountain in another, and some of the orange grass in another. The snow would be another - the red of the backpack - etc.</p> <p>I'm trying to design an algorithm that will be both accurate and efficient (it needs to run in a matter of ms on midrange laptop grade hardware)</p> <hr> <p>Below is what I have tried:</p> <p>Using a connected component based algorithm to go through every pixel from top left scanning every line of pixels from left to right (and comparing the current pixel to the top pixel and left pixel). Using the CIEDE2000 color difference formula if the pixel at the top or left was within a certain range then it would be considered "similar" and part of the group.</p> <p>This sort of worked - but the problem is it relies on color regions having sharp edges - if any color groups are connected by a soft gradient it will travel down that gradient and continue to "join" the pixels as the difference between the individual pixels being compared is small enough to be considered "similar".</p> <p>To try to fix this I chose to set every visited pixel's color to the color of most "similar" adjacent pixel (either top or left). If there are no similar pixels than it retains it's original color. This somewhat fixes the issue of more blurred boundaries or soft edges because the first color of a new group will be "carried" along as the algorithm progresses and eventually the difference between that color and the current compared color will exceed the "similarity" threashold and no longer be part of that group.</p> <p>Hopefully this is making sense. The problem is neither of these options are really working. On the image above what is returned are not clean groups but noisy fragmented groups that is not what I am looking for.</p> <p>I'm not looking for code specifically - but more ideas as to how an algorithm could be structured to successfully combat this problem. Does anyone have ideas about this?</p> <p>Thanks!</p>
0debug
Spark executors crash due to netty memory leak : <p>when running spark streaming app that consumes data from kafka topic with 100 partitions, and the streaming runs with 10 executors, 5 cores and 20GB RAM per executor, the executors crash with the following log:</p> <blockquote> <p>ERROR ResourceLeakDetector: LEAK: ByteBuf.release() was not called before it's garbage-collected. Enable advanced leak reporting to find out where the leak occurred.</p> <p>ERROR YarnClusterScheduler: Lost executor 18 on worker23.oct.com: Slave lost</p> <p>ERROR ApplicationMaster: RECEIVED SIGNAL TERM</p> </blockquote> <p>this exception appears in spark JIRA:</p> <p><a href="https://issues.apache.org/jira/browse/SPARK-17380" rel="noreferrer">https://issues.apache.org/jira/browse/SPARK-17380</a></p> <p>and someone wrote that after upgrading to spark 2.0.2 the problem was solved. however we use spark 2.1 as part of HDP 2.6. so I guess this bug wasn't solved in spark 2.1.</p> <p>there's also someone who encountered this bug and wrote about it in spark user list but got no answer:</p> <p><a href="http://apache-spark-user-list.1001560.n3.nabble.com/Spark-Streaming-Receiver-Resource-Leak-td27857.html" rel="noreferrer">http://apache-spark-user-list.1001560.n3.nabble.com/Spark-Streaming-Receiver-Resource-Leak-td27857.html</a></p> <p>BTW - the streaming app doesn't call <code>cache()</code> or <code>persist()</code>, so no caching is involved whatsoever.</p> <p>Did anyone encounter a streaming app that crashed on such bug?</p>
0debug
font size depending on number of words : <p>I have vertically aligned <em>div</em> with <em>fixed height</em> (800px). The problem is that my div is dynamic and <em>font size</em> depends on number of words, for example <a href="https://i.stack.imgur.com/RpgbT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RpgbT.png" alt=""></a></p> <p>how can I achieve that?</p> <p><a href="https://fiddle.jshell.net/elene/640kLut2/1/" rel="nofollow noreferrer">link</a></p>
0debug
static int qcow_read_extensions(BlockDriverState *bs, uint64_t start_offset, uint64_t end_offset) { BDRVQcowState *s = bs->opaque; QCowExtension ext; uint64_t offset; #ifdef DEBUG_EXT printf("qcow_read_extensions: start=%ld end=%ld\n", start_offset, end_offset); #endif offset = start_offset; while (offset < end_offset) { #ifdef DEBUG_EXT if (offset > s->cluster_size) printf("qcow_handle_extension: suspicious offset %lu\n", offset); printf("attemting to read extended header in offset %lu\n", offset); #endif if (bdrv_pread(s->hd, offset, &ext, sizeof(ext)) != sizeof(ext)) { fprintf(stderr, "qcow_handle_extension: ERROR: pread fail from offset %llu\n", (unsigned long long)offset); return 1; } be32_to_cpus(&ext.magic); be32_to_cpus(&ext.len); offset += sizeof(ext); #ifdef DEBUG_EXT printf("ext.magic = 0x%x\n", ext.magic); #endif switch (ext.magic) { case QCOW_EXT_MAGIC_END: return 0; case QCOW_EXT_MAGIC_BACKING_FORMAT: if (ext.len >= sizeof(bs->backing_format)) { fprintf(stderr, "ERROR: ext_backing_format: len=%u too large" " (>=%zu)\n", ext.len, sizeof(bs->backing_format)); return 2; } if (bdrv_pread(s->hd, offset , bs->backing_format, ext.len) != ext.len) return 3; bs->backing_format[ext.len] = '\0'; #ifdef DEBUG_EXT printf("Qcow2: Got format extension %s\n", bs->backing_format); #endif offset += ((ext.len + 7) & ~7); break; default: offset += ((ext.len + 7) & ~7); break; } } return 0; }
1threat
static void rocker_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); k->init = pci_rocker_init; k->exit = pci_rocker_uninit; k->vendor_id = PCI_VENDOR_ID_REDHAT; k->device_id = PCI_DEVICE_ID_REDHAT_ROCKER; k->revision = ROCKER_PCI_REVISION; k->class_id = PCI_CLASS_NETWORK_OTHER; set_bit(DEVICE_CATEGORY_NETWORK, dc->categories); dc->desc = "Rocker Switch"; dc->reset = rocker_reset; dc->props = rocker_properties; dc->vmsd = &rocker_vmsd; }
1threat
void qemu_thread_create(QemuThread *thread, void *(*start_routine)(void *), void *arg, int mode) { HANDLE hThread; assert(mode == QEMU_THREAD_DETACHED); struct QemuThreadData *data; qemu_thread_init(); data = g_malloc(sizeof *data); data->thread = thread; data->start_routine = start_routine; data->arg = arg; hThread = (HANDLE) _beginthreadex(NULL, 0, win32_start_routine, data, 0, NULL); if (!hThread) { error_exit(GetLastError(), __func__); } CloseHandle(hThread); }
1threat
static void gen_wait(DisasContext *ctx) { TCGv_i32 t0 = tcg_temp_new_i32(); tcg_gen_st_i32(t0, cpu_env, -offsetof(PowerPCCPU, env) + offsetof(CPUState, halted)); tcg_temp_free_i32(t0); gen_exception_err(ctx, EXCP_HLT, 1); }
1threat
static void gen_advance_ccount(DisasContext *dc) { gen_advance_ccount_cond(dc); dc->ccount_delta = 0; }
1threat
Git rebase, fix conflicts, then push is rejected : <p>When I <strong>rebase</strong>, and there are <strong>conflicts which I then resolve</strong>, I get the following message:</p> <blockquote> <p>hint: Updates were rejected because the tip of your current branch is behind</p> </blockquote> <hr> <p>We have 2 branches:</p> <ul> <li><code>master</code> is our base</li> <li><code>feature/fix-input-height</code> (new feature to merge into master)</li> </ul> <p>I am preparing <code>feature/fix-input-height</code> by rebasing master to locally resolve conflicts</p> <pre><code>git checkout master git pull origin master git checkout feature/fix-input-height git pull origin feature/fix-input-height git rebase master </code></pre> <hr> <ul> <li>Conflicts arise</li> <li>I resolve them</li> <li>Then attempt to push the new feature branch</li> </ul> <pre><code>git push origin feature/fix-input-height </code></pre> <p>And end up with that <strong>rejected error message</strong> again:</p> <blockquote> <p>hint: Updates were rejected because the tip of your current branch is behind</p> </blockquote> <hr> <p>Everyone on stackoverflow suggests:</p> <pre><code>git push origin -f feature/fix-input-height </code></pre> <p><strong>But forcing the push just feels wrong</strong></p>
0debug
FirebaseFirestoreException: FAILED_PRECONDITION : <p>To get the data from the firestore collection for instance update I tried the below query.</p> <p>docRef.whereArrayContains().orderBy().limit()</p> <p>com.google.firebase.firestore.FirebaseFirestoreException: FAILED_PRECONDITION: The query requires an index. You can create it here:</p>
0debug
av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v) { MpegEncContext *s = &v->s; int i; int mb_height = FFALIGN(s->mb_height, 2); v->mv_type_mb_plane = av_malloc (s->mb_stride * mb_height); v->direct_mb_plane = av_malloc (s->mb_stride * mb_height); v->forward_mb_plane = av_malloc (s->mb_stride * mb_height); v->fieldtx_plane = av_mallocz(s->mb_stride * mb_height); v->acpred_plane = av_malloc (s->mb_stride * mb_height); v->over_flags_plane = av_malloc (s->mb_stride * mb_height); v->n_allocated_blks = s->mb_width + 2; v->block = av_malloc(sizeof(*v->block) * v->n_allocated_blks); v->cbp_base = av_malloc(sizeof(v->cbp_base[0]) * 2 * s->mb_stride); v->cbp = v->cbp_base + s->mb_stride; v->ttblk_base = av_malloc(sizeof(v->ttblk_base[0]) * 2 * s->mb_stride); v->ttblk = v->ttblk_base + s->mb_stride; v->is_intra_base = av_mallocz(sizeof(v->is_intra_base[0]) * 2 * s->mb_stride); v->is_intra = v->is_intra_base + s->mb_stride; v->luma_mv_base = av_malloc(sizeof(v->luma_mv_base[0]) * 2 * s->mb_stride); v->luma_mv = v->luma_mv_base + s->mb_stride; v->mb_type_base = av_malloc(s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); v->mb_type[0] = v->mb_type_base + s->b8_stride + 1; v->mb_type[1] = v->mb_type_base + s->b8_stride * (mb_height * 2 + 1) + s->mb_stride + 1; v->mb_type[2] = v->mb_type[1] + s->mb_stride * (mb_height + 1); v->blk_mv_type_base = av_mallocz( s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); v->blk_mv_type = v->blk_mv_type_base + s->b8_stride + 1; v->mv_f_base = av_mallocz(2 * (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2)); v->mv_f[0] = v->mv_f_base + s->b8_stride + 1; v->mv_f[1] = v->mv_f[0] + (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); v->mv_f_next_base = av_mallocz(2 * (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2)); v->mv_f_next[0] = v->mv_f_next_base + s->b8_stride + 1; v->mv_f_next[1] = v->mv_f_next[0] + (s->b8_stride * (mb_height * 2 + 1) + s->mb_stride * (mb_height + 1) * 2); ff_intrax8_common_init(&v->x8,s); if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { for (i = 0; i < 4; i++) if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width))) return -1; } if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || !v->over_flags_plane || !v->block || !v->cbp_base || !v->ttblk_base || !v->is_intra_base || !v->luma_mv_base || !v->mb_type_base) { goto error; } return 0; error: ff_vc1_decode_end(s->avctx); return AVERROR(ENOMEM); }
1threat
Wrap long template literal line to multiline without creating a new line in the string : <p>In es6 template literals, how can one wrap a long template literal to multiline without creating a new line in the string?</p> <p>For example, if you do this:</p> <pre><code>const text = `a very long string that just continues and continues and continues` </code></pre> <p>Then it will create a new line symbol to the string, as interpreting it to have a new line. How can one wrap the long template literal to multiple lines without creating the newline?</p>
0debug
Convert XML to JSON with NodeJS : <p>I'm trying to convert the following xml to json, thereby I need to get a mapping to the TS-tc-dt</p> <p>Here is the xml </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;TestScenario&gt; &lt;TestSuite name="TS_EdgeHome"&gt; &lt;TestCaseName name="tc_Login"&gt;dt_EdgeCaseHome,dt_EdgeCaseRoute&lt;/TestCaseName&gt; &lt;TestCaseName name="tc_Logout"&gt;dt_EdgeCaseRoute&lt;/TestCaseName&gt; &lt;/TestSuite&gt; &lt;TestSuite name="TS_EdgePanel"&gt; &lt;TestCaseName name="tc_AddContract"&gt;dt_EdgeCaseHome,dt_EdgeCaseSpectrum&lt;/TestCaseName&gt; &lt;/TestSuite&gt; &lt;TestSuite name="TS_EdgeRoute"&gt; &lt;TestCaseName name="tc_VerifyContract"&gt;dt_EdgeCaseRoute&lt;/TestCaseName&gt; &lt;TestCaseName name="tc_Payment"&gt;dt_EdgeCaseRoute&lt;/TestCaseName&gt; &lt;/TestSuite&gt; &lt;TestSuite name="TS_EdgeSpectrum"&gt; &lt;TestCaseName name="tc_ClientFeedback"&gt;dt_EdgeCaseSpectrum&lt;/TestCaseName&gt; &lt;/TestSuite&gt; &lt;/TestScenario&gt; </code></pre> <p>How can I achieve this in NodeJS?</p>
0debug
i live my magento website but its show error : headers; headers already sent in /home/tantransh/public_html/test/app/Mage.php, line 766 Trace: #0 /home/tantransh/public_html/test/lib/Zend/Controller/Response/Abstract.php(115): Zend_Controller_Response_Abstract->canSendHeaders(true) #1 /home/tantransh/public_html/test/app/code/core/Mage/Core/Model/App.php(1246): Zend_Controller_Response_Abstract->setHeader('Content-Type', 'text/html; char...') #2 /home/tantransh/public_html/test/app/code/core/Mage/Core/Controller/Varien/Front.php(80): Mage_Core_Model_App->getResponse() #3 /home/tantransh/public_html/test/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(202): Mage_Core_Controller_Varien_Front->getResponse() #4 /home/tantransh/public_html/test/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http)) #5 /home/tantransh/public_html/test/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch() #6 /home/tantransh/public_html/test/app/Mage.php(683): Mage_Core_Model_App->run(Array) #7 /home/tantransh/public_html/test/index.php(87): Mage::run('', 'store') #8 {main}
0debug
Your requirements could not be resolved to an installable set of packages in laravel 5.2 quickadmin : [enter image description here][1] [1]: http://i.stack.imgur.com/JEj9f.jpg please solve my problem.,., asup
0debug
What is 'nul' in batch file? : I was curious to learn what is `nul`. It is usually used: - When we want to hide output of a command. In this case, we say that "we redirected `STDOUT` and `STDERR` outout to nul (if we cpecify `2>&1`)". - When we want to create a new file. Then we usually use `type nul > newfile.txt` or even `copy nul newfile.txt` as https://stackoverflow.com/q/210201 says. But **what** is `nul`? My research only shows its usage. I have also read [this](https://ss64.com/nt/syntax-redirection.html) great article from https://ss64.com which says: > Create empty files using the `NUL` **device**. So, `nul` is a device? If so, can someone explain it, please? Also, there is some confusion with `null`. What are their differences? *I suggest to make your posts/explanations community wikis.*
0debug
many global fct in cuda : can I write for example 2 global functions whose treat different operations, in the same source code !!! .... __global__ void Ker1(mpz_t *d,mpz_t *c,mpz_t e,mpz_t n ) { int i=blockIdx.x*blockDim.x + threadIdx.x; mpz_powm (gmp_cipher, gmp_actuel, e, n); } __global__ void Ker2(mpz_t *d,mpz_t *c,mpz_t d, mpz_t n) { int i=blockIdx.x*blockDim.x + threadIdx.x; mpz_powm(c[i], d[i],d, n); } int main(){ .... cudaMemcpy(decode_device,decode_buffer,memSize,cudaMemcpyHostToDevice); ker1<<<dimGrid , dimBlock >>>( d_device,c_device,e,n ); ker2<<<dimGrid , dimBlock>>>(c_device,d_device,d,n); cudaMemcpy(decode_buffer,decode_device,memSize,cudaMemcpyDeviceToHost); .... } if not, what is the equivalent of this implementation ? tks for help
0debug
How can i visit my nodejs website without typing :8080 or :8000? : I have an ubuntu 16.04 server with plesk installed with nodejs because it is written in angular2. At the moment I'm runing the page with `http-server .` on my ubuntu server. When i'm typing the ip address with ip:8000 or www.page.de:8080 I can visit my page. But when i just type the ip address or www.page.de I see only a white page. How can i change this? Thanks in advance^^
0debug
Convert an upper to lower triangle matrix in r : <p>I looked inot several posts, but I still couldn't find a way to just transform an upper triangle matrix into a lower triangle matrix.</p> <p>I just want this: </p> <pre><code> 1 2 3 a 10 11 12 b 13 14 c 15 </code></pre> <p>To become this:</p> <pre><code> a b c 1 10 2 11 13 3 12 14 15 </code></pre>
0debug
Rotate switched facet labels in ggplot2 facet_grid : <p>I would like to plot some barplots on top of each other using facet_grid:</p> <pre><code>library(ggplot2) df &lt;- group_by(mpg, manufacturer) %&gt;% summarise(cty = mean(cty), hwy = mean(hwy)) %&gt;% ungroup() df &lt;- melt(df, id.vars = "manufacturer") ggplot() + geom_bar(data =df, aes(x = variable, y = value), stat = "identity") + facet_grid(manufacturer ~ ., switch = "y") </code></pre> <p>I use the <code>switch</code>argument of <code>ggplot2::facet_grid()</code>to let the facet labels be displayed on the y-axis instead of on top of each facet. Problem is that the facet labels are plotted vertically and therefore cropped. Is there any way to plot the facet -labels horizontally? All the questions I found so far related to rotating the x-axis labels only, not the facet labels.</p>
0debug
Limitting session time : I need your help here. I have a Windows Server 2012 R2 on which a policy needs to be set. This policy should logoff a user if it is disconnected or idle for more than 2 hrs. One twist is, I have a user with name 'Invo' which should not get kicked out due to this policy. Any help is appreciated. Thank you !
0debug
What is logic to construct a binay Tree? : I have a while which continuously takes integers until -1 entered. And those elements must be inserted into binary tree (Not BST). If BST we have a conditon to where to insert node. But how can I construct binay tree? I mean if nodes are 1,2,3,4,5,6...... 1 is root, 2,3 are left and right childs of node 1. 4,5 are left and right childs of node 2. And 6 is left child of 3...like this I am basic learner. Help me in this.
0debug
static int commit_direntries(BDRVVVFATState* s, int dir_index, int parent_mapping_index) { direntry_t* direntry = array_get(&(s->directory), dir_index); uint32_t first_cluster = dir_index == 0 ? 0 : begin_of_direntry(direntry); mapping_t* mapping = find_mapping_for_cluster(s, first_cluster); int factor = 0x10 * s->sectors_per_cluster; int old_cluster_count, new_cluster_count; int current_dir_index = mapping->info.dir.first_dir_index; int first_dir_index = current_dir_index; int ret, i; uint32_t c; DLOG(fprintf(stderr, "commit_direntries for %s, parent_mapping_index %d\n", mapping->path, parent_mapping_index)); assert(direntry); assert(mapping); assert(mapping->begin == first_cluster); assert(mapping->info.dir.first_dir_index < s->directory.next); assert(mapping->mode & MODE_DIRECTORY); assert(dir_index == 0 || is_directory(direntry)); mapping->info.dir.parent_mapping_index = parent_mapping_index; if (first_cluster == 0) { old_cluster_count = new_cluster_count = s->last_cluster_of_root_directory; } else { for (old_cluster_count = 0, c = first_cluster; !fat_eof(s, c); c = fat_get(s, c)) old_cluster_count++; for (new_cluster_count = 0, c = first_cluster; !fat_eof(s, c); c = modified_fat_get(s, c)) new_cluster_count++; } if (new_cluster_count > old_cluster_count) { if (insert_direntries(s, current_dir_index + factor * old_cluster_count, factor * (new_cluster_count - old_cluster_count)) == NULL) return -1; } else if (new_cluster_count < old_cluster_count) remove_direntries(s, current_dir_index + factor * new_cluster_count, factor * (old_cluster_count - new_cluster_count)); for (c = first_cluster; !fat_eof(s, c); c = modified_fat_get(s, c)) { void* direntry = array_get(&(s->directory), current_dir_index); int ret = vvfat_read(s->bs, cluster2sector(s, c), direntry, s->sectors_per_cluster); if (ret) return ret; assert(!strncmp(s->directory.pointer, "QEMU", 4)); current_dir_index += factor; } ret = commit_mappings(s, first_cluster, dir_index); if (ret) return ret; for (i = 0; i < factor * new_cluster_count; i++) { direntry = array_get(&(s->directory), first_dir_index + i); if (is_directory(direntry) && !is_dot(direntry)) { mapping = find_mapping_for_cluster(s, first_cluster); assert(mapping->mode & MODE_DIRECTORY); ret = commit_direntries(s, first_dir_index + i, array_index(&(s->mapping), mapping)); if (ret) return ret; } } return 0; }
1threat
static int local_open(FsContext *ctx, V9fsPath *fs_path, int flags, V9fsFidOpenState *fs) { char buffer[PATH_MAX]; char *path = fs_path->data; fs->fd = open(rpath(ctx, path, buffer), flags | O_NOFOLLOW); return fs->fd; }
1threat
static int parse_numa(void *opaque, QemuOpts *opts, Error **errp) { NumaOptions *object = NULL; Error *err = NULL; { Visitor *v = opts_visitor_new(opts); visit_type_NumaOptions(v, NULL, &object, &err); visit_free(v); } if (err) { goto error; } switch (object->type) { case NUMA_OPTIONS_KIND_NODE: numa_node_parse(object->u.node.data, opts, &err); if (err) { goto error; } nb_numa_nodes++; break; default: abort(); } return 0; error: error_report_err(err); qapi_free_NumaOptions(object); return -1; }
1threat
How to group by unique user ID and sort by latest messages ID? : <p>my message table</p> <pre><code>message_id | message_body_content | sender_user_id | receiver_user_id 1 | hello world | 1000 | 1200 2 | hello world 2 | 1001 | 1200 3 | hello world again | 1000 | 1200 4 | xyz | 1001 | 1200 5 | abc | 1200 | 1999 </code></pre> <p>I want to group by my <code>message</code> table by <code>sender_user_id</code> unique and by last <code>message_id</code></p> <p>so output should be like;</p> <pre><code>message_id | message_body_content | sender_user_id | receiver_user_id 3 | hello world again | 1000 | 1200 4 | xyz | 1001 | 1200 </code></pre> <p>Because latest <code>message_id</code> for <code>sender_user_id</code> IS 3. This is in theory.</p> <p>When I try</p> <pre><code>SELECT * FROM message WHERE receiver_user_id = 1200 GROUP BY sender_user_id ORDER BY message_id DESC </code></pre> <p>It did not work. Because MySQL grouping first by <code>message_id</code> (min message_id value)</p> <p>then sorting.</p> <p>How can I get unique sender message by max <code>message_id</code></p>
0debug
How does setTimeout work? : <p>-so i am obviously trying to get two functions to run automatically whilst on a timer using setTimeout. However i am not to sure how it works. All i can see when i search it up is it in a function. so how do i have it outside a function?</p> <pre><code>function ChangeImage() { if(position &lt; TrafficL.length) { document.getElementById("myImage").src = TrafficL[position]; position++ } } function RestartPos() { if (position==3) document.getElementById("myImage").src = TrafficL["position"] position=0 var setTimeout = (ChangeImage(),1500) var setTimeout = (RestartPos(),6000) </code></pre>
0debug
How to tail a docker log from the current position in the log without seeing the whole file or waiting for it to traverse the whole file : <p>If you use the coreutils tail command in Linux you have a -f option that lets you follow a log file from the logs current position (it does not go to the very beginning of the file and display everything).</p> <p>Is this functionality available in docker logs without having to wait for it to traverse the whole log?</p> <p>Maybe I am trying the wrong arguments for the options? Using the available documentation I have tried </p> <pre><code>docker logs --since 1m somecontainer </code></pre> <p>and</p> <pre><code>docker logs -f --since 1m somecontainer </code></pre> <p>It appears that it actually traverses the entire log file (which can take a long time) and then starts echoing to screen once it reaches the the time frame you specify. </p> <p>Is there a way to just start tailing from the current point without waiting? Is my best option to always log out to some external file and just tail that with the coreutils tail command?</p>
0debug
C Delete Linked List By Reference? : <p>Brand new to C, tried other SO Answers that I found about this before posting, and saw that none of them were using a function and passing their list in by reference for deleting all item, but that is the way I want to implement it. Console is outputting </p> <blockquote> <p><strong>* Error in `./testing': double free or corruption (out): 0x00007ffc26622b30 *</strong> Aborted</p> </blockquote> <p>Awesome error message for a noob! That isn't cryptic at all. :)<br> P.S. All of my other functions are working as intended.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdbool.h&gt; typedef struct node { int n; struct node* next; } node; bool search(int number, node* list); void showItems(node* list); void insertItem(int number, node** list); void deleteItem(int number, node** list); void deleteList(node** list); int main(void) { node* list = NULL; insertItem(1337, &amp;list); insertItem(1337, &amp;list); bool found = search(5, list); if (found) { printf("found number in linked list."); } deleteList(&amp;list); showItems(list); } void showItems(node* list) { node* ptr = list; while (ptr) { printf("%i\n",ptr-&gt;n); ptr = ptr-&gt;next; } } bool search(int number, node* list) { node* ptr = list; while (ptr) { if (ptr-&gt;n == number) { return true; } ptr = ptr-&gt;next; } //Number not found. return false; } void insertItem(int number, node** list) { node* newItem = malloc(sizeof(node)); newItem-&gt;n = number; newItem-&gt;next = *list; *list = newItem; } void deleteItem(int number, node** list) { node* ptr = *list; node* prev = NULL; while (ptr) { if (ptr-&gt;n == number) { if (prev != NULL) { //Check if there is a previous node. If there is, set its next node to the current items next node. Then free the current node. prev-&gt;next = ptr-&gt;next; } free(ptr); break; } prev = ptr; ptr = ptr-&gt;next; } } void deleteList(node** list) { node* temp = NULL; while (list) { temp = *list; free(list); list = &amp;temp-&gt;next; } } </code></pre>
0debug
int ff_h264_decode_ref_pic_list_reordering(H264Context *h) { int list, index, pic_structure, i; print_short_term(h); print_long_term(h); for (list = 0; list < h->list_count; list++) { for (i = 0; i < h->ref_count[list]; i++) COPY_PICTURE(&h->ref_list[list][i], &h->default_ref_list[list][i]); if (get_bits1(&h->gb)) { int pred = h->curr_pic_num; for (index = 0; ; index++) { unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(&h->gb); unsigned int pic_id; int i; Picture *ref = NULL; if (reordering_of_pic_nums_idc == 3) break; if (index >= h->ref_count[list]) { av_log(h->avctx, AV_LOG_ERROR, "reference count overflow\n"); return -1; } if (reordering_of_pic_nums_idc < 3) { if (reordering_of_pic_nums_idc < 2) { const unsigned int abs_diff_pic_num = get_ue_golomb(&h->gb) + 1; int frame_num; if (abs_diff_pic_num > h->max_pic_num) { av_log(h->avctx, AV_LOG_ERROR, "abs_diff_pic_num overflow\n"); return -1; } if (reordering_of_pic_nums_idc == 0) pred -= abs_diff_pic_num; else pred += abs_diff_pic_num; pred &= h->max_pic_num - 1; frame_num = pic_num_extract(h, pred, &pic_structure); for (i = h->short_ref_count - 1; i >= 0; i--) { ref = h->short_ref[i]; assert(ref->reference); assert(!ref->long_ref); if (ref->frame_num == frame_num && (ref->reference & pic_structure)) break; } if (i >= 0) ref->pic_id = pred; } else { int long_idx; pic_id = get_ue_golomb(&h->gb); long_idx = pic_num_extract(h, pic_id, &pic_structure); if (long_idx > 31) { av_log(h->avctx, AV_LOG_ERROR, "long_term_pic_idx overflow\n"); return -1; } ref = h->long_ref[long_idx]; assert(!(ref && !ref->reference)); if (ref && (ref->reference & pic_structure)) { ref->pic_id = pic_id; assert(ref->long_ref); i = 0; } else { i = -1; } } if (i < 0) { av_log(h->avctx, AV_LOG_ERROR, "reference picture missing during reorder\n"); memset(&h->ref_list[list][index], 0, sizeof(Picture)); } else { for (i = index; i + 1 < h->ref_count[list]; i++) { if (ref->long_ref == h->ref_list[list][i].long_ref && ref->pic_id == h->ref_list[list][i].pic_id) break; } for (; i > index; i--) { COPY_PICTURE(&h->ref_list[list][i], &h->ref_list[list][i - 1]); } COPY_PICTURE(&h->ref_list[list][index], ref); if (FIELD_PICTURE(h)) { pic_as_field(&h->ref_list[list][index], pic_structure); } } } else { av_log(h->avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc\n"); return -1; } } } } for (list = 0; list < h->list_count; list++) { for (index = 0; index < h->ref_count[list]; index++) { if (!h->ref_list[list][index].f.data[0]) { av_log(h->avctx, AV_LOG_ERROR, "Missing reference picture\n"); if (h->default_ref_list[list][0].f.data[0]) COPY_PICTURE(&h->ref_list[list][index], &h->default_ref_list[list][0]); else return -1; } } } return 0; }
1threat
static void x86_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); X86CPU *cpu = X86_CPU(obj); X86CPUClass *xcc = X86_CPU_GET_CLASS(obj); CPUX86State *env = &cpu->env; FeatureWord w; cs->env_ptr = env; object_property_add(obj, "family", "int", x86_cpuid_version_get_family, x86_cpuid_version_set_family, NULL, NULL, NULL); object_property_add(obj, "model", "int", x86_cpuid_version_get_model, x86_cpuid_version_set_model, NULL, NULL, NULL); object_property_add(obj, "stepping", "int", x86_cpuid_version_get_stepping, x86_cpuid_version_set_stepping, NULL, NULL, NULL); object_property_add_str(obj, "vendor", x86_cpuid_get_vendor, x86_cpuid_set_vendor, NULL); object_property_add_str(obj, "model-id", x86_cpuid_get_model_id, x86_cpuid_set_model_id, NULL); object_property_add(obj, "tsc-frequency", "int", x86_cpuid_get_tsc_freq, x86_cpuid_set_tsc_freq, NULL, NULL, NULL); object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo", x86_cpu_get_feature_words, NULL, NULL, (void *)env->features, NULL); object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo", x86_cpu_get_feature_words, NULL, NULL, (void *)cpu->filtered_features, NULL); cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY; for (w = 0; w < FEATURE_WORDS; w++) { int bitnr; for (bitnr = 0; bitnr < 32; bitnr++) { x86_cpu_register_feature_bit_props(cpu, w, bitnr); } } object_property_add_alias(obj, "sse3", obj, "pni", &error_abort); object_property_add_alias(obj, "pclmuldq", obj, "pclmulqdq", &error_abort); object_property_add_alias(obj, "sse4-1", obj, "sse4.1", &error_abort); object_property_add_alias(obj, "sse4-2", obj, "sse4.2", &error_abort); object_property_add_alias(obj, "xd", obj, "nx", &error_abort); object_property_add_alias(obj, "ffxsr", obj, "fxsr-opt", &error_abort); object_property_add_alias(obj, "i64", obj, "lm", &error_abort); object_property_add_alias(obj, "ds_cpl", obj, "ds-cpl", &error_abort); object_property_add_alias(obj, "tsc_adjust", obj, "tsc-adjust", &error_abort); object_property_add_alias(obj, "fxsr_opt", obj, "fxsr-opt", &error_abort); object_property_add_alias(obj, "lahf_lm", obj, "lahf-lm", &error_abort); object_property_add_alias(obj, "cmp_legacy", obj, "cmp-legacy", &error_abort); object_property_add_alias(obj, "nodeid_msr", obj, "nodeid-msr", &error_abort); object_property_add_alias(obj, "perfctr_core", obj, "perfctr-core", &error_abort); object_property_add_alias(obj, "perfctr_nb", obj, "perfctr-nb", &error_abort); object_property_add_alias(obj, "kvm_nopiodelay", obj, "kvm-nopiodelay", &error_abort); object_property_add_alias(obj, "kvm_mmu", obj, "kvm-mmu", &error_abort); object_property_add_alias(obj, "kvm_asyncpf", obj, "kvm-asyncpf", &error_abort); object_property_add_alias(obj, "kvm_steal_time", obj, "kvm-steal-time", &error_abort); object_property_add_alias(obj, "kvm_pv_eoi", obj, "kvm-pv-eoi", &error_abort); object_property_add_alias(obj, "kvm_pv_unhalt", obj, "kvm-pv-unhalt", &error_abort); object_property_add_alias(obj, "svm_lock", obj, "svm-lock", &error_abort); object_property_add_alias(obj, "nrip_save", obj, "nrip-save", &error_abort); object_property_add_alias(obj, "tsc_scale", obj, "tsc-scale", &error_abort); object_property_add_alias(obj, "vmcb_clean", obj, "vmcb-clean", &error_abort); object_property_add_alias(obj, "pause_filter", obj, "pause-filter", &error_abort); object_property_add_alias(obj, "sse4_1", obj, "sse4.1", &error_abort); object_property_add_alias(obj, "sse4_2", obj, "sse4.2", &error_abort); x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort); }
1threat
static int wsvqa_read_header(AVFormatContext *s) { WsVqaDemuxContext *wsvqa = s->priv_data; AVIOContext *pb = s->pb; AVStream *st; unsigned char *header; unsigned char scratch[VQA_PREAMBLE_SIZE]; unsigned int chunk_tag; unsigned int chunk_size; int fps; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->start_time = 0; wsvqa->video_stream_index = st->index; st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = AV_CODEC_ID_WS_VQA; st->codec->codec_tag = 0; avio_seek(pb, 20, SEEK_SET); st->codec->extradata_size = VQA_HEADER_SIZE; st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); header = (unsigned char *)st->codec->extradata; if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) != VQA_HEADER_SIZE) { av_free(st->codec->extradata); return AVERROR(EIO); } st->codec->width = AV_RL16(&header[6]); st->codec->height = AV_RL16(&header[8]); fps = header[12]; st->nb_frames = st->duration = AV_RL16(&header[4]); if (fps < 1 || fps > 30) { av_log(s, AV_LOG_ERROR, "invalid fps: %d\n", fps); return AVERROR_INVALIDDATA; } avpriv_set_pts_info(st, 64, 1, fps); wsvqa->version = AV_RL16(&header[ 0]); wsvqa->sample_rate = AV_RL16(&header[24]); wsvqa->channels = header[26]; wsvqa->bps = header[27]; wsvqa->audio_stream_index = -1; s->ctx_flags |= AVFMTCTX_NOHEADER; do { if (avio_read(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) return AVERROR(EIO); chunk_tag = AV_RB32(&scratch[0]); chunk_size = AV_RB32(&scratch[4]); switch (chunk_tag) { case CINF_TAG: case CINH_TAG: case CIND_TAG: case PINF_TAG: case PINH_TAG: case PIND_TAG: case FINF_TAG: case CMDS_TAG: break; default: av_log (s, AV_LOG_ERROR, " note: unknown chunk seen (%c%c%c%c)\n", scratch[0], scratch[1], scratch[2], scratch[3]); break; } avio_skip(pb, chunk_size); } while (chunk_tag != FINF_TAG); return 0; }
1threat
static int write_elf_loads(DumpState *s) { hwaddr offset; MemoryMapping *memory_mapping; uint32_t phdr_index = 1; int ret; uint32_t max_index; if (s->have_section) { max_index = s->sh_info; } else { max_index = s->phdr_num; } QTAILQ_FOREACH(memory_mapping, &s->list.head, next) { offset = get_offset(memory_mapping->phys_addr, s); if (s->dump_info.d_class == ELFCLASS64) { ret = write_elf64_load(s, memory_mapping, phdr_index++, offset); } else { ret = write_elf32_load(s, memory_mapping, phdr_index++, offset); } if (ret < 0) { return -1; } if (phdr_index >= max_index) { break; } } return 0; }
1threat
Get input of switch control via headphone jack on iOS : <p>As a little holiday project I want to control an app via an accessibility switch which is connected via 3,5mm headphone jack to the iOS device.</p> <p>This is the switch and the plug:<a href="https://i.stack.imgur.com/63hTl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/63hTl.png" alt="enter image description here"></a></p> <p>My problem is that I don't have any clue what kind of signal is fired when I press the button - I assumed that it acts similar to a headphone's remote control.</p> <p>Is there a way to measure the input of this or does anybody know how to get the input of the button on iOS?</p>
0debug
RECORD / NUMBER A FORMULA IN A CELL, NOT TO BE DELETED GOOGLE SPREADSHEET - APPSCRIPT : I'm new to this apps script and I'm trying to create a function that leaves a formula nested / recorded inside a cell since the database is used by people who are not experts in the formulation and this would prevent them from deleting the fomulations The problem is that the formula I am trying to record in the cell contains quotes "" and when executing the script it marks me an error, when modifying the script and removing the quotes if it records the formula but with an error (because the quotes are missing) I hope you can help me as I see they are experts in the subject. The sequence that I have so far is this: function myFunction() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; var cell = sheet.getRange("H1"); cell.setFormula("=importrange("https://docs.google.com/spreadsheets/d/1boU9bEyqJkLbf895QavKEzeZ4sLle2qoqepeZeJVV8/edit#gid=0";"sucursal 0007!B4")"); } [the error that you send me I understand that it is because of the quotes that are inside the formula][1] when you remove the quotes if you save the formula on sheet 1 but with an error (because you do not have the quotes required by the formula) [enter image description here][2] [1]: https://i.stack.imgur.com/UGe3O.png [2]: https://i.stack.imgur.com/cN1a9.png the correct formula that I need is this: =importrange("https://docs.google.com/spreadsheets/d/1bpUJbEyqJkALbf995QavKEzeZ4sLle2qoqepeZaJVV8/edit#gid=0";"sucursal 0007!B4") I will thank infinitely for your support!
0debug
SCSIRequest *scsi_req_find(SCSIDevice *d, uint32_t tag) { SCSIRequest *req; QTAILQ_FOREACH(req, &d->requests, next) { if (req->tag == tag) { return req; } } return NULL; }
1threat
Creating a Behavior for a continuously measurable phenomenon : <p>I would like to create a <code>Behavior t a</code> from an <code>IO a</code>, with the intended semantics that the IO action would be run every time the behavior is <code>sample</code>d:</p> <pre><code>{- language FlexibleContexts #-} import Reflex.Dom import Control.Monad.Trans onDemand :: (MonadWidget t m, MonadIO (PullM t)) =&gt; IO a -&gt; m (Behavior t a) </code></pre> <p>I hoped I could do this by just executing the <code>measurement</code> in a <code>pull</code>:</p> <pre><code>onDemand measure = return $ pull (liftIO measure) </code></pre> <p>However, the resulting <code>Behavior</code> never changes after an initial <code>measure</code>ment.</p> <p>The workaround I could come up with was to create a dummy <code>Behavior</code> that changes "frequently enough" and then create a fake dependency on that:</p> <pre><code>import Data.Time.Clock as Time hold_ :: (MonadHold t m, Reflex t) =&gt; Event t a -&gt; m (Behavior t ()) hold_ = hold () . (() &lt;$) onDemand :: (MonadWidget t m, MonadIO (PullM t)) =&gt; IO a -&gt; m (Behavior t a) onDemand measure = do now &lt;- liftIO Time.getCurrentTime tick &lt;- hold_ =&lt;&lt; tickLossy (1/1200) now return $ pull $ do _ &lt;- sample tick liftIO measure </code></pre> <p>This then works as expected; but since <code>Behavior</code>s can only be sampled on demand anyway, this shouldn't be necessary. </p> <p>What is the correct way to create a <code>Behavior</code> for a continuous, observable-at-any-time phenomenon?</p>
0debug
static void video_decode_example(const char *outfilename, const char *filename) { AVCodec *codec; AVCodecContext *c= NULL; int frame, got_picture, len; FILE *f; AVFrame *picture; uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; char buf[1024]; AVPacket avpkt; av_init_packet(&avpkt); memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); printf("Decode video file %s\n", filename); codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO); if (!codec) { fprintf(stderr, "codec not found\n"); exit(1); } c = avcodec_alloc_context3(codec); picture= avcodec_alloc_frame(); if(codec->capabilities&CODEC_CAP_TRUNCATED) c->flags|= CODEC_FLAG_TRUNCATED; if (avcodec_open2(c, codec, NULL) < 0) { fprintf(stderr, "could not open codec\n"); exit(1); } f = fopen(filename, "rb"); if (!f) { fprintf(stderr, "could not open %s\n", filename); exit(1); } frame = 0; for(;;) { avpkt.size = fread(inbuf, 1, INBUF_SIZE, f); if (avpkt.size == 0) break; avpkt.data = inbuf; while (avpkt.size > 0) { len = avcodec_decode_video2(c, picture, &got_picture, &avpkt); if (len < 0) { fprintf(stderr, "Error while decoding frame %d\n", frame); exit(1); } if (got_picture) { printf("saving frame %3d\n", frame); fflush(stdout); snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } avpkt.size -= len; avpkt.data += len; } } avpkt.data = NULL; avpkt.size = 0; len = avcodec_decode_video2(c, picture, &got_picture, &avpkt); if (got_picture) { printf("saving last frame %3d\n", frame); fflush(stdout); snprintf(buf, sizeof(buf), outfilename, frame); pgm_save(picture->data[0], picture->linesize[0], c->width, c->height, buf); frame++; } fclose(f); avcodec_close(c); av_free(c); av_free(picture); printf("\n"); }
1threat
uri_resolve_relative (const char *uri, const char * base) { char *val = NULL; int ret; int ix; int pos = 0; int nbslash = 0; int len; URI *ref = NULL; URI *bas = NULL; char *bptr, *uptr, *vptr; int remove_path = 0; if ((uri == NULL) || (*uri == 0)) return NULL; ref = uri_new (); if (uri[0] != '.') { ret = uri_parse_into (ref, uri); if (ret != 0) goto done; } else ref->path = g_strdup(uri); if ((base == NULL) || (*base == 0)) { val = g_strdup (uri); goto done; } bas = uri_new (); if (base[0] != '.') { ret = uri_parse_into (bas, base); if (ret != 0) goto done; } else bas->path = g_strdup(base); if ((ref->scheme != NULL) && ((bas->scheme == NULL) || (strcmp (bas->scheme, ref->scheme)) || (strcmp (bas->server, ref->server)))) { val = g_strdup (uri); goto done; } if (!strcmp(bas->path, ref->path)) { val = g_strdup(""); goto done; } if (bas->path == NULL) { val = g_strdup(ref->path); goto done; } if (ref->path == NULL) { ref->path = (char *) "/"; remove_path = 1; } if (bas->path == NULL) { if (ref->path != NULL) { uptr = ref->path; if (*uptr == '/') uptr++; val = uri_string_escape(uptr, "/;&=+$,"); } goto done; } bptr = bas->path; if (ref->path == NULL) { for (ix = 0; bptr[ix] != 0; ix++) { if (bptr[ix] == '/') nbslash++; } uptr = NULL; len = 1; } else { if ((ref->path[pos] == '.') && (ref->path[pos+1] == '/')) pos += 2; if ((*bptr == '.') && (bptr[1] == '/')) bptr += 2; else if ((*bptr == '/') && (ref->path[pos] != '/')) bptr++; while ((bptr[pos] == ref->path[pos]) && (bptr[pos] != 0)) pos++; if (bptr[pos] == ref->path[pos]) { val = g_strdup(""); goto done; } ix = pos; if ((ref->path[ix] == '/') && (ix > 0)) ix--; else if ((ref->path[ix] == 0) && (ix > 1) && (ref->path[ix - 1] == '/')) ix -= 2; for (; ix > 0; ix--) { if (ref->path[ix] == '/') break; } if (ix == 0) { uptr = ref->path; } else { ix++; uptr = &ref->path[ix]; } if (bptr[pos] != ref->path[pos]) { for (; bptr[ix] != 0; ix++) { if (bptr[ix] == '/') nbslash++; } } len = strlen (uptr) + 1; } if (nbslash == 0) { if (uptr != NULL) val = uri_string_escape(uptr, "/;&=+$,"); goto done; } val = g_malloc (len + 3 * nbslash); vptr = val; for (; nbslash>0; nbslash--) { *vptr++ = '.'; *vptr++ = '.'; *vptr++ = '/'; } if (uptr != NULL) { if ((vptr > val) && (len > 0) && (uptr[0] == '/') && (vptr[-1] == '/')) { memcpy (vptr, uptr + 1, len - 1); vptr[len - 2] = 0; } else { memcpy (vptr, uptr, len); vptr[len - 1] = 0; } } else { vptr[len - 1] = 0; } vptr = val; val = uri_string_escape(vptr, "/;&=+$,"); g_free(vptr); done: if (remove_path != 0) ref->path = NULL; if (ref != NULL) uri_free (ref); if (bas != NULL) uri_free (bas); return val; }
1threat
Changing a Spring Joint's resting length in Unity3d : <p>According to Spring Joint's documentation, a spring's resting length (the length at which the spring won't try to pull or push together the two bodies it connects) is the distance that was calculated between the two bodies as the joint was created.</p> <p>However, I'd like to be able to change this resting distance at runtime, and the documentation doesn't mention anything about how the length can be changed.</p> <p>Is there anyway to accomplish this with Spring Joint? If not, how to create a spring with a set resting length (which can be changed in a script) with <strong>Configurable Joint</strong>?</p>
0debug
chrome not running an EventListener : I'm having an issue with chrome, I have tried to create a button that adds a new input tag when the button is pressed. Now the below code works totally fine on internet explorer however in chrome nothing happens at all. I also get no errors on the console the function just doesn't seem to run. I've tried replacing it with just the ` $("#addto").append(input1);` with `alert("hello world");` just to see if the code ran at all and it doesn't. Html <div class="modal-footer"> <button id="addinput" type="button" class="btn btn-default">add</button> </div> Javascript window.onload = function () { var buttonElement = document.getElementById("addinput"); if (buttonElement) { buttonElement.addEventListener('click', addinput); } function addinput() { var input1 = '<div class="input-group mb-3"><div class="input-group-prepend"><span class="input-group-text" id="basic-addon1">Name</span></div><input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1"></div>'; $("#addto").append(input1); } }
0debug
static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, uint8_t *dst, long width, long height, long srcStride1, long srcStride2, long srcStride3, long dstStride) { long y,x,w,h; w=width/2; h=height; for(y=0;y<h;y++){ const uint8_t* yp=src1+srcStride1*y; const uint8_t* up=src2+srcStride2*(y>>2); const uint8_t* vp=src3+srcStride3*(y>>2); uint8_t* d=dst+dstStride*y; x=0; #ifdef HAVE_MMX for(;x<w-7;x+=8) { asm volatile( PREFETCH" 32(%1, %0)\n\t" PREFETCH" 32(%2, %0)\n\t" PREFETCH" 32(%3, %0)\n\t" "movq (%1, %0, 4), %%mm0\n\t" "movq (%2, %0), %%mm1\n\t" "movq (%3, %0), %%mm2\n\t" "movq %%mm0, %%mm3\n\t" "movq %%mm1, %%mm4\n\t" "movq %%mm2, %%mm5\n\t" "punpcklbw %%mm1, %%mm1\n\t" "punpcklbw %%mm2, %%mm2\n\t" "punpckhbw %%mm4, %%mm4\n\t" "punpckhbw %%mm5, %%mm5\n\t" "movq %%mm1, %%mm6\n\t" "punpcklbw %%mm2, %%mm1\n\t" "punpcklbw %%mm1, %%mm0\n\t" "punpckhbw %%mm1, %%mm3\n\t" MOVNTQ" %%mm0, (%4, %0, 8)\n\t" MOVNTQ" %%mm3, 8(%4, %0, 8)\n\t" "punpckhbw %%mm2, %%mm6\n\t" "movq 8(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm6, %%mm0\n\t" "punpckhbw %%mm6, %%mm3\n\t" MOVNTQ" %%mm0, 16(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 24(%4, %0, 8)\n\t" "movq %%mm4, %%mm6\n\t" "movq 16(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm5, %%mm4\n\t" "punpcklbw %%mm4, %%mm0\n\t" "punpckhbw %%mm4, %%mm3\n\t" MOVNTQ" %%mm0, 32(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 40(%4, %0, 8)\n\t" "punpckhbw %%mm5, %%mm6\n\t" "movq 24(%1, %0, 4), %%mm0\n\t" "movq %%mm0, %%mm3\n\t" "punpcklbw %%mm6, %%mm0\n\t" "punpckhbw %%mm6, %%mm3\n\t" MOVNTQ" %%mm0, 48(%4, %0, 8)\n\t" MOVNTQ" %%mm3, 56(%4, %0, 8)\n\t" : "+r" (x) : "r"(yp), "r" (up), "r"(vp), "r"(d) :"memory"); } #endif for(; x<w; x++) { const long x2= x<<2; d[8*x+0]=yp[x2]; d[8*x+1]=up[x]; d[8*x+2]=yp[x2+1]; d[8*x+3]=vp[x]; d[8*x+4]=yp[x2+2]; d[8*x+5]=up[x]; d[8*x+6]=yp[x2+3]; d[8*x+7]=vp[x]; } } #ifdef HAVE_MMX asm( EMMS" \n\t" SFENCE" \n\t" ::: "memory" ); #endif }
1threat
Pandas recalculate index after a concatenation : <p>I have a problem where I produce a pandas dataframe by concatenating along the row axis (stacking vertically). </p> <p>Each of the constituent dataframes has an autogenerated index (ascending numbers). </p> <p>After concatenation, my index is screwed up: it counts up to n (where n is the shape[0] of the corresponding dataframe), and restarts at zero at the next dataframe. </p> <p>I am trying to "re-calculate the index, given the current order", or "re-index" (or so I thought). Turns out that isn't exactly what <code>DataFrame.reindex</code> seems to be doing. </p> <hr> <p>Here is what I tried to do:</p> <pre><code>train_df = pd.concat(train_class_df_list) train_df = train_df.reindex(index=[i for i in range(train_df.shape[0])]) </code></pre> <p>It failed with "cannot reindex from a duplicate axis." I don't want to change the order of my data... just need to delete the old index and set up a new one, with the order of rows preserved. </p>
0debug
how to select class name from button of span in below code as follows : how to select class name from button of span in below code as follows ``` <span class="input-group-btn-vertical"> <button class="btn btn-white bootstrap-touchspin-up " type="button">+</button> <button class="btn btn-white bootstrap-touchspin-down " type="button">-</button></span> ```
0debug
c++ public vs private inheritancce : <p>I don't understand and i really don't get public vs private inheritance in classes. Suppose we have the following code:</p> <pre><code>class A { int A_a; protected: int A_b; public: int A_c; }; class B : public A { int B_a; protected: int B_b; public: int B_c; }; class C : private A { int C_a; protected: int C_b; public: int C_c; }; </code></pre> <p>I know it has to be with access rights over vars and funcs, but doing all the tests i really can grasp it and i don't know when to apply public or private inheritance;</p>
0debug
void qemu_input_event_send_key(QemuConsole *src, KeyValue *key, bool down) { InputEvent *evt; evt = qemu_input_event_new_key(key, down); if (QTAILQ_EMPTY(&kbd_queue)) { qemu_input_event_send(src, evt); qemu_input_event_sync(); qapi_free_InputEvent(evt); } else { qemu_input_queue_event(&kbd_queue, src, evt); qemu_input_queue_sync(&kbd_queue); } }
1threat
How to write Sqlite database in Fragment Android : while i am creating a database on android sqlite database with fragment if i i write inside the onViewCreated method couldn't write the database name and Listview findviewbyid get error i don't know.what i tried so i wrote below. cannot resolve the method openOrCreateDatabase SQLiteDatabase db = openOrCreateDatabase("course", Context.MODE_PRIVATE, null); lst1 = findViewById(R.id.lst1); cannot resolve the method findViewById cannot resolve the constructor ArrayAdapter **arrayAdapter = new ArrayAdapter(this, `R.layout.support_simple_spinner_dropdown_item, titles);**` lst1 = findViewById(R.id.lst1); ListView lst1; ArrayList<String> titles = new ArrayList<String>(); ArrayAdapter arrayAdapter; @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); SQLiteDatabase db = openOrCreateDatabase("course", Context.MODE_PRIVATE, null); lst1 = findViewById(R.id.lst1); final Cursor c = db.rawQuery("select * from category", null); int id = c.getColumnIndex("id"); int title = c.getColumnIndex("title"); int description = c.getColumnIndex("description"); titles.clear(); arrayAdapter = new ArrayAdapter(this, R.layout.support_simple_spinner_dropdown_item, titles); lst1.setAdapter(arrayAdapter); final ArrayList<cate> cat = new ArrayList<cate>(); if (c.moveToFirst()) { do { cate stu = new cate(); stu.id = c.getString(id); stu.course = c.getString(title); stu.description = c.getString(description); cat.add(stu); titles.add(c.getString(id) + " \t " + c.getString(title) ); } while (c.moveToNext()); arrayAdapter.notifyDataSetChanged(); lst1.invalidateViews(); } lst1.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String aa = titles.get(position).toString(); cate stu = cat.get(position); Intent i = new Intent(getApplicationContext(), editcategory.class); i.putExtra("id", stu.id); i.putExtra("category", stu.course); i.putExtra("description", stu.description); startActivity(i); } }); }
0debug
static void bench_undrained_flush_cb(void *opaque, int ret) { if (ret < 0) { error_report("Failed flush request: %s\n", strerror(-ret)); exit(EXIT_FAILURE); } }
1threat
Need resultset on following resulset in sql : I have result set as follows, **Employer_id Type Amount** 1 penalty 100 1 interest 120 2 penalty 50 2 interest 60 2 contribution 70 1 contribution 140 I need result as, **Employer_id penalty interest contribution** 1 100 120 140 2 50 60 70 Is it possible in sql? can anyone provide query if possible.
0debug
Count words with the letter 'w' in them but only the(almost done) : <p>So the goal is to count the number of words in the sentence with the letter 'w', and I have written the code to count the number of w's but I can't get it to count the words in total. </p> <pre><code>items = ["whirring", "wow!", "calendar", "wry", "glass", "", "llama","tumultuous","owing"] items = str(items) acc_num = 0 for i in items: if i in ['w']: acc_num += 1 print(items) </code></pre>
0debug
Java compare array to variable : Brand new to Java, I am in the process of writing a program that has an array initialized, as well as a variable that is holding a single integer. What I am trying to do is have my program check the array and then check the variable and if the variable integer is within my array sopln my array and print it without the number that is in the variable. Here is a rough little example of what I currently have written up. Therefore I want the array to be printed without the 17. Stuck on what to do after what I have written. public class Harrison7b { public static void main(String [] args) { int[]arrayA = {2,4,8,19,32,17,17,18,25,17}; for(int B = 17; B < arrayA.length - 1; B++) { } } }
0debug
2 declaration of $_POST not working : <p>I need to use 2 $_POST. Here's the code but it's not working.</p> <pre><code>if($_POST['grade'] == 'G1') &amp;&amp; ($_POST['district'] == 'D1') </code></pre> <p>Thanks in advance!</p>
0debug
Foreach as in array without looping php : i have code : <?php foreach($this->params as $key=>$val) { $this->rawRequest .= "&$key=$val"; } ?> how to $this->params as $key=>$val without looping?
0debug
static void sun4m_common_init(int ram_size, int boot_device, DisplayState *ds, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model, unsigned int machine, int max_ram) { if ((unsigned int)ram_size > (unsigned int)max_ram) { fprintf(stderr, "qemu: Too much memory for this machine: %d, maximum %d\n", (unsigned int)ram_size / (1024 * 1024), (unsigned int)max_ram / (1024 * 1024)); exit(1); } sun4m_hw_init(&hwdefs[machine], ram_size, ds, cpu_model); sun4m_load_kernel(hwdefs[machine].vram_size, ram_size, boot_device, kernel_filename, kernel_cmdline, initrd_filename, hwdefs[machine].machine_id); }
1threat
static void close_guest_eventfds(IVShmemState *s, int posn) { int i, guest_curr_max; if (!ivshmem_has_feature(s, IVSHMEM_IOEVENTFD)) { guest_curr_max = s->peers[posn].nb_eventfds; memory_region_transaction_begin(); for (i = 0; i < guest_curr_max; i++) { ivshmem_del_eventfd(s, posn, i); memory_region_transaction_commit(); for (i = 0; i < guest_curr_max; i++) { event_notifier_cleanup(&s->peers[posn].eventfds[i]); g_free(s->peers[posn].eventfds); s->peers[posn].nb_eventfds = 0;
1threat
int block_job_set_speed(BlockJob *job, int64_t value) { int rc; if (!job->job_type->set_speed) { return -ENOTSUP; } rc = job->job_type->set_speed(job, value); if (rc == 0) { job->speed = value; } return rc; }
1threat
which web services use develop the Real time application in Organization? : I know implements of web services into different ways but few are Open source & few are non-open source. Which side develop the web service Consumer side OR Provider side?
0debug
static void *rcu_read_perf_test(void *arg) { int i; long long n_reads_local = 0; rcu_register_thread(); *(struct rcu_reader_data **)arg = &rcu_reader; atomic_inc(&nthreadsrunning); while (goflag == GOFLAG_INIT) { g_usleep(1000); } while (goflag == GOFLAG_RUN) { for (i = 0; i < RCU_READ_RUN; i++) { rcu_read_lock(); rcu_read_unlock(); } n_reads_local += RCU_READ_RUN; } atomic_add(&n_reads, n_reads_local); rcu_unregister_thread(); return NULL; }
1threat
ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size) { FdMigrationState *s = opaque; ssize_t ret; do { ret = s->write(s, data, size); } while (ret == -1 && ((s->get_error(s)) == EINTR)); if (ret == -1) ret = -(s->get_error(s)); if (ret == -EAGAIN) { qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s); } else if (ret < 0) { s->state = MIG_STATE_ERROR; notifier_list_notify(&migration_state_notifiers, NULL); } return ret; }
1threat
static void qxl_spice_destroy_surface_wait(PCIQXLDevice *qxl, uint32_t id, qxl_async_io async) { if (async) { #if SPICE_INTERFACE_QXL_MINOR < 1 abort(); #else spice_qxl_destroy_surface_async(&qxl->ssd.qxl, id, (uint64_t)id); #endif } else { qxl->ssd.worker->destroy_surface_wait(qxl->ssd.worker, id); qxl_spice_destroy_surface_wait_complete(qxl, id); } }
1threat
ScrollView minHeight to take up all the space : <p>I have a <code>ScrollView</code> which content doesn't necessarily exceeds it's size. Let's say it's a form where, upon errors, it expands to add error messages and then it exceeds the <code>ScrollView</code> size and thus is why I'm using that scroll.</p> <p>The thing is that I want the content to always be at least of the same size of the ScrollView. I'm aware of the <code>minHeight</code> property, but the only way I found to use it is re-rendering, which I'd like to avoid.</p> <p>I'm using redux for state management and this is what I have</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ScrollView contentContainerStyle={[ownStyles.container, {minHeight: this.props.scrollHeight}]} style={this.props.style} showsVerticalScrollIndicator={false} onLayout={(event) =&gt; { scrollHeight = event.nativeEvent.layout.height; this.props.setScrollContentHeight(scrollHeight); }} &gt;</code></pre> </div> </div> </p> <p>Where the <code>this.props.setScrollContentHeight</code> triggers an action which enters the height on the state, and <code>this.props.scrollHeight</code> is said height. So that after the first render where the onLayout function is triggered, the state is updated with the ScrollView's <code>height</code>, which I then assign as <code>minHeight</code> to its content.</p> <p>If I set the content's style to <code>flex: 1</code> then the ScrollView won't scroll.</p> <p>Can you think of a way to avoid that second render for performance purposes?</p> <p>Thank you!</p>
0debug
How to add "refs" dynamically with react hooks? : <p>So I have an array of data in and I am generating a list of components with that data. I'd like to have a ref on each generated element to calculate the height. I know how to do it with a Class component, but I would like to do it with React Hooks.</p> <p>Here is an example explaining what I want to do:</p> <pre><code>import React, {useState, useCallback} from 'react' const data = [ { text: 'test1' }, { text: 'test2' } ] const Component = () =&gt; { const [height, setHeight] = useState(0); const measuredRef = useCallback(node =&gt; { if (node !== null) { setHeight(node.getBoundingClientRect().height); } }, []); return ( &lt;div&gt; { data.map((item, index) =&gt; &lt;div ref={measuredRef} key={index}&gt; {item.text} &lt;/div&gt; ) } &lt;/div&gt; ) } </code></pre>
0debug
Styling a php variable in css using the <p> tags : <p>I am having lots of trouble trying to style a php variable within a css file. I am coding a simple exercise type website, but am stumped on what to do. I have made a log in system and I want the user's username to appear in the corner every time they log in. Here is my code</p> <pre><code>&lt;!--header.php--&gt; &lt;header&gt; &lt;nav&gt; &lt;div class="mainWrapper"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="index.php"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="forum.php"&gt;Forums&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class="navLogin"&gt; &lt;?php if (isset($_SESSION['u_id'])) { echo '&lt;p class="navUsername"&gt;'.$_SESSION['u_uid'].'&lt;/p&gt;&lt;form action="Includes/logout.inc.php" method="POST"&gt; &lt;button type="submit" name="submit"&gt;Logout&lt;/button&gt; &lt;/form&gt;'; } else { echo '&lt;form method="POST" action="Includes/login.inc.php"&gt; &lt;input type="text" name="uid" placeholder="Username/Email"&gt; &lt;input type="password" name="pwd" placeholder="Password"&gt; &lt;button type="submit" name="submit"&gt;Sign In&lt;/button&gt; &lt;/form&gt;&lt;a href="Includes/signup.inc.php"&gt;Sign Up&lt;/a&gt;'; }; ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;/nav&gt; &lt;/header&gt; </code></pre> <p>and now the css:</p> <pre><code>.navUsername { font-size: 100px;} </code></pre> <p>I have researched online and they say to put the css within a php file, but in their examples they are using the variable as a parameter rather than styling the variable itself. </p>
0debug
static int qcow2_create(const char *filename, QemuOpts *opts, Error **errp) { char *backing_file = NULL; char *backing_fmt = NULL; char *buf = NULL; uint64_t size = 0; int flags = 0; size_t cluster_size = DEFAULT_CLUSTER_SIZE; PreallocMode prealloc; int version = 3; uint64_t refcount_bits = 16; int refcount_order; Error *local_err = NULL; int ret; size = ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0), BDRV_SECTOR_SIZE); backing_file = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE); backing_fmt = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FMT); if (qemu_opt_get_bool_del(opts, BLOCK_OPT_ENCRYPT, false)) { flags |= BLOCK_FLAG_ENCRYPT; } cluster_size = qemu_opt_get_size_del(opts, BLOCK_OPT_CLUSTER_SIZE, DEFAULT_CLUSTER_SIZE); buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC); prealloc = qapi_enum_parse(PreallocMode_lookup, buf, PREALLOC_MODE__MAX, PREALLOC_MODE_OFF, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto finish; } g_free(buf); buf = qemu_opt_get_del(opts, BLOCK_OPT_COMPAT_LEVEL); if (!buf) { } else if (!strcmp(buf, "0.10")) { version = 2; } else if (!strcmp(buf, "1.1")) { version = 3; } else { error_setg(errp, "Invalid compatibility level: '%s'", buf); ret = -EINVAL; goto finish; } if (qemu_opt_get_bool_del(opts, BLOCK_OPT_LAZY_REFCOUNTS, false)) { flags |= BLOCK_FLAG_LAZY_REFCOUNTS; } if (backing_file && prealloc != PREALLOC_MODE_OFF) { error_setg(errp, "Backing file and preallocation cannot be used at " "the same time"); ret = -EINVAL; goto finish; } if (version < 3 && (flags & BLOCK_FLAG_LAZY_REFCOUNTS)) { error_setg(errp, "Lazy refcounts only supported with compatibility " "level 1.1 and above (use compat=1.1 or greater)"); ret = -EINVAL; goto finish; } refcount_bits = qemu_opt_get_number_del(opts, BLOCK_OPT_REFCOUNT_BITS, refcount_bits); if (refcount_bits > 64 || !is_power_of_2(refcount_bits)) { error_setg(errp, "Refcount width must be a power of two and may not " "exceed 64 bits"); ret = -EINVAL; goto finish; } if (version < 3 && refcount_bits != 16) { error_setg(errp, "Different refcount widths than 16 bits require " "compatibility level 1.1 or above (use compat=1.1 or " "greater)"); ret = -EINVAL; goto finish; } refcount_order = ctz32(refcount_bits); ret = qcow2_create2(filename, size, backing_file, backing_fmt, flags, cluster_size, prealloc, opts, version, refcount_order, &local_err); if (local_err) { error_propagate(errp, local_err); } finish: g_free(backing_file); g_free(backing_fmt); g_free(buf); return ret; }
1threat
how to get specific string from multiple memo : i want to check specific string from multiple memo and if all of them check out then run a procedure but in my code sometimes the procedure runs and sometimes it doesn't and sometimes it runs only when a few have checked out here is my code `procedure TForm1.Timer14Timer(Sender: TObject); begin if (pos('ActiveTunnel',memo10.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo10.text)<>0) and (pos('ActiveTunnel',memo9.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo9.text)<>0) and (pos('ActiveTunnel',memo8.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo8.text)<>0) and (pos('ActiveTunnel',memo7.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo7.text)<>0) and (pos('ActiveTunnel',memo6.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo6.text)<>0) and (pos('ActiveTunnel',memo5.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo5.text)<>0) and (pos('ActiveTunnel',memo4.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo4.text)<>0) and (pos('ActiveTunnel',memo3.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo3.text)<>0) and (pos('ActiveTunnel',memo2.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo2.text)<>0) and (pos('ActiveTunnel',memo1.Text)<>0) or (pos('https://ipfounder.net/? sponsor',memo1.text)<>0) then begin if Checkbox1.Checked = true then begin starttun; sleep(3000); routesaddlast; end; end; end;`
0debug
static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num) { gen_update_cc_op(s); set_cc_op(s, CC_OP_DYNAMIC); if (s->jmp_opt) { gen_goto_tb(s, tb_num, eip); s->is_jmp = DISAS_TB_JUMP; } else { gen_jmp_im(eip); gen_eob(s); } }
1threat
Laravel text going out of paragraph : <p>I wanna ask why my text goes out of paragraph? How can I fix it?</p> <p><a href="https://i.stack.imgur.com/r0pAm.png" rel="nofollow noreferrer">1 Photo</a></p> <p><a href="https://i.stack.imgur.com/PBaTV.png" rel="nofollow noreferrer">2 Photo</a></p> <p><a href="https://i.stack.imgur.com/3AiQ6.png" rel="nofollow noreferrer">3 Photo</a></p>
0debug
regex pattrn for date time validation : i m using this regex pattern for date time validation.. $regexp = "/^([0][1-9]|[12][0-9]|3[0-1])\/([0][1-9]|1[0-2])\/(\d{4}) ([0-9]|1[0-2])\:([0-5][0-9]) (am|pm)$/"; can anybody help where is the problem.
0debug
Visual Studio expected ';' after a function : <p>So, I'm trying to learn some basic C++, and I can't even get a function to work.</p> <pre><code>bool isInteger(std::string input) { try { std::stoi(input); return true } catch (...) { return false } } </code></pre> <p>Upon the first curly bracket, it says ';' expected. I don't see anything wrong with the function.</p> <p>Help?</p>
0debug
Link between specified EBS volume name and actual device name in Linux system : <p>I have EC2 instance with EBS volume attached, so that describe-instances command prints: </p> <pre><code> "DeviceName": "/dev/sdf", "Ebs": { "Status": "attached", "DeleteOnTermination": false, "VolumeId": "vol-04bfa2fab8e57a3dc", "AttachTime": "2016-09-26T09:39:08.000Z" } </code></pre> <p>As per documentation:</p> <blockquote> <p>Depending on the block device driver of the kernel, the device might be attached with a different name than what you specify</p> </blockquote> <p>In my case actual name of this volume is <code>/dev/xvdf</code>. </p> <p>Is it possible from within an instance to know which name was specified for a volume in Amazon console? </p> <p>Or vice versa - to know which actual name will be used by linux for a volume outside an instance? </p>
0debug
Run Jest tests only for current folder : <p>I have Jest installed on my machine and typing <code>jest</code> from terminal results in tests from parent folers also getting executed. I want to run tests only from the current folder. </p> <p>For e.g. if I go to <code>c:/dev/app</code> in terminal and type <code>some-jest-command</code>, it should only run files with <code>.test.js</code> present in the <code>app</code> folder. Currently, running <code>jest</code> command from <code>app</code> folder runs tests in parent folders too, which is not my desired behaviour.</p>
0debug
How can we add 3% of amount to each account : <p>I would like to add 3% of total amount to each account</p> <p>Is there any mysql query that would calculate 3% of amount for each account and add the amount to that account </p> <p>Can I use a dynamic variable ?</p> <p>Any suggestions!</p>
0debug
I want to increase my cpu speed in laptop : <p>I want to download and install visual studio2017 and I saw it’s requirement tools and hardware. It needs 1.8ghz- processor , but my laptop cpu is 1.7 How can I increase my cpu speed and doesn’t visual work If I don’t chang it to 1.8ghz?</p>
0debug
Detecting Operation Sign in a String Java : <p>Currently I have a string where it signifies an expression (i.e., "2+4*8/2") and is there a way to convert this to a regular expression that is NOT a string so it can return 18?</p> <p>If not, is there a way to detect what kind of operator it is at a given character?</p> <p>In Java would help.</p> <p>Thank you.</p>
0debug