problem
stringlengths
26
131k
labels
class label
2 classes
void ff_celt_quant_bands(CeltFrame *f, OpusRangeCoder *rc) { float lowband_scratch[8 * 22]; float norm1[2 * 8 * 100]; float *norm2 = norm1 + 8 * 100; int totalbits = (f->framebits << 3) - f->anticollapse_needed; int update_lowband = 1; int lowband_offset = 0; int i, j; for (i = f->start_band; i < f->end_band; i++) { uint32_t cm[2] = { (1 << f->blocks) - 1, (1 << f->blocks) - 1 }; int band_offset = ff_celt_freq_bands[i] << f->size; int band_size = ff_celt_freq_range[i] << f->size; float *X = f->block[0].coeffs + band_offset; float *Y = (f->channels == 2) ? f->block[1].coeffs + band_offset : NULL; float *norm_loc1, *norm_loc2; int consumed = opus_rc_tell_frac(rc); int effective_lowband = -1; int b = 0; if (i != f->start_band) f->remaining -= consumed; f->remaining2 = totalbits - consumed - 1; if (i <= f->coded_bands - 1) { int curr_balance = f->remaining / FFMIN(3, f->coded_bands-i); b = av_clip_uintp2(FFMIN(f->remaining2 + 1, f->pulses[i] + curr_balance), 14); } if ((ff_celt_freq_bands[i] - ff_celt_freq_range[i] >= ff_celt_freq_bands[f->start_band] || i == f->start_band + 1) && (update_lowband || lowband_offset == 0)) lowband_offset = i; if (i == f->start_band + 1) { int offset = 8 * ff_celt_freq_bands[i]; int count = 8 * (ff_celt_freq_range[i] - ff_celt_freq_range[i-1]); memcpy(&norm1[offset], &norm1[offset - count], count * sizeof(float)); if (f->channels == 2) memcpy(&norm2[offset], &norm2[offset - count], count * sizeof(float)); } if (lowband_offset != 0 && (f->spread != CELT_SPREAD_AGGRESSIVE || f->blocks > 1 || f->tf_change[i] < 0)) { int foldstart, foldend; effective_lowband = FFMAX(ff_celt_freq_bands[f->start_band], ff_celt_freq_bands[lowband_offset] - ff_celt_freq_range[i]); foldstart = lowband_offset; while (ff_celt_freq_bands[--foldstart] > effective_lowband); foldend = lowband_offset - 1; while (++foldend < i && ff_celt_freq_bands[foldend] < effective_lowband + ff_celt_freq_range[i]); cm[0] = cm[1] = 0; for (j = foldstart; j < foldend; j++) { cm[0] |= f->block[0].collapse_masks[j]; cm[1] |= f->block[f->channels - 1].collapse_masks[j]; } } if (f->dual_stereo && i == f->intensity_stereo) { f->dual_stereo = 0; for (j = ff_celt_freq_bands[f->start_band] << f->size; j < band_offset; j++) norm1[j] = (norm1[j] + norm2[j]) / 2; } norm_loc1 = effective_lowband != -1 ? norm1 + (effective_lowband << f->size) : NULL; norm_loc2 = effective_lowband != -1 ? norm2 + (effective_lowband << f->size) : NULL; if (f->dual_stereo) { cm[0] = f->pvq->quant_band(f->pvq, f, rc, i, X, NULL, band_size, b >> 1, f->blocks, norm_loc1, f->size, norm1 + band_offset, 0, 1.0f, lowband_scratch, cm[0]); cm[1] = f->pvq->quant_band(f->pvq, f, rc, i, Y, NULL, band_size, b >> 1, f->blocks, norm_loc2, f->size, norm2 + band_offset, 0, 1.0f, lowband_scratch, cm[1]); } else { cm[0] = f->pvq->quant_band(f->pvq, f, rc, i, X, Y, band_size, b >> 0, f->blocks, norm_loc1, f->size, norm1 + band_offset, 0, 1.0f, lowband_scratch, cm[0] | cm[1]); cm[1] = cm[0]; } f->block[0].collapse_masks[i] = (uint8_t)cm[0]; f->block[f->channels - 1].collapse_masks[i] = (uint8_t)cm[1]; f->remaining += f->pulses[i] + consumed; update_lowband = (b > band_size << 3); } }
1threat
static void do_boot_set(Monitor *mon, const QDict *qdict) { int res; const char *bootdevice = qdict_get_str(qdict, "bootdevice"); res = qemu_boot_set(bootdevice); if (res == 0) { monitor_printf(mon, "boot device list now set to %s\n", bootdevice); } else if (res > 0) { monitor_printf(mon, "setting boot device list failed\n"); } else { monitor_printf(mon, "no function defined to set boot device list for " "this architecture\n"); } }
1threat
i am not able to open my android studio after the first page whhich just show a box containing android studio image : [I am not able to open android studio as it is showing the below dilog box.][1] [1]: https://i.stack.imgur.com/gFAaI.png
0debug
static int find_allocation(BlockDriverState *bs, off_t start, off_t *data, off_t *hole) { BDRVGlusterState *s = bs->opaque; off_t offs; if (!s->supports_seek_data) { return -ENOTSUP; } offs = glfs_lseek(s->fd, start, SEEK_DATA); if (offs < 0) { return -errno; } assert(offs >= start); if (offs > start) { *hole = start; *data = offs; return 0; } offs = glfs_lseek(s->fd, start, SEEK_HOLE); if (offs < 0) { return -errno; } assert(offs >= start); if (offs > start) { *data = start; *hole = offs; return 0; } return -EBUSY; }
1threat
Angular Internal: What happens when we inherit a class : <p>Basically i searching to understand what happens when we inherit one class in another internally, also does it like bring performance issue incase if i inherit in n classes.</p>
0debug
javaFX crash when using an infinte loop : <p>I am trying to build a clock in javafx but the GUI crashes when I try using an infinite loop</p> <pre><code>while (true) { Date time = new Date(); // mins and hour are labels if (time.getMinutes() &lt; 10) { mins.setText("0" + Integer.toString(time.getMinutes())); } else { mins.setText(Integer.toString(time.getMinutes())); } if (time.getHours() &lt; 10) { hour.setText(0 + Integer.toString(time.getHours())); } else { hour.setText(Integer.toString(time.getHours())); } } </code></pre>
0debug
def check_subset_list(list1, list2): l1, l2 = list1[0], list2[0] exist = True for i in list2: if i not in list1: exist = False return exist
0debug
python getting error ValueError: too many values to unpack (expected 3) : <p>I have a code like this :</p> <pre><code> for stri in node.iter('string'): name= (stri.text) # name=name.replace(" ","_") a, b, c = name.split() name = b + "_" + c </code></pre> <p>I dont know why i get the error : </p> <pre><code>a, b, c = name.split() ValueError: too many values to unpack (expected 3) </code></pre> <p>it is very interesting that this code used to execute with no error!</p>
0debug
How to control Arduino program with Python GUI? : <p>I need help figuring how to control an Arduino program using a Python GUI. This is my first project involving user-interface design and Arduino so I don't know where to start with this task. Any starting tips or help would be greatly appreciated.</p> <p>The Arduino program is provided to me and the main function I am focusing on involves moving several motors to control a platform. So far I have created a basic GUI using the PyQt5 GUI Designer that allows for movement in the x, y, and z directions of the platform.</p> <p>I would first like to figure out how to execute a simple command such as setting the platform to the "Home" position (x, y, and z values set to 0) using the Python GUI first.</p> <p>This is the code in the Arduino program that I believe is involved in setting the platform to the "Home" position:</p> <pre><code>void goHome(){ setPos(arr0); if (altech == 1) { moveDiffSpd(servo_pos, spdOld); } if (altech == 2) { moveBresenham(servo_pos, spdOld); } getSerPos0(servo_pos); } void presetHome(){ setPos(arr0); // Return directly to HOME position for (int i=0; i&lt;6; i++){ if (Dynamixel.readPosition(i+1)!=servo_pos[i]) { Dynamixel.moveSpeedRW(i+1,servo_pos[i],spdOld); } } Dynamixel.action(); getSerPos0(servo_pos); } </code></pre> <p>I have very little experience with Arduino so there may be more in the code involved than this, if more are needed I may be able to provide that.</p> <p>This function is called when "H" is entered in the Arduino command line. </p> <p>Essentially I am trying to create an interface that would be able to the same thing as entering "H" to return to home but by clicking a button instead of typing out the command. Ideally I would be able to do this with the interface I created using PyQt5, but if another GUI program is more effective I could look into that.</p> <p>Again any help or starting points are appreciated. Thanks!</p>
0debug
How to use google speech recognition api in python? : <p>Stack overflow might not be the best place to ask this question but i need help. I have an mp3 file and i want to use google's speech recognition to get the text out of that file. Any ideas where i can find documentation or examples will be appreciated.</p>
0debug
Couldn't convert factor to numeric values in R for binning operation : I am provided with a dataset and I am asked to perform binning based on a particular column value. Here the column value is in factor when I tried converting to numeric I am getting either the NA coercion or getting the factor values but not the data in the table. **"data$imdbVotes <- as.numeric(as.character(data$imdbVotes))"** When I tried with this code I got the error **"Warning message: NAs introduced by coercion "**[This is the table provided and I have to perform binning based on IMDB votes][1] [1]: http://i.stack.imgur.com/FLi0t.png
0debug
Best way to periodically retrieve results from a thread : <p>I am new to threading, but I need to use threads in order to make my javafx application work. My problem is that I need to perform a lot of calculations in my program, and update the UI periodically in between. I am aware that making calculations in the javafx thread is blocking the UI update, so I need to move that work to another thread.</p> <p>What I need to know, since I have never worked with threads before is, what is the best way to periodically start that thread, do part of the calculations, and send the results back to the javafx thread. </p>
0debug
static void openpic_irq_raise(openpic_t *opp, int n_CPU, IRQ_src_t *src) { int n_ci = IDR_CI0 - n_CPU; if ((opp->flags & OPENPIC_FLAG_IDE_CRIT) && test_bit(&src->ide, n_ci)) { qemu_irq_raise(opp->dst[n_CPU].irqs[OPENPIC_OUTPUT_CINT]); } else { qemu_irq_raise(opp->dst[n_CPU].irqs[OPENPIC_OUTPUT_INT]); } }
1threat
uint32 float64_to_uint32( float64 a STATUS_PARAM ) { int64_t v; uint32 res; v = float64_to_int64(a STATUS_VAR); if (v < 0) { res = 0; float_raise( float_flag_invalid STATUS_VAR); } else if (v > 0xffffffff) { res = 0xffffffff; float_raise( float_flag_invalid STATUS_VAR); } else { res = v; } return res; }
1threat
Python regex, how to delete all matches from a string : <p>I have a list of regex patterns.</p> <pre><code>rgx_list = ['pattern_1', 'pattern_2', 'pattern_3'] </code></pre> <p>And I am using a function to loop through the list, compile the regex's, and apply a <code>findall</code> to grab the matched terms and then I would like a way of deleting said terms from the text.</p> <pre><code>def clean_text(rgx_list, text): matches = [] for r in rgx_list: rgx = re.compile(r) found_matches = re.findall(rgx, text) matches.append(found_matches) </code></pre> <p>I want to do something like <code>text.delete(matches)</code> so that all of the matches will be deleted from the text and then I can return the <em>cleansed</em> text. </p> <p>Does anyone know how to do this? My current code will only work for one match of each pattern, but the text may have more than <strong>one</strong> occurence of the same pattern and I would like to eliminate all matches.</p>
0debug
block_crypto_open_opts_init(QCryptoBlockFormat format, QemuOpts *opts, Error **errp) { OptsVisitor *ov; QCryptoBlockOpenOptions *ret = NULL; Error *local_err = NULL; ret = g_new0(QCryptoBlockOpenOptions, 1); ret->format = format; ov = opts_visitor_new(opts); visit_start_struct(opts_get_visitor(ov), NULL, NULL, 0, &local_err); if (local_err) { goto out; } switch (format) { case Q_CRYPTO_BLOCK_FORMAT_LUKS: visit_type_QCryptoBlockOptionsLUKS_members( opts_get_visitor(ov), &ret->u.luks, &local_err); break; default: error_setg(&local_err, "Unsupported block format %d", format); break; } error_propagate(errp, local_err); local_err = NULL; visit_end_struct(opts_get_visitor(ov), &local_err); out: if (local_err) { error_propagate(errp, local_err); qapi_free_QCryptoBlockOpenOptions(ret); ret = NULL; } opts_visitor_cleanup(ov); return ret; }
1threat
static void dec_store(DisasContext *dc) { TCGv t, *addr; unsigned int size; size = 1 << (dc->opcode & 3); LOG_DIS("s%d%s\n", size, dc->type_b ? "i" : ""); t_sync_flags(dc); sync_jmpstate(dc); addr = compute_ldst_addr(dc, &t); if ((dc->env->pvr.regs[2] & PVR2_UNALIGNED_EXC_MASK) && size > 1) { gen_helper_memalign(*addr, tcg_const_tl(dc->rd), tcg_const_tl(1), tcg_const_tl(size - 1)); gen_store(dc, *addr, cpu_R[dc->rd], size); if (addr == &t) tcg_temp_free(t);
1threat
C malloc struct implementation : <p>I am having a problem with the following program. When I try to compile it, it crashes. I guess it's a segmentation fault somewhere in insert function but I just can't figure out where.</p> <pre><code>char *names[HOW_MANY]= {"Simon", "Suzie", "Alfred", "Chip", "John", "Tim", "Harriet"}; int ages[HOW_MANY]= {22, 24, 106, 6, 18, 32, 24}; struct person { char name[40]; unsigned int age; struct person *next; }; struct person* insert(struct person *people[], char *name, int age) { struct person *ptr; ptr=(struct person * )malloc(sizeof(struct person)); if(ptr==NULL) { printf("error"); return; } //ptr=ptr-&gt;next; strcpy(ptr-&gt;name,name); ptr-&gt;age = age; ptr-&gt;next=NULL; } int main() { struct person *people[HOW_MANY]; for (int i =0; i&lt;HOW_MANY;i++) insert (people, names[i], ages[i]); for(int i=0;i&lt;HOW_MANY;i++) printf("%s %d\n", people[i]-&gt;name, people[i]-&gt;age); return 0; } </code></pre>
0debug
How this works in c,(a=b---) : //full code//What is the output of this program and how. #include<stdio.h> int main(){` int a=0,b=10; a=b--- printf("the value of b=%d",b); printf("the value of a=%d",a); return 0;` }
0debug
static int vc1_decode_intra_block(VC1Context *v, DCTELEM block[64], int n, int coded, int mquant, int codingset) { GetBitContext *gb = &v->s.gb; MpegEncContext *s = &v->s; int dc_pred_dir = 0; int run_diff, i; int16_t *dc_val; int16_t *ac_val, *ac_val2; int dcdiff; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int a_avail, c_avail; mquant = (mquant < 1) ? 0 : ( (mquant>31) ? 31 : mquant ); s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; a_avail = c_avail = 0; if((n == 2 || n == 3) || (s->mb_y && IS_INTRA(s->current_picture.mb_type[mb_pos - s->mb_stride]))) a_avail = 1; if((n == 1 || n == 3) || (s->mb_x && IS_INTRA(s->current_picture.mb_type[mb_pos - 1]))) c_avail = 1; if (n < 4) { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } else { dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3); } if (dcdiff < 0){ av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n"); return -1; } if (dcdiff) { if (dcdiff == 119 ) { if (mquant == 1) dcdiff = get_bits(gb, 10); else if (mquant == 2) dcdiff = get_bits(gb, 9); else dcdiff = get_bits(gb, 8); } else { if (mquant == 1) dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3; else if (mquant == 2) dcdiff = (dcdiff<<1) + get_bits(gb, 1) - 1; } if (get_bits(gb, 1)) dcdiff = -dcdiff; } dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, a_avail, c_avail, &dc_val, &dc_pred_dir); *dc_val = dcdiff; if (n < 4) { block[0] = dcdiff * s->y_dc_scale; } else { block[0] = dcdiff * s->c_dc_scale; } run_diff = 0; i = 0; if (!coded) { goto not_coded; } i = 1; { int last = 0, skip, value; const int8_t *zz_table; int scale; int k; scale = mquant * 2 + v->halfpq; zz_table = vc1_simple_progressive_8x8_zz; ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; if(dc_pred_dir) ac_val -= 16; else ac_val -= 16 * s->block_wrap[n]; while (!last) { vc1_decode_ac_coeff(v, &last, &skip, &value, codingset); i += skip; if(i > 63) break; block[zz_table[i++]] = value; } if(s->ac_pred) { int mb_pos2, q1, q2; mb_pos2 = mb_pos - dc_pred_dir - (1 - dc_pred_dir) * s->mb_stride; q1 = s->current_picture.qscale_table[mb_pos]; q2 = s->current_picture.qscale_table[mb_pos2]; if(!c_avail) { memset(ac_val, 0, 8 * sizeof(ac_val[0])); dc_pred_dir = 0; } if(!a_avail) { memset(ac_val + 8, 0, 8 * sizeof(ac_val[0])); dc_pred_dir = 1; } if(!q1 && q1 && q2 && q1 != q2) { q1 = q1 * 2 - 1; q2 = q2 * 2 - 1; if(dc_pred_dir) { for(k = 1; k < 8; k++) block[k << 3] += (ac_val[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; } else { for(k = 1; k < 8; k++) block[k] += (ac_val[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18; } } else { if(dc_pred_dir) { for(k = 1; k < 8; k++) block[k << 3] += ac_val[k]; } else { for(k = 1; k < 8; k++) block[k] += ac_val[k + 8]; } } } for(k = 1; k < 8; k++) { ac_val2[k] = block[k << 3]; ac_val2[k + 8] = block[k]; } for(k = 1; k < 64; k++) if(block[k]) { block[k] *= scale; if(!v->pquantizer) block[k] += (block[k] < 0) ? -mquant : mquant; } if(s->ac_pred) i = 63; } not_coded: if(!coded) { int k, scale; ac_val = s->ac_val[0][0] + s->block_index[n] * 16; ac_val2 = ac_val; if(!c_avail) { memset(ac_val, 0, 8 * sizeof(ac_val[0])); dc_pred_dir = 0; } if(!a_avail) { memset(ac_val + 8, 0, 8 * sizeof(ac_val[0])); dc_pred_dir = 1; } scale = mquant * 2 + v->halfpq; memset(ac_val2, 0, 16 * 2); if(dc_pred_dir) { ac_val -= 16; if(s->ac_pred) memcpy(ac_val2, ac_val, 8 * 2); } else { ac_val -= 16 * s->block_wrap[n]; if(s->ac_pred) memcpy(ac_val2 + 8, ac_val + 8, 8 * 2); } if(s->ac_pred) { if(dc_pred_dir) { for(k = 1; k < 8; k++) { block[k << 3] = ac_val[k] * scale; if(!v->pquantizer) block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant; } } else { for(k = 1; k < 8; k++) { block[k] = ac_val[k + 8] * scale; if(!v->pquantizer) block[k] += (block[k] < 0) ? -mquant : mquant; } } i = 63; } } s->block_last_index[n] = i; return 0; }
1threat
static uint32_t ecc_mem_readl(void *opaque, target_phys_addr_t addr) { ECCState *s = opaque; uint32_t ret = 0; switch (addr & ECC_ADDR_MASK) { case ECC_MER: ret = s->regs[0]; DPRINTF("Read memory enable %08x\n", ret); break; case ECC_MDR: ret = s->regs[1]; DPRINTF("Read memory delay %08x\n", ret); break; case ECC_MFSR: ret = s->regs[2]; DPRINTF("Read memory fault status %08x\n", ret); break; case ECC_VCR: ret = s->regs[3]; DPRINTF("Read slot configuration %08x\n", ret); break; case ECC_MFAR0: ret = s->regs[4]; DPRINTF("Read memory fault address 0 %08x\n", ret); break; case ECC_MFAR1: ret = s->regs[5]; DPRINTF("Read memory fault address 1 %08x\n", ret); break; case ECC_DR: ret = s->regs[6]; DPRINTF("Read diagnostic %08x\n", ret); break; case ECC_ECR0: ret = s->regs[7]; DPRINTF("Read event count 1 %08x\n", ret); break; case ECC_ECR1: ret = s->regs[7]; DPRINTF("Read event count 2 %08x\n", ret); break; } return ret; }
1threat
static int floppy_probe_device(const char *filename) { int fd, ret; int prio = 0; struct floppy_struct fdparam; struct stat st; if (strstart(filename, "/dev/fd", NULL)) prio = 50; fd = open(filename, O_RDONLY | O_NONBLOCK); if (fd < 0) { goto out; } ret = fstat(fd, &st); if (ret == -1 || !S_ISBLK(st.st_mode)) { goto outc; } ret = ioctl(fd, FDGETPRM, &fdparam); if (ret >= 0) prio = 100; outc: close(fd); out: return prio; }
1threat
Shuffling training data with LSTM RNN : <p>Since an LSTM RNN uses previous events to predict current sequences, why do we shuffle the training data? Don't we lose the temporal ordering of the training data? How is it still effective at making predictions after being trained on shuffled training data?</p>
0debug
Keep Dotnet Core Grpc Server running as a console application? : <p>I am trying to keep a Grpc server running as a console daemon. This gRPC server is a microservice that runs in a docker container.</p> <p>All of the examples I can find make use of the following:</p> <pre><code>Console.ReadKey(); </code></pre> <p>This does indeed block the main thread and keeps it running but does not work in docker with the following error:</p> <pre><code>"Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read." </code></pre> <p>Now I could probably try to find a workaround for docker specifically, but this still doesn't feel right. Does anyone know of a good "production ready" way to keep the service running?</p>
0debug
static int kvm_handle_debug(PowerPCCPU *cpu, struct kvm_run *run) { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; struct kvm_debug_exit_arch *arch_info = &run->debug.arch; int handle = 0; if (kvm_find_sw_breakpoint(cs, arch_info->address)) { handle = 1; } else { cpu_synchronize_state(cs); env->nip += 4; cs->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL; ppc_cpu_do_interrupt(cs); } return handle; }
1threat
Regex: take string between <tag> and \n or </tag> : <p>I can't figure out where I'm wrong.</p> <p>I have a pile of pages from where I need to get the content of the tags and make it a file name.</p> <p>My regex</p> <pre><code>title2 = re.search(r'(&lt;title&gt;)(.+)(&lt;/title&gt;)', content) filename_test = str(title2.group(2)+'.txt') </code></pre> <p>It works fine until it comes to a title like this:</p> <pre><code>&lt;title&gt;Klaatu - barada nikto &lt;/title&gt; </code></pre> <p>I've tried a lot of variants, none of them works.</p> <p>Main idea is that something like this should have worked:</p> <pre><code>title2 = re.search(r'(&lt;title&gt;)(.+)(\n|(&lt;/title&gt;))', content) </code></pre> <p>i.e. "stop when you come to new line <strong>or</strong> this tag" But it doesn't.</p>
0debug
See more and less button : <p>I wanna use See more and see less button button for my ul > li and i am using following code but its not working. </p> <pre><code>$(document).ready(function() { var list = $(".partners__ul li"); var numToShow = 4; var button = $(".partners__button__a"); var numInList = list.length; list.hide(); if (numInList &gt; numToShow) { button.show(); } list.slice(0, numToShow).show(); button.click(function() { var showing = list.filter(':visible').length; list.slice(showing - 1, showing + numToShow).fadeIn(); var nowShowing = list.filter(':visible').length; }); }); </code></pre>
0debug
Testing Angular2 components that use setInterval or setTimeout : <p>I have a fairly typical, simple ng2 component that calls a service to get some data (carousel items). It also uses setInterval to auto-switch carousel slides in the UI every n seconds. It works just fine, but when running Jasmine tests I get the error: "Cannot use setInterval from within an async test zone".</p> <p>I tried wrapping the setInterval call in this.zone.runOutsideAngular(() => {...}), but the error remained. I would've thought changing the test to run in fakeAsync zone would solve the problem, but then I get an error saying XHR calls are not allowed from within fakeAsync test zone (which does make sense).</p> <p>How can I use both the XHR calls made by the service and the interval, while still being able to test the component? I'm using ng2 rc4, project generated by angular-cli. Many thanks in advance.</p> <p>My code from the component:</p> <pre><code>constructor(private carouselService: CarouselService) { } ngOnInit() { this.carouselService.getItems().subscribe(items =&gt; { this.items = items; }); this.interval = setInterval(() =&gt; { this.forward(); }, this.intervalMs); } </code></pre> <p>And from the Jasmine spec: </p> <pre><code>it('should display carousel items', async(() =&gt; { testComponentBuilder .overrideProviders(CarouselComponent, [provide(CarouselService, { useClass: CarouselServiceMock })]) .createAsync(CarouselComponent).then((fixture: ComponentFixture&lt;CarouselComponent&gt;) =&gt; { fixture.detectChanges(); let compiled = fixture.debugElement.nativeElement; // some expectations here; }); })); </code></pre>
0debug
how to get continious real life traking of car in andriud like UBER : how to get current location continious location tracking in android, like an **UBER** application, i which the car is continious tracking in client mobile.. **Thannks in advance**..
0debug
c++ CryptoPP - encrypt / decrypt with RC6 : I want to encrypt and decrypt strings with RC6 but I don't understand how it works with the CryptoPP library, could you give me a snippet ? Thanks you !
0debug
static void pc_init_pci_1_5(QEMUMachineInitArgs *args) { has_pci_info = false; pc_init_pci(args); }
1threat
static int vvfat_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVVVFATState *s = bs->opaque; int cyls, heads, secs; bool floppy; const char *dirname, *label; QemuOpts *opts; Error *local_err = NULL; int ret; #ifdef DEBUG vvv = s; #endif opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto fail; } dirname = qemu_opt_get(opts, "dir"); if (!dirname) { error_setg(errp, "vvfat block driver requires a 'dir' option"); ret = -EINVAL; goto fail; } s->fat_type = qemu_opt_get_number(opts, "fat-type", 0); floppy = qemu_opt_get_bool(opts, "floppy", false); memset(s->volume_label, ' ', sizeof(s->volume_label)); label = qemu_opt_get(opts, "label"); if (label) { size_t label_length = strlen(label); if (label_length > 11) { error_setg(errp, "vvfat label cannot be longer than 11 bytes"); ret = -EINVAL; goto fail; } memcpy(s->volume_label, label, label_length); } else { memcpy(s->volume_label, "QEMU VVFAT", 10); } if (floppy) { if (!s->fat_type) { s->fat_type = 12; secs = 36; s->sectors_per_cluster = 2; } else { secs = s->fat_type == 12 ? 18 : 36; s->sectors_per_cluster = 1; } cyls = 80; heads = 2; } else { if (!s->fat_type) { s->fat_type = 16; } s->offset_to_bootsector = 0x3f; cyls = s->fat_type == 12 ? 64 : 1024; heads = 16; secs = 63; } switch (s->fat_type) { case 32: fprintf(stderr, "Big fat greek warning: FAT32 has not been tested. " "You are welcome to do so!\n"); break; case 16: case 12: break; default: error_setg(errp, "Valid FAT types are only 12, 16 and 32"); ret = -EINVAL; goto fail; } s->bs = bs; s->sectors_per_cluster=0x10; s->current_cluster=0xffffffff; s->qcow = NULL; s->qcow_filename = NULL; s->fat2 = NULL; s->downcase_short_names = 1; fprintf(stderr, "vvfat %s chs %d,%d,%d\n", dirname, cyls, heads, secs); s->sector_count = cyls * heads * secs - s->offset_to_bootsector; if (qemu_opt_get_bool(opts, "rw", false)) { if (!bdrv_is_read_only(bs)) { ret = enable_write_target(bs, errp); if (ret < 0) { goto fail; } } else { ret = -EPERM; error_setg(errp, "Unable to set VVFAT to 'rw' when drive is read-only"); goto fail; } } else { ret = bdrv_set_read_only(bs, true, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto fail; } } bs->total_sectors = cyls * heads * secs; if (init_directories(s, dirname, heads, secs, errp)) { ret = -EIO; goto fail; } s->sector_count = s->offset_to_root_dir + s->sectors_per_cluster * s->cluster_count; if (s->qcow) { error_setg(&s->migration_blocker, "The vvfat (rw) format used by node '%s' " "does not support live migration", bdrv_get_device_or_node_name(bs)); ret = migrate_add_blocker(s->migration_blocker, &local_err); if (local_err) { error_propagate(errp, local_err); error_free(s->migration_blocker); goto fail; } } if (s->offset_to_bootsector > 0) { init_mbr(s, cyls, heads, secs); } qemu_co_mutex_init(&s->lock); ret = 0; fail: qemu_opts_del(opts); return ret; }
1threat
How to printf real digit of float in printf : <p>for instance:</p> <pre><code>#include &lt;stdio.h&gt; int main(int argc, char **argv) { my_printf("%f\n", 1.233239208938208); my_printf("%f\n", 1.23); return (0); }; </code></pre> <p>I hope output is </p> <pre><code>1.233239208938208 1.23 </code></pre> <p>How should I do?</p>
0debug
How to create custom type in angular : <p>Can some one explain how to create our own custom types in angular using typescript syntax. Please provide example as well. Thanks!</p>
0debug
Send WhatsApp Message out of another application in android. Without opening WhatsApp : <p>my question is, if it is possible to send a whats app message out of an android application, without opening WhatsApp. I already know that i can do something like share and then WhatsApp opens and i have to press send again. But i want to send it automatically out of another application.Without any further user interaction. Thank you for your answers.</p>
0debug
static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet) { TargaContext *s = avctx->priv_data; int bpp, picsize, datasize = -1, ret; uint8_t *out; if(avctx->width > 0xffff || avctx->height > 0xffff) { av_log(avctx, AV_LOG_ERROR, "image dimensions too large\n"); return AVERROR(EINVAL); } picsize = av_image_get_buffer_size(avctx->pix_fmt, avctx->width, avctx->height, 1); if ((ret = ff_alloc_packet(pkt, picsize + 45)) < 0) { av_log(avctx, AV_LOG_ERROR, "encoded frame too large\n"); return ret; } memset(pkt->data, 0, 12); AV_WL16(pkt->data+12, avctx->width); AV_WL16(pkt->data+14, avctx->height); pkt->data[17] = 0x20 | (avctx->pix_fmt == AV_PIX_FMT_BGRA ? 8 : 0); switch(avctx->pix_fmt) { case AV_PIX_FMT_GRAY8: pkt->data[2] = TGA_BW; pkt->data[16] = 8; break; case AV_PIX_FMT_RGB555LE: pkt->data[2] = TGA_RGB; pkt->data[16] = 16; break; case AV_PIX_FMT_BGR24: pkt->data[2] = TGA_RGB; pkt->data[16] = 24; break; case AV_PIX_FMT_BGRA: pkt->data[2] = TGA_RGB; pkt->data[16] = 32; break; default: av_log(avctx, AV_LOG_ERROR, "Pixel format '%s' not supported.\n", av_get_pix_fmt_name(avctx->pix_fmt)); return AVERROR(EINVAL); } bpp = pkt->data[16] >> 3; out = pkt->data + 18; #if FF_API_CODER_TYPE FF_DISABLE_DEPRECATION_WARNINGS if (avctx->coder_type == FF_CODER_TYPE_RAW) s->rle = 0; FF_ENABLE_DEPRECATION_WARNINGS #endif if (s->rle) datasize = targa_encode_rle(out, picsize, p, bpp, avctx->width, avctx->height); if(datasize >= 0) pkt->data[2] |= 8; else datasize = targa_encode_normal(out, p, bpp, avctx->width, avctx->height); out += datasize; memcpy(out, "\0\0\0\0\0\0\0\0TRUEVISION-XFILE.", 26); pkt->size = out + 26 - pkt->data; pkt->flags |= AV_PKT_FLAG_KEY; *got_packet = 1; return 0; }
1threat
Hi I am trying to run a pig script on apache Zeppelin and it is giving me the error. : org.apache.pig.backend.executionengine.ExecException: ERROR 4010: Cannot find hadoop configurations in classpath (neither hadoop-site.xml nor core-site.xml was found in the classpath). If you plan to use local mode, please put -x local option in command line at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.getExecConf(HExecutionEngine.java:157) at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:194) at org.apache.pig.backend.hadoop.executionengine.HExecutionEngine.init(HExecutionEngine.java:111) at org.apache.pig.impl.PigContext.connect(PigContext.java:310) at org.apache.pig.PigServer.<init>(PigServer.java:232) at org.apache.pig.PigServer.<init>(PigServer.java:220) at org.apache.pig.PigServer.<init>(PigServer.java:193) at org.apache.pig.PigServer.<init>(PigServer.java:185) at org.apache.zeppelin.pig.PigInterpreter.open(PigInterpreter.java:61) at org.apache.zeppelin.interpreter.LazyOpenInterpreter.open(LazyOpenInterpreter.java:69) at org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:617) at org.apache.zeppelin.scheduler.Job.run(Job.java:188) at org.apache.zeppelin.scheduler.FIFOScheduler$1.run(FIFOScheduler.java:140) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) I had checked all the configurations and settings but unable to resolve this.
0debug
How to get current year in android? : <p>I tried</p> <pre><code>int year = Calendar.get(Calendar.YEAR); </code></pre> <p>but it is giving me compile time error that </p> <blockquote> <p>Non-static method 'get(int)' cannot be referenced from a static context.</p> </blockquote> <p>I am calling this method from call method of observable.</p> <pre><code>Observable.combineLatest(ob1 ob2, ob3, new Func3&lt;String, String, String, Boolean&gt;() { @Override public Boolean call(String a, String b, String c) {... </code></pre> <p>I had also seen <code>(new Date()).getYear();</code> but it is deprecated.</p>
0debug
dshow_cycle_devices(AVFormatContext *avctx, ICreateDevEnum *devenum, enum dshowDeviceType devtype, enum dshowSourceFilterType sourcetype, IBaseFilter **pfilter) { struct dshow_ctx *ctx = avctx->priv_data; IBaseFilter *device_filter = NULL; IEnumMoniker *classenum = NULL; IMoniker *m = NULL; const char *device_name = ctx->device_name[devtype]; int skip = (devtype == VideoDevice) ? ctx->video_device_number : ctx->audio_device_number; int r; const GUID *device_guid[2] = { &CLSID_VideoInputDeviceCategory, &CLSID_AudioInputDeviceCategory }; const char *devtypename = (devtype == VideoDevice) ? "video" : "audio only"; const char *sourcetypename = (sourcetype == VideoSourceDevice) ? "video" : "audio"; r = ICreateDevEnum_CreateClassEnumerator(devenum, device_guid[sourcetype], (IEnumMoniker **) &classenum, 0); if (r != S_OK) { av_log(avctx, AV_LOG_ERROR, "Could not enumerate %s devices (or none found).\n", devtypename); return AVERROR(EIO); } while (!device_filter && IEnumMoniker_Next(classenum, 1, &m, NULL) == S_OK) { IPropertyBag *bag = NULL; char *friendly_name = NULL; char *unique_name = NULL; VARIANT var; IBindCtx *bind_ctx = NULL; LPOLESTR olestr = NULL; LPMALLOC co_malloc = NULL; int i; r = CoGetMalloc(1, &co_malloc); if (r = S_OK) goto fail1; r = CreateBindCtx(0, &bind_ctx); if (r != S_OK) goto fail1; r = IMoniker_GetDisplayName(m, bind_ctx, NULL, &olestr); if (r != S_OK) goto fail1; unique_name = dup_wchar_to_utf8(olestr); for (i = 0; i < strlen(unique_name); i++) { if (unique_name[i] == ':') unique_name[i] = '_'; } r = IMoniker_BindToStorage(m, 0, 0, &IID_IPropertyBag, (void *) &bag); if (r != S_OK) goto fail1; var.vt = VT_BSTR; r = IPropertyBag_Read(bag, L"FriendlyName", &var, NULL); if (r != S_OK) goto fail1; friendly_name = dup_wchar_to_utf8(var.bstrVal); if (pfilter) { if (strcmp(device_name, friendly_name) && strcmp(device_name, unique_name)) goto fail1; if (!skip--) { r = IMoniker_BindToObject(m, 0, 0, &IID_IBaseFilter, (void *) &device_filter); if (r != S_OK) { av_log(avctx, AV_LOG_ERROR, "Unable to BindToObject for %s\n", device_name); goto fail1; } } } else { av_log(avctx, AV_LOG_INFO, " \"%s\"\n", friendly_name); av_log(avctx, AV_LOG_INFO, " Alternative name \"%s\"\n", unique_name); } fail1: if (olestr && co_malloc) IMalloc_Free(co_malloc, olestr); if (bind_ctx) IBindCtx_Release(bind_ctx); av_free(friendly_name); av_free(unique_name); if (bag) IPropertyBag_Release(bag); IMoniker_Release(m); } IEnumMoniker_Release(classenum); if (pfilter) { if (!device_filter) { av_log(avctx, AV_LOG_ERROR, "Could not find %s device with name [%s] among source devices of type %s.\n", devtypename, device_name, sourcetypename); return AVERROR(EIO); } *pfilter = device_filter; } return 0; }
1threat
int ff_hevc_extract_rbsp(HEVCContext *s, const uint8_t *src, int length, HEVCNAL *nal) { int i, si, di; uint8_t *dst; if (s) nal->skipped_bytes = 0; #define STARTCODE_TEST \ if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \ if (src[i + 2] != 3) { \ \ length = i; \ } \ break; \ } #if HAVE_FAST_UNALIGNED #define FIND_FIRST_ZERO \ if (i > 0 && !src[i]) \ i--; \ while (src[i]) \ i++ #if HAVE_FAST_64BIT for (i = 0; i + 1 < length; i += 9) { if (!((~AV_RN64A(src + i) & (AV_RN64A(src + i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; i -= 7; } #else for (i = 0; i + 1 < length; i += 5) { if (!((~AV_RN32A(src + i) & (AV_RN32A(src + i) - 0x01000101U)) & 0x80008080U)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; i -= 3; } #endif #else for (i = 0; i + 1 < length; i += 2) { if (src[i]) continue; if (i > 0 && src[i - 1] == 0) i--; STARTCODE_TEST; } #endif if (i >= length - 1) { nal->data = nal->raw_data = src; nal->size = nal->raw_size = length; return length; } av_fast_malloc(&nal->rbsp_buffer, &nal->rbsp_buffer_size, length + AV_INPUT_BUFFER_PADDING_SIZE); if (!nal->rbsp_buffer) return AVERROR(ENOMEM); dst = nal->rbsp_buffer; memcpy(dst, src, i); si = di = i; while (si + 2 < length) { if (src[si + 2] > 3) { dst[di++] = src[si++]; dst[di++] = src[si++]; } else if (src[si] == 0 && src[si + 1] == 0) { if (src[si + 2] == 3) { dst[di++] = 0; dst[di++] = 0; si += 3; if (s && nal->skipped_bytes_pos) { nal->skipped_bytes++; if (nal->skipped_bytes_pos_size < nal->skipped_bytes) { nal->skipped_bytes_pos_size *= 2; av_assert0(nal->skipped_bytes_pos_size >= nal->skipped_bytes); av_reallocp_array(&nal->skipped_bytes_pos, nal->skipped_bytes_pos_size, sizeof(*nal->skipped_bytes_pos)); if (!nal->skipped_bytes_pos) { nal->skipped_bytes_pos_size = 0; return AVERROR(ENOMEM); } } if (nal->skipped_bytes_pos) nal->skipped_bytes_pos[nal->skipped_bytes-1] = di - 1; } continue; } else goto nsc; } dst[di++] = src[si++]; } while (si < length) dst[di++] = src[si++]; nsc: memset(dst + di, 0, AV_INPUT_BUFFER_PADDING_SIZE); nal->data = dst; nal->size = di; nal->raw_data = src; nal->raw_size = si; return si; }
1threat
How to decrypt the shell file with SHC encryption? : How to decrypt the shell file with SHC encryption? I have a file that would like to know the contents of it, but it is encrypted and the use of SHC encryption
0debug
GitHub Actions: how to target all branches EXCEPT master? : <p>I want to be able to let an action run on any given branch except master. I am aware that there is a prebuilt <code>filter</code> action, but I want the exact opposite. </p> <p>More like GitLab's <code>except</code> keyword. Since this is not inside the official docs, has anyone prepared a decent workaround?</p> <p>Thank you very much.</p>
0debug
Mac Terminal error: -bash: /Users/tim/.profile: No such file or directory : <p>Every time I open a new Terminal window I see the following.</p> <pre><code>-bash: /Users/tim/.profile: No such file or directory </code></pre> <p>I have no idea why this is happening or where to look to fix it; my profile is located at <code>/Users/tim/.bash_profile</code> not <code>/Users/tim/.profile</code></p> <p>Any thoughts on how to troubleshoot this?</p>
0debug
Quick Help On Bool Values in Swift : I have a bool "alreadyHaveProfile" that I change to TRUE inside of a while loop...however after the loop ends the value changes to FALSE. Here is the code... if AccessToken.current != nil { fetchUserData() DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 3.5) { let dref = FIRDatabase.database().reference().child("CheckUsers") dref.observeSingleEvent(of: .value, with: { (snapshot: FIRDataSnapshot) in var alreadyHaveProfile = false let enumerator = snapshot.children loop: while let user = enumerator.nextObject() as? FIRDataSnapshot { if user.key == userID { alreadyHaveProfile = true break loop } } }, withCancel: { (error: Error) in print(error.localizedDescription) }) print(alreadyHaveProfile) Any reason why the variable keeps going back to FALSE despite being changed to TRUE inside the loop? I know it's something super simple, I just can't seem to find out what it is right now. Appreciate the help!
0debug
RecyclerView Q&A : <p>I'm creating a Q&amp;A where each question is a card. The answer starts showing the first line, but when its clicked it should expanded to show the full answer.</p> <p>When an answer is expanded/collapsed the rest of the RecyclerView should animate to make room for the expansion or collapse to avoid showing a blank space.</p> <p>I watched the talk on <a href="https://www.youtube.com/watch?v=imsr8NrIAMs">RecyclerView animations</a>, and believe I want a custom ItemAnimator, where I override animateChange. At that point I should create an ObjectAnimator to animate the height of the View's LayoutParams. Unfortunately I'm having a hard time tying it all together. I also return true when overriding canReuseUpdatedViewHolder, so we reuse the same viewholder.</p> <pre><code>@Override public boolean canReuseUpdatedViewHolder(RecyclerView.ViewHolder viewHolder) { return true; } @Override public boolean animateChange(@NonNull RecyclerView.ViewHolder oldHolder, @NonNull final RecyclerView.ViewHolder newHolder, @NonNull ItemHolderInfo preInfo, @NonNull ItemHolderInfo postInfo) { Log.d("test", "Run custom animation."); final ColorsAdapter.ColorViewHolder holder = (ColorsAdapter.ColorViewHolder) newHolder; FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) holder.tvColor.getLayoutParams(); ObjectAnimator halfSize = ObjectAnimator.ofInt(holder.tvColor.getLayoutParams(), "height", params.height, 0); halfSize.start(); return super.animateChange(oldHolder, newHolder, preInfo, postInfo); } </code></pre> <p>Right now I'm just trying to get something to animate, but nothing happens... Any ideas?</p>
0debug
static int dxv_decompress_dxt1(AVCodecContext *avctx) { DXVContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; uint32_t value, prev, op; int idx = 0, state = 0; int pos = 2; AV_WL32(ctx->tex_data, bytestream2_get_le32(gbc)); AV_WL32(ctx->tex_data + 4, bytestream2_get_le32(gbc)); while (pos < ctx->tex_size / 4) { CHECKPOINT(2); if (op) { prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } else { CHECKPOINT(2); if (op) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); else prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; CHECKPOINT(2); if (op) prev = AV_RL32(ctx->tex_data + 4 * (pos - idx)); else prev = bytestream2_get_le32(gbc); AV_WL32(ctx->tex_data + 4 * pos, prev); pos++; } } return 0; }
1threat
Python: Update columns in a list dependant on the value in another column : <p>Assume I have the following list: </p> <pre><code>list = [["A",0,"C"],["B",1,"C"]] </code></pre> <p>I want to do something that accomplishes the following: Set the values in the 1st column equal to "D" where the value in the 2nd column is equal to 0.</p> <p>So the list after the update should look like this:</p> <pre><code>list = [["D",0,"C"],["B",1,"C"]] </code></pre>
0debug
How can I apply multiple transformation to the same key in a Python dictionary : <p>I am an inventory manager, and my stock is as below</p> <pre><code>oldstock = {"A":100,"B":120,"C":150,"D":100,"E":230,"F":200,"G":180,"H":140,"I":90,"J":50} </code></pre> <p>I sold some items from each bin as below however (seems as though a list of dictionaries was the best way to represent it)</p> <pre><code>sale = [{"A":20},{"C":25},{"E":15},{"F":18},{"H":20},{"C":35},{"A":40},{"A":5},{"E":40},{"H":20}] </code></pre> <p>How can I calculate my new stock after making these sales per bin?</p>
0debug
Java can't use public static final int = 283 in switch : i had a weird problem with java, while working with Sockets i created a new public static final int LOGOUT = 283 to decleare a Service of the server to handle ( in simple terms client send different int to specify a service request to server), but here were a weird thing start to happen, in my switch LOGOUT statement was unreachable for no reason ( intelliJ told me that this statement was unreachable). SO i tried to System.out.println(ServiceId) and it was always a different number ( not a random one) from 283, it was really weird, i solved this problem by change the number. Obviously the number 283 wasn't in no other variable. Could it be Java that use a final static int with value 283 for something else? P.S : could it be that switch has maximum number of statement where this number is less than 283? switch(ServiceID){ case A: // TODO break; ................ case LOGOUT: // here it told me that this state was unreachable, no break or return problem, but when i changed the number from 283 to another number it was ok //NOT IMPORTANT CODE }
0debug
Problems on adding RecyclerView Android Studio : I needed recycler view in my project and I decided to implement it, also changed targetSDK and compileSDK from 29 to 27. After compiling the app there appeared some errors, can you help me? ![enter image description here](https://i.stack.imgur.com/N8ej6.png)![enter image description here](https://i.stack.imgur.com/uH7Vi.png)![enter image description here](https://i.stack.imgur.com/hHbRP.png)![enter image description here](https://i.stack.imgur.com/dmlTK.png) Or you can just show me another way of implementing e.t.c
0debug
static int kvm_ppc_register_host_cpu_type(void) { TypeInfo type_info = { .name = TYPE_HOST_POWERPC_CPU, .class_init = kvmppc_host_cpu_class_init, }; PowerPCCPUClass *pvr_pcc; DeviceClass *dc; int i; pvr_pcc = kvm_ppc_get_host_cpu_class(); if (pvr_pcc == NULL) { return -1; } type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc)); type_register(&type_info); #if defined(TARGET_PPC64) type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host"); type_info.parent = TYPE_SPAPR_CPU_CORE, type_info.instance_size = sizeof(sPAPRCPUCore); type_info.instance_init = NULL; type_info.class_init = spapr_cpu_core_class_init; type_info.class_data = (void *) "host"; type_register(&type_info); g_free((void *)type_info.name); #endif dc = DEVICE_CLASS(ppc_cpu_get_family_class(pvr_pcc)); for (i = 0; ppc_cpu_aliases[i].alias != NULL; i++) { if (strcmp(ppc_cpu_aliases[i].alias, dc->desc) == 0) { ObjectClass *oc = OBJECT_CLASS(pvr_pcc); char *suffix; ppc_cpu_aliases[i].model = g_strdup(object_class_get_name(oc)); suffix = strstr(ppc_cpu_aliases[i].model, "-"TYPE_POWERPC_CPU); if (suffix) { *suffix = 0; } ppc_cpu_aliases[i].oc = oc; break; } } return 0; }
1threat
static void usb_ohci_init(OHCIState *ohci, DeviceState *dev, int num_ports, dma_addr_t localmem_base, char *masterbus, uint32_t firstport, AddressSpace *as, Error **errp) { Error *err = NULL; int i; ohci->as = as; if (usb_frame_time == 0) { #ifdef OHCI_TIME_WARP usb_frame_time = get_ticks_per_sec(); usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ/1000); #else usb_frame_time = muldiv64(1, get_ticks_per_sec(), 1000); if (get_ticks_per_sec() >= USB_HZ) { usb_bit_time = muldiv64(1, get_ticks_per_sec(), USB_HZ); } else { usb_bit_time = 1; } #endif trace_usb_ohci_init_time(usb_frame_time, usb_bit_time); } ohci->num_ports = num_ports; if (masterbus) { USBPort *ports[OHCI_MAX_PORTS]; for(i = 0; i < num_ports; i++) { ports[i] = &ohci->rhport[i].port; } usb_register_companion(masterbus, ports, num_ports, firstport, ohci, &ohci_port_ops, USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL, &err); if (err) { error_propagate(errp, err); return; } } else { usb_bus_new(&ohci->bus, sizeof(ohci->bus), &ohci_bus_ops, dev); for (i = 0; i < num_ports; i++) { usb_register_port(&ohci->bus, &ohci->rhport[i].port, ohci, i, &ohci_port_ops, USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL); } } memory_region_init_io(&ohci->mem, OBJECT(dev), &ohci_mem_ops, ohci, "ohci", 256); ohci->localmem_base = localmem_base; ohci->name = object_get_typename(OBJECT(dev)); usb_packet_init(&ohci->usb_packet); ohci->async_td = 0; qemu_register_reset(ohci_reset, ohci); }
1threat
Deploying in tomcat with exception: Cannot find operation isServiced : <p>I installed Tomcat and Tomcat Manager on a remote server as per the instructions on <a href="https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04" rel="noreferrer">this post</a>. </p> <p>After adding it I successfully accessed the manager on <code>http://IP_ADDRESS:8080/manager/html</code></p> <p>Then I used the war file upload option to try to deploy the war file on it but it gives the following exception.</p> <p><code>FAIL - Deploy Upload Failed, Exception: Cannot find operation isServiced</code></p> <p><a href="https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/catalina/manager/ManagerServlet.html#isServiced(java.lang.String)" rel="noreferrer">Documentation on <code>isServiced</code></a></p>
0debug
static void *spapr_create_fdt_skel(const char *cpu_model, target_phys_addr_t rma_size, target_phys_addr_t initrd_base, target_phys_addr_t initrd_size, const char *boot_device, const char *kernel_cmdline, long hash_shift) { void *fdt; CPUState *env; uint64_t mem_reg_property_rma[] = { 0, cpu_to_be64(rma_size) }; uint64_t mem_reg_property_nonrma[] = { cpu_to_be64(rma_size), cpu_to_be64(ram_size - rma_size) }; uint32_t start_prop = cpu_to_be32(initrd_base); uint32_t end_prop = cpu_to_be32(initrd_base + initrd_size); uint32_t pft_size_prop[] = {0, cpu_to_be32(hash_shift)}; char hypertas_prop[] = "hcall-pft\0hcall-term\0hcall-dabr\0hcall-interrupt" "\0hcall-tce\0hcall-vio\0hcall-splpar\0hcall-bulk"; uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)}; int i; char *modelname; int smt = kvmppc_smt_threads(); #define _FDT(exp) \ do { \ int ret = (exp); \ if (ret < 0) { \ fprintf(stderr, "qemu: error creating device tree: %s: %s\n", \ #exp, fdt_strerror(ret)); \ exit(1); \ } \ } while (0) fdt = g_malloc0(FDT_MAX_SIZE); _FDT((fdt_create(fdt, FDT_MAX_SIZE))); _FDT((fdt_finish_reservemap(fdt))); _FDT((fdt_begin_node(fdt, ""))); _FDT((fdt_property_string(fdt, "device_type", "chrp"))); _FDT((fdt_property_string(fdt, "model", "IBM pSeries (emulated by qemu)"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x2))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x2))); _FDT((fdt_begin_node(fdt, "chosen"))); _FDT((fdt_property_string(fdt, "bootargs", kernel_cmdline))); _FDT((fdt_property(fdt, "linux,initrd-start", &start_prop, sizeof(start_prop)))); _FDT((fdt_property(fdt, "linux,initrd-end", &end_prop, sizeof(end_prop)))); _FDT((fdt_property_string(fdt, "qemu,boot-device", boot_device))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "memory@0"))); _FDT((fdt_property_string(fdt, "device_type", "memory"))); _FDT((fdt_property(fdt, "reg", mem_reg_property_rma, sizeof(mem_reg_property_rma)))); _FDT((fdt_end_node(fdt))); if (ram_size > rma_size) { char mem_name[32]; sprintf(mem_name, "memory@%" PRIx64, (uint64_t)rma_size); _FDT((fdt_begin_node(fdt, mem_name))); _FDT((fdt_property_string(fdt, "device_type", "memory"))); _FDT((fdt_property(fdt, "reg", mem_reg_property_nonrma, sizeof(mem_reg_property_nonrma)))); _FDT((fdt_end_node(fdt))); } _FDT((fdt_begin_node(fdt, "cpus"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x1))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x0))); modelname = g_strdup(cpu_model); for (i = 0; i < strlen(modelname); i++) { modelname[i] = toupper(modelname[i]); } for (env = first_cpu; env != NULL; env = env->next_cpu) { int index = env->cpu_index; uint32_t servers_prop[smp_threads]; uint32_t gservers_prop[smp_threads * 2]; char *nodename; uint32_t segs[] = {cpu_to_be32(28), cpu_to_be32(40), 0xffffffff, 0xffffffff}; uint32_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TIMEBASE_FREQ; uint32_t cpufreq = kvm_enabled() ? kvmppc_get_clockfreq() : 1000000000; uint32_t vmx = kvm_enabled() ? kvmppc_get_vmx() : 0; uint32_t dfp = kvm_enabled() ? kvmppc_get_dfp() : 0; if ((index % smt) != 0) { continue; } if (asprintf(&nodename, "%s@%x", modelname, index) < 0) { fprintf(stderr, "Allocation failure\n"); exit(1); } _FDT((fdt_begin_node(fdt, nodename))); free(nodename); _FDT((fdt_property_cell(fdt, "reg", index))); _FDT((fdt_property_string(fdt, "device_type", "cpu"))); _FDT((fdt_property_cell(fdt, "cpu-version", env->spr[SPR_PVR]))); _FDT((fdt_property_cell(fdt, "dcache-block-size", env->dcache_line_size))); _FDT((fdt_property_cell(fdt, "icache-block-size", env->icache_line_size))); _FDT((fdt_property_cell(fdt, "timebase-frequency", tbfreq))); _FDT((fdt_property_cell(fdt, "clock-frequency", cpufreq))); _FDT((fdt_property_cell(fdt, "ibm,slb-size", env->slb_nr))); _FDT((fdt_property(fdt, "ibm,pft-size", pft_size_prop, sizeof(pft_size_prop)))); _FDT((fdt_property_string(fdt, "status", "okay"))); _FDT((fdt_property(fdt, "64-bit", NULL, 0))); for (i = 0; i < smp_threads; i++) { servers_prop[i] = cpu_to_be32(index + i); gservers_prop[i*2] = cpu_to_be32(index + i); gservers_prop[i*2 + 1] = 0; } _FDT((fdt_property(fdt, "ibm,ppc-interrupt-server#s", servers_prop, sizeof(servers_prop)))); _FDT((fdt_property(fdt, "ibm,ppc-interrupt-gserver#s", gservers_prop, sizeof(gservers_prop)))); if (env->mmu_model & POWERPC_MMU_1TSEG) { _FDT((fdt_property(fdt, "ibm,processor-segment-sizes", segs, sizeof(segs)))); } if (vmx) { _FDT((fdt_property_cell(fdt, "ibm,vmx", vmx))); } if (dfp) { _FDT((fdt_property_cell(fdt, "ibm,dfp", dfp))); } _FDT((fdt_end_node(fdt))); } g_free(modelname); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "rtas"))); _FDT((fdt_property(fdt, "ibm,hypertas-functions", hypertas_prop, sizeof(hypertas_prop)))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "interrupt-controller"))); _FDT((fdt_property_string(fdt, "device_type", "PowerPC-External-Interrupt-Presentation"))); _FDT((fdt_property_string(fdt, "compatible", "IBM,ppc-xicp"))); _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); _FDT((fdt_property(fdt, "ibm,interrupt-server-ranges", interrupt_server_ranges_prop, sizeof(interrupt_server_ranges_prop)))); _FDT((fdt_property_cell(fdt, "#interrupt-cells", 2))); _FDT((fdt_property_cell(fdt, "linux,phandle", PHANDLE_XICP))); _FDT((fdt_property_cell(fdt, "phandle", PHANDLE_XICP))); _FDT((fdt_end_node(fdt))); _FDT((fdt_begin_node(fdt, "vdevice"))); _FDT((fdt_property_string(fdt, "device_type", "vdevice"))); _FDT((fdt_property_string(fdt, "compatible", "IBM,vdevice"))); _FDT((fdt_property_cell(fdt, "#address-cells", 0x1))); _FDT((fdt_property_cell(fdt, "#size-cells", 0x0))); _FDT((fdt_property_cell(fdt, "#interrupt-cells", 0x2))); _FDT((fdt_property(fdt, "interrupt-controller", NULL, 0))); _FDT((fdt_end_node(fdt))); _FDT((fdt_end_node(fdt))); _FDT((fdt_finish(fdt))); return fdt; }
1threat
static void virtio_balloon_save(QEMUFile *f, void *opaque) { VirtIOBalloon *s = opaque; virtio_save(&s->vdev, f); qemu_put_be32(f, s->num_pages); qemu_put_be32(f, s->actual); qemu_put_buffer(f, (uint8_t *)&s->stats_vq_elem, sizeof(VirtQueueElement)); qemu_put_buffer(f, (uint8_t *)&s->stats_vq_offset, sizeof(size_t)); qemu_put_buffer(f, (uint8_t *)&s->stats_callback, sizeof(MonitorCompletion)); qemu_put_buffer(f, (uint8_t *)&s->stats_opaque_callback_data, sizeof(void)); }
1threat
convert API response : I am making AJAX call and getting response console.log(data); {"valid":true,"when":"Today"} when I try to read it var res = data.valid; console.log(res); it shows undefined . I am trying to add a condition if(res==true){ /*code*/ }
0debug
How do i get my activity time to update every minute not just on create : public class MainActivity extends ActionBarActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {`enter code here` super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TimeZone tz = TimeZone.getTimeZone("Atlantic/St_Helena"); Calendar c = Calendar.getInstance(tz); String timez = String.format("Year "+"%02d" , c.get(Calendar.YEAR)) Display formattedDate value in TextView TextView time = new TextView(this); time.setText("Its"+timez+" PM"+"\n\n"+"Ants stretch when they wake up in the morning."); time.setGravity(Gravity.TOP); time.setTextSize(20); setContentView(time); }}
0debug
iTunes Connect and Xcode 8: your app has changed to invalid binary : <p>Last week, with Xcode 7, I was able to upload without any issue. But today I am getting the message your app has changed to invalid binary.</p> <p>I have seen that now with Xcode 8 a new icon 20x20 2x and 3x is added. I added one, but still getting the error.</p> <p>Does anyone had similar problem? </p>
0debug
d3 getting invert value of Band Scales : <p>i am writing a Gantt Chart using d3</p> <p>i have xScale with Time Scale(Time)</p> <pre><code>this.xScale = d3.scaleTime() .domain([this.startDate,this.endDate]) .range([0,this.getWidth()]); </code></pre> <p>and yScale as Band Scale (Resources)</p> <pre><code>this.yScale = d3.scaleBand() .domain(resources.map(function(res){ return res.res_num; })) .rangeRound([0,this.getHeight()]) .paddingInner(.3) </code></pre> <p>Problem is i need to drag and drop the task( SVG Rect) from one resource to another resources</p> <p>When i drag i am using the transfrom so its moving on the SVG</p> <pre><code>_onDrag : function(d) { var x = d3.event.dx+d3.event.x; var y = d3.event.dy+d3.event.y; d3.select(this).raise().attr("transform","translate(" + [x,y] + ")"); }, </code></pre> <p>But on drop i have to handle the logic as below:</p> <ol> <li>the rect should not be in between the resources, so need to transform to any band based on d3.event.y <ol start="2"> <li>in xAxis the time scale which has the invert but the yScale not have this. How to do this? </li> </ol></li> </ol>
0debug
Mutiple main files in golang project : I have a GOLANG project. When I run the program -main.go(with function main), it serves a web server serving a JSON object. In the same folder I have another file - serializedata.go(with function main) which loads the JSON object into a file that is server by the web server. Now, when I try to run go install I get this error - ./serialize_data.go:17: main redeclared in this block previous declaration at ./main.go:13 I want to keep both these files together as they are related. The test data needs to be serialized before it can be served. How can I prevent to build the serialization.go file. Im from python world and its easy to have these utils file separately.
0debug
Request all reddit comments from user with Javascript : <p>I am trying to achieve the following with Javascript:</p> <p>Given a reddit username , I want to retrieve the maximum amount of comments allowed for this user.</p> <p>So far what i have managed to do is retrieve only the 25 latest comments which is the default reddit behaviour. Typing in the browser for example the following url, we receive 25 comments in the json response.</p> <p>"<a href="https://www.reddit.com/user/spez/.json" rel="nofollow noreferrer">https://www.reddit.com/user/spez/.json</a>"</p> <p>We can limit or extend the number of comments from a user ( name of user is spez in the example) as follows:</p> <p>"<a href="https://www.reddit.com/user/spez/.json?limit=1000" rel="nofollow noreferrer">https://www.reddit.com/user/spez/.json?limit=1000</a>"</p> <p>However how could I also use limit with the following ?</p> <pre><code>$.getJSON( "http://www.reddit.com/u/"+ user + "/.json?jsonp=?",function foo(result) { $.each(result.data.children.slice(0, 10), function (i, post) { $("#reddit-content").append( '&lt;br&gt;' + post.data.body ); $("#reddit-content").append( '&lt;hr&gt;' ); }); } ) </code></pre>
0debug
Why does code in c# differ from code in c when i write the same algorithm? : Function in C unsigned long int ROTL(unsigned long int x, unsigned long int y) { return ((x) << (y&(32 - 1))) | ((x) >> (32 - (y&(32 - 1)))); } Function in C# uint ROTL(uint x, uint y) { return ((x) << (int)(y & (32 - 1))) | ((x) >> (int)(32- (y & (32 - 1)))); } above functions do the same work and the same result for small numbers, but when I pass large numbers the result in C# differ from C. is there any problem in casting or in the function itself. also I'm try to convert using Convert.ToInt32()
0debug
Google Chrome device frame is not visible when turned on : <p>I know my question is out of topic, but I will ask anyway. Because I need an answer, I also asked this on Quora.</p> <p>From this <a href="https://winaero.com/blog/make-screenshot-of-web-page-with-device-frame-in-chrome/" rel="noreferrer">site</a> it shows how to enable the frame. </p> <p>I want to take a screen shot / even full screen shot of my web app for showcase / use it for reporting. I used <code>Chrome</code> for this. </p> <p>In the developer's tool there is this option to hide and show the <code>Device Frame</code>. Yet I didn't see it. </p> <p><a href="https://i.stack.imgur.com/oocvO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oocvO.png" alt="sample"></a></p> <p>As you can see, there is an overflow menu from the right - <code>hide device frame</code>. I already enabled it. </p> <p>I take a sample screen shot from Angular Material page. As you can see there is no device frame wrapping the web app. Yet I enable the device frame. :( </p> <p><a href="https://i.stack.imgur.com/ots4s.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ots4s.png" alt="angularMaterial"></a></p> <p>I thought it will be visible the device frame once the screen shot is done. But what I see is what I get. </p> <p>Is this a bug? Is there any extension that can perform this operation?</p>
0debug
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory : <p>I have OS </p> <pre><code>Red Hat Enterprise Linux Server release 7.4 (Maipo) </code></pre> <p>and python </p> <pre><code>Python 2.7.13 :: Anaconda 4.4.0 (64-bit) </code></pre> <p>Tried to install lib sasl</p> <p>sudo pip install sasl</p> <pre><code>Collecting sasl Downloading http://repo.com/api/pypi/pypi/packages/8e/2c/45dae93d666aea8492678499e0999269b4e55f1829b1e4de5b8204706ad9/sasl-0.2.1.tar.gz Collecting six (from sasl) Downloading http://repo.com/api/pypi/pypi/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl Installing collected packages: six, sasl building 'sasl.saslwrapper' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/sasl gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Isasl -I/usr/include/python2.7 -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-2.7/sasl/saslwrapper.o In file included from sasl/saslwrapper.cpp:254:0: sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory #include &lt;sasl/sasl.h&gt; ^ compilation terminated. error: command 'gcc' failed with exit status 1 ---------------------------------------- Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Ym7ZOA/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_8ahws-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-Ym7ZOA/sasl/ </code></pre> <p>How solve this problem?</p>
0debug
how to convert month number to month name in oracle? : I have a .java page and in that page I am getting the 'from' & 'to' date value from a jsp page. string from = "18-Jan-2018"; string to = "20-Jan-2018" In that java page i have written String f_date_p ="SELECT TO_DATE('"+from+"') +90 from dual" ; and String t_date_m = "SELECT TO_DATE('"+to+"') -90 from dual" ; After executing this, I am getting fdayp = "2018-04-18 00:00:00.0" .[initially String fdayp ="";] and String t_date_m = "SELECT TO_DATE('"+to+"') -90 from dual" ;[initially String tdaym ="";] tdaym = "2017-10-22 00:00:00.0" But i got failed to execute this oracle query- " select count(*)from a where start_date BETWEEN '2018-04-18 00:00:00.0' and '2017-10-20 00:00:00.0' and id='703301' ";
0debug
open iOS iPad simulator with React Native : <p>When testing a React Native app with <code>react-native run-ios</code> it opens an iPhone simulator.</p> <p>You can change the virtual device to an iPad in the Simulator options, but the React Native app does not appear in the list of installed apps.</p> <p>Is there a way to open an iPad simulator from the CLI?</p>
0debug
How to include native transitions to ionic modals? : <p>I built an ionic App and initially the transitions were slow. So, I opted for <a href="https://github.com/shprink/ionic-native-transitions">ionic-native-transitions</a> plugin . Now that the app transitions became smoother I'm trying to apply these transitions for my ionic modals. Below is the function I use to set my modal in ionic.</p> <pre><code>function LoadFilter(){ $ionicModal.fromTemplateUrl('templates/filter.html', { scope: $scope }).then(function(modal) { $scope.modal = modal; $scope.modal.show(); }); $scope.closeFilter = function() { $scope.modal.hide(); }; $scope.showFilter = function() { $scope.modal.show(); }; </code></pre> <p>Any idea how to apply transtions to modals?</p>
0debug
OAuth facebook login not normally : Facebook returning error : "Not Logged In: You are not logged in. Please login and try again." anyone know why this happen ?.
0debug
invalid timespan for time string in C# : <p>I'm trying to add a string that represents a time to a c# datetime object but I'm getting a exception that says 'invalid format'</p> <pre><code>details.UTCEventDate.Add(TimeSpan.Parse(details.UTCEventTime)); </code></pre> <p>where 'details.UTCEventTime' is something like "4:45AM"</p>
0debug
Center image within it's container : <p>I can't seem to center my image, it's positioned absolute to it's parent which is relative. </p> <p>I've used inspect element to try many ways, but it doesn't seem to want to work.</p> <p>Please see the example here: <a href="http://dassiedev.dassieartisan.com/furniture" rel="nofollow noreferrer">http://dassiedev.dassieartisan.com/furniture</a></p> <p>Here's my CSS:</p> <pre><code> .tm-switch-image-container { position: relative; overflow: hidden; height: 276px; } .tm-switch-image-container img { width: 276px; height: 276px; max-width: none; } </code></pre>
0debug
static void versatile_init(QEMUMachineInitArgs *args, int board_id) { ARMCPU *cpu; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); qemu_irq *cpu_pic; qemu_irq pic[32]; qemu_irq sic[32]; DeviceState *dev, *sysctl; SysBusDevice *busdev; DeviceState *pl041; PCIBus *pci_bus; NICInfo *nd; i2c_bus *i2c; int n; int done_smc = 0; DriveInfo *dinfo; if (!args->cpu_model) { args->cpu_model = "arm926"; } cpu = cpu_arm_init(args->cpu_model); if (!cpu) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } memory_region_init_ram(ram, "versatile.ram", args->ram_size); vmstate_register_ram_global(ram); memory_region_add_subregion(sysmem, 0, ram); sysctl = qdev_create(NULL, "realview_sysctl"); qdev_prop_set_uint32(sysctl, "sys_id", 0x41007004); qdev_prop_set_uint32(sysctl, "proc_id", 0x02000000); qdev_init_nofail(sysctl); sysbus_mmio_map(SYS_BUS_DEVICE(sysctl), 0, 0x10000000); cpu_pic = arm_pic_init_cpu(cpu); dev = sysbus_create_varargs("pl190", 0x10140000, cpu_pic[ARM_PIC_CPU_IRQ], cpu_pic[ARM_PIC_CPU_FIQ], NULL); for (n = 0; n < 32; n++) { pic[n] = qdev_get_gpio_in(dev, n); } dev = sysbus_create_simple("versatilepb_sic", 0x10003000, NULL); for (n = 0; n < 32; n++) { sysbus_connect_irq(SYS_BUS_DEVICE(dev), n, pic[n]); sic[n] = qdev_get_gpio_in(dev, n); } sysbus_create_simple("pl050_keyboard", 0x10006000, sic[3]); sysbus_create_simple("pl050_mouse", 0x10007000, sic[4]); dev = qdev_create(NULL, "versatile_pci"); busdev = SYS_BUS_DEVICE(dev); qdev_init_nofail(dev); sysbus_mmio_map(busdev, 0, 0x41000000); sysbus_mmio_map(busdev, 1, 0x42000000); sysbus_connect_irq(busdev, 0, sic[27]); sysbus_connect_irq(busdev, 1, sic[28]); sysbus_connect_irq(busdev, 2, sic[29]); sysbus_connect_irq(busdev, 3, sic[30]); pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci"); for(n = 0; n < nb_nics; n++) { nd = &nd_table[n]; if (!done_smc && (!nd->model || strcmp(nd->model, "smc91c111") == 0)) { smc91c111_init(nd, 0x10010000, sic[25]); done_smc = 1; } else { pci_nic_init_nofail(nd, "rtl8139", NULL); } } if (usb_enabled(false)) { pci_create_simple(pci_bus, -1, "pci-ohci"); } n = drive_get_max_bus(IF_SCSI); while (n >= 0) { pci_create_simple(pci_bus, -1, "lsi53c895a"); n--; } sysbus_create_simple("pl011", 0x101f1000, pic[12]); sysbus_create_simple("pl011", 0x101f2000, pic[13]); sysbus_create_simple("pl011", 0x101f3000, pic[14]); sysbus_create_simple("pl011", 0x10009000, sic[6]); sysbus_create_simple("pl080", 0x10130000, pic[17]); sysbus_create_simple("sp804", 0x101e2000, pic[4]); sysbus_create_simple("sp804", 0x101e3000, pic[5]); sysbus_create_simple("pl061", 0x101e4000, pic[6]); sysbus_create_simple("pl061", 0x101e5000, pic[7]); sysbus_create_simple("pl061", 0x101e6000, pic[8]); sysbus_create_simple("pl061", 0x101e7000, pic[9]); dev = sysbus_create_simple("pl110_versatile", 0x10120000, pic[16]); qdev_connect_gpio_out(sysctl, 0, qdev_get_gpio_in(dev, 0)); sysbus_create_varargs("pl181", 0x10005000, sic[22], sic[1], NULL); sysbus_create_varargs("pl181", 0x1000b000, sic[23], sic[2], NULL); sysbus_create_simple("pl031", 0x101e8000, pic[10]); dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL); i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c"); i2c_create_slave(i2c, "ds1338", 0x68); pl041 = qdev_create(NULL, "pl041"); qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512); qdev_init_nofail(pl041); sysbus_mmio_map(SYS_BUS_DEVICE(pl041), 0, 0x10004000); sysbus_connect_irq(SYS_BUS_DEVICE(pl041), 0, sic[24]); dinfo = drive_get(IF_PFLASH, 0, 0); if (!pflash_cfi01_register(VERSATILE_FLASH_ADDR, NULL, "versatile.flash", VERSATILE_FLASH_SIZE, dinfo ? dinfo->bdrv : NULL, VERSATILE_FLASH_SECT_SIZE, VERSATILE_FLASH_SIZE / VERSATILE_FLASH_SECT_SIZE, 4, 0x0089, 0x0018, 0x0000, 0x0, 0)) { fprintf(stderr, "qemu: Error registering flash memory.\n"); } versatile_binfo.ram_size = args->ram_size; versatile_binfo.kernel_filename = args->kernel_filename; versatile_binfo.kernel_cmdline = args->kernel_cmdline; versatile_binfo.initrd_filename = args->initrd_filename; versatile_binfo.board_id = board_id; arm_load_kernel(cpu, &versatile_binfo); }
1threat
create a variants of products : Im looking for an **efficient way** to group a different types of products variants. I have this json file, and inside each product I have an different type of attributes. **attributes:** [ {title: color, labels: [{title: red}, {title: blue}]}, {title: brand, labels: [{title: nike}, {title: rebook}]}, {title: size, labels: [{title: 38}, {title: 40}] ] and it can have more/less attributes. **I need to create an efficient function that will return:** variants: [ 'red nike 38', 'red nike 40', 'blue nike 38', 'blue nike 40', 'red rebook 38', 'red rebook 40', 'blue rebook 38', 'blue rebook 40' ] pls help :D
0debug
static void init_proc_970GX (CPUPPCState *env) { gen_spr_ne_601(env); gen_spr_7xx(env); gen_tbl(env); spr_register(env, SPR_HID0, "HID0", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_clear, 0x60000000); spr_register(env, SPR_HID1, "HID1", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_750_HID2, "HID2", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); spr_register(env, SPR_970_HID5, "HID5", SPR_NOACCESS, SPR_NOACCESS, &spr_read_generic, &spr_write_generic, 0x00000000); gen_low_BATs(env); #if 0 env->slb_nr = 32; #endif init_excp_970(env); env->dcache_line_size = 128; env->icache_line_size = 128; ppc970_irq_init(env); #if !defined(CONFIG_USER_ONLY) env->hreset_vector = 0x0000000000000100ULL; #endif }
1threat
static int cdrom_probe_device(const char *filename) { int fd, ret; int prio = 0; if (strstart(filename, "/dev/cd", NULL)) prio = 50; fd = open(filename, O_RDONLY | O_NONBLOCK); if (fd < 0) { goto out; } ret = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT); if (ret >= 0) prio = 100; close(fd); out: return prio; }
1threat
void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size) { long i; long num_pixels = src_size >> 1; for(i=0; i<num_pixels; i++) { unsigned b,g,r; register uint16_t rgb; rgb = src[2*i]; r = rgb&0x1F; g = (rgb&0x7E0)>>5; b = (rgb&0xF800)>>11; dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10); } }
1threat
av_cold static int auto_matrix(SwrContext *s) { int i, j, out_i; double matrix[NUM_NAMED_CHANNELS][NUM_NAMED_CHANNELS]={{0}}; int64_t unaccounted, in_ch_layout, out_ch_layout; double maxcoef=0; char buf[128]; const int matrix_encoding = s->matrix_encoding; float maxval; in_ch_layout = clean_layout(s, s->in_ch_layout); out_ch_layout = clean_layout(s, s->out_ch_layout); if( out_ch_layout == AV_CH_LAYOUT_STEREO_DOWNMIX && (in_ch_layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == 0 ) out_ch_layout = AV_CH_LAYOUT_STEREO; if( in_ch_layout == AV_CH_LAYOUT_STEREO_DOWNMIX && (out_ch_layout & AV_CH_LAYOUT_STEREO_DOWNMIX) == 0 ) in_ch_layout = AV_CH_LAYOUT_STEREO; if(!sane_layout(in_ch_layout)){ av_get_channel_layout_string(buf, sizeof(buf), -1, s->in_ch_layout); av_log(s, AV_LOG_ERROR, "Input channel layout '%s' is not supported\n", buf); return AVERROR(EINVAL); } if(!sane_layout(out_ch_layout)){ av_get_channel_layout_string(buf, sizeof(buf), -1, s->out_ch_layout); av_log(s, AV_LOG_ERROR, "Output channel layout '%s' is not supported\n", buf); return AVERROR(EINVAL); } memset(s->matrix, 0, sizeof(s->matrix)); for(i=0; i<FF_ARRAY_ELEMS(matrix); i++){ if(in_ch_layout & out_ch_layout & (1ULL<<i)) matrix[i][i]= 1.0; } unaccounted= in_ch_layout & ~out_ch_layout; if(unaccounted & AV_CH_FRONT_CENTER){ if((out_ch_layout & AV_CH_LAYOUT_STEREO) == AV_CH_LAYOUT_STEREO){ if(in_ch_layout & AV_CH_LAYOUT_STEREO) { matrix[ FRONT_LEFT][FRONT_CENTER]+= s->clev; matrix[FRONT_RIGHT][FRONT_CENTER]+= s->clev; } else { matrix[ FRONT_LEFT][FRONT_CENTER]+= M_SQRT1_2; matrix[FRONT_RIGHT][FRONT_CENTER]+= M_SQRT1_2; } }else av_assert0(0); } if(unaccounted & AV_CH_LAYOUT_STEREO){ if(out_ch_layout & AV_CH_FRONT_CENTER){ matrix[FRONT_CENTER][ FRONT_LEFT]+= M_SQRT1_2; matrix[FRONT_CENTER][FRONT_RIGHT]+= M_SQRT1_2; if(in_ch_layout & AV_CH_FRONT_CENTER) matrix[FRONT_CENTER][ FRONT_CENTER] = s->clev*sqrt(2); }else av_assert0(0); } if(unaccounted & AV_CH_BACK_CENTER){ if(out_ch_layout & AV_CH_BACK_LEFT){ matrix[ BACK_LEFT][BACK_CENTER]+= M_SQRT1_2; matrix[BACK_RIGHT][BACK_CENTER]+= M_SQRT1_2; }else if(out_ch_layout & AV_CH_SIDE_LEFT){ matrix[ SIDE_LEFT][BACK_CENTER]+= M_SQRT1_2; matrix[SIDE_RIGHT][BACK_CENTER]+= M_SQRT1_2; }else if(out_ch_layout & AV_CH_FRONT_LEFT){ if (matrix_encoding == AV_MATRIX_ENCODING_DOLBY || matrix_encoding == AV_MATRIX_ENCODING_DPLII) { if (unaccounted & (AV_CH_BACK_LEFT | AV_CH_SIDE_LEFT)) { matrix[FRONT_LEFT ][BACK_CENTER] -= s->slev * M_SQRT1_2; matrix[FRONT_RIGHT][BACK_CENTER] += s->slev * M_SQRT1_2; } else { matrix[FRONT_LEFT ][BACK_CENTER] -= s->slev; matrix[FRONT_RIGHT][BACK_CENTER] += s->slev; } } else { matrix[ FRONT_LEFT][BACK_CENTER]+= s->slev*M_SQRT1_2; matrix[FRONT_RIGHT][BACK_CENTER]+= s->slev*M_SQRT1_2; } }else if(out_ch_layout & AV_CH_FRONT_CENTER){ matrix[ FRONT_CENTER][BACK_CENTER]+= s->slev*M_SQRT1_2; }else av_assert0(0); } if(unaccounted & AV_CH_BACK_LEFT){ if(out_ch_layout & AV_CH_BACK_CENTER){ matrix[BACK_CENTER][ BACK_LEFT]+= M_SQRT1_2; matrix[BACK_CENTER][BACK_RIGHT]+= M_SQRT1_2; }else if(out_ch_layout & AV_CH_SIDE_LEFT){ if(in_ch_layout & AV_CH_SIDE_LEFT){ matrix[ SIDE_LEFT][ BACK_LEFT]+= M_SQRT1_2; matrix[SIDE_RIGHT][BACK_RIGHT]+= M_SQRT1_2; }else{ matrix[ SIDE_LEFT][ BACK_LEFT]+= 1.0; matrix[SIDE_RIGHT][BACK_RIGHT]+= 1.0; } }else if(out_ch_layout & AV_CH_FRONT_LEFT){ if (matrix_encoding == AV_MATRIX_ENCODING_DOLBY) { matrix[FRONT_LEFT ][BACK_LEFT ] -= s->slev * M_SQRT1_2; matrix[FRONT_LEFT ][BACK_RIGHT] -= s->slev * M_SQRT1_2; matrix[FRONT_RIGHT][BACK_LEFT ] += s->slev * M_SQRT1_2; matrix[FRONT_RIGHT][BACK_RIGHT] += s->slev * M_SQRT1_2; } else if (matrix_encoding == AV_MATRIX_ENCODING_DPLII) { matrix[FRONT_LEFT ][BACK_LEFT ] -= s->slev * SQRT3_2; matrix[FRONT_LEFT ][BACK_RIGHT] -= s->slev * M_SQRT1_2; matrix[FRONT_RIGHT][BACK_LEFT ] += s->slev * M_SQRT1_2; matrix[FRONT_RIGHT][BACK_RIGHT] += s->slev * SQRT3_2; } else { matrix[ FRONT_LEFT][ BACK_LEFT] += s->slev; matrix[FRONT_RIGHT][BACK_RIGHT] += s->slev; } }else if(out_ch_layout & AV_CH_FRONT_CENTER){ matrix[ FRONT_CENTER][BACK_LEFT ]+= s->slev*M_SQRT1_2; matrix[ FRONT_CENTER][BACK_RIGHT]+= s->slev*M_SQRT1_2; }else av_assert0(0); } if(unaccounted & AV_CH_SIDE_LEFT){ if(out_ch_layout & AV_CH_BACK_LEFT){ if (in_ch_layout & AV_CH_BACK_LEFT) { matrix[BACK_LEFT ][SIDE_LEFT ] += M_SQRT1_2; matrix[BACK_RIGHT][SIDE_RIGHT] += M_SQRT1_2; } else { matrix[BACK_LEFT ][SIDE_LEFT ] += 1.0; matrix[BACK_RIGHT][SIDE_RIGHT] += 1.0; } }else if(out_ch_layout & AV_CH_BACK_CENTER){ matrix[BACK_CENTER][ SIDE_LEFT]+= M_SQRT1_2; matrix[BACK_CENTER][SIDE_RIGHT]+= M_SQRT1_2; }else if(out_ch_layout & AV_CH_FRONT_LEFT){ if (matrix_encoding == AV_MATRIX_ENCODING_DOLBY) { matrix[FRONT_LEFT ][SIDE_LEFT ] -= s->slev * M_SQRT1_2; matrix[FRONT_LEFT ][SIDE_RIGHT] -= s->slev * M_SQRT1_2; matrix[FRONT_RIGHT][SIDE_LEFT ] += s->slev * M_SQRT1_2; matrix[FRONT_RIGHT][SIDE_RIGHT] += s->slev * M_SQRT1_2; } else if (matrix_encoding == AV_MATRIX_ENCODING_DPLII) { matrix[FRONT_LEFT ][SIDE_LEFT ] -= s->slev * SQRT3_2; matrix[FRONT_LEFT ][SIDE_RIGHT] -= s->slev * M_SQRT1_2; matrix[FRONT_RIGHT][SIDE_LEFT ] += s->slev * M_SQRT1_2; matrix[FRONT_RIGHT][SIDE_RIGHT] += s->slev * SQRT3_2; } else { matrix[ FRONT_LEFT][ SIDE_LEFT] += s->slev; matrix[FRONT_RIGHT][SIDE_RIGHT] += s->slev; } }else if(out_ch_layout & AV_CH_FRONT_CENTER){ matrix[ FRONT_CENTER][SIDE_LEFT ]+= s->slev*M_SQRT1_2; matrix[ FRONT_CENTER][SIDE_RIGHT]+= s->slev*M_SQRT1_2; }else av_assert0(0); } if(unaccounted & AV_CH_FRONT_LEFT_OF_CENTER){ if(out_ch_layout & AV_CH_FRONT_LEFT){ matrix[ FRONT_LEFT][ FRONT_LEFT_OF_CENTER]+= 1.0; matrix[FRONT_RIGHT][FRONT_RIGHT_OF_CENTER]+= 1.0; }else if(out_ch_layout & AV_CH_FRONT_CENTER){ matrix[ FRONT_CENTER][ FRONT_LEFT_OF_CENTER]+= M_SQRT1_2; matrix[ FRONT_CENTER][FRONT_RIGHT_OF_CENTER]+= M_SQRT1_2; }else av_assert0(0); } if (unaccounted & AV_CH_LOW_FREQUENCY) { if (out_ch_layout & AV_CH_FRONT_CENTER) { matrix[FRONT_CENTER][LOW_FREQUENCY] += s->lfe_mix_level; } else if (out_ch_layout & AV_CH_FRONT_LEFT) { matrix[FRONT_LEFT ][LOW_FREQUENCY] += s->lfe_mix_level * M_SQRT1_2; matrix[FRONT_RIGHT][LOW_FREQUENCY] += s->lfe_mix_level * M_SQRT1_2; } else av_assert0(0); } for(out_i=i=0; i<64; i++){ double sum=0; int in_i=0; for(j=0; j<64; j++){ if (i < FF_ARRAY_ELEMS(matrix) && j < FF_ARRAY_ELEMS(matrix[0])) s->matrix[out_i][in_i]= matrix[i][j]; else s->matrix[out_i][in_i]= i == j && (in_ch_layout & out_ch_layout & (1ULL<<i)); sum += fabs(s->matrix[out_i][in_i]); if(in_ch_layout & (1ULL<<j)) in_i++; } maxcoef= FFMAX(maxcoef, sum); if(out_ch_layout & (1ULL<<i)) out_i++; } if(s->rematrix_volume < 0) maxcoef = -s->rematrix_volume; if (s->rematrix_maxval > 0) { maxval = s->rematrix_maxval; } else if ( av_get_packed_sample_fmt(s->out_sample_fmt) < AV_SAMPLE_FMT_FLT || av_get_packed_sample_fmt(s->int_sample_fmt) < AV_SAMPLE_FMT_FLT) { maxval = 1.0; } else maxval = INT_MAX; if(maxcoef > maxval || s->rematrix_volume < 0){ maxcoef /= maxval; for(i=0; i<SWR_CH_MAX; i++) for(j=0; j<SWR_CH_MAX; j++){ s->matrix[i][j] /= maxcoef; } } if(s->rematrix_volume > 0){ for(i=0; i<SWR_CH_MAX; i++) for(j=0; j<SWR_CH_MAX; j++){ s->matrix[i][j] *= s->rematrix_volume; } } for(i=0; i<av_get_channel_layout_nb_channels(out_ch_layout); i++){ for(j=0; j<av_get_channel_layout_nb_channels(in_ch_layout); j++){ av_log(NULL, AV_LOG_DEBUG, "%f ", s->matrix[i][j]); } av_log(NULL, AV_LOG_DEBUG, "\n"); } return 0; }
1threat
In the context of OpenCV, what is `ippicv`? : <p>While building OpenCV 3.1.0 on CentOS I've been getting a hash mismatch error caused by a file called <code>ippicv_linux_20151201.tgz</code>. After some research I have found that the two prevailing solutions suggested by several people (for example <a href="https://github.com/opencv/opencv/issues/5973" rel="noreferrer">here</a>) are the following.</p> <ol> <li>Build again with option <code>-DWITH_IPP=OFF</code>.</li> <li>Manually download the file <code>ippicv_linux_20151201.tgz</code> and put it in the right place.</li> </ol> <p>Now solution 2 above didn't work for me, and I feel a bit nervous about solution 1. My fear is that building OpenCV with <code>-DWITH_IPP=OFF</code> might prevent some things from working properly later, thus making a time bomb. My question is what is IPP? Or <code>ippicv</code>? Or ICV? I'm not even sure what to ask here. I want to know what I'm about to disable in the build before I disable it.</p>
0debug
How to cast object to customer class : I got the result from Hibernate HQL query.list(). So, the return are all in Object[]. The fields of each item of the array are also in Object[]. The contents are correct. So, is there anyway to cast it to a custom java object? Thanks
0debug
How to push a commit to Github from a CircleCI build using a personal access token : <p>When executing a build for git repository <code>giantswarm/docs-content</code> in CircleCI, I'd like to push a commit to another repository <code>giantswarm/docs</code>.</p> <p>I have this in the <code>deployment</code> section of <code>circle.yml</code>:</p> <pre><code>git config credential.helper cache git config user.email "&lt;some verified email&gt;" git config user.name "Github Bot" git clone --depth 1 https://${GITHUB_PERSONAL_TOKEN}:x-oauth-basic@github.com/giantswarm/docs.git cd docs/ git commit --allow-empty -m "Trigger build and publishing via docs-content" git push -u origin master </code></pre> <p>This <a href="https://circleci.com/gh/giantswarm/docs-content/67" rel="noreferrer">fails</a> in the very last command with this error message:</p> <pre><code>ERROR: The key you are authenticating with has been marked as read only. fatal: Could not read from remote repository. </code></pre> <p>The <code>GITHUB_PERSONAL_TOKEN</code> environment variable is set to a user's personal access token, which has been created with <code>repo</code> scope to access the private repo <code>giantswarm/docs</code>. In addition, I added the user to a team that has admin permissions for that repo.</p> <p>That series of commands works just fine when I execute it in a fresh Ubuntu VM. Any idea why it doesn't on CircleCI?</p>
0debug
void bios_linker_loader_add_pointer(GArray *linker, const char *dest_file, const char *src_file, GArray *table, void *pointer, uint8_t pointer_size) { BiosLinkerLoaderEntry entry; memset(&entry, 0, sizeof entry); strncpy(entry.pointer.dest_file, dest_file, sizeof entry.pointer.dest_file - 1); strncpy(entry.pointer.src_file, src_file, sizeof entry.pointer.src_file - 1); entry.command = cpu_to_le32(BIOS_LINKER_LOADER_COMMAND_ADD_POINTER); entry.pointer.offset = cpu_to_le32((gchar *)pointer - table->data); entry.pointer.size = pointer_size; assert(pointer_size == 1 || pointer_size == 2 || pointer_size == 4 || pointer_size == 8); g_array_append_val(linker, entry); }
1threat
Moving from one activity to another activity in android studio : <p>I'm writing an application in android studio IDE which shows the models,brands ,prices and etc of the cars and I want to move from one activity to another one.can I use putExtra?if yes i wonder if anyone would like to tell me how can i use it.</p>
0debug
static int ffm_read_header(AVFormatContext *s) { FFMContext *ffm = s->priv_data; AVStream *st; AVIOContext *pb = s->pb; AVCodecContext *codec; int i, nb_streams; uint32_t tag; tag = avio_rl32(pb); if (tag == MKTAG('F', 'F', 'M', '2')) return ffm2_read_header(s); if (tag != MKTAG('F', 'F', 'M', '1')) goto fail; ffm->packet_size = avio_rb32(pb); if (ffm->packet_size != FFM_PACKET_SIZE) goto fail; ffm->write_index = avio_rb64(pb); if (pb->seekable) { ffm->file_size = avio_size(pb); if (ffm->write_index && 0) adjust_write_index(s); } else { ffm->file_size = (UINT64_C(1) << 63) - 1; } nb_streams = avio_rb32(pb); avio_rb32(pb); for(i=0;i<nb_streams;i++) { char rc_eq_buf[128]; st = avformat_new_stream(s, NULL); if (!st) goto fail; avpriv_set_pts_info(st, 64, 1, 1000000); codec = st->codec; codec->codec_id = avio_rb32(pb); codec->codec_type = avio_r8(pb); codec->bit_rate = avio_rb32(pb); codec->flags = avio_rb32(pb); codec->flags2 = avio_rb32(pb); codec->debug = avio_rb32(pb); switch(codec->codec_type) { case AVMEDIA_TYPE_VIDEO: codec->time_base.num = avio_rb32(pb); codec->time_base.den = avio_rb32(pb); codec->width = avio_rb16(pb); codec->height = avio_rb16(pb); codec->gop_size = avio_rb16(pb); codec->pix_fmt = avio_rb32(pb); codec->qmin = avio_r8(pb); codec->qmax = avio_r8(pb); codec->max_qdiff = avio_r8(pb); codec->qcompress = avio_rb16(pb) / 10000.0; codec->qblur = avio_rb16(pb) / 10000.0; codec->bit_rate_tolerance = avio_rb32(pb); avio_get_str(pb, INT_MAX, rc_eq_buf, sizeof(rc_eq_buf)); codec->rc_eq = av_strdup(rc_eq_buf); codec->rc_max_rate = avio_rb32(pb); codec->rc_min_rate = avio_rb32(pb); codec->rc_buffer_size = avio_rb32(pb); codec->i_quant_factor = av_int2double(avio_rb64(pb)); codec->b_quant_factor = av_int2double(avio_rb64(pb)); codec->i_quant_offset = av_int2double(avio_rb64(pb)); codec->b_quant_offset = av_int2double(avio_rb64(pb)); codec->dct_algo = avio_rb32(pb); codec->strict_std_compliance = avio_rb32(pb); codec->max_b_frames = avio_rb32(pb); codec->mpeg_quant = avio_rb32(pb); codec->intra_dc_precision = avio_rb32(pb); codec->me_method = avio_rb32(pb); codec->mb_decision = avio_rb32(pb); codec->nsse_weight = avio_rb32(pb); codec->frame_skip_cmp = avio_rb32(pb); codec->rc_buffer_aggressivity = av_int2double(avio_rb64(pb)); codec->codec_tag = avio_rb32(pb); codec->thread_count = avio_r8(pb); codec->coder_type = avio_rb32(pb); codec->me_cmp = avio_rb32(pb); codec->me_subpel_quality = avio_rb32(pb); codec->me_range = avio_rb32(pb); codec->keyint_min = avio_rb32(pb); codec->scenechange_threshold = avio_rb32(pb); codec->b_frame_strategy = avio_rb32(pb); codec->qcompress = av_int2double(avio_rb64(pb)); codec->qblur = av_int2double(avio_rb64(pb)); codec->max_qdiff = avio_rb32(pb); codec->refs = avio_rb32(pb); break; case AVMEDIA_TYPE_AUDIO: codec->sample_rate = avio_rb32(pb); codec->channels = avio_rl16(pb); codec->frame_size = avio_rl16(pb); break; default: goto fail; } if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) { if (ff_get_extradata(codec, pb, avio_rb32(pb)) < 0) return AVERROR(ENOMEM); } } while ((avio_tell(pb) % ffm->packet_size) != 0) avio_r8(pb); ffm->packet_ptr = ffm->packet; ffm->packet_end = ffm->packet; ffm->frame_offset = 0; ffm->dts = 0; ffm->read_state = READ_HEADER; ffm->first_packet = 1; return 0; fail: ffm_close(s); return -1; }
1threat
OOP Inheritance homework (Animal to lion super class inheritance) : <p>I need to: Extend the animal class with a Lion class and have different features(done).</p> <p>Add a field called Liontype class and add a method classifying the lion type per its weight.(Needs to be derived from the superclass)</p> <p>And print it out.</p> <p>There are errors in my code and I've been trying to fix it. Thank for any assistance in advance.</p> <pre><code>public class Animal { private int numTeeth = 0; private boolean spots = false; private int weight = 0; public Animal(int numTeeth, boolean spots, int weight){ this.setNumTeeth(numTeeth); this.setSpots(spots); this.setWeight(weight); } public int getNumTeeth(){ return numTeeth; } public void setNumTeeth(int numTeeth) { this.numTeeth = numTeeth; } public boolean getSpots() { return spots; } public void setSpots(boolean spots) { this.spots = spots; } public int getWeight() { return weight; } public void setWeight(int weight) { this.weight = weight; } } //Extend animal class public class Lion extends Animal{ public Lion (int numTeeth, boolean spots, int weight){ super(numTeeth, spots, weight); //Add new attributes int age = 0; int cubs = 0; } public static void main(String args[]){ //Create lions and assign attributes Lion lion1 = new Lion(); lion1.numTeeth = 12; lion1.spots = 1; lion1. weight = 86; lion1.age = 7; lion1.cubs = 3; //Print attributes System.out.println("Lion1 attributes:"); System.out.println("Number of teeth : " + numTeeth); System.out.println("Number of spots : " + spots); System.out.println("Weight of lion : " + weight + " kgs"); System.out.println("Age : " + age); System.out.println("No of cubs : " + cubs); System.out.println(" "); Lion lion2 = new Lion(); lion2.numTeeth = 16; lion2.spots = 0; lion2. weight = 123; lion2.age = 13; lion2.cubs = 5; System.out.println("Lion2 attributes:"); System.out.println("Number of teeth : " + numTeeth); System.out.println("Number of spots : " + spots); System.out.println("Weight of lion : " + weight + " kgs"); System.out.println("Age : " + age); System.out.println("No of cubs : " + cubs); System.out.println(" "); } public class Liontype{ //Trying to get weight from another class public Integer getWeight() { if (weight &gt; 120) { System.out.println("This lion is a cub"); } else if (weight &gt;= 120 &amp;&amp; weight &lt; 180) { System.out.println("This lion is a female"); } else if (weight &gt;= 180) { System.out.println("This lion is a male"); } } } } Expected outcome: Lion attributes: Number of teeth : 16 Spots : true Weight of lion : 83kgs Age : 13 No of cubs : 3 This lion is a female </code></pre>
0debug
How to install a library from github? : <p>Trying to install this library.</p> <p><a href="https://github.com/pib/PyBrowser" rel="nofollow">https://github.com/pib/PyBrowser</a></p> <p>with the command </p> <pre><code>pip install git+https://github.com/pib/PyBrowser.git </code></pre> <p>and run into this error </p> <pre><code>setup.py </code></pre> <p>So I just cloned the repo in my sites-packages folder, but it still isnt seeing it as installed in python...</p> <p>Thanks!</p>
0debug
Eval Injection / hack : **Is it possible in C# to 'hack' an eval ?**<br/> When you are using : <%# Eval("MyDataFieldFromDatabase") %> instead of : <%# ((Foo)Container.DataItem).MyDataFieldFromDatabase %>
0debug
ISO27001 and open software : <p>The company am employed considers to obtain an ISO27001 certification. Have already implemented a Linux testbed running Open VPN without issues. However am told a company cannot be ISO27001 certified unless their VPN is materialized using commercial only solutions, <em>implying open solutions such as Open VPN are considered unacceptable and un-certifiable under ISO27001</em>. Was surprised to hear this, would like to know from more knowledgeable people if there is any substance on that.</p> <p>kind regards</p> <p>K</p>
0debug
InkWell ripple over top of image in GridTile in Flutter : <p>I'm trying to use <code>InkWell</code> to get a ripple effect on top of an image inside of a <code>GridTile</code> when the user taps on the tile.</p> <p>I believe the image itself is obscuring the ripple because when I remove the image, I see the ripple.</p> <p>Below is the code for a single GridTile. </p> <pre><code>return new InkWell( onTap: () =&gt; debugPrint(s.displayName), highlightColor: Colors.pinkAccent, splashColor: Colors.greenAccent, child: new GridTile( footer: new GridTileBar( title: new Text(s.displayName), subtitle: new Text(s.gameName), backgroundColor: Colors.black45, trailing: new Icon( Icons.launch, color: Colors.white, ), ), child: new Image.network( //this is obscuring the InkWell ripple s.imageSrc, fit: BoxFit.cover, ), ), ); </code></pre> <p>I've tried moving the InkWell to different levels of the hierarchy, using <code>DecorationImage</code> inside a <code>Container</code>, but none of these seem to work to reveal the ripple.</p> <p>How can I get the ripple to appear on top of the tile/image?</p>
0debug
what practice is better using pure javascript & css is or using frameworks? : <p>being a student which practice is better using pure javascript &amp; css or frameworks? And which is better for professional field?</p>
0debug
How to optimize this nested for loop in R? : I need help figuring out how to improve a for loop. It doesn't necessarily needs to be an apply, I just thought it was the best way after researching it on stackoverflow. I tried following the guides I found on stackoverflow, but i'm a newbie and believe i'm not getting a good grasp on the apply function. This is a reconstruction of the snippet i'm trying to change: for (j in 1:NROW(teste2) { for (z in 1:NROW(teste2)) { if(is.na(teste2$DATE[z]==Sys.Date()+j-1) | z==NROW(teste2)){ teste2$SALDO[z] <- 0 }else{ if(teste2$SALDO[z]!=0 & teste2$DATE[z]==Sys.Date()+j-1){ teste2$SALDO[z+1] <- teste2$PREVISAO_FINAL2[z] + teste2$SALDO[z+1] }else{ teste2$SALDO[z] <- teste2$SALDO[z] } } } i tried doing the following: for (j in 1:NROW(teste2) { rows = 1:NROW(teste2) saldo_fn <- function(z){ return(if(is.na(teste2$DATE[z]==Sys.Date()+j-1) | z==NROW(teste2)){ teste2$SALDO[z] <- 0 }else{ if(teste2$SALDO[z]!=0 & teste2$DATE[z]==Sys.Date()+j-1){ teste2$SALDO[z+1] <- teste2$PREVISAO_FINAL2[z] + teste2$SALDO[z+1] }else{ teste2$SALDO[z] <- teste2$SALDO[z] } }) } teste2$SALDO <- sapply(rows, saldo_fn) } but when i run sum(teste2$SALDO) it gives a different value. What am I doing wrong? how do I fix it?
0debug
Frameless window with controls in electron (Windows) : <p>I want my app to have no title bar but still be closeable, draggable, minimizable, maximizable and resizable like a regular window. I can do this in OS X since there is a <a href="https://github.com/atom/electron/blob/master/docs/api/frameless-window.md" rel="noreferrer"><code>titleBarStyle</code></a> option called <code>hidden-inset</code> that I can use but unfortunately it's not available for Windows, which is the platform that I'm developing for. How would I go about doing something like this in Windows?</p> <p><a href="https://cloud.githubusercontent.com/assets/2175645/10311824/0f1bebae-6c51-11e5-9194-07cecebfbab3.gif" rel="noreferrer">Here's an example</a> of what I'm talking about. </p>
0debug
Get values from Map : I have this Ruby map: PAYMENT_TYPE_TO_CURRENCY_AND_COUNTRY_MAPPING = { zimpler: { 'EUR' => ['FI'], 'SEK' => ['SE']}, qiwi: { 'EUR' => ['RU', 'KZ'], 'RUB' => ['RU'], 'KZT' => ['KZ'], 'USD' => ['UA']}, payu: { 'CZK' => ['CZ'], 'PLN' => ['PL']}, entercash: { 'EUR' => ['AT', 'DE', 'FI'], 'SEK' => ['SE'] }, davivienda: { 'USD' => ['CO'] }, banco_de_chile: { 'USD' => ['CL'] } } I want to get random currency and country from the structure with sample: currency = PAYMENT_TYPE_TO_CURRENCY_TO_COUNTRY_BY_PAYMENT_TYPE_MAPPING[payment_type].keys.sample country = PAYMENT_TYPE_TO_CURRENCY_TO_COUNTRY_BY_PAYMENT_TYPE_MAPPING[payment_type][currency].sample But I get `execute': undefined method `keys' How I can implement this?
0debug
int coroutine_fn blk_co_pwritev(BlockBackend *blk, int64_t offset, unsigned int bytes, QEMUIOVector *qiov, BdrvRequestFlags flags) { int ret; trace_blk_co_pwritev(blk, blk_bs(blk), offset, bytes, flags); ret = blk_check_byte_request(blk, offset, bytes); if (ret < 0) { return ret; } if (blk->public.throttle_state) { throttle_group_co_io_limits_intercept(blk, bytes, true); } if (!blk->enable_write_cache) { flags |= BDRV_REQ_FUA; } return bdrv_co_pwritev(blk_bs(blk), offset, bytes, qiov, flags); }
1threat
awk and flagging identical patterns : <p>I'm missing something about awk pattern matching a using flags --</p> <p>Given a file:</p> <pre><code>2019 foo a b c 2019 bar d e f 2019 foobar g h i </code></pre> <p>I can use awk with flags and get the expected output -- <code>awk '/foo/{flag=1;next} /^[0-9]+/{flag=0} flag' file</code></p> <pre><code> a b c g h i </code></pre> <p>But if I exclude the next to include the matched pattern, then nothing is printed. Does awk continue from the matched line?</p> <p>Using another syntax -- <code>awk '/foo/,/2019/' file</code></p> <pre><code>2019 foo 2019 foobar </code></pre> <p>I was expecting awk to print between and including the match. I'm definitely missing something on syntax.</p>
0debug
Formatting string connected to for loop from a list (python) : <p>I want to display a single string connected to values from a list displayed using a for loop</p> <p>For example I have this:</p> <pre><code>nums = [1,2,3,4,5] print("Numbers: ") for i in nums: print(i) </code></pre> <p>but I would like it to be displayed with the 1 starting after "Numbers:"</p> <p>e.g</p> <p>Numbers: 1<br>2<br>3<br>...</p> <p>How would I format the code to enable this to happen?</p>
0debug
static int dump_ppc_insns (CPUPPCState *env) { opc_handler_t **table, *handler; uint8_t opc1, opc2, opc3; printf("Instructions set:\n"); for (opc1 = 0x00; opc1 < 0x40; opc1++) { table = env->opcodes; handler = table[opc1]; if (is_indirect_opcode(handler)) { for (opc2 = 0; opc2 < 0x20; opc2++) { table = env->opcodes; handler = env->opcodes[opc1]; table = ind_table(handler); handler = table[opc2]; if (is_indirect_opcode(handler)) { table = ind_table(handler); for (opc3 = 0; opc3 < 0x20; opc3++) { handler = table[opc3]; if (handler->handler != &gen_invalid) { printf("INSN: %02x %02x %02x (%02d %04d) : %s\n", opc1, opc2, opc3, opc1, (opc3 << 5) | opc2, handler->oname); } } } else { if (handler->handler != &gen_invalid) { printf("INSN: %02x %02x -- (%02d %04d) : %s\n", opc1, opc2, opc1, opc2, handler->oname); } } } } else { if (handler->handler != &gen_invalid) { printf("INSN: %02x -- -- (%02d ----) : %s\n", opc1, opc1, handler->oname); } } } }
1threat
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
assignment makes integer from pointer without a cast c[a0][4]="YES"; i cant get it what is wrong int it integer t is already decleared : <p>warning: assignment makes integer from pointer without a cast c[a0][4]="YES"; i cant get it what is wrong int it integer t is already decleared </p> <pre><code>char c[t][4]; for(int a0 = 0; a0 &lt; t; a0++) { int n; int k; scanf("%d %d",&amp;n,&amp;k); int a[n]; for(int a_i = 0; a_i &lt; n; a_i++) { scanf("%d",&amp;a[a_i]); if(a[a_i]&lt;=0) { count++; } } if(count&gt;=k) c[a0][4]="NO"; else c[a0][4]="YES"; count=0; } for(int p=0;p&lt;t;p++) printf("%c \n",c[p][4]); </code></pre>
0debug
static void vfio_unmap_bar(VFIOPCIDevice *vdev, int nr) { VFIOBAR *bar = &vdev->bars[nr]; if (!bar->region.size) { return; } vfio_bar_quirk_teardown(vdev, nr); memory_region_del_subregion(&bar->region.mem, &bar->region.mmap_mem); munmap(bar->region.mmap, memory_region_size(&bar->region.mmap_mem)); if (vdev->msix && vdev->msix->table_bar == nr) { memory_region_del_subregion(&bar->region.mem, &vdev->msix->mmap_mem); munmap(vdev->msix->mmap, memory_region_size(&vdev->msix->mmap_mem)); } }
1threat
Dockerfile - How to pass an answer to a prompt post apt-get install? : <p>In my Dockerfile, I am trying to install jackd2 package:</p> <pre><code>RUN apt-get install -y jackd2 </code></pre> <p>It installs properly, but after installation, I can see the following prompt:</p> <pre><code>If you want to run jackd with realtime priorities, the user starting jackd needs realtime permissions. Accept this option to create the file /etc/security/limits.d/audio.conf, granting realtime priority and memlock privileges to the audio group. Running jackd with realtime priority minimizes latency, but may lead to complete system lock-ups by requesting all the available physical system memory, which is unacceptable in multi-user environments. Enable realtime process priority? [yes/no] </code></pre> <p>```</p> <p>At this point, I would like to answer with either yes or no, hit enter and move on but I have no idea how to script this inside a dockerfile and my build hangs right there. </p>
0debug
Parse error: syntax error, unexpected end of file in C:\Users\p\Desktop\xampp\htdocs\myproject\login.php on line 55 : <p>Parse error: syntax error, unexpected end of file in C:\Users\p\Desktop\xampp\htdocs\myproject\login.php on line 55</p> <p>So I dont know what is causing this problem I have only started to learn Php and Html. Can anyone help fix this.</p> <p>Here is the code.</p> <p>Line 55 is at the bottom. <pre><code>if(isset($_POST['submit'])) { $username = $_POST['username']; $password = $_POST['password']; $connection = mysqli_connect('localhost', 'root', 'root', 'loginapp'); if($connection) { echo "We are connected"; } else { } die("Database connection failed"); ?&gt; &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;Document&lt;/title&gt; &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container"&gt; &lt;div class="col-sm-6"&gt; &lt;form action="login.php" method="post"&gt; &lt;div class="form-group"&gt;&lt;/div&gt; &lt;label for="username"&gt;Username&lt;/label&gt; &lt;input type="text" name="username" class="form-control"&gt; &lt;div class="form-group"&gt; &lt;label for="password"&gt;Password&lt;/label&gt; &lt;input type="password" name="password" class="form-control"&gt; &lt;input class="btn btn-primary" type="submit" name="submit" value="Submit"&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
0debug