problem
stringlengths
26
131k
labels
class label
2 classes
static void setup_rt_frame_v1(int usig, struct target_sigaction *ka, target_siginfo_t *info, target_sigset_t *set, CPUARMState *env) { struct rt_sigframe_v1 *frame; abi_ulong frame_addr = get_sigframe(ka, env, sizeof(*frame)); struct target_sigaltstack stack; int i; abi_ulong info_addr, uc_addr; if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) return ; info_addr = frame_addr + offsetof(struct rt_sigframe_v1, info); __put_user(info_addr, &frame->pinfo); uc_addr = frame_addr + offsetof(struct rt_sigframe_v1, uc); __put_user(uc_addr, &frame->puc); copy_siginfo_to_user(&frame->info, info); memset(&frame->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext)); memset(&stack, 0, sizeof(stack)); __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp); __put_user(target_sigaltstack_used.ss_size, &stack.ss_size); __put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags); memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack)); setup_sigcontext(&frame->uc.tuc_mcontext, env, set->sig[0]); for(i = 0; i < TARGET_NSIG_WORDS; i++) { if (__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i])) goto end; } setup_return(env, ka, &frame->retcode, frame_addr, usig, frame_addr + offsetof(struct rt_sigframe_v1, retcode)); env->regs[1] = info_addr; env->regs[2] = uc_addr; end: unlock_user_struct(frame, frame_addr, 1); }
1threat
Code returning adress : I'm currently learning C at home (already know java from university). I'm just trying to run some basic functions but It seems I'm getting the adrees instead of the value.. #include <stdio.h> int getDepartureDate (int day, int month, int year); int getReturningDate (int retDay, int retMonth, int retYear); int getNoOfCountries (int countries); int getNoOfTravellers (int noOfTravellers); int main() { int day; int month; int year; int retDay; int retYear; int retMonth; int countries; int travellers; printf("Please enter the departure date"); scanf("%d %d %d",&day,&month,&year); printf("Please enter the returning date:"); scanf("%d %d %d",&retDay,&retMonth,&retYear); printf("Please enter the number of countries:"); scanf("%d",&countries); printf("Please enter the number of travellers:"); scanf("%d",&travellers); printf("Your information is: \n"); printf("Your departure date is: %d \n",&getDepartureDate); printf("Your returning date is: %d \n",&getReturningDate); printf("Your number of countries are: %d \n",&getNoOfCountries); printf("Your number of travellers is: %d \n",&getNoOfTravellers); return 0; } int getDepartureDate (int day, int month, int year) { return ("%d %d %d",&day,&month,&year); } int getReturningDate (int retDay, int retMonth, int retYear) { return ("%d %d %d",&retDay,&retMonth,&retYear); } int getNoOfCountries (int noOfCountries) { return ("%d",&noOfCountries); } int getNoOfTravellers (int noOfTravellers) { return ("%d",&noOfTravellers); } So when I run the programm it returns: Your departure date is: 45687, something like that for all the methods.. Maybe it's not possible to use getters this way in C? Thank you!
0debug
In "h2, h3 a {}", who is a's parent element? : <p>In the following CSS code:</p> <pre><code>h2, h3 a { color: black; } </code></pre> <p>Is a's parent element h3, h2, or both?</p>
0debug
static int get_packet_payload_size(AVFormatContext *ctx, int stream_index, int64_t pts, int64_t dts) { MpegMuxContext *s = ctx->priv_data; int buf_index; StreamInfo *stream; stream = ctx->streams[stream_index]->priv_data; buf_index = 0; if (((s->packet_number % s->pack_header_freq) == 0)) { if (s->is_mpeg2) buf_index += 14; else buf_index += 12; if (s->is_vcd) { if (stream->packet_number==0) buf_index += 15; } else { if ((s->packet_number % s->system_header_freq) == 0) buf_index += s->system_header_size; } } if (s->is_vcd && stream->packet_number==0) buf_index += s->packet_size - buf_index; else { buf_index += 6; if (s->is_mpeg2) buf_index += 3; if (pts != AV_NOPTS_VALUE) { if (dts != pts) buf_index += 5 + 5; else buf_index += 5; } else { if (!s->is_mpeg2) buf_index++; } if (stream->id < 0xc0) { buf_index += 4; if (stream->id >= 0xa0) { int n; buf_index += 3; n = (s->packet_size - buf_index) % stream->lpcm_align; if (n) buf_index += (stream->lpcm_align - n); } } if (s->is_vcd && stream->id == AUDIO_ID) buf_index+=20; } return s->packet_size - buf_index; }
1threat
Delphi: react in the program on the signal change : I would like to react in the program (VLC) on the signal change of a Boolean variable (call the different functions, for example- start/stop the measurement). How can I realize it? Is there an another way without timer? I use Delphi 7 and I work with Delphi for just short time. Thanks in advance.
0debug
Linux date timezone : <p>I have a question about timezone and the output of the linux <code>date</code> command. Is it standard or daylight? <code>date +%Z</code> returns <code>EDT</code>. </p> <p>Is there a way to change the timezone returned by <code>date +%Z</code> from <code>EDT</code> to <code>EST</code>?</p>
0debug
static int resample(ResampleContext *c, void *dst, const void *src, int *consumed, int src_size, int dst_size, int update_ctx, int nearest_neighbour) { int dst_index; int index = c->index; int frac = c->frac; int dst_incr_frac = c->dst_incr % c->src_incr; int dst_incr = c->dst_incr / c->src_incr; int compensation_distance = c->compensation_distance; if (!dst != !src) return AVERROR(EINVAL); if (nearest_neighbour) { int64_t index2 = ((int64_t)index) << 32; int64_t incr = (1LL << 32) * c->dst_incr / c->src_incr; dst_size = FFMIN(dst_size, (src_size-1-index) * (int64_t)c->src_incr / c->dst_incr); if (dst) { for(dst_index = 0; dst_index < dst_size; dst_index++) { c->resample_nearest(dst, dst_index, src, index2 >> 32); index2 += incr; } } else { dst_index = dst_size; } index += dst_index * dst_incr; index += (frac + dst_index * (int64_t)dst_incr_frac) / c->src_incr; frac = (frac + dst_index * (int64_t)dst_incr_frac) % c->src_incr; } else { for (dst_index = 0; dst_index < dst_size; dst_index++) { int sample_index = index >> c->phase_shift; if (sample_index + c->filter_length > src_size || -sample_index >= src_size) break; if (dst) c->resample_one(c, dst, dst_index, src, src_size, index, frac); frac += dst_incr_frac; index += dst_incr; if (frac >= c->src_incr) { frac -= c->src_incr; index++; } if (dst_index + 1 == compensation_distance) { compensation_distance = 0; dst_incr_frac = c->ideal_dst_incr % c->src_incr; dst_incr = c->ideal_dst_incr / c->src_incr; } } } if (consumed) *consumed = FFMAX(index, 0) >> c->phase_shift; if (update_ctx) { if (index >= 0) index &= c->phase_mask; if (compensation_distance) { compensation_distance -= dst_index; if (compensation_distance <= 0) return AVERROR_BUG; } c->frac = frac; c->index = index; c->dst_incr = dst_incr_frac + c->src_incr*dst_incr; c->compensation_distance = compensation_distance; } return dst_index; }
1threat
I'm can't quite wrap my head around this code for checking for a perfect square. : I'm a novice as may be obvious, in advanced c++ at my school and I was working on home work and was having issues with try to figure out how to decide if an integer is a perfect square or not when I stumbled across this piece of code. if (num <= 0 || sqrt(num) != static_cast<int>(sqrt(num))) throw "Error: The number is not a perfect square.\n"; return sqrt(num); If possible as an exception function I just don't quite understand how the piece after || works. And would just like to know for future reference.
0debug
C# Make form invisible : i know this question seems very simple but its not working for me, i think i changed a property by accident so the form wont go invisible. on load, i have : this.Visible = false; this.ShowInTaskbar = false; this.ShowIcon = false; it doesnt show in taskbar or the icon but for some reason its still visible like in the image below [![enter image description here][1]][1] i know thats the form because i changed the color to red and it turned red [1]: http://i.stack.imgur.com/y1Nv5.png
0debug
static void gen_wsr_ps(DisasContext *dc, uint32_t sr, TCGv_i32 v) { uint32_t mask = PS_WOE | PS_CALLINC | PS_OWB | PS_UM | PS_EXCM | PS_INTLEVEL; if (option_enabled(dc, XTENSA_OPTION_MMU)) { mask |= PS_RING; } tcg_gen_andi_i32(cpu_SR[sr], v, mask); gen_jumpi(dc, dc->next_pc, -1); }
1threat
static void vc1_decode_b_mb_intfi(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; int mqdiff, mquant; int ttmb = v->ttfrm; int mb_has_coeffs = 0; int val; int first_block = 1; int dst_idx, off; int fwd; int dmv_x[2], dmv_y[2], pred_flag[2]; int bmvtype = BMV_TYPE_BACKWARD; int idx_mbmode; int av_uninit(interpmvp); mquant = v->pq; s->mb_intra = 0; idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2); if (idx_mbmode <= 1) { s->mb_intra = v->is_intra[s->mb_x] = 1; s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = idx_mbmode & 1; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2); dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); v->mb_type[0][s->block_index[i]] = s->mb_intra; v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) for (j = 0; j < 64; j++) s->block[i][j] <<= 1; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; s->current_picture.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16; for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; if (v->fmb_is_raw) fwd = v->forward_mb_plane[mb_pos] = get_bits1(gb); else fwd = v->forward_mb_plane[mb_pos]; if (idx_mbmode <= 5) { dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; pred_flag[0] = pred_flag[1] = 0; if (fwd) bmvtype = BMV_TYPE_FORWARD; else { bmvtype = decode012(gb); switch (bmvtype) { case 0: bmvtype = BMV_TYPE_BACKWARD; break; case 1: bmvtype = BMV_TYPE_DIRECT; break; case 2: bmvtype = BMV_TYPE_INTERPOLATED; interpmvp = get_bits1(gb); } } v->bmvtype = bmvtype; if (bmvtype != BMV_TYPE_DIRECT && idx_mbmode & 1) { get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD], &dmv_y[bmvtype == BMV_TYPE_BACKWARD], &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); } if (bmvtype == BMV_TYPE_INTERPOLATED && interpmvp) { get_mvdata_interlaced(v, &dmv_x[1], &dmv_y[1], &pred_flag[1]); } if (bmvtype == BMV_TYPE_DIRECT) { dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; dmv_x[1] = dmv_y[1] = pred_flag[0] = 0; } vc1_pred_b_mv_intfi(v, 0, dmv_x, dmv_y, 1, pred_flag); vc1_b_mc(v, dmv_x, dmv_y, (bmvtype == BMV_TYPE_DIRECT), bmvtype); mb_has_coeffs = !(idx_mbmode & 2); } else { if (fwd) bmvtype = BMV_TYPE_FORWARD; v->bmvtype = bmvtype; v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); for (i = 0; i < 6; i++) { if (i < 4) { dmv_x[0] = dmv_y[0] = pred_flag[0] = 0; dmv_x[1] = dmv_y[1] = pred_flag[1] = 0; val = ((v->fourmvbp >> (3 - i)) & 1); if (val) { get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD], &dmv_y[bmvtype == BMV_TYPE_BACKWARD], &pred_flag[bmvtype == BMV_TYPE_BACKWARD]); } vc1_pred_b_mv_intfi(v, i, dmv_x, dmv_y, 0, pred_flag); vc1_mc_4mv_luma(v, i, bmvtype == BMV_TYPE_BACKWARD, 0); } else if (i == 4) vc1_mc_4mv_chroma(v, bmvtype == BMV_TYPE_BACKWARD); } mb_has_coeffs = idx_mbmode & 1; } if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (cbp) { GET_MQUANT(); } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) { ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); } dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize; if (val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } }
1threat
Sublime Text 3, how to add to right click? : <p>How do I add Sublime Text just like how Edit with Notepad++ is there it's nothing big but it saves time.</p> <p><a href="https://i.stack.imgur.com/mGOPJ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mGOPJ.png" alt="enter image description here"></a></p>
0debug
static void eval_cond_jmp(DisasContext *dc, TCGv pc_true, TCGv pc_false) { int l1; l1 = gen_new_label(); tcg_gen_mov_tl(cpu_SR[SR_PC], pc_false); tcg_gen_brcondi_tl(TCG_COND_EQ, env_btaken, 0, l1); tcg_gen_mov_tl(cpu_SR[SR_PC], pc_true); gen_set_label(l1); }
1threat
How to get Name from second table by referring ID from fist table : I am new to the SQL Server world. I've two tables for example **gameDetails(gid,name,categoryid,companyid,year)** and **gameSubDetails(id,name,delflag).** In gameDetails i've stored ids of gameSubDetails in categoryid and companyid. Now if I want to search any value in gameDetails based on the criteria also from gameDetails, How can I get the name of the Category and Company from gameSubDetails. For Example I want to search all the values of gameDetails where year=2015. So I wrote query as `select g.gName,gsub.name as catid,gsub.name as compid from gameMaster g,gameSubDetails gsub where g.compid=gsub.id and g.year='2015'` But i shows only company name in both(catid,compid), but even if i try to put another where condition with catid like `where g.compid=gsub.id and and g.catid=gsub.id and .year='2015'` It does not give me any records. Please suggest what is the best way to work upon this scenario. Note : CategoryId and CompanyID are stored in same table gameSubDetails just Id is different.
0debug
Does not evaluate the condition : Good day, that does not happen in my code, but when running, does not fall to assess the condition, otherwise I run the line of the "else" could help me have I got wrong. Thank you. public class LoginActivity extends AppCompatActivity { private EditText usern; private EditText passw; private Button logButton; @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); usern = (EditText) findViewById(R.id.userNameText); passw = (EditText) findViewById(R.id.passwordText); logButton = (Button) findViewById(R.id.loginButton); logButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(usern.getText().toString().equals("demo") && passw.getText().equals("demo")){ Intent intent = new Intent(LoginActivity.this, MainActivity.class); startActivity(intent); Toast.makeText(getApplicationContext(), "Login...", Toast.LENGTH_SHORT).show(); } else{ Toast.makeText(getApplicationContext(), "Username or password incorrect", Toast.LENGTH_SHORT).show(); } } }); } } *Android Studio
0debug
static void video_image_display(VideoState *is) { Frame *vp; Frame *sp; AVPicture pict; SDL_Rect rect; int i; vp = frame_queue_peek(&is->pictq); if (vp->bmp) { if (is->subtitle_st) { if (frame_queue_nb_remaining(&is->subpq) > 0) { sp = frame_queue_peek(&is->subpq); if (vp->pts >= sp->pts + ((float) sp->sub.start_display_time / 1000)) { SDL_LockYUVOverlay (vp->bmp); pict.data[0] = vp->bmp->pixels[0]; pict.data[1] = vp->bmp->pixels[2]; pict.data[2] = vp->bmp->pixels[1]; pict.linesize[0] = vp->bmp->pitches[0]; pict.linesize[1] = vp->bmp->pitches[2]; pict.linesize[2] = vp->bmp->pitches[1]; for (i = 0; i < sp->sub.num_rects; i++) blend_subrect(&pict, sp->sub.rects[i], vp->bmp->w, vp->bmp->h); SDL_UnlockYUVOverlay (vp->bmp); } } } calculate_display_rect(&rect, is->xleft, is->ytop, is->width, is->height, vp->width, vp->height, vp->sar); SDL_DisplayYUVOverlay(vp->bmp, &rect); if (rect.x != is->last_display_rect.x || rect.y != is->last_display_rect.y || rect.w != is->last_display_rect.w || rect.h != is->last_display_rect.h || is->force_refresh) { int bgcolor = SDL_MapRGB(screen->format, 0x00, 0x00, 0x00); fill_border(is->xleft, is->ytop, is->width, is->height, rect.x, rect.y, rect.w, rect.h, bgcolor, 1); is->last_display_rect = rect; } } }
1threat
Subclassing Numpy Array - Propagate Attributes : <p>I would like to know how custom attributes of numpy arrays can be propagated, even when the array passes through functions like <code>np.fromfunction</code>. </p> <p>For example, my class <code>ExampleTensor</code> defines an attribute <code>attr</code> that is set to 1 on default.</p> <pre><code>import numpy as np class ExampleTensor(np.ndarray): def __new__(cls, input_array): return np.asarray(input_array).view(cls) def __array_finalize__(self, obj) -&gt; None: if obj is None: return # This attribute should be maintained! self.attr = getattr(obj, 'attr', 1) </code></pre> <p>Slicing and basic operations between <code>ExampleTensor</code> instances will maintain the attributes, but using other numpy functions will not (probably because they create regular numpy arrays instead of ExampleTensors). <strong>My question:</strong> Is there a solution that persists the custom attributes when a regular numpy array is constructed out of subclassed numpy array instances?</p> <p>Example to reproduce problem:</p> <pre><code>ex1 = ExampleTensor([[3, 4],[5, 6]]) ex1.attr = "some val" print(ex1[0].attr) # correctly outputs "some val" print((ex1+ex1).attr) # correctly outputs "some val" np.sum([ex1, ex1], axis=0).attr # Attribute Error: 'numpy.ndarray' object has no attribute 'attr' </code></pre>
0debug
What is the correct css for the list of results to show correctly in this situation? : <p>What is the correct css for the list of results to show correctly? Here are the steps to view the results:</p> <p>1) Navigate to <a href="http://mypubguide.com/good-pubs/east-region" rel="nofollow">http://mypubguide.com/good-pubs/east-region</a></p> <p>2) Type "Hull" in the search input on the navigation bar and enter</p> <p>3) Check: You see a list of results but the styling is incorrect, e.g., the anchor tag is not showing the text correctly and other elements look badly formatted.</p> <p>How do I resolve this?</p>
0debug
static int get_cluster_table(BlockDriverState *bs, uint64_t offset, uint64_t **new_l2_table, int *new_l2_index) { BDRVQcowState *s = bs->opaque; unsigned int l1_index, l2_index; uint64_t l2_offset; uint64_t *l2_table = NULL; int ret; l1_index = offset >> (s->l2_bits + s->cluster_bits); if (l1_index >= s->l1_size) { ret = qcow2_grow_l1_table(bs, l1_index + 1, false); if (ret < 0) { return ret; } } l2_offset = s->l1_table[l1_index] & L1E_OFFSET_MASK; if (s->l1_table[l1_index] & QCOW_OFLAG_COPIED) { ret = l2_load(bs, l2_offset, &l2_table); if (ret < 0) { return ret; } } else { ret = l2_allocate(bs, l1_index, &l2_table); if (ret < 0) { return ret; } if (l2_offset) { qcow2_free_clusters(bs, l2_offset, s->l2_size * sizeof(uint64_t)); } } l2_index = (offset >> s->cluster_bits) & (s->l2_size - 1); *new_l2_table = l2_table; *new_l2_index = l2_index; return 0; }
1threat
How to call an async task inside a timer? : <p>I figured out how to use a repeat a normal method with a timer, and it worked fine. But now I have to use some async methods inside of this method, so I had to make it a Task instead of a normal method. This is the code I currently have now:</p> <pre><code>public async Task Test() { Timer t = new Timer(5000); t.AutoReset = true; t.Elapsed += new ElapsedEventHandler(OnTimedEvent); t.Start(); } private async Task OnTimedEvent(Object source, ElapsedEventArgs e) { } </code></pre> <p>I am currently getting an error on the <code>t.Elapsed +=</code> line because there is no await, but if I add it, it simply acts as if it was a normal func, and gives me a missing params error. How would I use this same Timer but with an async task?</p>
0debug
How can install arm-linux-gcc-3.3.2.tar.bz2 on ubuntu : <p>I'm trying to make cross compiler. And I commend like tar xvjf arm-linux-gcc-3.3.2.tar.bz2. But when ls /usr/local/arm there is nothing. arm directory doesn't exsist.... I dont know what to do.....</p>
0debug
static void typhoon_pcihost_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = typhoon_pcihost_init; dc->no_user = 1; }
1threat
User registration on PHP with MySQL : <p>I create a simple code for user registration, and when user submit the data was not recorded to MySQL.</p> <p>Here is my logic code </p> <pre><code>&lt;?php $username = $_POST["user"]; $password = $_POST["pass"]; $confirmPassword = $_POST["repass"]; $email = $_POST["email"]; $username = stripcslashes($username); $password = stripcslashes($password); $confirmPassword = stripcslashes($confirmPassword); $email = stripcslashes($email); $con = mysqli_connect('localhost', 'root', '', 'dbtest'); if($con-&gt;connect_error) { echo"&lt;script type='text/javascript'&gt;alert('connection to database failed!')&lt;/script&gt;"; } else { $query = mysqli_query($con, "INSERT INTO 'user'('Username', 'Password', 'Email') VALUES('$username', $password', '$email')"); echo "You are successfully registered!"; } $con-&gt;close(); ?&gt; </code></pre> <p>Is there something that I missed?</p>
0debug
Remove the following redirect chain if possible from Google : <p>We have recently started using <strong>Google Analytics</strong> and activated Google Re Marketting on <strong>Analytics panel</strong> </p> <p>Now we are seeing the following error messages when testing with <strong>Pingdom</strong>:</p> <p>Its says Remove the following redirect chain if possible:</p> <pre><code>https://www.google-analytics.com/r/collect?v=1&amp; ... https://stats.g.doubleclick.net/r/collect?v=1&amp;a ... https://www.google.com/ads/ga-audiences?v=1&amp;aip ... https://www.google.se/ads/ga-audiences?v=1&amp;aip= ... </code></pre> <p>How Can we fix this <a href="https://i.stack.imgur.com/0nYQK.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/0nYQK.jpg" alt="enter image description here"></a></p> <p>Using PingDom, We just scored an "F" from "Minimizing Redirects" , How can I fix the redirect chain that was pointed out to us by the pingdom tool?</p> <blockquote> <p><strong>PS</strong>: We are not locally hosting the Analytics.js</p> </blockquote>
0debug
void mixeng_clear (st_sample_t *buf, int len) { memset (buf, 0, len * sizeof (st_sample_t)); }
1threat
static void pc_dimm_plug(HotplugHandler *hotplug_dev, DeviceState *dev, Error **errp) { HotplugHandlerClass *hhc; Error *local_err = NULL; PCMachineState *pcms = PC_MACHINE(hotplug_dev); PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms); PCDIMMDevice *dimm = PC_DIMM(dev); PCDIMMDeviceClass *ddc = PC_DIMM_GET_CLASS(dimm); MemoryRegion *mr = ddc->get_memory_region(dimm); uint64_t align = TARGET_PAGE_SIZE; bool is_nvdimm = object_dynamic_cast(OBJECT(dev), TYPE_NVDIMM); if (memory_region_get_alignment(mr) && pcmc->enforce_aligned_dimm) { align = memory_region_get_alignment(mr); } if (!pcms->acpi_dev) { error_setg(&local_err, "memory hotplug is not enabled: missing acpi device"); goto out; } if (is_nvdimm && !pcms->acpi_nvdimm_state.is_enabled) { error_setg(&local_err, "nvdimm is not enabled: missing 'nvdimm' in '-M'"); goto out; } pc_dimm_memory_plug(dev, &pcms->hotplug_memory, mr, align, &local_err); if (local_err) { goto out; } if (is_nvdimm) { nvdimm_plug(&pcms->acpi_nvdimm_state); } hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev); hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &error_abort); out: error_propagate(errp, local_err); }
1threat
aio_ctx_prepare(GSource *source, gint *timeout) { AioContext *ctx = (AioContext *) source; uint32_t wait = -1; aio_bh_update_timeout(ctx, &wait); if (wait != -1) { *timeout = MIN(*timeout, wait); return wait == 0; } return false; }
1threat
The imported project "C:\Program Files\dotnet\sdk\2.1.201\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found : <p>In Visual Studio 2017, I go to the Package Manager to do a dotnet restore. Then I get an error message</p> <blockquote> <p>error MSB4019: The imported project "C:\Program Files\dotnet\sdk\2.1.201\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" was not found.</p> </blockquote> <p>I navigate to </p> <blockquote> <p>C:\Program Files\dotnet\sdk\2.1.201\Microsoft</p> </blockquote> <p>and the VisualStudio path is missing and hence the error message. How do I fix this?</p>
0debug
void HELPER(srst)(CPUS390XState *env, uint32_t r1, uint32_t r2) { uintptr_t ra = GETPC(); uint64_t end, str; uint32_t len; uint8_t v, c = env->regs[0]; if (env->regs[0] & 0xffffff00u) { cpu_restore_state(ENV_GET_CPU(env), ra); program_interrupt(env, PGM_SPECIFICATION, 6); } str = get_address(env, r2); end = get_address(env, r1); for (len = 0; len < 0x2000; ++len) { if (str + len == end) { env->cc_op = 2; return; } v = cpu_ldub_data_ra(env, str + len, ra); if (v == c) { env->cc_op = 1; set_address(env, r1, str + len); return; } } env->cc_op = 3; set_address(env, r2, str + len); }
1threat
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb) { ARMCPU *cpu = arm_env_get_cpu(env); CPUState *cs = CPU(cpu); DisasContext dc1, *dc = &dc1; target_ulong pc_start; target_ulong next_page_start; int num_insns; int max_insns; bool end_of_page; if (ARM_TBFLAG_AARCH64_STATE(tb->flags)) { gen_intermediate_code_a64(cpu, tb); return; } pc_start = tb->pc; dc->tb = tb; dc->is_jmp = DISAS_NEXT; dc->pc = pc_start; dc->singlestep_enabled = cs->singlestep_enabled; dc->condjmp = 0; dc->aarch64 = 0; dc->secure_routed_to_el3 = arm_feature(env, ARM_FEATURE_EL3) && !arm_el_is_aa64(env, 3); dc->thumb = ARM_TBFLAG_THUMB(tb->flags); dc->sctlr_b = ARM_TBFLAG_SCTLR_B(tb->flags); dc->be_data = ARM_TBFLAG_BE_DATA(tb->flags) ? MO_BE : MO_LE; dc->condexec_mask = (ARM_TBFLAG_CONDEXEC(tb->flags) & 0xf) << 1; dc->condexec_cond = ARM_TBFLAG_CONDEXEC(tb->flags) >> 4; dc->mmu_idx = ARM_TBFLAG_MMUIDX(tb->flags); dc->current_el = arm_mmu_idx_to_el(dc->mmu_idx); #if !defined(CONFIG_USER_ONLY) dc->user = (dc->current_el == 0); #endif dc->ns = ARM_TBFLAG_NS(tb->flags); dc->fp_excp_el = ARM_TBFLAG_FPEXC_EL(tb->flags); dc->vfp_enabled = ARM_TBFLAG_VFPEN(tb->flags); dc->vec_len = ARM_TBFLAG_VECLEN(tb->flags); dc->vec_stride = ARM_TBFLAG_VECSTRIDE(tb->flags); dc->c15_cpar = ARM_TBFLAG_XSCALE_CPAR(tb->flags); dc->cp_regs = cpu->cp_regs; dc->features = env->features; dc->ss_active = ARM_TBFLAG_SS_ACTIVE(tb->flags); dc->pstate_ss = ARM_TBFLAG_PSTATE_SS(tb->flags); dc->is_ldex = false; dc->ss_same_el = false; cpu_F0s = tcg_temp_new_i32(); cpu_F1s = tcg_temp_new_i32(); cpu_F0d = tcg_temp_new_i64(); cpu_F1d = tcg_temp_new_i64(); cpu_V0 = cpu_F0d; cpu_V1 = cpu_F1d; cpu_M0 = tcg_temp_new_i64(); next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } if (max_insns > TCG_MAX_INSNS) { max_insns = TCG_MAX_INSNS; } gen_tb_start(tb); tcg_clear_temp_count(); if (dc->condexec_mask || dc->condexec_cond) { TCGv_i32 tmp = tcg_temp_new_i32(); tcg_gen_movi_i32(tmp, 0); store_cpu_field(tmp, condexec_bits); } do { dc->insn_start_idx = tcg_op_buf_count(); tcg_gen_insn_start(dc->pc, (dc->condexec_cond << 4) | (dc->condexec_mask >> 1), 0); num_insns++; #ifdef CONFIG_USER_ONLY if (dc->pc >= 0xffff0000) { gen_exception_internal(EXCP_KERNEL_TRAP); dc->is_jmp = DISAS_EXC; break; } #else if (arm_dc_feature(dc, ARM_FEATURE_M)) { assert(dc->pc < 0xfffffff0); } #endif if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) { CPUBreakpoint *bp; QTAILQ_FOREACH(bp, &cs->breakpoints, entry) { if (bp->pc == dc->pc) { if (bp->flags & BP_CPU) { gen_set_condexec(dc); gen_set_pc_im(dc, dc->pc); gen_helper_check_breakpoints(cpu_env); dc->is_jmp = DISAS_UPDATE; } else { gen_exception_internal_insn(dc, 0, EXCP_DEBUG); dc->pc += 2; goto done_generating; } break; } } } if (num_insns == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } if (dc->ss_active && !dc->pstate_ss) { assert(num_insns == 1); gen_exception(EXCP_UDEF, syn_swstep(dc->ss_same_el, 0, 0), default_exception_el(dc)); goto done_generating; } if (dc->thumb) { disas_thumb_insn(env, dc); if (dc->condexec_mask) { dc->condexec_cond = (dc->condexec_cond & 0xe) | ((dc->condexec_mask >> 4) & 1); dc->condexec_mask = (dc->condexec_mask << 1) & 0x1f; if (dc->condexec_mask == 0) { dc->condexec_cond = 0; } } } else { unsigned int insn = arm_ldl_code(env, dc->pc, dc->sctlr_b); dc->pc += 4; disas_arm_insn(dc, insn); } if (dc->condjmp && !dc->is_jmp) { gen_set_label(dc->condlabel); dc->condjmp = 0; } if (tcg_check_temp_count()) { fprintf(stderr, "TCG temporary leak before "TARGET_FMT_lx"\n", dc->pc); } end_of_page = (dc->pc >= next_page_start) || ((dc->pc >= next_page_start - 3) && insn_crosses_page(env, dc)); } while (!dc->is_jmp && !tcg_op_buf_full() && !is_singlestepping(dc) && !singlestep && !end_of_page && num_insns < max_insns); if (tb->cflags & CF_LAST_IO) { if (dc->condjmp) { cpu_abort(cs, "IO on conditional branch instruction"); } gen_io_end(); } gen_set_condexec(dc); if (unlikely(is_singlestepping(dc))) { switch (dc->is_jmp) { case DISAS_SWI: gen_ss_advance(dc); gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb), default_exception_el(dc)); break; case DISAS_HVC: gen_ss_advance(dc); gen_exception(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2); break; case DISAS_SMC: gen_ss_advance(dc); gen_exception(EXCP_SMC, syn_aa32_smc(), 3); break; case DISAS_NEXT: case DISAS_UPDATE: gen_set_pc_im(dc, dc->pc); default: gen_singlestep_exception(dc); } } else { switch(dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; case DISAS_UPDATE: gen_set_pc_im(dc, dc->pc); case DISAS_JUMP: default: tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: break; case DISAS_WFI: gen_helper_wfi(cpu_env); tcg_gen_exit_tb(0); break; case DISAS_WFE: gen_helper_wfe(cpu_env); break; case DISAS_YIELD: gen_helper_yield(cpu_env); break; case DISAS_SWI: gen_exception(EXCP_SWI, syn_aa32_svc(dc->svc_imm, dc->thumb), default_exception_el(dc)); break; case DISAS_HVC: gen_exception(EXCP_HVC, syn_aa32_hvc(dc->svc_imm), 2); break; case DISAS_SMC: gen_exception(EXCP_SMC, syn_aa32_smc(), 3); break; } } if (dc->condjmp) { gen_set_label(dc->condlabel); gen_set_condexec(dc); if (unlikely(is_singlestepping(dc))) { gen_set_pc_im(dc, dc->pc); gen_singlestep_exception(dc); } else { gen_goto_tb(dc, 1, dc->pc); } } done_generating: gen_tb_end(tb, num_insns); #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM) && qemu_log_in_addr_range(pc_start)) { qemu_log_lock(); qemu_log("----------------\n"); qemu_log("IN: %s\n", lookup_symbol(pc_start)); log_target_disas(cs, pc_start, dc->pc - pc_start, dc->thumb | (dc->sctlr_b << 1)); qemu_log("\n"); qemu_log_unlock(); } #endif tb->size = dc->pc - pc_start; tb->icount = num_insns; }
1threat
how get data json in php : <p>I'm not getting any information from Json as I try I want to get every single information and save it in the database</p> <pre><code> { "data":[ { "name":"چلوکباب چنجه", "price":"20000", "phone":"0930", "number":"2", "orider_id":"1", "img_name":"Changea.jpg" }, { "name":"سالاد فصل", "price":"3000", "phone":"0930", "number":"2", "orider_id":"1", "img_name":"SaladFasl.jpg" }, { "name":"ایستک لیمو ", "price":"2000", "phone":"0930", "number":"2", "orider_id":"1", "img_name":"Istak.jpeg" } ] }` </code></pre>
0debug
Minio: How's bucket policy related to anonymous/authorized access? : <p>Minio has policies for <a href="https://github.com/minio/minio-java/blob/6a4cf897df8c55cf4b46ed32617bf8bf41efe53c/api/src/main/java/io/minio/policy/PolicyType.java#L20" rel="noreferrer">each bucket</a>. Which contains: </p> <ul> <li>ReadOnly </li> <li>WriteOnly </li> <li>Read+Write </li> <li>None </li> </ul> <p>How are these related to the anonymous/authorized access to the folders?<br> Like say I want to make a bunch of files available as read-only to users without credentials (access key and secret key). How can I do it? </p>
0debug
How to read JSON with multiple key value pair : <p>On AJAX request response is following :</p> <pre><code>[ {"status":{"login":"invalid"}}, {"user":{"username":false,"pwd":false}} ] </code></pre> <p>How to read values in Jquery.</p>
0debug
Merging duplicate values in a single row sql but keeping other information for crystal report : I have a sql query and i got the following result [SQL Query Result][1] But i want to merge the MemberName column for same members but the values in other columns will remain same so i can make the crystal report properly. I want to make my report in the following format [Desired Result][2] btw, sorry for using images & TIA. [1]: https://i.stack.imgur.com/DcfC1.png [2]: https://i.stack.imgur.com/n7NOY.png
0debug
Docker Bad owner or permissions on /root/.ssh/config : <p>So, I've set up <code>docker 17.03</code> on <code>Ubuntu 16.04.5 LTS</code>. The problem is, the application needs to <code>ssh</code> to an external server. Since <code>docker</code> binds current users <code>ssh</code> files, it should allow me to <code>ssh</code> into the server from the container. However its giving me the <code>Bad owner or permissions on /root/.ssh/config</code> error. </p> <p>From what I've figured, docker is running as my ubuntu user which is <code>1001</code> and is trying to access <code>root</code> account <code>ssh</code> files (I could be wrong) which is why its giving me this error. </p> <p>Also, when I run <code>echo $USER</code> from the container, its not returning any user, but just an empty line.</p> <p>The question is, has anybody faced this problem before and if so, has anybody solved it?</p>
0debug
How to embed new Youtube's live video permanent URL? : <p>I stream live on youtube a lot and since yesterday I experience a weird thing:</p> <p>I embedded the livestream URL in my site. it was <code>youtube.com/embed/ABCDE</code> (normal embed link). That link used to show the <strong>current</strong> livestream and not a specific video. for example:</p> <p>I'm streaming and you can watch it on <code>youtube.com/embed/ABCDE</code>. When i'm finished, the video gets its own url, something like <code>youtube.com/watch?v=FGHIJ</code>. In the next time I will stream, users can watch the stream on <code>youtube.com/embed/ABCDE</code> (that was a permanent url that didn't change).</p> <p>Now, every time I stream, the livestream get its own link at first place, which means I have to update my embed code manually every time I stream.</p> <p>I researched a bit around Google, SO and YouTube and I found out that a livestream's permanent url is <code>youtube.com/channel/CHANNEL_ID/live</code>. It's awesome and all, but I can't find a way to embed it.</p> <p>(I use wordpress and I didn't find any plugin to do it automatically for me).</p> <p><strong>TL:DR;</strong> how to embed the livestream in the page <code>youtube.com/channel/CHANNEL_ID/live</code>?</p>
0debug
Identfy "Start" and "End" date of a trip in SQL? : I want to get the start and end date of the trip from a table as shown below - [enter image description here][1] I have tried Min(Date) and then Max(Date) Group by Line_Number,Country Also LEAD function Preferred Outcome [enter image description here][2] [1]: https://i.stack.imgur.com/6gZGC.png [2]: https://i.stack.imgur.com/oaL7O.png
0debug
static int rsd_probe(AVProbeData *p) { if (!memcmp(p->buf, "RSD", 3) && p->buf[3] - '0' >= 2 && p->buf[3] - '0' <= 6) return AVPROBE_SCORE_EXTENSION; return 0; }
1threat
Filling user card with the information from the form : <p>I need to create the card which is filled with the information as soon as the user types something into the form. For example, he enters his name and the name appears on the card. The page shouldn't be reloaded, the info on the card must appear instantly. </p>
0debug
Browser navigation broken by use of React Error Boundaries : <p>When an error is thrown in our React 16 codebase, it is caught by our top-level error boundary. The <code>ErrorBoundary</code> component happily renders an error page when this happens.</p> <p>Where the ErrorBoundary sits</p> <pre><code> return ( &lt;Provider store={configureStore()}&gt; &lt;ErrorBoundary&gt; &lt;Router history={browserHistory}&gt;{routes}&lt;/Router&gt; &lt;/ErrorBoundary&gt; &lt;/Provider&gt; ) </code></pre> <p>However, when navigating back using the browser back button (one click), the URL changes in the address but the page does not update.</p> <p>I have tried shifting the error boundary down the component tree but this issue persists.</p> <p>Any clues on where this issue lies?</p>
0debug
static int ast_write_trailer(AVFormatContext *s) { AVIOContext *pb = s->pb; ASTMuxContext *ast = s->priv_data; AVCodecContext *enc = s->streams[0]->codec; int64_t file_size = avio_tell(pb); int64_t samples = (file_size - 64 - (32 * enc->frame_number)) / enc->block_align; av_log(s, AV_LOG_DEBUG, "total samples: %"PRId64"\n", samples); if (s->pb->seekable) { avio_seek(pb, ast->samples, SEEK_SET); avio_wb32(pb, samples); if (ast->loopstart > 0) { if (ast->loopstart >= samples) { av_log(s, AV_LOG_WARNING, "Loopstart value is out of range and will be ignored\n"); ast->loopstart = -1; avio_skip(pb, 4); } else avio_wb32(pb, ast->loopstart); } else avio_skip(pb, 4); if (ast->loopend && ast->loopstart >= 0) { if (ast->loopend > samples) { av_log(s, AV_LOG_WARNING, "Loopend value is out of range and will be ignored\n"); ast->loopend = samples; } avio_wb32(pb, ast->loopend); } else { avio_wb32(pb, samples); } avio_wb32(pb, ast->fbs); avio_seek(pb, ast->size, SEEK_SET); avio_wb32(pb, file_size - 64); if (ast->loopstart >= 0) { avio_skip(pb, 6); avio_wb16(pb, 0xFFFF); } avio_seek(pb, file_size, SEEK_SET); avio_flush(pb); } return 0; }
1threat
NDK not configured (although it is installed)—how to fix without Android Studio : <p>I am trying to build an Android project with Gradle. The project uses native code and thus needs NDK, which I have installed.</p> <p>However, Gradle fails with the following error:</p> <pre><code>&gt; NDK not configured. Download it with SDK manager. </code></pre> <p>Android’s SDK Manager does not list NDK as an option. Besides, I have NDK installed on my box, so the error seems to be that Gradle isn’t finding it.</p> <p>Most answers assume users to have Android Studio, which I do not have and do not want. Any way to fix this without?</p>
0debug
static int get_fw_cfg_order(FWCfgState *s, const char *name) { int i; if (s->fw_cfg_order_override > 0) { return s->fw_cfg_order_override; } for (i = 0; i < ARRAY_SIZE(fw_cfg_order); i++) { if (fw_cfg_order[i].name == NULL) { continue; } if (strcmp(name, fw_cfg_order[i].name) == 0) { return fw_cfg_order[i].order; } } error_report("warning: Unknown firmware file in legacy mode: %s", name); return FW_CFG_ORDER_OVERRIDE_LAST; }
1threat
long do_rt_sigreturn(CPUSH4State *regs) { struct target_rt_sigframe *frame; abi_ulong frame_addr; sigset_t blocked; target_ulong r0; #if defined(DEBUG_SIGNAL) fprintf(stderr, "do_rt_sigreturn\n"); #endif frame_addr = regs->gregs[15]; if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) goto badframe; target_to_host_sigset(&blocked, &frame->uc.tuc_sigmask); do_sigprocmask(SIG_SETMASK, &blocked, NULL); if (restore_sigcontext(regs, &frame->uc.tuc_mcontext, &r0)) goto badframe; if (do_sigaltstack(frame_addr + offsetof(struct target_rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(regs)) == -EFAULT) goto badframe; unlock_user_struct(frame, frame_addr, 0); return r0; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
1threat
I get an error when I'm trying to use Firefox In Debian Vagrant : <p>I installed firefox in my debian vagrant using these commands:</p> <pre><code>sudo nano /etc/apt/sources.list Add line in this file: deb http://packages.linuxmint.com debian import sudo apt-get update sudo apt-get install firefox </code></pre> <p>When I trying to use firefox I get error:</p> <pre><code>vagrant@packer-debian-7:~$ firefox -v XPCOMGlueLoad error for file /opt/firefox/libxul.so: libXdamage.so.1: cannot open shared object file: No such file or directory Couldn't load XPCOM. </code></pre> <p>What can I do with this problem?</p>
0debug
static BlockDriverState *bdrv_open_inherit(const char *filename, const char *reference, QDict *options, int flags, BlockDriverState *parent, const BdrvChildRole *child_role, Error **errp) { int ret; BdrvChild *file = NULL; BlockDriverState *bs; BlockDriver *drv = NULL; const char *drvname; const char *backing; Error *local_err = NULL; QDict *snapshot_options = NULL; int snapshot_flags = 0; assert(!child_role || !flags); assert(!child_role == !parent); if (reference) { bool options_non_empty = options ? qdict_size(options) : false; QDECREF(options); if (filename || options_non_empty) { error_setg(errp, "Cannot reference an existing block device with " "additional options or a new filename"); return NULL; } bs = bdrv_lookup_bs(reference, reference, errp); if (!bs) { return NULL; } bdrv_ref(bs); return bs; } bs = bdrv_new(); if (options == NULL) { options = qdict_new(); } parse_json_protocol(options, &filename, &local_err); if (local_err) { goto fail; } bs->explicit_options = qdict_clone_shallow(options); if (child_role) { bs->inherits_from = parent; child_role->inherit_options(&flags, options, parent->open_flags, parent->options); } ret = bdrv_fill_options(&options, filename, &flags, &local_err); if (local_err) { goto fail; } if (g_strcmp0(qdict_get_try_str(options, BDRV_OPT_READ_ONLY), "on") && !qdict_get_try_bool(options, BDRV_OPT_READ_ONLY, false)) { flags |= (BDRV_O_RDWR | BDRV_O_ALLOW_RDWR); } else { flags &= ~BDRV_O_RDWR; } if (flags & BDRV_O_SNAPSHOT) { snapshot_options = qdict_new(); bdrv_temp_snapshot_options(&snapshot_flags, snapshot_options, flags, options); qdict_del(options, BDRV_OPT_READ_ONLY); bdrv_backing_options(&flags, options, flags, options); } bs->open_flags = flags; bs->options = options; options = qdict_clone_shallow(options); drvname = qdict_get_try_str(options, "driver"); if (drvname) { drv = bdrv_find_format(drvname); if (!drv) { error_setg(errp, "Unknown driver: '%s'", drvname); goto fail; } } assert(drvname || !(flags & BDRV_O_PROTOCOL)); backing = qdict_get_try_str(options, "backing"); if (backing && *backing == '\0') { flags |= BDRV_O_NO_BACKING; qdict_del(options, "backing"); } if ((flags & BDRV_O_PROTOCOL) == 0) { file = bdrv_open_child(filename, options, "file", bs, &child_file, true, &local_err); if (local_err) { goto fail; } } bs->probed = !drv; if (!drv && file) { ret = find_image_format(file, filename, &drv, &local_err); if (ret < 0) { goto fail; } qdict_put(bs->options, "driver", qstring_from_str(drv->format_name)); qdict_put(options, "driver", qstring_from_str(drv->format_name)); } else if (!drv) { error_setg(errp, "Must specify either driver or file"); goto fail; } assert(!!(flags & BDRV_O_PROTOCOL) == !!drv->bdrv_file_open); assert(!(flags & BDRV_O_PROTOCOL) || !file); ret = bdrv_open_common(bs, file, options, &local_err); if (ret < 0) { goto fail; } if (file && (bs->file != file)) { bdrv_unref_child(bs, file); file = NULL; } if ((flags & BDRV_O_NO_BACKING) == 0) { ret = bdrv_open_backing_file(bs, options, "backing", &local_err); if (ret < 0) { goto close_and_fail; } } bdrv_refresh_filename(bs); if (options && (qdict_size(options) != 0)) { const QDictEntry *entry = qdict_first(options); if (flags & BDRV_O_PROTOCOL) { error_setg(errp, "Block protocol '%s' doesn't support the option " "'%s'", drv->format_name, entry->key); } else { error_setg(errp, "Block format '%s' does not support the option '%s'", drv->format_name, entry->key); } goto close_and_fail; } if (!bdrv_key_required(bs)) { bdrv_parent_cb_change_media(bs, true); } else if (!runstate_check(RUN_STATE_PRELAUNCH) && !runstate_check(RUN_STATE_INMIGRATE) && !runstate_check(RUN_STATE_PAUSED)) { error_setg(errp, "Guest must be stopped for opening of encrypted image"); goto close_and_fail; } QDECREF(options); if (snapshot_flags) { BlockDriverState *snapshot_bs; snapshot_bs = bdrv_append_temp_snapshot(bs, snapshot_flags, snapshot_options, &local_err); snapshot_options = NULL; if (local_err) { goto close_and_fail; } bdrv_unref(bs); bs = snapshot_bs; } return bs; fail: if (file != NULL) { bdrv_unref_child(bs, file); } QDECREF(snapshot_options); QDECREF(bs->explicit_options); QDECREF(bs->options); QDECREF(options); bs->options = NULL; bdrv_unref(bs); error_propagate(errp, local_err); return NULL; close_and_fail: bdrv_unref(bs); QDECREF(snapshot_options); QDECREF(options); error_propagate(errp, local_err); return NULL; }
1threat
Asyncronous texture object allocation in multi-GPU code : I have some code for texture object allocation and Host to Device copy. It is just a modification of the answer [here](https://stackoverflow.com/questions/53524944/array-of-cudaarray-for-multi-gpu-texture-code). I do not explicitly use streams, just `cudaSetDevice()` This code works fine, however, when I run the Visual Profiler, I can see that the memory copies from Host to Array are not asynchronous. They are allocated each to their own device stream, but the second one does not start until the first one finishes (running on 2 GPUs). I have tried it with large images, so I make certain that its not overhead from CPU. My guess is that there is something in the code that requires to be synchronous thus halts the CPU, but I don't know what. What can I do to make this loop asynchronous? void CreateTexture(int num_devices,const float* imagedata, int nVoxelX, int nVoxelY, int nVoxelZ ,cudaArray** d_cuArrTex, cudaTextureObject_t *texImage) { //size_t size_image=nVoxelX*nVoxelY*nVoxelZ; for (unsigned int i = 0; i < num_devices; i++){ cudaSetDevice(i); //cudaArray Descriptor const cudaExtent extent = make_cudaExtent(nVoxelX, nVoxelY, nVoxelZ); cudaChannelFormatDesc channelDesc = cudaCreateChannelDesc<float>(); //cuda Array cudaMalloc3DArray(&d_cuArrTex[i], &channelDesc, extent); cudaCheckErrors("Texture memory allocation fail"); cudaMemcpy3DParms copyParams = {0}; //Array creation copyParams.srcPtr = make_cudaPitchedPtr((void *)imagedata, extent.width*sizeof(float), extent.width, extent.height); copyParams.dstArray = d_cuArrTex[i]; copyParams.extent = extent; copyParams.kind = cudaMemcpyHostToDevice; cudaMemcpy3DAsync(&copyParams); cudaCheckErrors("Texture memory data copy fail"); //Array creation End cudaResourceDesc texRes; memset(&texRes, 0, sizeof(cudaResourceDesc)); texRes.resType = cudaResourceTypeArray; texRes.res.array.array = d_cuArrTex[i]; cudaTextureDesc texDescr; memset(&texDescr, 0, sizeof(cudaTextureDesc)); texDescr.normalizedCoords = false; texDescr.filterMode = cudaFilterModePoint; texDescr.addressMode[0] = cudaAddressModeBorder; texDescr.addressMode[1] = cudaAddressModeBorder; texDescr.addressMode[2] = cudaAddressModeBorder; texDescr.readMode = cudaReadModeElementType; cudaCreateTextureObject(&texImage[i], &texRes, &texDescr, NULL); cudaCheckErrors("Texture object creation fail"); } }
0debug
Java - Get Objects to Arraylist and stream it : I want to write Objects from a Jlist(with DefaultListModel) into Arraylist, so that I can use it to save/load (stream) them. How can I get the Objects into the Arraylist? Which is the best way to stream it? (buffered/filewriter,reader) Thanks for answering
0debug
static void bastardized_rice_decompress(ALACContext *alac, int32_t *output_buffer, int output_size, int readsamplesize, int rice_initialhistory, int rice_kmodifier, int rice_historymult, int rice_kmodifier_mask ) { int output_count; unsigned int history = rice_initialhistory; int sign_modifier = 0; for (output_count = 0; output_count < output_size; output_count++) { int32_t x; int32_t x_modified; int32_t final_val; x = get_unary_0_9(&alac->gb); if (x > 8) { x = get_bits(&alac->gb, readsamplesize); } else { int extrabits; int k; k = 31 - count_leading_zeros((history >> 9) + 3); if (k >= rice_kmodifier) k = rice_kmodifier; if (k != 1) { extrabits = show_bits(&alac->gb, k); x = (x << k) - x; if (extrabits > 1) { x += extrabits - 1; skip_bits(&alac->gb, k); } else skip_bits(&alac->gb, k - 1); } } x_modified = sign_modifier + x; final_val = (x_modified + 1) / 2; if (x_modified & 1) final_val *= -1; output_buffer[output_count] = final_val; sign_modifier = 0; history += x_modified * rice_historymult - ((history * rice_historymult) >> 9); if (x_modified > 0xffff) history = 0xffff; if ((history < 128) && (output_count+1 < output_size)) { int block_size; sign_modifier = 1; x = get_unary_0_9(&alac->gb); if (x > 8) { block_size = get_bits(&alac->gb, 16); } else { int k; int extrabits; k = count_leading_zeros(history) + ((history + 16) >> 6 ) - 24; extrabits = show_bits(&alac->gb, k); block_size = (((1 << k) - 1) & rice_kmodifier_mask) * x + extrabits - 1; if (extrabits < 2) { x = 1 - extrabits; block_size += x; skip_bits(&alac->gb, k - 1); } else { skip_bits(&alac->gb, k); } } if (block_size > 0) { memset(&output_buffer[output_count+1], 0, block_size * 4); output_count += block_size; } if (block_size > 0xffff) sign_modifier = 0; history = 0; } } }
1threat
How to addClass to an element that appears later in the page? : <p>I have the following jquery code:</p> <pre><code>$('.kv-editable-reset').addClass('green'); </code></pre> <p>which should add the class 'green' to this element:</p> <pre><code>&lt;button type="button" class="btn kv-editable-reset"&gt;&lt;/button&gt; </code></pre> <p>but it does not work because .kv-editable-reset appears only later in the page, after click on the following button:</p> <pre><code>&lt;button type="button" class="kv-editable-link"&gt;&lt;/button&gt; </code></pre> <p>How can I detect elements that appears in the page only <strong>after</strong> another element has been clicked?</p>
0debug
PHP code not connecting with html : <p>I'm having a very difficult time getting my PHP and HTML to work together on an email form. This is a website I've adopted and I'm not sure what I'm missing. I'm basically building a form within a modal so users have to register their email before downloading assets. So, once the form is sent they'll be able to connect to the next page to download what they needed. The trouble I'm having is with the form. Whatever I try isn't working. Help!</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;div class="modal-content"&gt; &lt;div class="modal-header"&gt; &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt; &lt;h4 class="modal-title"&gt;Download 3D Models&lt;/h4&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;div class="container slate"&gt; &lt;div class="row"&gt; &lt;div class="col-md-6"&gt; &lt;form name="send_form_email" action="../quform/send_form_email.php" method="get" enctype="multipart/form-data"&gt; &lt;div class="quform-elements"&gt; &lt;div class="form-group"&gt; &lt;label for="email"&gt;Name &lt;span class="text-danger"&gt;*&lt;/span&gt;&lt;/label&gt; &lt;input id="name" type="text" name="name" class="form-control" placeholder="Name"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="company"&gt;Company / Firm &lt;span class="text-danger"&gt;*&lt;/span&gt;&lt;/label&gt; &lt;input id="company" type="text" name="email" class="form-control" placeholder="Company / Firm"&gt; &lt;/div&gt; &lt;div class="form-group"&gt; &lt;label for="email"&gt;Email&lt;span class="text-danger"&gt;*&lt;/span&gt;&lt;/label&gt; &lt;input id="email" type="text" name="email" class="form-control" placeholder="Email"&gt; &lt;/div&gt; &lt;div class="quform-element quform-element-recaptcha"&gt; &lt;div class="quform-spacer"&gt; &lt;label&gt;Are you human?&lt;span class="text-danger"&gt;*&lt;/span&gt;&lt;/label&gt; &lt;div class="quform-input" style="width: 250px;"&gt; &lt;script src="https://www.google.com/recaptcha/api.js" async defer&gt;&lt;/script&gt; &lt;div class="g-recaptcha" data-sitekey="6Le2WvkSAAAAAP9bLeD4OaiVYvDrHXhcKaFo1chy"&gt;&lt;/div&gt; &lt;noscript&gt; &lt;div style="width: 302px; height: 352px;"&gt; &lt;div style="width: 302px; height: 352px; position: relative;"&gt; &lt;div style="width: 302px; height: 352px; position: absolute;"&gt; &lt;iframe src="https://www.google.com/recaptcha/api/fallback?k=6Le2WvkSAAAAAP9bLeD4OaiVYvDrHXhcKaFo1chy" frameborder="0" scrolling="no" style="width: 302px; height:352px; border-style: none;"&gt; &lt;/iframe&gt; &lt;/div&gt; &lt;div style="width: 250px; height: 80px; position: absolute; border-style: none; bottom: 21px; left: 25px; margin: 0px; padding: 0px; right: 5px;"&gt; &lt;textarea id="g-recaptcha-response" name="g-recaptcha-response" class="g-recaptcha-response" style="width: 250px; height: 80px; border: 1px solid #c1c1c1; margin: 0px; padding: 0px; resize: none;"&gt;&lt;/textarea&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/noscript&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt;&lt;!--/.recaptcha --&gt; &lt;div class="form-group"&gt; &lt;button type="reset" class="btn btn-default"&gt;Cancel&lt;/button&gt; &lt;button type="submit" class="btn btn-primary" value="Send"&gt;Send&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;!--/. quform-elements--&gt; &lt;/form&gt; &lt;/div&gt; &lt;!--/.col-md-6--&gt;</code></pre> </div> </div> </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;?php $name = $_POST['name']; //'name' has to be the same as the name value on the form input element $company = $_POST['company']; $email = $_POST['email']; $human = $_POST['human']; $from = $_POST['email']; $to = 'xxx@gmail.com'; //set to the default email address $subject = $_POST['3D Model Request']; $body = "From: $name\n Company: $company/n E-Mail: $email\n"; $headers = "From: $email" . "\r\n" . "Reply-To: $email" . "\r\n" . "X-Mailer: PHP/" . phpversion(); if(isset($_POST['submit']) &amp;&amp; ($_POST['human']) == '4') { mail ($to, $subject, $body, $headers); //mail sends it to the SMTP server side which sends the email echo "&lt;p&gt;Your message has been sent!&lt;/p&gt;"; } else { echo "&lt;p&gt;Something went wrong, go back and try again!&lt;/p&gt;"; } if (!isset($_POST['submit']) &amp;&amp; ($_POST['human']) != '4') { echo "&lt;p&gt;You answered the anti-spam question incorrectly!&lt;/p&gt;"; } ?&gt;</code></pre> </div> </div> </p>
0debug
alert('Hello ' + user_input);
1threat
How does char* map to a string : <p>In C, the character * makes a variable a pointer. Thus one would assume that some variable char* would be a pointer to a char, but somehow it can become an array of chars. How is this possible?</p>
0debug
jQuery: Stop the progress bar animation when it reaches 100%? : I'm trying to create a progress bar using jQuery and CSS. At the moment, I have created the progress bar using CSS and I can animate it using jQuery. However, I can't stop the progress bar (loading animation) from stopping when it reaches the `100%`. to explain the issue, I have created this working FIDDLE: https://jsfiddle.net/6jvr0ahg/ And this is my code: setInterval(function(){ // place this within dom ready function if(currentProgress == '100'){ alert('all downloaded'); }else{ var currentProgress = $(".progress-bar").width() / $('.progress-bar').parent().width() * 100; var setWidth = Number(currentProgress) + 25; if(currentProgress > 80){ $('.progress-bar').css({ 'width' : ''+setWidth+'%', 'background-color' : '#86e01e' }); }else{ $('.progress-bar').css({ 'width' : ''+setWidth+'%', 'background-color' : '#f27011' }); } } }, 3000); If you run the fiddle above, you will see that the progress bar keeps going even when it passes the 100%. Can someone please advice on this issue? Any help would be appreciated. Thanks in advance.
0debug
Python Anaconda: should I use `conda activate` or `source activate` in linux : <p>So I am used to typing <code>source activate &lt;environment&gt;</code> when starting a python Anaconda environment. That works just fine. But when I create new conda environments I am seeing the message on Ubuntu 16.04 to start the environments with <code>conda activate</code> instead. Besides the errors about how to set up my shell to use <code>conda activate</code> instead, I am still not clear on what is the difference between <code>source activate ...</code> and <code>conda activate ...</code> Is there a reason to change? Does anyone know the difference between these two commands? Thanks.</p>
0debug
static int e1000_post_load(void *opaque, int version_id) { E1000State *s = opaque; NetClientState *nc = qemu_get_queue(s->nic); nc->link_down = (s->mac_reg[STATUS] & E1000_STATUS_LU) == 0; return 0; }
1threat
generic binary search for string case in c++ : I am a beginner. I tried to find an answer, but I couldn't. If I asked a duplicate question, I am sorry. Here is my question. I use template to do generic binary search, but in string case I cannot get the result. It keeps showing me error messeage of "error: no matching function for call to 'binarySearch(std::cxx11::string [11], int&, std::cxx11::string&)' " please help me out to understand Thanks! #include <iostream> #include <string> using namespace std; template <class T> T binarySearch(T arr[], int left, int right, T x) { if(right >= 1) { int mid = (left + right)/2; if(x == arr[mid]) { return mid; } //right side of array else if(x > arr[mid]) { return binarySearch(arr,mid+1,right,x); } //left side of array else { return binarySearch(arr,left,mid-1,x); } } else return -1; } int main() { int intArr[11] = {0,1,2,3,4,5,6,7,8,9,10}; double doubleArr[11] = {1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0}; string stringArr[11] = {"abc", "bcd", "cde", "def", "efg", "fgh", "ghi", "hij", "ijk", "jkl", "klm"}; int length = sizeof(intArr)/sizeof(intArr[0]); cout << "binarySearch<int>(intArr,0,length,9): " << binarySearch<int>(intArr,0,length,9) << endl; cout << "binarySearch<double>(doubleArr,0,length,1.3): " << binarySearch<double>(doubleArr,0,length,1.3) << endl; string s = "cdf"; cout << "binarySearch<string>(stringArr,length,cdf): " << binarySearch<string>(stringArr,length,s)) << endl; }
0debug
Javascript simple taks : So, my task is to sort an array in Javascript by one parameter - value. It is calculated via .map method which applies a formula to some object parameters, calculating them. .map is supposed to return an array so that I could use is for sorting, but somehow I get undefined. This Javascript task should be simple, yet I don’t get it! Here is the code function comparisonGame () { var peopleArr = [ person_1 = { name: 'Nikita', age: 26, height: 182, value: 0 }, person_2 = { name: 'Pasha', age: 28, height: 193, value: 0 }, person_3 = { name: 'Olexey', age: 31, height: 168, value: 0 } ]; var transformendArr = []; function compare (value_1, value_2) { if(value_1<value_2) { return 1; } else if (value_1=value_2) { return -1; } else { return 0; } } transformendArr = peopleArr.map(function (age, height) { return this.value = this.age * 5 + this.height; }); var sortedArr = transformendArr.value.sort(compare); return this.sortedArr[0].name; } alert(comparisonGame() + ' is a winner!')
0debug
Pace.Js help to link another page when loader finish : <p>i have the index, but i want to load another page, after he pace.js loader finish, i modify the default properties of time the time intervals, but i want to show the some another page after this loader finish, i think some pace script code is required. please help.</p> <p>this is my html</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt; &lt;title&gt;Casa del nino&lt;/title&gt; &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous"&gt; &lt;script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"&gt;&lt;/script&gt; &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"&gt;&lt;/script&gt; &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"&gt;&lt;/script&gt; &lt;script src="pace/pace.js"&gt;&lt;/script&gt; &lt;link href="pace/themes/green/pace-theme-loading-bar.css" rel="stylesheet" /&gt; &lt;link rel="stylesheet" href="casanino2.css"&gt; &lt;/head&gt; &lt;body class="image" &gt; &lt;script&gt; Pace.start() &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>this is my css code</p> <pre><code> .image{ background: url('imagenes/20130819180556.jpg') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; background-size: cover; -o-background-size: cover; } </code></pre>
0debug
static av_cold int pcm_decode_init(AVCodecContext *avctx) { PCMDecode *s = avctx->priv_data; int i; if (avctx->channels <= 0) { av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n"); return AVERROR(EINVAL); } switch (avctx->codec->id) { case AV_CODEC_ID_PCM_ALAW: for (i = 0; i < 256; i++) s->table[i] = alaw2linear(i); break; case AV_CODEC_ID_PCM_MULAW: for (i = 0; i < 256; i++) s->table[i] = ulaw2linear(i); break; default: break; } avctx->sample_fmt = avctx->codec->sample_fmts[0]; if (avctx->sample_fmt == AV_SAMPLE_FMT_S32) avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec->id); avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; return 0; }
1threat
static inline void gen_scas(DisasContext *s, int ot) { gen_op_mov_TN_reg(OT_LONG, 0, R_EAX); gen_string_movl_A0_EDI(s); gen_op_ld_T1_A0(ot + s->mem_index); gen_op_cmpl_T0_T1_cc(); gen_op_movl_T0_Dshift[ot](); #ifdef TARGET_X86_64 if (s->aflag == 2) { gen_op_addq_EDI_T0(); } else #endif if (s->aflag) { gen_op_addl_EDI_T0(); } else { gen_op_addw_EDI_T0(); } }
1threat
PHP error: "The zip extension and unzip command are both missing, skipping." : <p>When I run a <code>composer update</code> I get this error message:</p> <pre><code>Loading composer repositories with package information Updating dependencies (including require-dev) Failed to download psr/log from dist: The zip extension and unzip command are both missing, skipping. The php.ini used by your command-line PHP is: /etc/php/7.0/cli/php.ini Now trying to download from source </code></pre> <p>What do I need to do to enable the zip and unzip commands so that composer can download dependencies?</p>
0debug
How to to compare numbers in a list, to the average of all the numbers in the same list. : import random def average(): infile = open("pa8_numbers.py") global mylist mylist = [] num = infile.readline() while num != "": mylist.append(eval(num)) num = infile.readline() Sum = 0 for x in mylist: Sum = x + Sum global avg avg = Sum/10000 print("Average: ", end=''), print(format(avg, '.2f')) These I don't know about, I know it's having trouble getting 'avg' and 'mylist' from of def, but I'm really bad at object oriented programming. Is there a work around? def above(mylist, avg): acount = 0 abv = avg + 10 for a in mylist: if a in range(eval(avg, abv)): count = count + 1 print(acount) def below(mylist, avg): bcount = 0 blw = avg - 10 for a in mylist: if a in range(avg, blw): count = count + 1 print(bcount) def main(): outfile = open("pa8_numbers.py","w") for i in range(10000): data = random.randint(1,100) outfile.write(str(data)+"\n") outfile.close() print("Statistics") print("---------------------") average() above(mylist, avg) below(mylist, avg) main() The goal is to make a list of 100 random numbers, sum those numbers and find the avg. The compare the list of random numbers to the avg+10 and avg-10. And Count how many random number from the list fall in the category avg+10 and avg-10. Please help, thanks
0debug
winston: Attempt to write logs with no transports - using default logger : <p>I followed a tutorial to set up winston (2.x) default logger in my express app. When updating to the current version of winston (3.0.0) I have a problem with adding the transports. I have followed the <a href="https://github.com/winstonjs/winston#using-the-default-logger" rel="noreferrer">latest docs</a> but still I get the notice in console and no log files are created at all:</p> <blockquote> <p>[winston] Attempt to write logs with no transports</p> </blockquote> <p><em>logging.js</em></p> <pre><code>const winston = require('winston'); module.exports = function () { const files = new winston.transports.File({ filename: 'logfile.log' }); const myconsole = new winston.transports.Console(); winston.add(myconsole); winston.add(files); } </code></pre> <p><em>index.js</em></p> <pre><code>const winston = require('winston'); ... require('./logging'); winston.info("Give some info"); </code></pre> <blockquote> <p>[winston] Attempt to write logs with no transports {"message":"Give some info","level":"info"}</p> </blockquote> <p><strong>What am I doing wrong?</strong></p>
0debug
Convert String "MM/dd/yy" in to date MM/dd/yyyy : <p>I am try to convert string 11/08/91(MM/dd/yy) into 11/08/1991(MM/dd/yyyy) but it is give wrong output link <strong>Date is :0091-11-07 18:06:32 +0000</strong></p> <ul> <li>My original output is 11/08/1991</li> </ul> <p>My Code</p> <pre><code>NSString *strdate = @"11/08/91"; NSDateFormatter *dateformate=[[NSDateFormatter alloc]init]; [dateformate setDateFormat:@"MM/dd/yyyy"]; NSDate *date = [dateformate dateFromString:strdate]; NSLog(@"Date is :%@",date); </code></pre>
0debug
static int nbd_negotiate_read(QIOChannel *ioc, void *buffer, size_t size) { ssize_t ret; guint watch; assert(qemu_in_coroutine()); watch = qio_channel_add_watch(ioc, G_IO_IN, nbd_negotiate_continue, qemu_coroutine_self(), NULL); ret = read_sync(ioc, buffer, size, NULL); g_source_remove(watch); return ret; }
1threat
QObject *object_property_get_qobject(Object *obj, const char *name, Error **errp) { QObject *ret = NULL; Error *local_err = NULL; Visitor *v; v = qmp_output_visitor_new(&ret); object_property_get(obj, v, name, &local_err); if (!local_err) { visit_complete(v, &ret); } error_propagate(errp, local_err); visit_free(v); return ret; }
1threat
static char *regname(uint32_t addr) { static char buf[16]; if (addr < PCI_IO_SIZE) { const char *r = reg[addr / 4]; if (r != 0) { sprintf(buf, "%s+%u", r, addr % 4); } else { sprintf(buf, "0x%02x", addr); } } else { sprintf(buf, "??? 0x%08x", addr); } return buf; }
1threat
Angular 2 scroll to top on route change not working : <p>I am trying to scroll to the top of my page on my angular 2 site when the route changes, I have tried the following, but nothing happens, when I change the route from one page to another, the page is scrolled to where it was on the first page:</p> <pre><code>import { Component, OnInit } from '@angular/core'; import { Router, NavigationEnd } from '@angular/router'; @Component({ selector: 'my-app', template: '&lt;ng-content&gt;&lt;/ng-content&gt;', }) export class MyAppComponent implements OnInit { constructor(private router: Router) { } ngOnInit() { this.router.events.subscribe((evt) =&gt; { if (!(evt instanceof NavigationEnd)) { return; } window.scrollTo(0, 0) }); } } </code></pre> <p>What am I doing wrong?</p>
0debug
How dose Angular or Typescripts work? : I dont know exactly how Angular or Typescripts works, I think in this code , it should be 3 1 2. but it is 1 2 3. Please help me. confirmDelete(id: number) { this.commentService.queryByStoryId(id).subscribe( (res: ResponseWrapper) => { this.comments = res.json; console.log(3); }, (res: ResponseWrapper) => this.onError(res.json) ); console.log(1); console.log(2); // for (let i = 0; i < this.comments.length; i++) { // this.commentService.delete(this.comments[i].id); // } this.postService.delete(id).subscribe((response) => { this.eventManager.broadcast({ name: 'postListModification', content: 'Deleted an post' }); this.activeModal.dismiss(true); }); } [Code][1] [Console][2] [1]: https://i.stack.imgur.com/rIEat.png [2]: https://i.stack.imgur.com/MEcs6.png
0debug
Custom HTML,CSS Scrollbar : <p>Looking for scrollbar that has no inside body, only arrows should available to scroll content. Is it possible? In the snippet, the body has a scrollbar with up and down arrow, I don't want a mid area of scrollbar, just custom arrows that do the same thing(maybe it's called scroll thumb or something else don't know).</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>body { height:700px; overflow:scroll; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;Div with some content&lt;/body&gt;</code></pre> </div> </div> </p>
0debug
Java io: Create folder and print to text file from command : for example you this command where the second word is directory plus file name: String fileName = "createF dir/text.txt"; String textToFile="apples, oranges"; How can I make "dir/text.txt" to make folder called dir and create a txtfile and write to it. The issue is it is a command. And it is file name can be changed to another file name. I can't use FileWriter method. It gives no directory error.
0debug
How to create a redis cloud connection url with an auth password : <p>I'm switching over from a heroku addon to a direct redis cloud account and am a bit puzzled on how to generate the redis url with the auth info.</p> <p>The old heroku add-on url was in the format of <code>redis://rediscloud:mypassword@redis...</code></p> <p>However in the dashboard and documentation I don't see any mention of a username to go along with the password. Do I still set <code>rediscloud</code> as the username in my new account and connection string. Does it even matter what I set as the username there?</p>
0debug
void avcodec_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int64_t channel_layout) { int i; if (channel_layout==0) channel_layout = avcodec_guess_channel_layout(nb_channels, CODEC_ID_NONE, NULL); for (i=0; channel_layout_map[i].name; i++) if (nb_channels == channel_layout_map[i].nb_channels && channel_layout == channel_layout_map[i].layout) { snprintf(buf, buf_size, channel_layout_map[i].name); return; } snprintf(buf, buf_size, "%d channels", nb_channels); if (channel_layout) { int i,ch; av_strlcat(buf, " (", buf_size); for(i=0,ch=0; i<64; i++) { if ((channel_layout & (1L<<i))) { const char *name = get_channel_name(i); if (name) { if (ch>0) av_strlcat(buf, "|", buf_size); av_strlcat(buf, name, buf_size); } ch++; } } av_strlcat(buf, ")", buf_size); } }
1threat
Is it possible to use a foreach to make new objects inside an IEnumberable? : Using *xunit* I want to pass a list of strings to a test (using ClassData or MemberData) Is there a way to do something like this but with a list: **before:** public static IEnumerable<object[]> GetPersonFromDataGenerator() { yield return new object[] { new Person {"Tribbiani"}, new Person {"Gotti"}, new Person {"Sopranos"}, new Person {"Corleone"} }; } **after:** public static IEnumerable<object[]> GetPersonFromDataGenerator() { var listOfPersons = GetList(); yield return new object[] { foreach(var p in listOfPersons) { new Person {p} } }; }
0debug
Html to content management system : <p>Hi I started learning web design couple of months ago and I just made my first functional site using HTML, CSS and JavaScript and PHP for my form. I wanted to find out if there is anyway I can transfer my whole site to a CMS without redesigning it. Thanks</p>
0debug
Kotlin "ternary operator" using WHEN : How to write Kotlin conditional if (a) b else c using WHEN
0debug
creating a simple electrical circuit using Three.JS : <p>I am a beginner to three.Js library.How can i implement/create a circuit having batteries,bulbs,ammeter,switches using Three.js with simple features like glowing of a bulb when circuit is closed,toggling of existing state(open/closed) of button when clicked ,i tried to search it over the internet but didn't get any useful information regarding this.Can anyone attach some links or provide some information regarding this?</p>
0debug
static int init_directory(BDRVVVFATState* s,const char* dirname) { bootsector_t* bootsector=(bootsector_t*)&(s->first_sectors[(s->first_sectors_number-1)*0x200]); unsigned int i; unsigned int cluster; memset(&(s->first_sectors[0]),0,0x40*0x200); s->sectors_per_fat=0xfc; s->sectors_per_cluster=0x10; s->cluster_size=s->sectors_per_cluster*0x200; s->cluster=malloc(s->cluster_size); array_init(&(s->mapping),sizeof(mapping_t)); array_init(&(s->directory),sizeof(direntry_t)); array_init(&(s->commit),sizeof(commit_t)); { direntry_t* entry=array_get_next(&(s->directory)); entry->attributes=0x28; snprintf(entry->name,11,"QEMU VVFAT"); } if(read_directory(s,dirname,0)) return -1; s->sectors_for_directory=s->directory.next/0x10; s->faked_sectors=s->first_sectors_number+s->sectors_per_fat*2+s->sectors_for_directory; s->cluster_count=(s->sector_count-s->faked_sectors)/s->sectors_per_cluster; init_fat(s); cluster=s->sectors_for_directory/s->sectors_per_cluster; assert(s->sectors_for_directory%s->sectors_per_cluster==0); if(s->first_file_mapping>0) { mapping_t* mapping=array_get(&(s->mapping),s->first_file_mapping-1); mapping->end=cluster; } for(i=1;i<s->mapping.next;i++) { mapping_t* mapping=array_get(&(s->mapping),i); direntry_t* direntry=array_get(&(s->directory),mapping->dir_index); if(mapping->mode==MODE_DIRECTORY) { int i; #ifdef DEBUG fprintf(stderr,"assert: %s %d < %d\n",mapping->filename,(int)mapping->begin,(int)mapping->end); #endif assert(mapping->begin<mapping->end); for(i=mapping->begin;i<mapping->end-1;i++) fat_set(s,i,i+1); fat_set(s,i,0x7fffffff); } else { unsigned int end_cluster=cluster+mapping->end/s->cluster_size; if(end_cluster>=s->cluster_count) { fprintf(stderr,"Directory does not fit in FAT%d\n",s->fat_type); return -1; } mapping->begin=cluster; mapping->mode=MODE_NORMAL; mapping->offset=0; direntry->size=cpu_to_le32(mapping->end); if(direntry->size==0) { direntry->begin=0; mapping->end=cluster; continue; } direntry->begin=cpu_to_le16(cluster); mapping->end=end_cluster+1; for(;cluster<end_cluster;cluster++) fat_set(s,cluster,cluster+1); fat_set(s,cluster,0x7fffffff); cluster++; } } s->current_mapping=0; bootsector->jump[0]=0xeb; bootsector->jump[1]=0x3e; bootsector->jump[2]=0x90; memcpy(bootsector->name,"QEMU ",8); bootsector->sector_size=cpu_to_le16(0x200); bootsector->sectors_per_cluster=s->sectors_per_cluster; bootsector->reserved_sectors=cpu_to_le16(1); bootsector->number_of_fats=0x2; bootsector->root_entries=cpu_to_le16(s->sectors_of_root_directory*0x10); bootsector->zero=0; bootsector->media_type=(s->first_sectors_number==1?0xf0:0xf8); bootsector->sectors_per_fat=cpu_to_le16(s->sectors_per_fat); bootsector->sectors_per_track=cpu_to_le16(0x3f); bootsector->number_of_heads=cpu_to_le16(0x10); bootsector->hidden_sectors=cpu_to_le32(s->first_sectors_number==1?0:0x3f); bootsector->total_sectors=cpu_to_le32(s->sector_count); bootsector->u.fat16.drive_number=0x80; bootsector->u.fat16.current_head=0; bootsector->u.fat16.signature=0x29; bootsector->u.fat16.id=cpu_to_le32(0xfabe1afd); memcpy(bootsector->u.fat16.volume_label,"QEMU VVFAT ",11); memcpy(bootsector->fat_type,(s->fat_type==12?"FAT12 ":s->fat_type==16?"FAT16 ":"FAT32 "),8); bootsector->magic[0]=0x55; bootsector->magic[1]=0xaa; return 0; }
1threat
How i can get Data from Wordpress plugin in json, like if a plugin showing data on wordpress , i want also get json and use in android : i upload a plugin on wordpress and all set it is working fine and fetching data, but same data i have to use in android as web service, How can this happen. is it possible? i download plugin and search url's from where plugin getting data but not found. i have download plugin but not understanding.
0debug
How to store a cell value in excel and increment it with adjacent changing value? : <p>Example - I have cell A2 = 10 and B2= 300+A2. The value in B2 will be 310. Now, if I change the value in A2 to 20, I want the value in B2 to automatically change to 330 (and not 300+20). Is there any VBA code or Excel formula which can make this happen?</p>
0debug
static void pci_bridge_region_cleanup(PCIBridge *br) { PCIBus *parent = br->dev.bus; pci_bridge_cleanup_alias(&br->alias_io, parent->address_space_io); pci_bridge_cleanup_alias(&br->alias_mem, parent->address_space_mem); pci_bridge_cleanup_alias(&br->alias_pref_mem, parent->address_space_mem); }
1threat
How to Trim leading and trailing tab spaces in MSSQL query : <p>I have data which has leading and trailing spaces in the string. when storing that data in database I want to trim the space in query itself before storing into DB.</p> <p>Normal spaces are trimming properly with RTRIM and LTRIM function but if a string contains tab space,its not trimming the tab space from the input string.</p> <p>Can anyone help me to get the string with trimmed with tab space from leading and trailing.</p>
0debug
static void arm_cpu_class_init(ObjectClass *oc, void *data) { ARMCPUClass *acc = ARM_CPU_CLASS(oc); CPUClass *cc = CPU_CLASS(acc); DeviceClass *dc = DEVICE_CLASS(oc); acc->parent_realize = dc->realize; dc->realize = arm_cpu_realizefn; dc->props = arm_cpu_properties; acc->parent_reset = cc->reset; cc->reset = arm_cpu_reset; cc->class_by_name = arm_cpu_class_by_name; cc->has_work = arm_cpu_has_work; cc->cpu_exec_interrupt = arm_cpu_exec_interrupt; cc->dump_state = arm_cpu_dump_state; cc->set_pc = arm_cpu_set_pc; cc->gdb_read_register = arm_cpu_gdb_read_register; cc->gdb_write_register = arm_cpu_gdb_write_register; #ifdef CONFIG_USER_ONLY cc->handle_mmu_fault = arm_cpu_handle_mmu_fault; #else cc->do_interrupt = arm_cpu_do_interrupt; cc->get_phys_page_debug = arm_cpu_get_phys_page_debug; cc->vmsd = &vmstate_arm_cpu; cc->virtio_is_big_endian = arm_cpu_is_big_endian; #endif cc->gdb_num_core_regs = 26; cc->gdb_core_xml_file = "arm-core.xml"; cc->gdb_stop_before_watchpoint = true; cc->debug_excp_handler = arm_debug_excp_handler; cc->disas_set_info = arm_disas_set_info; }
1threat
Update one column based on the first 3 letters of another : <p>can someone help show me how to update one field in my table based on the first 3 letters in another field in MySql?</p> <p>in my tblpeople I have a column called location, in it are various codes but where the code starts VOL- then I need to update the country column to USA, if it starts HOM- then update to Canada and finally HOME to united kingdom</p>
0debug
Plotting multi histograms in one. with R : I have a set of data with 5 columns of data. Im looking to put all 5 into a single histagram/ or similar, to compare them. `ggplot()+geom_histogram(data=Ft_max, aes(x=1,2,3,4,5)) does not seem to be having anyt effect and I was hoping to get some advise.
0debug
VBA: Single line if statement with multiple actions : <p>I really should be able to google this, but I can't find what I wanna know about.</p> <p>I want to check if a file exists. If not, a MessageBox should pop up and VBA should exit the sub.</p> <pre><code>If Dir("C:\file.txt", vbDirectory) = "" Then MsgBox "File doesn't exist" Exit Sub End If </code></pre> <p>It works, I just wanna know if you can you do this in a single line statement? Does VBA allow this when more than one thing is supposed to happen (like it is the case here)? This code doesn't work (syntax error): </p> <pre><code>If Dir("C:\file.txt", vbDirectory) = "" Then MsgBox "File doesn't exist" And Exit Sub </code></pre>
0debug
Mac .bash_profile double quotes (straight and curly) : <p><a href="https://i.stack.imgur.com/of0DT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/of0DT.png" alt="enter image description here"></a></p> <p>While running alias <strong>bb</strong> I was getting error.</p> <pre><code>. .bash_profile -bash: alias: off: not found -bash: alias: =: not found -bash: alias: “open: not found -bash: alias: -e: not found -bash: alias: .bash_profile”: not found </code></pre> <p>Upon further investing I found its due to the way double quotes are automatically changed from <strong>straight-quotes</strong> to <strong>curly-quotes</strong> in mac. So I changed keyboard preferences of Mac to <strong>straight-quotes</strong> and now alias <strong>bp</strong> works fine.</p> <p>I wonder why the <strong>curly-quotes</strong> didn't work in bash, took me a while to figure out the issue.</p>
0debug
Name of method same like class, what it means? : Need help, I couldn't to figure out why no error class DerivedPoint { public DerivedPoint(string fName, string Name, double sallary) { } }
0debug
def unique_sublists(list1): result ={} for l in list1: result.setdefault(tuple(l), list()).append(1) for a, b in result.items(): result[a] = sum(b) return result
0debug
link textbox with listbox in userform : guys i have two textbox one for search to show data from sheet to listbox and the other to show value what i would is any code to show value in textbox2 after show the data in list box the list box have 7 column the total value which show in textbox from the column7 automatically without any command button
0debug
Why is size() function of std::string[] array returning an incorrect number of parameters : <p>This is a simple 2 line question that I just don't understand. </p> <p>I just created an array with 3 members, and immediately afterwards, the size is reported as 6. It was working before, but all of sudden changed. I tried cleaning my project.</p> <p>This is using Visual Studio 2015</p> <pre><code>std::string detectionMethods[3] = { "SQUARE", "CIRCLE", "CIRCLE-SSV" }; int k_size = detectionMethods-&gt;length(); </code></pre> <p>Thanks,</p> <p><a href="https://i.stack.imgur.com/iZcM6.jpg" rel="nofollow noreferrer">Source code and debug screenshot</a></p>
0debug
Create custom UI Button with 2 text colors? : <p>I have a UIButton mock-up and I want to make the number red as the mock-up. can someone help me to how to do it?</p> <p><a href="https://i.stack.imgur.com/SF5W1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SF5W1.png" alt="enter image description here"></a> </p> <pre><code>func arrowRightButton(baseColor:UIColor){ self.setTitleColor(baseColor, for: .normal) self.setTitleColor(baseColor.withAlphaComponent(0.3), for: .highlighted) guard let image = UIImage(named: "ArrowRight")?.withRenderingMode(.alwaysTemplate) else { return } guard let imageHighlight = UIImage(named: "ArrowRight")?.alpha(0.3)?.withRenderingMode(.alwaysTemplate) else { return } self.imageView?.contentMode = .scaleAspectFit self.setImage(image, for: .normal) self.setImage(imageHighlight, for: .highlighted) self.imageEdgeInsets = UIEdgeInsets(top: 0, left: self.bounds.size.width-image.size.width*1.5, bottom: 0, right: 0); self.layer.borderWidth = 1.0 self.layer.borderColor = UIColor(red:0.29, green:0.64, blue:0.80, alpha:1.0).cgColor self.contentEdgeInsets = UIEdgeInsets(top: 10,left: 0,bottom: 10,right: 0) } </code></pre>
0debug
how to avoid java.util.zip.ZipException in android studio at build time : Do not suggest to clean build or ./gredlew clean solution already tried a lot. I simply want to avoid this error without excluding any jar file. Error details com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/cardview/BuildConfig.class
0debug
static int nbd_opt_go(QIOChannel *ioc, const char *wantname, NBDExportInfo *info, Error **errp) { nbd_opt_reply reply; uint32_t len = strlen(wantname); uint16_t type; int error; char *buf; info->flags = 0; trace_nbd_opt_go_start(wantname); buf = g_malloc(4 + len + 2 + 2 * info->request_sizes + 1); stl_be_p(buf, len); memcpy(buf + 4, wantname, len); stw_be_p(buf + 4 + len, info->request_sizes); if (info->request_sizes) { stw_be_p(buf + 4 + len + 2, NBD_INFO_BLOCK_SIZE); } if (nbd_send_option_request(ioc, NBD_OPT_GO, 4 + len + 2 + 2 * info->request_sizes, buf, errp) < 0) { return -1; } while (1) { if (nbd_receive_option_reply(ioc, NBD_OPT_GO, &reply, errp) < 0) { return -1; } error = nbd_handle_reply_err(ioc, &reply, errp); if (error <= 0) { return error; } len = reply.length; if (reply.type == NBD_REP_ACK) { if (len) { error_setg(errp, "server sent invalid NBD_REP_ACK"); nbd_send_opt_abort(ioc); return -1; } if (!info->flags) { error_setg(errp, "broken server omitted NBD_INFO_EXPORT"); nbd_send_opt_abort(ioc); return -1; } trace_nbd_opt_go_success(); return 1; } if (reply.type != NBD_REP_INFO) { error_setg(errp, "unexpected reply type %" PRIx32 " (%s), expected %x", reply.type, nbd_rep_lookup(reply.type), NBD_REP_INFO); nbd_send_opt_abort(ioc); return -1; } if (len < sizeof(type)) { error_setg(errp, "NBD_REP_INFO length %" PRIu32 " is too short", len); nbd_send_opt_abort(ioc); return -1; } if (nbd_read(ioc, &type, sizeof(type), errp) < 0) { error_prepend(errp, "failed to read info type"); nbd_send_opt_abort(ioc); return -1; } len -= sizeof(type); be16_to_cpus(&type); switch (type) { case NBD_INFO_EXPORT: if (len != sizeof(info->size) + sizeof(info->flags)) { error_setg(errp, "remaining export info len %" PRIu32 " is unexpected size", len); nbd_send_opt_abort(ioc); return -1; } if (nbd_read(ioc, &info->size, sizeof(info->size), errp) < 0) { error_prepend(errp, "failed to read info size"); nbd_send_opt_abort(ioc); return -1; } be64_to_cpus(&info->size); if (nbd_read(ioc, &info->flags, sizeof(info->flags), errp) < 0) { error_prepend(errp, "failed to read info flags"); nbd_send_opt_abort(ioc); return -1; } be16_to_cpus(&info->flags); trace_nbd_receive_negotiate_size_flags(info->size, info->flags); break; case NBD_INFO_BLOCK_SIZE: if (len != sizeof(info->min_block) * 3) { error_setg(errp, "remaining export info len %" PRIu32 " is unexpected size", len); nbd_send_opt_abort(ioc); return -1; } if (nbd_read(ioc, &info->min_block, sizeof(info->min_block), errp) < 0) { error_prepend(errp, "failed to read info minimum block size"); nbd_send_opt_abort(ioc); return -1; } be32_to_cpus(&info->min_block); if (!is_power_of_2(info->min_block)) { error_setg(errp, "server minimum block size %" PRId32 "is not a power of two", info->min_block); nbd_send_opt_abort(ioc); return -1; } if (nbd_read(ioc, &info->opt_block, sizeof(info->opt_block), errp) < 0) { error_prepend(errp, "failed to read info preferred block size"); nbd_send_opt_abort(ioc); return -1; } be32_to_cpus(&info->opt_block); if (!is_power_of_2(info->opt_block) || info->opt_block < info->min_block) { error_setg(errp, "server preferred block size %" PRId32 "is not valid", info->opt_block); nbd_send_opt_abort(ioc); return -1; } if (nbd_read(ioc, &info->max_block, sizeof(info->max_block), errp) < 0) { error_prepend(errp, "failed to read info maximum block size"); nbd_send_opt_abort(ioc); return -1; } be32_to_cpus(&info->max_block); trace_nbd_opt_go_info_block_size(info->min_block, info->opt_block, info->max_block); break; default: trace_nbd_opt_go_info_unknown(type, nbd_info_lookup(type)); if (nbd_drop(ioc, len, errp) < 0) { error_prepend(errp, "Failed to read info payload"); nbd_send_opt_abort(ioc); return -1; } break; } } }
1threat
static MemTxResult gic_cpu_read(GICState *s, int cpu, int offset, uint64_t *data, MemTxAttrs attrs) { switch (offset) { case 0x00: *data = s->cpu_enabled[cpu]; break; case 0x04: *data = s->priority_mask[cpu]; break; case 0x08: if (s->security_extn && !attrs.secure) { *data = s->abpr[cpu]; } else { *data = s->bpr[cpu]; } break; case 0x0c: *data = gic_acknowledge_irq(s, cpu); break; case 0x14: *data = s->running_priority[cpu]; break; case 0x18: *data = s->current_pending[cpu]; break; case 0x1c: if (!gic_has_groups(s) || (s->security_extn && !attrs.secure)) { *data = 0; } else { *data = s->abpr[cpu]; } break; case 0xd0: case 0xd4: case 0xd8: case 0xdc: *data = s->apr[(offset - 0xd0) / 4][cpu]; break; default: qemu_log_mask(LOG_GUEST_ERROR, "gic_cpu_read: Bad offset %x\n", (int)offset); return MEMTX_ERROR; } return MEMTX_OK; }
1threat
static void gen_dmtc0 (CPUState *env, DisasContext *ctx, int reg, int sel) { const char *rn = "invalid"; if (sel != 0) check_insn(env, ctx, ISA_MIPS64); switch (reg) { case 0: switch (sel) { case 0: gen_op_mtc0_index(); rn = "Index"; break; case 1: check_mips_mt(env, ctx); gen_op_mtc0_mvpcontrol(); rn = "MVPControl"; break; case 2: check_mips_mt(env, ctx); rn = "MVPConf0"; break; case 3: check_mips_mt(env, ctx); rn = "MVPConf1"; break; default: goto die; } break; case 1: switch (sel) { case 0: rn = "Random"; break; case 1: check_mips_mt(env, ctx); gen_op_mtc0_vpecontrol(); rn = "VPEControl"; break; case 2: check_mips_mt(env, ctx); gen_op_mtc0_vpeconf0(); rn = "VPEConf0"; break; case 3: check_mips_mt(env, ctx); gen_op_mtc0_vpeconf1(); rn = "VPEConf1"; break; case 4: check_mips_mt(env, ctx); gen_op_mtc0_yqmask(); rn = "YQMask"; break; case 5: check_mips_mt(env, ctx); gen_op_mtc0_vpeschedule(); rn = "VPESchedule"; break; case 6: check_mips_mt(env, ctx); gen_op_mtc0_vpeschefback(); rn = "VPEScheFBack"; break; case 7: check_mips_mt(env, ctx); gen_op_mtc0_vpeopt(); rn = "VPEOpt"; break; default: goto die; } break; case 2: switch (sel) { case 0: gen_op_mtc0_entrylo0(); rn = "EntryLo0"; break; case 1: check_mips_mt(env, ctx); gen_op_mtc0_tcstatus(); rn = "TCStatus"; break; case 2: check_mips_mt(env, ctx); gen_op_mtc0_tcbind(); rn = "TCBind"; break; case 3: check_mips_mt(env, ctx); gen_op_mtc0_tcrestart(); rn = "TCRestart"; break; case 4: check_mips_mt(env, ctx); gen_op_mtc0_tchalt(); rn = "TCHalt"; break; case 5: check_mips_mt(env, ctx); gen_op_mtc0_tccontext(); rn = "TCContext"; break; case 6: check_mips_mt(env, ctx); gen_op_mtc0_tcschedule(); rn = "TCSchedule"; break; case 7: check_mips_mt(env, ctx); gen_op_mtc0_tcschefback(); rn = "TCScheFBack"; break; default: goto die; } break; case 3: switch (sel) { case 0: gen_op_mtc0_entrylo1(); rn = "EntryLo1"; break; default: goto die; } break; case 4: switch (sel) { case 0: gen_op_mtc0_context(); rn = "Context"; break; case 1: rn = "ContextConfig"; default: goto die; } break; case 5: switch (sel) { case 0: gen_op_mtc0_pagemask(); rn = "PageMask"; break; case 1: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_pagegrain(); rn = "PageGrain"; break; default: goto die; } break; case 6: switch (sel) { case 0: gen_op_mtc0_wired(); rn = "Wired"; break; case 1: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_srsconf0(); rn = "SRSConf0"; break; case 2: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_srsconf1(); rn = "SRSConf1"; break; case 3: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_srsconf2(); rn = "SRSConf2"; break; case 4: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_srsconf3(); rn = "SRSConf3"; break; case 5: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_srsconf4(); rn = "SRSConf4"; break; default: goto die; } break; case 7: switch (sel) { case 0: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_hwrena(); rn = "HWREna"; break; default: goto die; } break; case 8: rn = "BadVaddr"; break; case 9: switch (sel) { case 0: gen_op_mtc0_count(); rn = "Count"; break; default: goto die; } ctx->bstate = BS_STOP; break; case 10: switch (sel) { case 0: gen_op_mtc0_entryhi(); rn = "EntryHi"; break; default: goto die; } break; case 11: switch (sel) { case 0: gen_op_mtc0_compare(); rn = "Compare"; break; default: goto die; } ctx->bstate = BS_STOP; break; case 12: switch (sel) { case 0: gen_op_mtc0_status(); gen_save_pc(ctx->pc + 4); ctx->bstate = BS_EXCP; rn = "Status"; break; case 1: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_intctl(); ctx->bstate = BS_STOP; rn = "IntCtl"; break; case 2: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_srsctl(); ctx->bstate = BS_STOP; rn = "SRSCtl"; break; case 3: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_srsmap(); ctx->bstate = BS_STOP; rn = "SRSMap"; break; default: goto die; } break; case 13: switch (sel) { case 0: gen_op_mtc0_cause(); rn = "Cause"; break; default: goto die; } ctx->bstate = BS_STOP; break; case 14: switch (sel) { case 0: gen_op_mtc0_epc(); rn = "EPC"; break; default: goto die; } break; case 15: switch (sel) { case 0: rn = "PRid"; break; case 1: check_insn(env, ctx, ISA_MIPS32R2); gen_op_mtc0_ebase(); rn = "EBase"; break; default: goto die; } break; case 16: switch (sel) { case 0: gen_op_mtc0_config0(); rn = "Config"; ctx->bstate = BS_STOP; break; case 1: rn = "Config1"; break; case 2: gen_op_mtc0_config2(); rn = "Config2"; ctx->bstate = BS_STOP; break; case 3: rn = "Config3"; break; default: rn = "Invalid config selector"; goto die; } break; case 17: switch (sel) { case 0: rn = "LLAddr"; break; default: goto die; } break; case 18: switch (sel) { case 0 ... 7: gen_op_mtc0_watchlo(sel); rn = "WatchLo"; break; default: goto die; } break; case 19: switch (sel) { case 0 ... 7: gen_op_mtc0_watchhi(sel); rn = "WatchHi"; break; default: goto die; } break; case 20: switch (sel) { case 0: check_insn(env, ctx, ISA_MIPS3); gen_op_mtc0_xcontext(); rn = "XContext"; break; default: goto die; } break; case 21: switch (sel) { case 0: gen_op_mtc0_framemask(); rn = "Framemask"; break; default: goto die; } break; case 22: rn = "Diagnostic"; break; case 23: switch (sel) { case 0: gen_op_mtc0_debug(); gen_save_pc(ctx->pc + 4); ctx->bstate = BS_EXCP; rn = "Debug"; break; case 1: ctx->bstate = BS_STOP; rn = "TraceControl"; case 2: ctx->bstate = BS_STOP; rn = "TraceControl2"; case 3: ctx->bstate = BS_STOP; rn = "UserTraceData"; case 4: ctx->bstate = BS_STOP; rn = "TraceBPC"; default: goto die; } break; case 24: switch (sel) { case 0: gen_op_mtc0_depc(); rn = "DEPC"; break; default: goto die; } break; case 25: switch (sel) { case 0: gen_op_mtc0_performance0(); rn = "Performance0"; break; case 1: rn = "Performance1"; case 2: rn = "Performance2"; case 3: rn = "Performance3"; case 4: rn = "Performance4"; case 5: rn = "Performance5"; case 6: rn = "Performance6"; case 7: rn = "Performance7"; default: goto die; } break; case 26: rn = "ECC"; break; case 27: switch (sel) { case 0 ... 3: rn = "CacheErr"; break; default: goto die; } break; case 28: switch (sel) { case 0: case 2: case 4: case 6: gen_op_mtc0_taglo(); rn = "TagLo"; break; case 1: case 3: case 5: case 7: gen_op_mtc0_datalo(); rn = "DataLo"; break; default: goto die; } break; case 29: switch (sel) { case 0: case 2: case 4: case 6: gen_op_mtc0_taghi(); rn = "TagHi"; break; case 1: case 3: case 5: case 7: gen_op_mtc0_datahi(); rn = "DataHi"; break; default: rn = "invalid sel"; goto die; } break; case 30: switch (sel) { case 0: gen_op_mtc0_errorepc(); rn = "ErrorEPC"; break; default: goto die; } break; case 31: switch (sel) { case 0: gen_op_mtc0_desave(); rn = "DESAVE"; break; default: goto die; } ctx->bstate = BS_STOP; break; default: goto die; } #if defined MIPS_DEBUG_DISAS if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "dmtc0 %s (reg %d sel %d)\n", rn, reg, sel); } #endif return; die: #if defined MIPS_DEBUG_DISAS if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "dmtc0 %s (reg %d sel %d)\n", rn, reg, sel); } #endif generate_exception(ctx, EXCP_RI); }
1threat
Error when I tried create new maven module in IntellijIDE 15 : <p>I tried add new module to project in IntellijIDE 15 and I have error</p> <pre><code>Failed to create a Maven project 'C:/gitProjects/mayProj/pom.xml' already exists in VFS </code></pre> <p>And in my project create file <code>moduleName.iml</code> but in IDE not shows module folder and in project structure this module is shows.</p>
0debug
Can't add setOnClickListener on function showInputDialog : I write a function to handle showing dialog but I can't use on click Listeriner to it what wrong with my code can any one tell me? Here is my function private void showInputDialog() { final Dialog dialog=new Dialog(MainDashboard.this); dialog.setContentView(R.layout.frg_dialog_change_pass); btn_save_password=(Button) findViewById(R.id.btn_save_password); btn_cancel_pass=(Button) findViewById(R.id.btn_cancel_pass); edtOldpass=(EditText) findViewById(R.id.edtOldpass); edtNewpass=(EditText) findViewById(R.id.edtNewpass); edtConfirmpass=(EditText)findViewById(R.id.edtConfirmpass); dialog.show();///Show the dialog. btn_save_password.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Toast.makeText(MainDashboard.this, "Success", Toast.LENGTH_SHORT).show(); dialog.cancel(); } });
0debug