problem
stringlengths
26
131k
labels
class label
2 classes
Object from AWS S3 folder : How can i get a single object from a particular folder in AWS S3 bucket ? By Using the Asp.Net C# language, i don't know how to retrieve a single object that are on a folder in bucket of Amazon S3 Service ?
0debug
writing to a file based on project location : <p>I'm writing a C# windows application in Visual Studio. I want to make it so my program saves a file to a folder automatically, based on the folder the program is stored in. I tried Directory.GetCurrentDirectory().ToString(); but access to that is denied to me. Any suggestions?</p>
0debug
Retreiving Date value through constructor and storing it in variable of type Date. : It throws exception while trying to parse String to Date after getting Date value as a string from the user. What should be done in order to store the Date value (or) is there any any specific method to retrieve date. Medicine.java package Medicine; import java.util.Date; public abstract class Medicine { public int price; Date expiryDate; Medicine() { } Medicine(int price, Date expiryDate) { this.price=price; this.expiryDate=expiryDate; } public void getDetails() { System.out.println("The price is "+this.price); System.out.println("The expiry Date for the product is "+this.expiryDate); } abstract void displayLabel(); } -------------------------------------------------------------------- Tablet.java package Medicine; import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; public class Tablet extends Medicine{ Date expDate; void displayLabel() { System.out.println("Store in a cool and dry place"); } Tablet() { } Tablet(int price, Date expDate) { this.price=price; this.expDate=expDate; } } ---------------------------------------------------------------------------- Execution Class int price; Date expDate=new Date();; Scanner reader = new Scanner(System.in); Medicine[] medicineArray =new Medicine[5]; DateFormat df=new SimpleDateFormat("dd-mm-yyyy"); System.out.println("Enter Tablet's price"); price = reader.nextInt(); System.out.println("Enter Tablet's expiry date in yyyy-dd-mm format"); String stringExpDate=reader.nextLine(); try { expDate=df.parse(stringExpDate); } catch(Exception e){ System.out.println("Date format not parsed"); } Medicine med1=new Tablet(price,expDate); med1.getDetails(); med1.displayLabel();
0debug
Can't add Team ID in Firebase Project settings : <p>I am trying to add dynamic links to my app and I am following this guide: </p> <p><a href="https://www.youtube.com/watch?v=sFPo296OQqk" rel="noreferrer">https://www.youtube.com/watch?v=sFPo296OQqk</a></p> <p>At around 3:20 he explains how to add team ID in the project settings but for me this option simply isn't there. I have checked all my projects and none of them has this option in project settings. This is a problem since dynamic links does not work without that added since I've seen people around with similar problem as me (that was solved by adding the Team ID they had forgot). </p> <p>Is there any solution to this? </p> <p>I'm working on a iOS project and my location is Sweden if that somehow matters. </p> <p>Any help is very much appreciated. </p>
0debug
AADSTS50012: Invalid client secret is provided when moving from a Test App to Production : <p>I have two applications registered under the Azure Portal: a test version and a production version. My test App works fine with the Client Id and ClientSecret/AppKey that I got from the test app's detail from Azure Portal. However when I move to the production one as I replace the ClientId and Secret values with the one specified by the production App I registered, I suddenly get an error: </p> <p>AdalServiceException: AADSTS70002: Error validating credentials. AADSTS50012: Invalid client secret is provided</p> <p>But I'm fairly sure that my client secret is correct as I just copied and pasted from the Portal. Is there any solutions to this?</p>
0debug
static int wav_read_header(AVFormatContext *s) { int64_t size, av_uninit(data_size); int64_t sample_count = 0; int rf64; uint32_t tag; AVIOContext *pb = s->pb; AVStream *st = NULL; WAVDemuxContext *wav = s->priv_data; int ret, got_fmt = 0; int64_t next_tag_ofs, data_ofs = -1; wav->unaligned = avio_tell(s->pb) & 1; wav->smv_data_ofs = -1; tag = avio_rl32(pb); rf64 = tag == MKTAG('R', 'F', '6', '4'); wav->rifx = tag == MKTAG('R', 'I', 'F', 'X'); if (!rf64 && !wav->rifx && tag != MKTAG('R', 'I', 'F', 'F')) return AVERROR_INVALIDDATA; avio_rl32(pb); tag = avio_rl32(pb); if (tag != MKTAG('W', 'A', 'V', 'E')) return AVERROR_INVALIDDATA; if (rf64) { if (avio_rl32(pb) != MKTAG('d', 's', '6', '4')) return AVERROR_INVALIDDATA; size = avio_rl32(pb); if (size < 24) return AVERROR_INVALIDDATA; avio_rl64(pb); data_size = avio_rl64(pb); sample_count = avio_rl64(pb); if (data_size < 0 || sample_count < 0) { av_log(s, AV_LOG_ERROR, "negative data_size and/or sample_count in " "ds64: data_size = %"PRId64", sample_count = %"PRId64"\n", data_size, sample_count); return AVERROR_INVALIDDATA; } avio_skip(pb, size - 24); } for (;;) { AVStream *vst; size = next_tag(pb, &tag, wav->rifx); next_tag_ofs = avio_tell(pb) + size; if (avio_feof(pb)) break; switch (tag) { case MKTAG('f', 'm', 't', ' '): if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st)) < 0) { return ret; } else if (got_fmt) av_log(s, AV_LOG_WARNING, "found more than one 'fmt ' tag\n"); got_fmt = 1; break; case MKTAG('d', 'a', 't', 'a'): if (!got_fmt) { av_log(s, AV_LOG_ERROR, "found no 'fmt ' tag before the 'data' tag\n"); return AVERROR_INVALIDDATA; } if (rf64) { next_tag_ofs = wav->data_end = avio_tell(pb) + data_size; } else { data_size = size; next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX; } data_ofs = avio_tell(pb); if (!pb->seekable || (!rf64 && !size)) goto break_loop; break; case MKTAG('f', 'a', 'c', 't'): if (!sample_count) sample_count = (!wav->rifx ? avio_rl32(pb) : avio_rb32(pb)); break; case MKTAG('b', 'e', 'x', 't'): if ((ret = wav_parse_bext_tag(s, size)) < 0) return ret; break; case MKTAG('S','M','V','0'): if (!got_fmt) { av_log(s, AV_LOG_ERROR, "found no 'fmt ' tag before the 'SMV0' tag\n"); return AVERROR_INVALIDDATA; } if (size != MKTAG('0','2','0','0')) { av_log(s, AV_LOG_ERROR, "Unknown SMV version found\n"); goto break_loop; } av_log(s, AV_LOG_DEBUG, "Found SMV data\n"); wav->smv_given_first = 0; vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); avio_r8(pb); vst->id = 1; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = AV_CODEC_ID_SMVJPEG; vst->codec->width = avio_rl24(pb); vst->codec->height = avio_rl24(pb); if (ff_alloc_extradata(vst->codec, 4)) { av_log(s, AV_LOG_ERROR, "Could not allocate extradata.\n"); return AVERROR(ENOMEM); } size = avio_rl24(pb); wav->smv_data_ofs = avio_tell(pb) + (size - 5) * 3; avio_rl24(pb); wav->smv_block_size = avio_rl24(pb); avpriv_set_pts_info(vst, 32, 1, avio_rl24(pb)); vst->duration = avio_rl24(pb); avio_rl24(pb); avio_rl24(pb); wav->smv_frames_per_jpeg = avio_rl24(pb); if (wav->smv_frames_per_jpeg > 65536) { av_log(s, AV_LOG_ERROR, "too many frames per jpeg\n"); return AVERROR_INVALIDDATA; } AV_WL32(vst->codec->extradata, wav->smv_frames_per_jpeg); wav->smv_cur_pt = 0; goto break_loop; case MKTAG('L', 'I', 'S', 'T'): if (size < 4) { av_log(s, AV_LOG_ERROR, "too short LIST tag\n"); return AVERROR_INVALIDDATA; } switch (avio_rl32(pb)) { case MKTAG('I', 'N', 'F', 'O'): ff_read_riff_info(s, size - 4); } break; } if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) || wav_seek_tag(wav, pb, next_tag_ofs, SEEK_SET) < 0) { break; } } break_loop: if (data_ofs < 0) { av_log(s, AV_LOG_ERROR, "no 'data' tag found\n"); return AVERROR_INVALIDDATA; } avio_seek(pb, data_ofs, SEEK_SET); if ( data_size > 0 && sample_count && st->codec->channels && data_size / sample_count / st->codec->channels > 8) { av_log(s, AV_LOG_WARNING, "ignoring wrong sample_count %"PRId64"\n", sample_count); sample_count = 0; } if (!sample_count || av_get_exact_bits_per_sample(st->codec->codec_id) > 0) if ( st->codec->channels && data_size && av_get_bits_per_sample(st->codec->codec_id) && wav->data_end <= avio_size(pb)) sample_count = (data_size << 3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); if (sample_count) st->duration = sample_count; ff_metadata_conv_ctx(s, NULL, wav_metadata_conv); ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); return 0; }
1threat
static av_cold void common_init(MpegEncContext * s) { static int initialized=0; switch(s->msmpeg4_version){ case 1: case 2: s->y_dc_scale_table= s->c_dc_scale_table= ff_mpeg1_dc_scale_table; break; case 3: if(s->workaround_bugs){ s->y_dc_scale_table= old_ff_y_dc_scale_table; s->c_dc_scale_table= wmv1_c_dc_scale_table; } else{ s->y_dc_scale_table= ff_mpeg4_y_dc_scale_table; s->c_dc_scale_table= ff_mpeg4_c_dc_scale_table; } break; case 4: case 5: s->y_dc_scale_table= wmv1_y_dc_scale_table; s->c_dc_scale_table= wmv1_c_dc_scale_table; break; #if CONFIG_WMV3_DECODER || CONFIG_VC1_DECODER case 6: s->y_dc_scale_table= wmv3_dc_scale_table; s->c_dc_scale_table= wmv3_dc_scale_table; break; #endif } if(s->msmpeg4_version>=4){ ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable , wmv1_scantable[1]); ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, wmv1_scantable[2]); ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, wmv1_scantable[3]); ff_init_scantable(s->dsp.idct_permutation, &s->inter_scantable , wmv1_scantable[0]); } if(!initialized){ initialized=1; init_h263_dc_for_msmpeg4(); } }
1threat
int qtest_init(void) { CharDriverState *chr; g_assert(qtest_chrdev != NULL); configure_icount("0"); chr = qemu_chr_new("qtest", qtest_chrdev, NULL); qemu_chr_add_handlers(chr, qtest_can_read, qtest_read, qtest_event, chr); qemu_chr_fe_set_echo(chr, true); inbuf = g_string_new(""); if (qtest_log) { if (strcmp(qtest_log, "none") != 0) { qtest_log_fp = fopen(qtest_log, "w+"); } } else { qtest_log_fp = stderr; } qtest_chr = chr; return 0; }
1threat
int coroutine_fn qed_find_cluster(BDRVQEDState *s, QEDRequest *request, uint64_t pos, size_t *len, uint64_t *img_offset) { uint64_t l2_offset; uint64_t offset = 0; unsigned int index; unsigned int n; int ret; *len = MIN(*len, (((pos >> s->l1_shift) + 1) << s->l1_shift) - pos); l2_offset = s->l1_table->offsets[qed_l1_index(s, pos)]; if (qed_offset_is_unalloc_cluster(l2_offset)) { *img_offset = 0; return QED_CLUSTER_L1; } if (!qed_check_table_offset(s, l2_offset)) { *img_offset = *len = 0; return -EINVAL; } ret = qed_read_l2_table(s, request, l2_offset); qed_acquire(s); if (ret) { goto out; } index = qed_l2_index(s, pos); n = qed_bytes_to_clusters(s, qed_offset_into_cluster(s, pos) + *len); n = qed_count_contiguous_clusters(s, request->l2_table->table, index, n, &offset); if (qed_offset_is_unalloc_cluster(offset)) { ret = QED_CLUSTER_L2; } else if (qed_offset_is_zero_cluster(offset)) { ret = QED_CLUSTER_ZERO; } else if (qed_check_cluster_offset(s, offset)) { ret = QED_CLUSTER_FOUND; } else { ret = -EINVAL; } *len = MIN(*len, n * s->header.cluster_size - qed_offset_into_cluster(s, pos)); out: *img_offset = offset; qed_release(s); return ret; }
1threat
Scroll position of recycler view lost when returning back to activity from another activity : I m using firebase recycler view apdapter with firebase ui in main activity. When i m opening another activity and returning back to main activity, scroll position moves to top. How to have same scroll position after closng of other activities using firebaseRecyclerview
0debug
SBT: is there a way to print the list of resolvers? : <p>I have a big project with many plugins. I think some of the resolvers are been added by some of the plugins. Is there a way to see what is there in the list of resolvers? (and how there are ordered?)</p>
0debug
void hmp_block_stream(Monitor *mon, const QDict *qdict) { Error *error = NULL; const char *device = qdict_get_str(qdict, "device"); const char *base = qdict_get_try_str(qdict, "base"); qmp_block_stream(device, base != NULL, base, &error); hmp_handle_error(mon, &error); }
1threat
Elixir: rationale behind allowing rebinding of variables : <p>What is the rationale behind allowing rebinding of variables in Elixir, when Erlang doesn't allow that?</p>
0debug
void qio_dns_resolver_lookup_async(QIODNSResolver *resolver, SocketAddress *addr, QIOTaskFunc func, gpointer opaque, GDestroyNotify notify) { QIOTask *task; struct QIODNSResolverLookupData *data = g_new0(struct QIODNSResolverLookupData, 1); data->addr = QAPI_CLONE(SocketAddress, addr); task = qio_task_new(OBJECT(resolver), func, opaque, notify); qio_task_run_in_thread(task, qio_dns_resolver_lookup_worker, data, qio_dns_resolver_lookup_data_free); }
1threat
for-loop and getchar() in C++ : Why does the code get the empty data directly in even times? I have no idea what is going on. Thank you very much. #include <stdio.h> #pragma warning(disable : 4996) void main() { int f, a = 10, b = 20; for (int i = 0; i < 5; i++) { char ch; ch = getchar(); printf("ch = %c\n", ch); switch (ch) { case '+': f = a + b; printf("f = %d\n", f); break; case '−': f = a - b; printf("f = %d\n", f); break; case '*': f = a * b; printf("f = %d\n", f); break; case '/': f = a / b; printf("f = %d\n", f); break; default: printf("invalid operator\n"); } } }
0debug
pandas .ix slicing deprecated - how to replace? : <p>Executing my Python code containing pandas df slicing with .ix, I get a warning about its future deprecation. I have been trying to find a replacement. But can for the life of me not get the code to work.</p> <p>I have followed this answer <a href="https://stackoverflow.com/questions/31593201/pandas-iloc-vs-ix-vs-loc-explanation-how-are-they-different">pandas iloc vs ix vs loc explanation, how are they different?</a> and many more</p> <p>If you try to remove the 2 lines with .loc slicing, and replace it with the line above that uses .ix, you may see the code work properly.</p> <p>Please help.</p> <p>My code that fetches updated excange-rates from the US Federal Reserve Bank.</p> <pre><code>module = __name__ import pandas as pd pd.core.common.is_list_like = pd.api.types.is_list_like from pandas_datareader import data as web import numpy as np import datetime xratelist = ['DEXDNUS', 'DEXUSEU'] xrts = [] def xRateList_pd(xratelist, modus='sim'): years = 1.2 days = int(252 * years) # ant. arb. dage pr år = 252 if modus == 'sim': start = datetime.datetime(2016,1,1) # indstil manuelt end = datetime.datetime(2018,5,18) # indstil manuelt if modus == 'trading': end = pd.Timestamp.utcnow() start = end - days * pd.tseries.offsets.BDay() # Pick all rates simultaneously print('Fetching xratelist from Fred: ', xratelist) for xrt in xratelist: r = web.DataReader(xrt, 'fred', start = start, end = end) # add a symbol column xrts.append(r) # concatenate all the dfs into one df_xrates = pd.concat(xrts, axis='columns') df_xrates['DEXDNUS'] = np.round(df_xrates['DEXDNUS'], decimals=4) df_xrates['DEXUSEU'] = np.round(df_xrates['DEXUSEU'], decimals=4) # xrateDNUS = float(df_xrates.ix[-1, 'DEXDNUS']) # Works but deprecated... xrateDNUS = float(df_xrates.loc[-1, 'DEXDNUS']) # Finds last x-rate in pd xratedateDNUS = df_xrates.index[-1] # Finds date for this xrate, index.. print('Found xrateDNUS DKK/USD : %1.2f DKK, from: %s' %(xrateDNUS, xratedateDNUS)) # xrateUSEU = float(df_xrates.ix[-1, 'DEXUSEU']) # Works but deprecated... xrateUSEU = float(df_xrates.loc[-1, 'DEXUSEU']) xratedateUSEU = df_xrates.index[-1] print('Found xrateUSEU USD/EUR : %1.2f $, from: %s' %(xrateUSEU, xratedateUSEU)) return df_xrates, xrateDNUS, xratedateDNUS, xrateUSEU, xratedateUSEU try: ### Get Xrates ============================================================= print('') print(' ==== $ ====') print('') print('Looking up DKK/USD &amp; USD/EUR online (US Federal Reserve Bank)') # via Federal Res. Bank (using pd DataReader)' df_xrates, xrateDNUS, xratedateDNUS, xrateUSEU, xratedateUSEU = xRateList_pd(xratelist, modus='trading') #,years=0.25 ,start=datetime.datetime(2000,1,1), end=pd.Timestamp.utcnow() except: print('!!! Error in module %s !!!' %(module)) pass if __name__ == '__main__': print("== m03_get_x_rates == is being run directly") else: print("Importing and processing == %s == from CrystallBall" %(module)) </code></pre>
0debug
Flatten batch in tensorflow : <p>I have an input to tensorflow of shape <code>[None, 9, 2]</code> (where the <code>None</code> is batch).</p> <p>To perform further actions (e.g. matmul) on it I need to transform it to <code>[None, 18]</code> shape. How to do it? </p>
0debug
Usage difference beteen Apache and Apache Tomcat : As Tomcat is a widely used java web server, and apache is also a web server, what's the different between them in real project usage?
0debug
Can I run multiple threads in a single heroku (python) dyno? : <p>Does the <code>threading</code> module work when running a single dyno on heroku? eg:</p> <pre><code>import threading import time import random def foo(x, s): time.sleep(s) print ("%s %s %s" % (threading.current_thread(), x, s)) for x in range(4): threading.Thread(target=foo, args=(x, random.random())).start() </code></pre> <p>should return something like...</p> <pre><code>$ python3 mythread.py &lt;Thread(Thread-3, started 123145318068224)&gt; 2 0.27166873449907303 &lt;Thread(Thread-4, started 123145323323392)&gt; 3 0.5510182055055494 &lt;Thread(Thread-1, started 123145307557888)&gt; 0 0.642366815814484 &lt;Thread(Thread-2, started 123145312813056)&gt; 1 0.8985126103340428 </code></pre> <p>Does it?</p>
0debug
static void gen_compute_eflags_s(DisasContext *s, TCGv reg, bool inv) { switch (s->cc_op) { case CC_OP_DYNAMIC: gen_compute_eflags(s); case CC_OP_EFLAGS: tcg_gen_shri_tl(reg, cpu_cc_src, 7); tcg_gen_andi_tl(reg, reg, 1); if (inv) { tcg_gen_xori_tl(reg, reg, 1); } break; default: { int size = (s->cc_op - CC_OP_ADDB) & 3; TCGv t0 = gen_ext_tl(reg, cpu_cc_dst, size, true); tcg_gen_setcondi_tl(inv ? TCG_COND_GE : TCG_COND_LT, reg, t0, 0); } break; } }
1threat
static inline void test_server_connect(TestServer *server) { test_server_create_chr(server, ",reconnect=1"); }
1threat
void *laio_init(void) { struct qemu_laio_state *s; s = qemu_mallocz(sizeof(*s)); QLIST_INIT(&s->completed_reqs); s->efd = eventfd(0, 0); if (s->efd == -1) goto out_free_state; fcntl(s->efd, F_SETFL, O_NONBLOCK); if (io_setup(MAX_EVENTS, &s->ctx) != 0) goto out_close_efd; qemu_aio_set_fd_handler(s->efd, qemu_laio_completion_cb, NULL, qemu_laio_flush_cb, qemu_laio_process_requests, s); return s; out_close_efd: close(s->efd); out_free_state: qemu_free(s); return NULL; }
1threat
I need help figuring what wrong with my code! ('int' issue) : <p>i am having an issue figuring out why my code is wrong.</p> <pre><code>def draw_poly(t, n, size): for s in (n): t.forward(sz) t.left(45) draw_poly (liz, 8, 50) </code></pre> <p>I am trying to make a octogon but it keeps on giving me an "'int' object is not iterable" error.</p> <p>If you could help i would be forever grateful, Thanks.</p>
0debug
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
hello sir multiple tables how to fetch data in single query : SELECT tbl_category.`cat_name` AS tbl_category_cat_name, registration.`firm_name` AS registration_firm_name, tbl_prod.`prod_name` AS tbl_prod_prod_name, tbl_prod.`prod_desc` AS tbl_prod_prod_desc, tbl_prod.`prod_size` AS tbl_prod_prod_size, tbl_prod.`prod_prate` AS tbl_prod_prod_prate, tbl_prod.`prod_mrp` AS tbl_prod_prod_mrp, tbl_prod.`prod_srate` AS tbl_prod_prod_srate, tbl_unit.`unit` AS tbl_unit_unit, tbl_brand.`bnd_name` AS tbl_brand_bnd_name FROM `tbl_category` tbl_category, `registration` registration, `tbl_prod` tbl_prod, `tbl_unit` tbl_unit, `tbl_brand` tbl_brand
0debug
static int decode_subframe(WMAProDecodeCtx *s) { int offset = s->samples_per_frame; int subframe_len = s->samples_per_frame; int i; int total_samples = s->samples_per_frame * s->avctx->channels; int transmit_coeffs = 0; int cur_subwoofer_cutoff; s->subframe_offset = get_bits_count(&s->gb); for (i = 0; i < s->avctx->channels; i++) { s->channel[i].grouped = 0; if (offset > s->channel[i].decoded_samples) { offset = s->channel[i].decoded_samples; subframe_len = s->channel[i].subframe_len[s->channel[i].cur_subframe]; } } av_dlog(s->avctx, "processing subframe with offset %i len %i\n", offset, subframe_len); s->channels_for_cur_subframe = 0; for (i = 0; i < s->avctx->channels; i++) { const int cur_subframe = s->channel[i].cur_subframe; total_samples -= s->channel[i].decoded_samples; if (offset == s->channel[i].decoded_samples && subframe_len == s->channel[i].subframe_len[cur_subframe]) { total_samples -= s->channel[i].subframe_len[cur_subframe]; s->channel[i].decoded_samples += s->channel[i].subframe_len[cur_subframe]; s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i; ++s->channels_for_cur_subframe; } } if (!total_samples) s->parsed_all_subframes = 1; av_dlog(s->avctx, "subframe is part of %i channels\n", s->channels_for_cur_subframe); s->table_idx = av_log2(s->samples_per_frame/subframe_len); s->num_bands = s->num_sfb[s->table_idx]; s->cur_sfb_offsets = s->sfb_offsets[s->table_idx]; cur_subwoofer_cutoff = s->subwoofer_cutoffs[s->table_idx]; for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; s->channel[c].coeffs = &s->channel[c].out[(s->samples_per_frame >> 1) + offset]; } s->subframe_len = subframe_len; s->esc_len = av_log2(s->subframe_len - 1) + 1; if (get_bits1(&s->gb)) { int num_fill_bits; if (!(num_fill_bits = get_bits(&s->gb, 2))) { int len = get_bits(&s->gb, 4); num_fill_bits = get_bits(&s->gb, len) + 1; } if (num_fill_bits >= 0) { if (get_bits_count(&s->gb) + num_fill_bits > s->num_saved_bits) { av_log(s->avctx, AV_LOG_ERROR, "invalid number of fill bits\n"); return AVERROR_INVALIDDATA; } skip_bits_long(&s->gb, num_fill_bits); } } if (get_bits1(&s->gb)) { avpriv_request_sample(s->avctx, "Reserved bit"); return AVERROR_PATCHWELCOME; } if (decode_channel_transform(s) < 0) return AVERROR_INVALIDDATA; for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; if ((s->channel[c].transmit_coefs = get_bits1(&s->gb))) transmit_coeffs = 1; } if (transmit_coeffs) { int step; int quant_step = 90 * s->bits_per_sample >> 4; if ((s->transmit_num_vec_coeffs = get_bits1(&s->gb))) { int num_bits = av_log2((s->subframe_len + 3)/4) + 1; for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; int num_vec_coeffs = get_bits(&s->gb, num_bits) << 2; if (num_vec_coeffs > WMAPRO_BLOCK_MAX_SIZE) { av_log(s->avctx, AV_LOG_ERROR, "num_vec_coeffs %d is too large\n", num_vec_coeffs); return AVERROR_INVALIDDATA; } s->channel[c].num_vec_coeffs = num_vec_coeffs; } } else { for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; s->channel[c].num_vec_coeffs = s->subframe_len; } } step = get_sbits(&s->gb, 6); quant_step += step; if (step == -32 || step == 31) { const int sign = (step == 31) - 1; int quant = 0; while (get_bits_count(&s->gb) + 5 < s->num_saved_bits && (step = get_bits(&s->gb, 5)) == 31) { quant += 31; } quant_step += ((quant + step) ^ sign) - sign; } if (quant_step < 0) { av_log(s->avctx, AV_LOG_DEBUG, "negative quant step\n"); } if (s->channels_for_cur_subframe == 1) { s->channel[s->channel_indexes_for_cur_subframe[0]].quant_step = quant_step; } else { int modifier_len = get_bits(&s->gb, 3); for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; s->channel[c].quant_step = quant_step; if (get_bits1(&s->gb)) { if (modifier_len) { s->channel[c].quant_step += get_bits(&s->gb, modifier_len) + 1; } else ++s->channel[c].quant_step; } } } if (decode_scale_factors(s) < 0) return AVERROR_INVALIDDATA; } av_dlog(s->avctx, "BITSTREAM: subframe header length was %i\n", get_bits_count(&s->gb) - s->subframe_offset); for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; if (s->channel[c].transmit_coefs && get_bits_count(&s->gb) < s->num_saved_bits) { decode_coeffs(s, c); } else memset(s->channel[c].coeffs, 0, sizeof(*s->channel[c].coeffs) * subframe_len); } av_dlog(s->avctx, "BITSTREAM: subframe length was %i\n", get_bits_count(&s->gb) - s->subframe_offset); if (transmit_coeffs) { FFTContext *mdct = &s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS]; inverse_channel_transform(s); for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; const int* sf = s->channel[c].scale_factors; int b; if (c == s->lfe_channel) memset(&s->tmp[cur_subwoofer_cutoff], 0, sizeof(*s->tmp) * (subframe_len - cur_subwoofer_cutoff)); for (b = 0; b < s->num_bands; b++) { const int end = FFMIN(s->cur_sfb_offsets[b+1], s->subframe_len); const int exp = s->channel[c].quant_step - (s->channel[c].max_scale_factor - *sf++) * s->channel[c].scale_factor_step; const float quant = pow(10.0, exp / 20.0); int start = s->cur_sfb_offsets[b]; s->fdsp.vector_fmul_scalar(s->tmp + start, s->channel[c].coeffs + start, quant, end - start); } mdct->imdct_half(mdct, s->channel[c].coeffs, s->tmp); } } wmapro_window(s); for (i = 0; i < s->channels_for_cur_subframe; i++) { int c = s->channel_indexes_for_cur_subframe[i]; if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) { av_log(s->avctx, AV_LOG_ERROR, "broken subframe\n"); return AVERROR_INVALIDDATA; } ++s->channel[c].cur_subframe; } return 0; }
1threat
Custom back button for NavigationView's navigation bar in SwiftUI : <p>I want to add a custom navigation button that will look somewhat like this:</p> <p><a href="https://i.stack.imgur.com/OFgvK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OFgvK.png" alt="desired navigation back button"></a></p> <p>Now, I've written a custom <code>BackButton</code> view for this. When applying that view as leading navigation bar item, by doing: </p> <pre><code>.navigationBarItems(leading: BackButton()) </code></pre> <p>...the navigation view looks like this:</p> <p><a href="https://i.stack.imgur.com/3YZD9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3YZD9.png" alt="current navigation back button"></a></p> <p>I've played around with modifiers like:</p> <pre><code>.navigationBarItem(title: Text(""), titleDisplayMode: .automatic, hidesBackButton: true) </code></pre> <p>without any luck.</p> <h2>Question</h2> <p>How can I...</p> <ol> <li>set a view used as custom back button in the navigation bar? OR:</li> <li>programmatically pop the view back to its parent?<br> When going for this approach, I could hide the navigation bar altogether using <code>.navigationBarHidden(true)</code></li> </ol>
0debug
static void qvirtio_scsi_stop(void) { qtest_end(); }
1threat
ram_addr_t qemu_ram_alloc_from_ptr(ram_addr_t size, void *host, MemoryRegion *mr) { RAMBlock *new_block; size = TARGET_PAGE_ALIGN(size); new_block = g_malloc0(sizeof(*new_block)); new_block->mr = mr; new_block->offset = find_ram_offset(size); if (host) { new_block->host = host; new_block->flags |= RAM_PREALLOC_MASK; } else { if (mem_path) { #if defined (__linux__) && !defined(TARGET_S390X) new_block->host = file_ram_alloc(new_block, size, mem_path); if (!new_block->host) { new_block->host = qemu_vmalloc(size); qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE); } #else fprintf(stderr, "-mem-path option unsupported\n"); exit(1); #endif } else { #if defined(TARGET_S390X) && defined(CONFIG_KVM) new_block->host = mmap((void*)0x800000000, size, PROT_EXEC|PROT_READ|PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0); if (new_block->host == MAP_FAILED) { fprintf(stderr, "Allocating RAM failed\n"); abort(); } #else if (xen_enabled()) { xen_ram_alloc(new_block->offset, size, mr); } else { new_block->host = qemu_vmalloc(size); } #endif qemu_madvise(new_block->host, size, QEMU_MADV_MERGEABLE); } } new_block->length = size; QLIST_INSERT_HEAD(&ram_list.blocks, new_block, next); ram_list.phys_dirty = g_realloc(ram_list.phys_dirty, last_ram_offset() >> TARGET_PAGE_BITS); cpu_physical_memory_set_dirty_range(new_block->offset, size, 0xff); if (kvm_enabled()) kvm_setup_guest_memory(new_block->host, size); return new_block->offset; }
1threat
static uint8_t virtio_scsi_do_command(QVirtIOSCSI *vs, const uint8_t *cdb, const uint8_t *data_in, size_t data_in_len, uint8_t *data_out, size_t data_out_len, struct virtio_scsi_cmd_resp *resp_out) { QVirtQueue *vq; struct virtio_scsi_cmd_req req = { { 0 } }; struct virtio_scsi_cmd_resp resp = { .response = 0xff, .status = 0xff }; uint64_t req_addr, resp_addr, data_in_addr = 0, data_out_addr = 0; uint8_t response; uint32_t free_head; vq = vs->vq[2]; req.lun[0] = 1; req.lun[1] = 1; memcpy(req.cdb, cdb, VIRTIO_SCSI_CDB_SIZE); req_addr = qvirtio_scsi_alloc(vs, sizeof(req), &req); free_head = qvirtqueue_add(vq, req_addr, sizeof(req), false, true); if (data_out_len) { data_out_addr = qvirtio_scsi_alloc(vs, data_out_len, data_out); qvirtqueue_add(vq, data_out_addr, data_out_len, false, true); } resp_addr = qvirtio_scsi_alloc(vs, sizeof(resp), &resp); qvirtqueue_add(vq, resp_addr, sizeof(resp), true, !!data_in_len); if (data_in_len) { data_in_addr = qvirtio_scsi_alloc(vs, data_in_len, data_in); qvirtqueue_add(vq, data_in_addr, data_in_len, true, false); } qvirtqueue_kick(vs->dev, vq, free_head); qvirtio_wait_queue_isr(vs->dev, vq, QVIRTIO_SCSI_TIMEOUT_US); response = readb(resp_addr + offsetof(struct virtio_scsi_cmd_resp, response)); if (resp_out) { memread(resp_addr, resp_out, sizeof(*resp_out)); } guest_free(vs->alloc, req_addr); guest_free(vs->alloc, resp_addr); guest_free(vs->alloc, data_in_addr); guest_free(vs->alloc, data_out_addr); return response; }
1threat
hexadecimal in typedef enum ios objectivec : today i was searching for the reason behind using hexadecimal in typedef enum in objectivec. I followed the following link, but there are two answers: http://stackoverflow.com/questions/8414188/c-obj-c-enum-without-tag-or-identifier LearnCocos2D says that, "there's no gain to use hex numbers and in particular there's no point in starting the hex numbers with a through f (10 to 15). " Sulthan says that, "Hexadecimal numbers are commonly used when the integer is a binary mask". I searched for binary mask and came to understand that, its a technique used in bitmap gaming from following link https://en.wikipedia.org/wiki/Mask_(computing) If sulthan is right, kindly help me understand it. I don't have enough reputation to comment, so I created this as new question.
0debug
How ca we do Jason parsing with authorization in objective c : NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration defaultSessionConfiguration]; NSURLSession *session = [NSURLSession sessionWithConfiguration:sessionConfig delegate:self delegateQueue:[NSOperationQueue mainQueue]]; NSURL *url = [NSURL URLWithString:@"http://192.168.1.37:8000/sap/opu/odata/sap/ZGW_BANK_DATA_SRV/BankSet?$filter=(BankCtry%20eq%20%27IN%27)&$format=json"]; NSMutableURLRequest *request= [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0]; // NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://192.168.1.37:8000/sap/opu/odata/sap/ZGW_BANK_DATA_SRV/BankSet?$filter=(BankCtry%20eq%20%27US%27)&$format=json"]]; // NSURLRequest * request = [NSURLRequest requestWithURL:[NSURL URLWithString: // [NSString stringWithFormat: // @"%@/%@/%@", // @"http://192.168.1.37:8000/sap/opu/odata/sap/ZGW_BANK_DATA_SRV/BankSet?$filter=(BankCtry%20eq%20%27IN%27)&$format=json", // @"abaper", // @"initial@1234"]]]; [request setHTTPMethod: @"GET" ]; // [request setHTTPBody:self.requestData]; [request setValue:@"abaper" forHTTPHeaderField:@"username"]; [request setValue:@"xyz..." forHTTPHeaderField:@"password"]; [request setValue:[[NSUserDefaults standardUserDefaults]valueForKey:@"Auth"] forHTTPHeaderField:@"Authorization"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; NSError *error ; NSHTTPURLResponse *responseCode = nil; NSData *oResponseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&responseCode error:&error]; if([responseCode statusCode] != 200){ NSLog(@"Error getting %@, HTTP status code %li", url, (long)[responseCode statusCode]); } else{ NSDictionary *responsedata = [NSJSONSerialization JSONObjectWithData:oResponseData options:NSJSONReadingAllowFragments error:&error]; NSLog(@"%@",responsedata); } // // NSHTTPURLResponse * response = nil; // NSError * error = nil; // NSData * data = [NSURLConnection sendSynchronousRequest:request // returningResponse:&response // error:&error]; // // NSLog(@"Response code: %ld", (long)[response statusCode]); // // if ([response statusCode] >= 200 && [response statusCode] < 300) // { // // NSString *responseData = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding]; // NSLog(@"Response ==> %@", responseData); // // // } }
0debug
int ff_lpc_calc_coefs(DSPContext *s, const int32_t *samples, int blocksize, int min_order, int max_order, int precision, int32_t coefs[][MAX_LPC_ORDER], int *shift, int use_lpc, int omethod, int max_shift, int zero_shift) { double autoc[MAX_LPC_ORDER+1]; double ref[MAX_LPC_ORDER]; double lpc[MAX_LPC_ORDER][MAX_LPC_ORDER]; int i, j, pass; int opt_order; assert(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER); if(use_lpc == 1){ s->flac_compute_autocorr(samples, blocksize, max_order, autoc); compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); for(i=0; i<max_order; i++) ref[i] = fabs(lpc[i][i]); }else{ LLSModel m[2]; double var[MAX_LPC_ORDER+1], weight; for(pass=0; pass<use_lpc-1; pass++){ av_init_lls(&m[pass&1], max_order); weight=0; for(i=max_order; i<blocksize; i++){ for(j=0; j<=max_order; j++) var[j]= samples[i-j]; if(pass){ double eval, inv, rinv; eval= av_evaluate_lls(&m[(pass-1)&1], var+1, max_order-1); eval= (512>>pass) + fabs(eval - var[0]); inv = 1/eval; rinv = sqrt(inv); for(j=0; j<=max_order; j++) var[j] *= rinv; weight += inv; }else weight++; av_update_lls(&m[pass&1], var, 1.0); } av_solve_lls(&m[pass&1], 0.001, 0); } for(i=0; i<max_order; i++){ for(j=0; j<max_order; j++) lpc[i][j]=-m[(pass-1)&1].coeff[i][j]; ref[i]= sqrt(m[(pass-1)&1].variance[i] / weight) * (blocksize - max_order) / 4000; } for(i=max_order-1; i>0; i--) ref[i] = ref[i-1] - ref[i]; } opt_order = max_order; if(omethod == ORDER_METHOD_EST) { opt_order = estimate_best_order(ref, min_order, max_order); i = opt_order-1; quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift); } else { for(i=min_order-1; i<max_order; i++) { quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift); } } return opt_order; }
1threat
is there any method to count an average date time in python and visualize it? : I am sorry I am new in python. This is my date time. I have it in csv. Here I have two columns CALL and Time. How can I count the average date time so I will know when is the best time to call ``` Time;"Call" 0 2019-12-10 11:35:55;"Answer" 1 2019-12-10 11:31:42;"Not Answer" 2 2019-12-10 11:26:42;"Answer" 3 2019-12-10 11:23:24;"Answer" 4 2019-12-10 11:22:28;"Answer" 5 2019-12-10 11:21:31;"Not Answer" 6 2019-12-10 11:02:08;"Answer" ```
0debug
static void handle_2misc_fcmp_zero(DisasContext *s, int opcode, bool is_scalar, bool is_u, bool is_q, int size, int rn, int rd) { bool is_double = (size == 3); TCGv_ptr fpst = get_fpstatus_ptr(); if (is_double) { TCGv_i64 tcg_op = tcg_temp_new_i64(); TCGv_i64 tcg_zero = tcg_const_i64(0); TCGv_i64 tcg_res = tcg_temp_new_i64(); NeonGenTwoDoubleOPFn *genfn; bool swap = false; int pass; switch (opcode) { case 0x2e: swap = true; case 0x2c: genfn = gen_helper_neon_cgt_f64; break; case 0x2d: genfn = gen_helper_neon_ceq_f64; break; case 0x6d: swap = true; case 0x6c: genfn = gen_helper_neon_cge_f64; break; default: g_assert_not_reached(); } for (pass = 0; pass < (is_scalar ? 1 : 2); pass++) { read_vec_element(s, tcg_op, rn, pass, MO_64); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } write_vec_element(s, tcg_res, rd, pass, MO_64); } if (is_scalar) { clear_vec_high(s, rd); } tcg_temp_free_i64(tcg_res); tcg_temp_free_i64(tcg_zero); tcg_temp_free_i64(tcg_op); } else { TCGv_i32 tcg_op = tcg_temp_new_i32(); TCGv_i32 tcg_zero = tcg_const_i32(0); TCGv_i32 tcg_res = tcg_temp_new_i32(); NeonGenTwoSingleOPFn *genfn; bool swap = false; int pass, maxpasses; switch (opcode) { case 0x2e: swap = true; case 0x2c: genfn = gen_helper_neon_cgt_f32; break; case 0x2d: genfn = gen_helper_neon_ceq_f32; break; case 0x6d: swap = true; case 0x6c: genfn = gen_helper_neon_cge_f32; break; default: g_assert_not_reached(); } if (is_scalar) { maxpasses = 1; } else { maxpasses = is_q ? 4 : 2; } for (pass = 0; pass < maxpasses; pass++) { read_vec_element_i32(s, tcg_op, rn, pass, MO_32); if (swap) { genfn(tcg_res, tcg_zero, tcg_op, fpst); } else { genfn(tcg_res, tcg_op, tcg_zero, fpst); } if (is_scalar) { write_fp_sreg(s, rd, tcg_res); } else { write_vec_element_i32(s, tcg_res, rd, pass, MO_32); } } tcg_temp_free_i32(tcg_res); tcg_temp_free_i32(tcg_zero); tcg_temp_free_i32(tcg_op); if (!is_q && !is_scalar) { clear_vec_high(s, rd); } } tcg_temp_free_ptr(fpst); }
1threat
static void s390_msi_ctrl_write(void *opaque, hwaddr addr, uint64_t data, unsigned int size) { S390PCIBusDevice *pbdev; uint32_t io_int_word; uint32_t fid = data >> ZPCI_MSI_VEC_BITS; uint32_t vec = data & ZPCI_MSI_VEC_MASK; uint64_t ind_bit; uint32_t sum_bit; uint32_t e = 0; DPRINTF("write_msix data 0x%" PRIx64 " fid %d vec 0x%x\n", data, fid, vec); pbdev = s390_pci_find_dev_by_fid(fid); if (!pbdev) { e |= (vec << ERR_EVENT_MVN_OFFSET); s390_pci_generate_error_event(ERR_EVENT_NOMSI, 0, fid, addr, e); return; } if (pbdev->state != ZPCI_FS_ENABLED) { return; } ind_bit = pbdev->routes.adapter.ind_offset; sum_bit = pbdev->routes.adapter.summary_offset; set_ind_atomic(pbdev->routes.adapter.ind_addr + (ind_bit + vec) / 8, 0x80 >> ((ind_bit + vec) % 8)); if (!set_ind_atomic(pbdev->routes.adapter.summary_addr + sum_bit / 8, 0x80 >> (sum_bit % 8))) { io_int_word = (pbdev->isc << 27) | IO_INT_WORD_AI; s390_io_interrupt(0, 0, 0, io_int_word); } }
1threat
Google home to read local webpage : I would like to use Google Home to read from a local webpage? and answer questions based on the content of that page using Javascrit. Is that possible?
0debug
I can't find the answer of this problem in python? : [enter image description here][1] find the python code for this problem. [1]: https://i.stack.imgur.com/C6s39.png
0debug
static int alloc_buffers(AVCodecContext *avctx) { CFHDContext *s = avctx->priv_data; int i, j, k, ret, planes; if ((ret = ff_set_dimensions(avctx, s->coded_width, s->coded_height)) < 0) return ret; avctx->pix_fmt = s->coded_format; avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift); planes = av_pix_fmt_count_planes(avctx->pix_fmt); for (i = 0; i < planes; i++) { int width = i ? avctx->width >> s->chroma_x_shift : avctx->width; int height = i ? avctx->height >> s->chroma_y_shift : avctx->height; int stride = FFALIGN(width / 8, 8) * 8; int w8, h8, w4, h4, w2, h2; height = FFALIGN(height / 8, 2) * 8; s->plane[i].width = width; s->plane[i].height = height; s->plane[i].stride = stride; w8 = FFALIGN(s->plane[i].width / 8, 8); h8 = FFALIGN(s->plane[i].height / 8, 2); w4 = w8 * 2; h4 = h8 * 2; w2 = w4 * 2; h2 = h4 * 2; s->plane[i].idwt_buf = av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_buf)); s->plane[i].idwt_tmp = av_malloc_array(height * stride, sizeof(*s->plane[i].idwt_tmp)); if (!s->plane[i].idwt_buf || !s->plane[i].idwt_tmp) { return AVERROR(ENOMEM); } s->plane[i].subband[0] = s->plane[i].idwt_buf; s->plane[i].subband[1] = s->plane[i].idwt_buf + 2 * w8 * h8; s->plane[i].subband[2] = s->plane[i].idwt_buf + 1 * w8 * h8; s->plane[i].subband[3] = s->plane[i].idwt_buf + 3 * w8 * h8; s->plane[i].subband[4] = s->plane[i].idwt_buf + 2 * w4 * h4; s->plane[i].subband[5] = s->plane[i].idwt_buf + 1 * w4 * h4; s->plane[i].subband[6] = s->plane[i].idwt_buf + 3 * w4 * h4; s->plane[i].subband[7] = s->plane[i].idwt_buf + 2 * w2 * h2; s->plane[i].subband[8] = s->plane[i].idwt_buf + 1 * w2 * h2; s->plane[i].subband[9] = s->plane[i].idwt_buf + 3 * w2 * h2; for (j = 0; j < DWT_LEVELS; j++) { for(k = 0; k < 4; k++) { s->plane[i].band[j][k].a_width = w8 << j; s->plane[i].band[j][k].a_height = h8 << j; } } s->plane[i].l_h[0] = s->plane[i].idwt_tmp; s->plane[i].l_h[1] = s->plane[i].idwt_tmp + 2 * w8 * h8; s->plane[i].l_h[3] = s->plane[i].idwt_tmp; s->plane[i].l_h[4] = s->plane[i].idwt_tmp + 2 * w4 * h4; s->plane[i].l_h[6] = s->plane[i].idwt_tmp; s->plane[i].l_h[7] = s->plane[i].idwt_tmp + 2 * w2 * h2; } s->a_height = s->coded_height; s->a_width = s->coded_width; s->a_format = s->coded_format; return 0; }
1threat
Error: Attempt to invoke virtual method 'void android.widget.TextView.setText(java.lang.CharSequence)' on a null object reference : <p>Getting Null Point Exception on when I try to change <code>TextView</code> text to putExtra string from an <code>Intent</code>.</p> <p>Here's my code:</p> <p>activity.xml</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".Login"&gt; &lt;TextView android:text="TextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/receive" android:textSize="10sp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>activity1.kt</p> <pre><code>class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) } fun begin(view: View){ val intent = Intent(this, Login::class.java) intent.putExtra("Key", "Value") startActivity(intent) } } </code></pre> <p>activity2.kt</p> <pre><code>class Login : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { val s: String = intent.getStringExtra("Key") println(s) val textView = findViewById&lt;TextView&gt;(R.id.receive).apply { text = s } super.onCreate(savedInstanceState) setContentView(R.layout.activity_login) } } </code></pre> <p>Any idea what the problem is?</p>
0debug
css fold out menu not closing after clicking : I have created a simple fold out menu. When i click on menu icon, **menu opens**. Now when i click on any option, it should get closed which is not happening. Please help, below is my code in [codepen][1] > Please provide solution using css only. I do not wish to use js. [1]: https://codepen.io/ersaurabh101/pen/yjaOgv `html code` <nav role="navigation"> <div id="menuToggle"> <!-- A fake / hidden checkbox is used as click reciever, so you can use the :checked selector on it. --> <input type="checkbox" /> <span></span> <span></span> <span></span> <ul id="menu"> <a href="#"><li>Home</li></a> <a href="#"><li>About</li></a> <a href="#"><li>Info</li></a> <a href="#"><li>Contact</li></a> <a href="https://erikterwan.com/" target="_blank"><li>Show me more</li></a> </ul> </div> </nav> `css code` body { margin: 0; padding: 0; /* make it look decent enough */ background: #232323; color: #cdcdcd; font-family: "Avenir Next", "Avenir", sans-serif; } a { text-decoration: none; color: #232323; transition: color 0.3s ease; } a:hover { color: tomato; } #menuToggle { display: block; position: relative; top: 50px; left: 50px; z-index: 1; -webkit-user-select: none; user-select: none; } #menuToggle input { display: block; width: 40px; height: 32px; position: absolute; top: -7px; left: -5px; cursor: pointer; opacity: 0; /* hide this */ z-index: 2; /* and place it over the hamburger */ -webkit-touch-callout: none; } /* * Just a quick hamburger */ #menuToggle span { display: block; width: 33px; height: 4px; margin-bottom: 5px; position: relative; background: #cdcdcd; border-radius: 3px; z-index: 1; transform-origin: 4px 0px; transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0), background 0.5s cubic-bezier(0.77,0.2,0.05,1.0), opacity 0.55s ease; } #menuToggle span:first-child { transform-origin: 0% 0%; } #menuToggle span:nth-last-child(2) { transform-origin: 0% 100%; } /* * Transform all the slices of hamburger * into a crossmark. */ #menuToggle input:checked ~ span { opacity: 1; transform: rotate(45deg) translate(-2px, -1px); background: #232323; } /* * But let's hide the middle one. */ #menuToggle input:checked ~ span:nth-last-child(3) { opacity: 0; transform: rotate(0deg) scale(0.2, 0.2); } /* * Ohyeah and the last one should go the other direction */ #menuToggle input:checked ~ span:nth-last-child(2) { transform: rotate(-45deg) translate(0, -1px); } /* * Make this absolute positioned * at the top left of the screen */ #menu { position: absolute; width: 300px; margin: -100px 0 0 -50px; padding: 50px; padding-top: 125px; background: #ededed; list-style-type: none; -webkit-font-smoothing: antialiased; /* to stop flickering of text in safari */ transform-origin: 0% 0%; transform: translate(-100%, 0); transition: transform 0.5s cubic-bezier(0.77,0.2,0.05,1.0); } #menu li { padding: 10px 0; font-size: 22px; } /* * And let's slide it in from the left */ #menuToggle input:checked ~ ul { transform: none; } Please provide solution using css only. Thank you for your time.
0debug
Styleguide settings for Kotlin : <p>I've started to use Koltin heavily and struggling a bit with code formatting. </p> <p>Although there is an official <a href="http://kotlinlang.org/docs/reference/coding-conventions.html" rel="noreferrer">coding conventions</a> guide, but I wonder if there is any public available styleguide settings for IntelliJ (such as <a href="https://github.com/google/styleguide" rel="noreferrer">google codestyle</a> for Java) which you can grab/import and use?</p>
0debug
Animate navigation bar barTintColor change in iOS10 not working : <p>I upgraded to XCode 8.0 / iOS 10 and now the color change animation of my navigation bar is not working anymore, it changes the color directly without any animation.</p> <pre><code>UIView.animateWithDuration(0.2, animations: { self.navigationController?.navigationBar.barTintColor = currentSection.color! }) </code></pre> <p>Anyone knows how to fix this?</p>
0debug
Jenkins wrong volume permissions : <p>I have a virtual machine hosting Oracle Linux where I've installed Docker and created containers using a docker-compose file. I placed the jenkins volume under a shared folder but when starting the docker-compose up I got the following error for Jenkins :</p> <blockquote> <p>jenkins | touch: cannot touch ‘/var/jenkins_home/copy_reference_file.log’: Permission denied jenkins | Can not write to /var/jenkins_home/copy_reference_file.log. Wrong volume permissions? jenkins exited with code 1</p> </blockquote> <p>Here's the volumes declaration</p> <pre><code> volumes: - "/media/sf_devops-workspaces/dev-tools/continuous-integration/jenkins:/var/jenkins_home" </code></pre>
0debug
static int show_hwaccels(void *optctx, const char *opt, const char *arg) { int i; printf("Hardware acceleration methods:\n"); for (i = 0; hwaccels[i].name; i++) { printf("%s\n", hwaccels[i].name); } printf("\n"); return 0; }
1threat
i hadtake input as list of string but i am not able to process list 'd' to obtain required output : input from the keyboard (standard input) containing the results of several tennis matches. Each match's score is recorded on a separate line with the following format: Winner:Loser:Set-1-score,...,Set-k-score, where 2 <= k <= 5 For example, an input line of the form Williams:Muguruza:3-6,6-3,6-3 The input is terminated by a blank line. Python program that reads information about all the matches and compile the following statistics for each player: 1. Number of best-of-5 set matches won 2. Number of best-of-3 set matches won 3. Number of sets won 4. Number of games won 5. Number of sets lost 6. Number of games lost print out to the screen (standard output) a summary in decreasing order of ranking, where the ranking is according to the criteria 1-6 in that order (compare item 1, if equal compare item 2, if equal compare item 3 etc, noting that for items 5 and 6 the comparison is reversed). For instance, given the following data Djokovic:Murray:2-6,6-7,7-6,6-3,6-1 Murray:Djokovic:6-3,4-6,6-4,6-3 Djokovic:Murray:6-0,7-6,6-7,6-3 Murray:Djokovic:6-4,6-4 Djokovic:Murray:2-6,6-2,6-0 Murray:Djokovic:6-3,4-6,6-3,6-4 Djokovic:Murray:7-6,4-6,7-6,2-6,6-2 Murray:Djokovic:7-5,7-5 Williams:Muguruza:3-6,6-3,6-3 your program should print out the following Djokovic 3 1 13 142 16 143 Murray 2 2 16 143 13 142 Williams 0 1 2 15 1 12 Muguruza 0 0 1 12 2 15 **I have written code to take input as list of string** d=["","","","","","","","","",""] i=0 while(True): s=input() d[i]=s i=i+1 if s=="": break **but i am not able to process list 'd' to obtain required output**
0debug
How do I run the Visual Studio (2017) Installer? : <p>It's probably really obvious once you know the answer, but I can't find it anywhere.</p> <p>I'm not talking about <em>making</em> an installer, I'm talking about running the installer that lets me modify which features of Visual Studio 2017 are installed.</p> <p>The main screen looks like this:</p> <p><a href="https://i.stack.imgur.com/e9LVG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e9LVG.png" alt="enter image description here"></a></p> <p>the screen I need is this one:</p> <p><a href="https://i.stack.imgur.com/lVM6z.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lVM6z.png" alt="enter image description here"></a></p> <p>In Visual Studio 2017, there is a menu entry for "Extensions and Updates" under the Tool menu that doesn't take me to this application. There is also a "NuGet Package Manager" which isn't even close.</p> <p>In my Windows 10 start menu, I see Visual Studio 2017 itself, and a folder named "Visual Studio 2017" that contains a couple of command prompts and a "Debuggable Package Manager".</p> <p>In the Control Panel - Programs and Features, I see Microsoft Visual Studio 2017 but right-click only gives me "Uninstall".</p>
0debug
static void rv34_idct_dc_add_c(uint8_t *dst, int stride, int dc) { const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; int i, j; cm += (13*13*dc + 0x200) >> 10; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) dst[j] = cm[ dst[j] ]; dst += stride; } }
1threat
static void gen_tlbwe_booke206(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } gen_update_nip(ctx, ctx->nip - 4); gen_helper_booke206_tlbwe(cpu_env); #endif }
1threat
void bdrv_add_before_write_notifier(BlockDriverState *bs, NotifierWithReturn *notifier) { notifier_with_return_list_add(&bs->before_write_notifiers, notifier); }
1threat
def counting_sort(my_list): max_value = 0 for i in range(len(my_list)): if my_list[i] > max_value: max_value = my_list[i] buckets = [0] * (max_value + 1) for i in my_list: buckets[i] += 1 i = 0 for j in range(max_value + 1): for a in range(buckets[j]): my_list[i] = j i += 1 return my_list
0debug
Error building xwalk with cordova android : <p>Building a cordova app with xwalk and it's no longer working.</p> <p>ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_77 Reading build config file: f:\source\Cutter\Canvasser\build.json null embedded org.xwalk:xwalk_core_library:15+</p> <p>FAILURE: Build failed with an exception.</p> <ul> <li>What went wrong: A problem occurred configuring root project 'android'. <blockquote> <p>Could not resolve all dependencies for configuration ':_armv7DebugCompile'. Could not resolve org.xwalk:xwalk_core_library:15+. Required by: :android:unspecified Failed to list versions for org.xwalk:xwalk_core_library. Unable to load Maven meta-data from <a href="https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml">https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml</a>. Could not GET '<a href="https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml">https://repo1.maven.org/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml</a>'. Connection to <a href="http://127.0.0.1:8888">http://127.0.0.1:8888</a> refused Failed to list versions for org.xwalk:xwalk_core_library. Unable to load Maven meta-data from <a href="https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml">https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml</a>. Could not GET '<a href="https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml">https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml</a>'.</p> </blockquote></li> </ul> <p>BUILD FAILED</p> <p>Total time: 4.251 secs</p> <blockquote> <p>Connection to <a href="http://127.0.0.1:8888">http://127.0.0.1:8888</a> refused</p> </blockquote> <p>Can anyone help? I don't understand why it's a maven repository which can't be found.</p>
0debug
How to get react-native run-ios to open in iTerm instead of Terminal on a macOS? : <p>How can somebody configure <code>react-native run-ios</code> to execute in iTerm instead of Terminal on OSX? By default, it opens a new Terminal window, but Terminal doesn't work as well with my window manager as iTerm does.</p>
0debug
C #define strange outputs : <pre><code>#include &lt;stdio.h&gt; #define test(x) x*x #define test2(x) x int main(void) { int x=5; printf("%d %d %d %d %d %d",test2(x), test2(x-2), test(x), test(x-2),4*(test(x-3)),4*test(x-3)); return 0; } </code></pre> <p>This gives the output as :</p> <p>5 3 25 -7 -52 2</p> <p>Well can understand for first 3 but why -7 when test(x-2) and for last 2…</p>
0debug
Removing multiple of 3 index from list : I want to remove multiple of 3 indexes from list. For Example: list1 = list(['a','b','c','d','e','f','g','h','i','j']) After removing indexes which are multiple of three the list will be: ['a','b','d','e','g','h','j'] How can I achieve this?
0debug
How to substract some values in different line using awk? : I have a data that separated by "|". This date is occurs every 15th minutes. What I want to do is to substract this data and multiply it with 100 but it seems didn't work. Can someone help me. Thank you :) bash-4.2$ cat kresna.txt 2019-05-29 16:48:01||196579|1637589633|0|109423435|101347165|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0||0|0|111|1554983|1554990|0||0|6347782|0|0|0|0|||1637602667|8747|13287295146|283512|1636036853|38771|||326516100|101703893|145340456|6988739|224616616|107247291|7764|101598218|19745231|0 2019-05-29 17:03:01||197446|1637876915|0|109456309|101349847|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0||0|0|111|1552437|1552441|0||0|6336110|0|0|0|0|||1637889948|8747|13290533845|283553|1636326689|38771|||326591972|101734973|145373623|6990480|224660545|107268556|7764|101629298|19748302|0 awk -F "|" '{if(NR>1){print (1 - ($45+$47+$49-_m) / ($44+$46+$48-_n) *100)};_n=$44+$46+$48;_m=$45+$47+$49}' kresna.txt 0.998926 That expected output is to e 99.98
0debug
static int raw_read_options(QDict *options, BlockDriverState *bs, BDRVRawState *s, Error **errp) { Error *local_err = NULL; QemuOpts *opts = NULL; int64_t real_size = 0; int ret; real_size = bdrv_getlength(bs->file->bs); if (real_size < 0) { error_setg_errno(errp, -real_size, "Could not get image size"); return real_size; } opts = qemu_opts_create(&raw_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 end; } s->offset = qemu_opt_get_size(opts, "offset", 0); if (s->offset > real_size) { error_setg(errp, "Offset (%" PRIu64 ") cannot be greater than " "size of the containing file (%" PRId64 ")", s->offset, real_size); ret = -EINVAL; goto end; } if (qemu_opt_find(opts, "size") != NULL) { s->size = qemu_opt_get_size(opts, "size", 0); s->has_size = true; } else { s->has_size = false; s->size = real_size - s->offset; } if ((real_size - s->offset) < s->size) { error_setg(errp, "The sum of offset (%" PRIu64 ") and size " "(%" PRIu64 ") has to be smaller or equal to the " " actual size of the containing file (%" PRId64 ")", s->offset, s->size, real_size); ret = -EINVAL; goto end; } if (s->has_size && !QEMU_IS_ALIGNED(s->size, BDRV_SECTOR_SIZE)) { error_setg(errp, "Specified size is not multiple of %llu", BDRV_SECTOR_SIZE); ret = -EINVAL; goto end; } ret = 0; end: qemu_opts_del(opts); return ret; }
1threat
i keep geting eror "Uncaught SyntaxError: Unexpected token ';' " in javascript switch statement : <p>i have tried to <em>delete</em> ';' and retype <strong>case</strong> command but nothing happen and still just getting uncaught error. iam get this from tutorial please help iam so new for programming :) can somebody tell me why the eror still poppin?? heres the code</p> <pre><code>//SWITCH STATEMMENT var job = 'teacher'; switch (job) { case 'teacher'; case 'instructor'; console.log(firstName + ' teachs kids how to code.'); break; case 'driver'; console.log(firstName + ' drives an uber in Bekasi.'); break; case 'designer'; console.log(firstName + ' design beautiiful website.'); break; default; console.log(firstName + ' does something else'); } </code></pre> <p><a href="https://i.stack.imgur.com/SDkNd.png" rel="nofollow noreferrer">this is the code and the error on the console</a></p>
0debug
static void ac3_update_bap_counts_c(uint16_t mant_cnt[16], uint8_t *bap, int len) { while (len-- >= 0) mant_cnt[bap[len]]++; }
1threat
PHP MySQL search word if %100 equals to word I searched "bat" and I saw "batman" in results : <p>PHP MySQL search word if %100 equals to word I searched "bat" and I saw "batman" in results. I just want to list if title contains "bat", I dont want to list if contains "batman"</p> <p>I'm tried many way. I can't solve this problem. How can be solve this problem? I can't understand why result like that. This code in the below. Thanks for your advice from now.</p> <pre><code>$sql = "SELECT * FROM `tablename` WHERE `title` LIKE '%bat%' ORDER BY RAND() LIMIT 30;"; </code></pre>
0debug
Force SSL on App Engine Flexible Environment Custom Runtime : <p>We're running an instance of Metabase on a App Engine Flexible Custom Runtime with a Dockerfile based on openjdk:8. Currently it allows access on <a href="http://[metabase-project].appspot.com/" rel="noreferrer">http://[metabase-project].appspot.com/</a> and <a href="https://[metabase-project].appspot.com/" rel="noreferrer">https://[metabase-project].appspot.com/</a>. I'd like to force SSL by having all http traffic redirected to https.</p> <p>The Dockerfile looks something like this:</p> <pre><code>FROM openjdk:8 ADD https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 ./cloud_sql_proxy ADD http://downloads.metabase.com/v0.21.1/metabase.jar ./metabase.jar CMD ./cloud_sql_proxy -instances=$INSTANCE=tcp:$MB_DB_PORT -dir=/cloudsql &amp; java -jar ./metabase.jar </code></pre> <p>Our app.yaml looks like:</p> <pre><code>service: metabase runtime: custom env: flex </code></pre> <p>In a normal App Engine app.yaml file, I'd want to add:</p> <pre><code>handlers: - url: [something] secure: always </code></pre> <p>But in the custom runtime we don't have access to handlers like this. Is there a way to configure the Flexible runtime to perform the redirect for all traffic?</p>
0debug
What is the C# equivalent of: printf("%s", " "); ? : I'm looking at a program that was written in C and I need to write it in C#. What is the C# equivalent of this whole line?: printf("%s", " ");
0debug
static ExitStatus trans_fop_weww_0e(DisasContext *ctx, uint32_t insn, const DisasInsn *di) { unsigned rt = assemble_rt64(insn); unsigned rb = assemble_rb64(insn); unsigned ra = assemble_ra64(insn); return do_fop_weww(ctx, rt, ra, rb, di->f_weww); }
1threat
NSDictionary with swift : <p><strong>Test dictionary declaration:</strong></p> <pre><code>var data = [ "A": [["userid":"1","username":"AAA","usergroupid":"2"], ["userid":"33","username":"ABB","usergroupid":"8"]], "B": [["userid":"2","username":"BBB","usergroupid":"8"], ["userid":"43","username":"ABC","usergroupid":"8"]] ] </code></pre> <p>How do I get the following output ?</p> <p><strong>For example:</strong> <br/> A -> username AAA , ABB<br/> B -> username BBB , ABC</p>
0debug
Color scatter plot points based on a value in third column? : <p>I am currently plotting a scatterplot based on two columns of data. However, I would like to color the datapoints based on a class label that I have in a third column.</p> <p>The labels in my third column are either 1,2 or 3. How would I color the scatter plot points based on the values in this third column?</p> <pre><code>plt.scatter(waterUsage['duration'],waterUsage['water_amount']) plt.xlabel('Duration (seconds)') plt.ylabel('Water (gallons)') </code></pre>
0debug
How to draw a few gray circles in a black rectangle using HTML/CSS/JS/PHP : I want to create a rectangle in which there will be several black circles. I've tried many ways, but not one has not helped me. Here's some of them: w3school: html: <span class="dot"></span> <span class="dot"></span> <span class="dot"></span> <span class="dot"></span> CSS: .dot {   height: 25px;   width: 25px;   background-color: #bbb;   border-radius: 50%;   display: inline-block; } Doesn't display anything in edge. Another: html: <div class="circle"></div> <div class="circle"></div> CSS: .circle{ border-radius: 100%; background: black; width: 35px; height: 35px; } That won't display two circles in one line. I tested a few more versions, but they did not work. This is an approximate version of what I want to do: [click][1] [1]: http://prntscr.com/klmxd0
0debug
static int mpegts_write_section1(MpegTSSection *s, int tid, int id, int version, int sec_num, int last_sec_num, uint8_t *buf, int len) { uint8_t section[1024], *q; unsigned int tot_len; unsigned int flags = tid == SDT_TID ? 0xf000 : 0xb000; tot_len = 3 + 5 + len + 4; if (tot_len > 1024) return -1; q = section; *q++ = tid; put16(&q, flags | (len + 5 + 4)); put16(&q, id); *q++ = 0xc1 | (version << 1); *q++ = sec_num; *q++ = last_sec_num; memcpy(q, buf, len); mpegts_write_section(s, section, tot_len); return 0; }
1threat
Force SSL on Google Analytics analytics.js load via Google Tag Manager : <p>We load Google Analytics (Universal) via Google Tag Manager and I can't find any way to force it to load the <code>analytics.js</code> script itself over SSL; we set <code>forceSSL</code> via the fields to set options, but by the time it applies that it has <em>already</em> loaded the initial script over plain HTTP.</p> <p>It looks like GTM checks whether it's on an HTTPS URL and then loads GA over HTTP if so, but I'd prefer to force it over HTTPS instead. Is there any way to do this?</p>
0debug
Where to place code for audio playback in a SwiftUI app : <p>Where is the best place to put code for audio playback in a SwiftUI based app, i.e. not having UIViewController classes? The sound I want to play is initiated by a view, so I'm thinking of putting it into the corresponding view model class. But as a model class is about data, I think there should be a better option. What's the best architecture?</p>
0debug
D(float, sse) D(float, avx) D(int16, mmx) D(int16, sse2) av_cold void swri_rematrix_init_x86(struct SwrContext *s){ int mm_flags = av_get_cpu_flags(); int nb_in = av_get_channel_layout_nb_channels(s->in_ch_layout); int nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout); int num = nb_in * nb_out; int i,j; s->mix_1_1_simd = NULL; s->mix_2_1_simd = NULL; if (s->midbuf.fmt == AV_SAMPLE_FMT_S16P){ if(mm_flags & AV_CPU_FLAG_MMX) { s->mix_1_1_simd = ff_mix_1_1_a_int16_mmx; s->mix_2_1_simd = ff_mix_2_1_a_int16_mmx; } if(mm_flags & AV_CPU_FLAG_SSE2) { s->mix_1_1_simd = ff_mix_1_1_a_int16_sse2; s->mix_2_1_simd = ff_mix_2_1_a_int16_sse2; } s->native_simd_matrix = av_mallocz(2 * num * sizeof(int16_t)); s->native_simd_one = av_mallocz(2 * sizeof(int16_t)); for(i=0; i<nb_out; i++){ int sh = 0; for(j=0; j<nb_in; j++) sh = FFMAX(sh, FFABS(((int*)s->native_matrix)[i * nb_in + j])); sh = FFMAX(av_log2(sh) - 14, 0); for(j=0; j<nb_in; j++) { ((int16_t*)s->native_simd_matrix)[2*(i * nb_in + j)+1] = 15 - sh; ((int16_t*)s->native_simd_matrix)[2*(i * nb_in + j)] = ((((int*)s->native_matrix)[i * nb_in + j]) + (1<<sh>>1)) >> sh; } } ((int16_t*)s->native_simd_one)[1] = 14; ((int16_t*)s->native_simd_one)[0] = 16384; } else if(s->midbuf.fmt == AV_SAMPLE_FMT_FLTP){ if(mm_flags & AV_CPU_FLAG_SSE) { s->mix_1_1_simd = ff_mix_1_1_a_float_sse; s->mix_2_1_simd = ff_mix_2_1_a_float_sse; } if(HAVE_AVX_EXTERNAL && mm_flags & AV_CPU_FLAG_AVX) { s->mix_1_1_simd = ff_mix_1_1_a_float_avx; s->mix_2_1_simd = ff_mix_2_1_a_float_avx; } s->native_simd_matrix = av_mallocz(num * sizeof(float)); memcpy(s->native_simd_matrix, s->native_matrix, num * sizeof(float)); s->native_simd_one = av_mallocz(sizeof(float)); memcpy(s->native_simd_one, s->native_one, sizeof(float)); } }
1threat
How does NPM handle version conflicts? : <p>Since NPM version 3 node modules and dependencies are all installed at the same root level. But what if I install two modules that depend on two different versions of the same module? For instance, if I install async <code>npm i async@2.1.4</code>, which <a href="https://github.com/caolan/async/blob/master/package.json#L21" rel="noreferrer">requires lodash version 4.14.0</a>, then I install yeoman <code>npm i yo@1.8.5</code>, which <a href="https://github.com/yeoman/yo/blob/master/package.json#L55" rel="noreferrer">requires lodash version version 3.2.0</a>, how does npm resolve this conflict?</p>
0debug
c# Error converting data type varchar to numeric. Sql Database : my code projeservices = new HProje(); projeservices.insert("INSERT INTO ProjeEkle(İsinAdi,Yuklenici,İhaleBedeli,İhaleTarihi,SozlesmeTarihi,İsinSuresi,TeslimTarihi,BaslamaTarihi,BitisTarihi)values('" + txtisinadi.Text + "','" + txtyuklenici.Text + "','" +ntxtihalebedeli.Text + "','" +dtpihaletarihi.Text + "','" + dtpsozlesmetarihi.Text + "','" +ntxtisinsuresi.Text + "','" + dtptxtteslim.Text + "','" + dtptxtbaslama.Text + "','" + dtptxtbitis.Text + "')"); my database Id int Unchecked İsinAdi nvarchar(200) Unchecked Yuklenici nvarchar(200) Unchecked İhaleBedeli decimal(18, 3) Unchecked İhaleTarihi datetime Unchecked SozlesmeTarihi datetime Unchecked İsinSuresi int Unchecked TeslimTarihi datetime Unchecked BaslamaTarihi datetime Unchecked BitisTarihi datetime Unchecked Unchecked Can you help title also is the reason I get the error
0debug
Align next to each other in <View/> react native : <p>How would I align two items (icon/text) next to each other?</p> <pre><code>&lt;TouchableOpacity key = {index} onPress = {() =&gt; this._onPress(key)} style = {containerStyle.container}&gt; &lt;View&gt; &lt;Icon name = {Platform.OS === "ios" ? "ios-checkmark-outline" : "md-checkmark"} size = {24} style = {{ paddingLeft: 10, color: "#108EE9"}} /&gt; &lt;Text style = {this._createStyleText(key)}&gt; {key} &lt;/Text&gt; &lt;/View&gt; &lt;/TouchableOpacity&gt; const containerStyle = StyleSheet.create({ container: { padding: 8, backgroundColor: "#ffffff", }, }); const textStyle = StyleSheet.create({ unselectedText: { paddingLeft: 45, color: "#000000", fontWeight: "normal", }, }); </code></pre> <p>Right now the are aligned like this:</p> <pre><code>icon text </code></pre> <p>I need them to be like this</p> <pre><code>icon text </code></pre>
0debug
How do you extract a value out of a golang map[string] string thats typed with interface{} : <p>I have something like this:</p> <pre><code>x1 := someFunctionWithAnInterfaceReturnValue() </code></pre> <p>and the underlying type is something like this: </p> <pre><code>x2 := map[string] string{"hello": "world"} </code></pre> <p>How would I access value in x1?</p> <p>Essentially I want the equivalent of this for x1:</p> <pre><code> var value string = x2["hello"] </code></pre>
0debug
celery periodic tasks not executing : <p>I am learning celery and I created a project to test my configuration. I installed <code>celery==4.0.0</code> and <code>django-celery-beat==1.0.1</code> according to the latest documentation.</p> <p>In drf_project(main project dir with manage.py)/drf_project/celery.py</p> <pre><code>from __future__ import absolute_import, unicode_literals from celery import Celery import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'drf_project.settings') app = Celery('drf_project') app.config_from_object('django.conf:settings', namespace='CELERY') app.autodiscover_tasks() </code></pre> <p>In drf_project/drf_project/settings.py</p> <pre><code>INSTALLED_APPS += ('django_celery_beat',) CELERYBEAT_SCHEDULE = { "test_1": { "task": "tasks.print_test", "schedule": timedelta(seconds=2), }, } </code></pre> <p>In drf_project/drf_project/<strong>init</strong>.py</p> <pre><code>from __future__ import absolute_import, unicode_literals from .celery import app as celery_app __all__ = ['celery_app'] </code></pre> <p>In my user_management app (drf_project/user_mangement/) I added a tasks.py </p> <pre><code>from celery import Celery from time import strftime app = Celery() @app.task def print_test(): print strftime('%Y-%m-%d %H:%M:%S') with open('abc.txt', 'ab+') as test_file: test_file.writeline(strftime('%Y-%m-%d %H:%M:%S')) </code></pre> <p>when i run the celery worker and my django project dev server in different terminals by:</p> <pre><code> celery -A drf_project worker -l info </code></pre> <p>and</p> <pre><code> python manage.py runserver </code></pre> <p>I can see my task in celery log like:</p> <pre><code>[tasks] . user_management.tasks.print_test </code></pre> <p>But it is not executing. Also I am not getting any error. SO what I am doing wrong? I followed the official documentation of celery.</p>
0debug
static uint64_t ppc_radix64_walk_tree(PowerPCCPU *cpu, int rwx, vaddr eaddr, uint64_t base_addr, uint64_t nls, hwaddr *raddr, int *psize, int *fault_cause, int *prot, hwaddr *pte_addr) { CPUState *cs = CPU(cpu); uint64_t index, pde; if (nls < 5) { *fault_cause |= DSISR_R_BADCONFIG; return 0; } index = eaddr >> (*psize - nls); index &= ((1UL << nls) - 1); pde = ldq_phys(cs->as, base_addr + (index * sizeof(pde))); if (!(pde & R_PTE_VALID)) { *fault_cause |= DSISR_NOPTE; return 0; } *psize -= nls; if (pde & R_PTE_LEAF) { uint64_t rpn = pde & R_PTE_RPN; uint64_t mask = (1UL << *psize) - 1; if (ppc_radix64_check_prot(cpu, rwx, pde, fault_cause, prot)) { return 0; } *raddr = (rpn & ~mask) | (eaddr & mask); *pte_addr = base_addr + (index * sizeof(pde)); return pde; } return ppc_radix64_walk_tree(cpu, rwx, eaddr, pde & R_PDE_NLB, pde & R_PDE_NLS, raddr, psize, fault_cause, prot, pte_addr); }
1threat
Regular Expression in Django URLs : <p>i am trying to add url to my view but it throws an exception </p> <p>"^(?p[0-9]+)/$" is not a valid regular expression: unknown extension ?p at position 2</p> <p>view url in URLs file</p> <pre><code>url(r'^(?p&lt;studentID&gt;[0-9]+)/$',views.Student,name ='Student' ) </code></pre>
0debug
static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport, void *data, size_t len) { VncState *vs = (VncState *)transport; int ret; retry: ret = qemu_recv(vs->csock, data, len, 0); if (ret < 0) { if (errno == EINTR) goto retry; return -1; } return ret; }
1threat
static av_always_inline void filter_mb_dir(const H264Context *h, H264SliceContext *sl, int mb_x, int mb_y, uint8_t *img_y, uint8_t *img_cb, uint8_t *img_cr, unsigned int linesize, unsigned int uvlinesize, int mb_xy, int mb_type, int mvy_limit, int first_vertical_edge_done, int a, int b, int chroma, int dir) { int edge; int chroma_qp_avg[2]; int chroma444 = CHROMA444(h); int chroma422 = CHROMA422(h); const int mbm_xy = dir == 0 ? mb_xy -1 : sl->top_mb_xy; const int mbm_type = dir == 0 ? sl->left_type[LTOP] : sl->top_type; static const uint8_t mask_edge_tab[2][8]={{0,3,3,3,1,1,1,1}, {0,3,1,1,3,3,3,3}}; const int mask_edge = mask_edge_tab[dir][(mb_type>>3)&7]; const int edges = mask_edge== 3 && !(sl->cbp&15) ? 1 : 4; const int mask_par0 = mb_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)); if(mbm_type && !first_vertical_edge_done){ if (FRAME_MBAFF(h) && (dir == 1) && ((mb_y&1) == 0) && IS_INTERLACED(mbm_type&~mb_type) ) { unsigned int tmp_linesize = 2 * linesize; unsigned int tmp_uvlinesize = 2 * uvlinesize; int mbn_xy = mb_xy - 2 * h->mb_stride; int j; for(j=0; j<2; j++, mbn_xy += h->mb_stride){ DECLARE_ALIGNED(8, int16_t, bS)[4]; int qp; if (IS_INTRA(mb_type | h->cur_pic.mb_type[mbn_xy])) { AV_WN64A(bS, 0x0003000300030003ULL); } else { if (!CABAC(h) && IS_8x8DCT(h->cur_pic.mb_type[mbn_xy])) { bS[0]= 1+((h->cbp_table[mbn_xy] & 0x4000) || sl->non_zero_count_cache[scan8[0]+0]); bS[1]= 1+((h->cbp_table[mbn_xy] & 0x4000) || sl->non_zero_count_cache[scan8[0]+1]); bS[2]= 1+((h->cbp_table[mbn_xy] & 0x8000) || sl->non_zero_count_cache[scan8[0]+2]); bS[3]= 1+((h->cbp_table[mbn_xy] & 0x8000) || sl->non_zero_count_cache[scan8[0]+3]); }else{ const uint8_t *mbn_nnz = h->non_zero_count[mbn_xy] + 3*4; int i; for( i = 0; i < 4; i++ ) { bS[i] = 1 + !!(sl->non_zero_count_cache[scan8[0]+i] | mbn_nnz[i]); } } } Do not use s->qscale as luma quantizer because it has not the same value in IPCM macroblocks. qp = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[mbn_xy] + 1) >> 1; ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, tmp_linesize, tmp_uvlinesize); { int i; for (i = 0; i < 4; i++) ff_tlog(h->avctx, " bS[%d]:%d", i, bS[i]); ff_tlog(h->avctx, "\n"); } filter_mb_edgeh( &img_y[j*linesize], tmp_linesize, bS, qp, a, b, h, 0 ); chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1; chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[mbn_xy]) + 1) >> 1; if (chroma) { if (chroma444) { filter_mb_edgeh (&img_cb[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[0], a, b, h, 0); filter_mb_edgeh (&img_cr[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[1], a, b, h, 0); } else { filter_mb_edgech(&img_cb[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[0], a, b, h, 0); filter_mb_edgech(&img_cr[j*uvlinesize], tmp_uvlinesize, bS, chroma_qp_avg[1], a, b, h, 0); } } } }else{ DECLARE_ALIGNED(8, int16_t, bS)[4]; int qp; if( IS_INTRA(mb_type|mbm_type)) { AV_WN64A(bS, 0x0003000300030003ULL); if ( (!IS_INTERLACED(mb_type|mbm_type)) || ((FRAME_MBAFF(h) || (h->picture_structure != PICT_FRAME)) && (dir == 0)) ) AV_WN64A(bS, 0x0004000400040004ULL); } else { int i; int mv_done; if( dir && FRAME_MBAFF(h) && IS_INTERLACED(mb_type ^ mbm_type)) { AV_WN64A(bS, 0x0001000100010001ULL); mv_done = 1; } else if( mask_par0 && ((mbm_type & (MB_TYPE_16x16 | (MB_TYPE_8x16 >> dir)))) ) { int b_idx= 8 + 4; int bn_idx= b_idx - (dir ? 8:1); bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, 8 + 4, bn_idx, mvy_limit); mv_done = 1; } else mv_done = 0; for( i = 0; i < 4; i++ ) { int x = dir == 0 ? 0 : i; int y = dir == 0 ? i : 0; int b_idx= 8 + 4 + x + 8*y; int bn_idx= b_idx - (dir ? 8:1); if (sl->non_zero_count_cache[b_idx] | sl->non_zero_count_cache[bn_idx]) { bS[i] = 2; } else if(!mv_done) { bS[i] = check_mv(sl, b_idx, bn_idx, mvy_limit); } } } Do not use s->qscale as luma quantizer because it has not the same value in IPCM macroblocks. if(bS[0]+bS[1]+bS[2]+bS[3]){ qp = (h->cur_pic.qscale_table[mb_xy] + h->cur_pic.qscale_table[mbm_xy] + 1) >> 1; ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize); chroma_qp_avg[0] = (sl->chroma_qp[0] + get_chroma_qp(h->ps.pps, 0, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1; chroma_qp_avg[1] = (sl->chroma_qp[1] + get_chroma_qp(h->ps.pps, 1, h->cur_pic.qscale_table[mbm_xy]) + 1) >> 1; if( dir == 0 ) { filter_mb_edgev( &img_y[0], linesize, bS, qp, a, b, h, 1 ); if (chroma) { if (chroma444) { filter_mb_edgev ( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1); filter_mb_edgev ( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1); } else { filter_mb_edgecv( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1); filter_mb_edgecv( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1); } } } else { filter_mb_edgeh( &img_y[0], linesize, bS, qp, a, b, h, 1 ); if (chroma) { if (chroma444) { filter_mb_edgeh ( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1); filter_mb_edgeh ( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1); } else { filter_mb_edgech( &img_cb[0], uvlinesize, bS, chroma_qp_avg[0], a, b, h, 1); filter_mb_edgech( &img_cr[0], uvlinesize, bS, chroma_qp_avg[1], a, b, h, 1); } } } } } } for( edge = 1; edge < edges; edge++ ) { DECLARE_ALIGNED(8, int16_t, bS)[4]; int qp; const int deblock_edge = !IS_8x8DCT(mb_type & (edge<<24)); (edge&1) && IS_8x8DCT(mb_type) if (!deblock_edge && (!chroma422 || dir == 0)) continue; if( IS_INTRA(mb_type)) { AV_WN64A(bS, 0x0003000300030003ULL); } else { int i; int mv_done; if( edge & mask_edge ) { AV_ZERO64(bS); mv_done = 1; } else if( mask_par0 ) { int b_idx= 8 + 4 + edge * (dir ? 8:1); int bn_idx= b_idx - (dir ? 8:1); bS[0] = bS[1] = bS[2] = bS[3] = check_mv(sl, b_idx, bn_idx, mvy_limit); mv_done = 1; } else mv_done = 0; for( i = 0; i < 4; i++ ) { int x = dir == 0 ? edge : i; int y = dir == 0 ? i : edge; int b_idx= 8 + 4 + x + 8*y; int bn_idx= b_idx - (dir ? 8:1); if (sl->non_zero_count_cache[b_idx] | sl->non_zero_count_cache[bn_idx]) { bS[i] = 2; } else if(!mv_done) { bS[i] = check_mv(sl, b_idx, bn_idx, mvy_limit); } } if(bS[0]+bS[1]+bS[2]+bS[3] == 0) continue; } Do not use s->qscale as luma quantizer because it has not the same value in IPCM macroblocks. qp = h->cur_pic.qscale_table[mb_xy]; ff_tlog(h->avctx, "filter mb:%d/%d dir:%d edge:%d, QPy:%d ls:%d uvls:%d", mb_x, mb_y, dir, edge, qp, linesize, uvlinesize); if( dir == 0 ) { filter_mb_edgev( &img_y[4*edge << h->pixel_shift], linesize, bS, qp, a, b, h, 0 ); if (chroma) { if (chroma444) { filter_mb_edgev ( &img_cb[4*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgev ( &img_cr[4*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } else if( (edge&1) == 0 ) { filter_mb_edgecv( &img_cb[2*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgecv( &img_cr[2*edge << h->pixel_shift], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } } } else { if (chroma422) { if (deblock_edge) filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0); if (chroma) { filter_mb_edgech(&img_cb[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgech(&img_cr[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } } else { filter_mb_edgeh(&img_y[4*edge*linesize], linesize, bS, qp, a, b, h, 0); if (chroma) { if (chroma444) { filter_mb_edgeh (&img_cb[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgeh (&img_cr[4*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } else if ((edge&1) == 0) { filter_mb_edgech(&img_cb[2*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[0], a, b, h, 0); filter_mb_edgech(&img_cr[2*edge*uvlinesize], uvlinesize, bS, sl->chroma_qp[1], a, b, h, 0); } } } } } }
1threat
Kotlin Android Spinner How : <p>How do I populate data in a spinner using the Kotlin language on Android Studio?</p> <p>Unfortunately I only know how to do in Java, </p> <p>in Kotlin I have no idea ...</p>
0debug
python takes 1 positional argument but 2 were given : <p>I have a class that calls upon another class to use it's function</p> <pre><code>main.py -------------------- class MyClass(): def main(self, arg): from lib.otherclass import OtherClass otherClass = OtherClass() result = otherClass.prepare.importImage(image) myClass = MyClass() final = myClass(image) </code></pre> <p>I get this error</p> <pre><code>importImage() takes 1 positional argument but 2 were given </code></pre> <p>This is what the other class looks like:</p> <pre><code>class OtherClass(): def __init__(self): self.prepare = Prepare() class Prepare(): def importImage(image): blah blah blah </code></pre> <p>How do I fix this?</p>
0debug
How does SQL server insert data parallelybetween applications? : Suppose I have two applications. One insert data into database continuously like it is having an infinity loop. Now when the second application inserts data to same database and table what will happen. If it waits till the other application to complete inserting which will handle this? Or it will say it is busy? Or code throws an exception?
0debug
Export data in ag-grid for cell renderer : <p>I'm using ag-grid and I have a column definition as following :</p> <pre><code>{ headerName: "Color", valueGetter: function (params) { return JSON.parse(params.data.color).name; }, field: 'color', cellRenderer: function (params) { if (angular.isDefined(params.data) &amp;&amp; angular.isDefined(params.data.color)) { var color = JSON.parse(params.data.color); return '&lt;div style="width: 50px; height: 18px; background-color:' + color.htmlValue + ';"&gt;&lt;/div&gt;'; } }, suppressMenu: true, suppressSorting: true } </code></pre> <p>When I export the grid in CSV format, I get undefined for the color column, which is a cell renderer, I searched for a solution for this and I found this in the official documentation :</p> <blockquote> <p>The raw values, and not the result of cell renderer, will get used, meaning:</p> <ul> <li>Cell Renderers will NOT be used.</li> <li>Value Getters will be used.</li> <li>Cell Formatters will NOT be used (use processCellCallback instead).</li> </ul> </blockquote> <p>As you can see I'm already using a valueGetter but I always get undefined in the exported data for the color column.</p> <p>How can I solve this ?</p>
0debug
What does the --pre option in pip signify? : <p>I saw on <a href="https://github.com/neo4j-contrib/neo4j_doc_manager" rel="noreferrer">this</a> page that <code>pip install neo4j-doc-manager --pre</code> was used. What does the <code>--pre</code> flag mean?</p>
0debug
Issue in converting to specific Date format in JAVA : <p>i am receiving following date in form of String : "Wed Feb 06 2019 16:07:03 PM" which i need to convert it in form "02/06/2019 at 04:17 PM ET"</p> <p>Please advise</p>
0debug
\n not working in php code when using chrome browser : <p>I am using the \n to insert a new line when echoing a string in PHP. But the output does not seem to reflect this. I am using chrome browser to display the output. </p> <p>Here is my code:</p> <pre><code>&lt;?php echo "Developers, Developers, developers, developers,\n developers, developers, developers, developers, developers!"; ?&gt; </code></pre> <p>I expect the output to be:</p> <p>Developers, Developers, developers, developers,<br> developers, developers, developers, developers, developers!</p> <p>But it is being displayed in a single line in chrome as:</p> <p>Developers, Developers, developers, developers, developers, developers, developers, developers, developers!</p> <p><a href="https://imgur.com/g7tV48z" rel="nofollow noreferrer">https://imgur.com/g7tV48z</a></p>
0debug
def remove_empty(tuple1): #L = [(), (), ('',), ('a', 'b'), ('a', 'b', 'c'), ('d')] tuple1 = [t for t in tuple1 if t] return tuple1
0debug
static CharDriverState *chr_open(const char *subtype, void (*set_fe_open)(struct CharDriverState *, int)) { CharDriverState *chr; SpiceCharDriver *s; chr = g_malloc0(sizeof(CharDriverState)); s = g_malloc0(sizeof(SpiceCharDriver)); s->chr = chr; s->active = false; s->sin.subtype = g_strdup(subtype); chr->opaque = s; chr->chr_write = spice_chr_write; chr->chr_add_watch = spice_chr_add_watch; chr->chr_close = spice_chr_close; chr->chr_set_fe_open = set_fe_open; chr->explicit_be_open = true; chr->chr_fe_event = spice_chr_fe_event; QLIST_INSERT_HEAD(&spice_chars, s, next); return chr; }
1threat
Neo4j: How to match realtionship? : For example: I know a person A who is connected to another person B and person B is connected to person C How can i show that person A is indirectly connected to person C?
0debug
Generate password with minimum and maximum length : batch file : <p>Trying to generate password with given characters but need to define minimum and maximum password string length inside batch file.</p> <p>i created batch file which is generating password string perfectly but i was unable to define length of string in Min_RNDLength &amp; Max_RNDLength field.</p> <pre><code>@Echo Off Setlocal EnableDelayedExpansion Set Min_RNDLength=8 Set Max_RNDLength=30 Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 Set _Str=%_Alphanumeric%987654321 :_LenLoop IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%&amp; SET /A _Len+=9&amp; GOTO :_LenLoop SET _tmp=%_Str:~9,1% SET /A _Len=_Len+_tmp Set _count=0 SET _RndAlphaNum= :_loop Set /a _count+=1 SET _RND=%Random% Set /A _RND=_RND%%%_Len% SET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%_RND%,1! If !_count! lss %_RNDLength% goto _loop Echo Random string is !_RndAlphaNum! </code></pre> <p>not sure how to overcome this issue.</p>
0debug
Django : Can't import 'module'. Check that module AppConfig.name is correct : <p>Might look like an already answered question, actually <a href="https://stackoverflow.com/questions/43621259/django-project-restructure-cant-import-app">here</a> you have the same problem (kind of) i had. My problem is, it's just a trick, one line, no explanation (and still it's different but the solution given works, and that's part of my problem). Here's my project structure, simplified:</p> <pre><code>manage.py compfactu/---settings.py |--__init__.py |--core/--------__init__.py |-apps.py </code></pre> <p>So here is how I added my app in <code>INSTALLED_APPS</code>:</p> <p><strong>apps.py</strong></p> <pre><code>from django.apps import AppConfig class CoreConfig(AppConfig): name = 'core' </code></pre> <p><strong>settings.py</strong></p> <pre><code>INSTALLED_APPS = [ ... #compfactu modules 'compfactu.core.apps.CoreConfig', ] </code></pre> <p>As I read the django 1.11 documentation, and I quote :</p> <blockquote> <p>New applications should avoid default_app_config. Instead they should require the dotted path to the appropriate AppConfig subclass to be configured explicitly in INSTALLED_APPS.</p> </blockquote> <p>Well nice, it's a new application so i should do that : but i'm getting an error. And it's not a problem of pythonpath, cause i just opened a python shell and I can do <code>from compfactu.core.apps import CoreConfig</code> with no problem (print the sys.path too, everything's fine).</p> <p>But I have this error, here's a full traceback:</p> <pre><code>Traceback (most recent call last): File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/site-packages/django/apps/config.py", line 147, in create app_module = import_module(app_name) File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "&lt;frozen importlib._bootstrap&gt;", line 986, in _gcd_import File "&lt;frozen importlib._bootstrap&gt;", line 969, in _find_and_load File "&lt;frozen importlib._bootstrap&gt;", line 956, in _find_and_load_unlocked ImportError: No module named 'core' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/site-packages/django/utils/autoreload.py", line 228, in wrapper fn(*args, **kwargs) File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run autoreload.raise_last_exception() File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception six.reraise(*_exception) File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/site-packages/django/utils/six.py", line 685, in reraise raise value.with_traceback(tb) File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/site-packages/django/utils/autoreload.py", line 228, in wrapper fn(*args, **kwargs) File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/site-packages/django/__init__.py", line 27, in setup apps.populate(settings.INSTALLED_APPS) File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/site-packages/django/apps/registry.py", line 85, in populate app_config = AppConfig.create(entry) File "/home/jbjaillet/Projets/venvcompfactu/lib/python3.5/site-packages/django/apps/config.py", line 151, in create app_name, mod_path, cls_name, django.core.exceptions.ImproperlyConfigured: Cannot import 'core'. Check that 'compfactu.core.apps.CoreConfig.name' is correct. </code></pre> <p>And from there, all files and class have been generated by django (manage.py startapp). And when I actually do what's told in the question I linked above, doing like :</p> <pre><code>INSTALLED_APPS = [ ... #compfactu modules 'compfactu.core', ] </code></pre> <p>it works ! And I don't get that point ! Reading the doc (part i've just quoted), it SHOULD NOT work (noting that I don't have a <code>default_app_config</code> in my <code>__init__.py</code>.</p> <p>So, as the question where I found the "trick" but no explanation, I'm here asking why it works this way when it shouldn't, and why the solution in the official doc doesn't work?</p> <p>Thank you in advance for you time.</p>
0debug
Java: What's the preferable way to iterate over a set? : <p>I've been teached in college that one has to create an iterator to loop over a set. </p> <pre><code>java.util.HashSet&lt;String&gt; set = new java.util.HashSet&lt;String&gt;(); set.add("Green"); set.add("Blue"); set.add("Yellow"); set.add("Orange"); set.add("Red"); Iterator it = set.iterator(); while (it.hasNext()) { String current = (String) it.next(); System.out.println(current); } </code></pre> <p>Now I've seen in the code of colleagues that there is a more simple way to accomplish it. Using a for-loop:</p> <pre><code>for (String str : set) { System.out.println(str); } </code></pre> <p>I asked myself why the approach with the for-loop wasn't showed in college.</p> <p><strong>Has the approach with the for-loop disadvantages?</strong></p> <p><strong>What's the preferable way to iterate over a set and why?</strong></p>
0debug
how to append json comma separated values to a select box? : Am getting json object as below: {id: "3", restaurant_name: "Annapurna Restaurant", sub_category_id: "2,3", sub_cat: "Meals,Tiffins"} I need to append sub_category_id and sub_cat to the select box like: $("#id").append("<option value='"+sub_category_id+"'>"+sub_cat+"</option>"); How to append those data to the select box. Thanks in advance...!
0debug
how to keep a large number of data.frame in .csv : <p>There are a large number of data.frame (more than 50). How can I save them quickly in .csv?</p> <pre><code>write.csv() </code></pre> <p>50 lines of code, it's awful...</p> <p>Help me, guys!</p>
0debug
php send data to other php file with 2 href : I want to send data to other php file I can send data with this url code to my second php file. www.test.com/second.php?task=demo&id=55 I have a href code like this <a href="first.php?task=first&name=Jack">send</a> how can I send this code `second.php?task=demo&id=55` with `a href href="first.php?task=first&name=Jack"` Sorry for my bad English. Thank you.
0debug
Error undefined function in R ":=" : <p>Im writing an R code to calculate the average of a data point for every minute for my given data. </p> <p>My data frame is</p> <pre><code>TIME PRICE 2013-01-01 23:54:54 20133 2013-01-01 23:54:50 20133 2013-01-01 23:53:34 20134 2013-01-01 23:53:40 20131 2013-01-01 22:52:54 20131 2013-01-01 22:52:50 20132 </code></pre> <p>I want my resultant data frame to have</p> <pre><code>TIME PRICE 2013-01-01 23:54:00 20133 2013-01-01 23:53:00 20132.5 2013-01-01 23:52:00 20131.5 </code></pre> <p>I used a code snippet to separate my data into hour and minute. </p> <pre><code>trade_1[, c('Hour', 'Minute') := .(data.table::hour("TIME"), minute("TIME")) + ][, .(Avg = mean("PRICE")), .(Hour, Minute)] </code></pre> <p>using package <code>lubridate</code></p> <p>I get the following error</p> <pre><code>Error in `:=`(c("Hour", "Minute"), .(data.table::hour("TRADETIME"), minute("TRADETIME"))) : could not find function ":=" </code></pre> <p>Can someone please help me out? </p> <p>I have already used <code>library(lubridate).</code> </p>
0debug
how to generate AndroidManifest.xml from a react-native app created with react-native init : <p>I used react-native init to create my react application. I'm trying to tie in auth0 and auth0 documentation is saying I need something from the androidManafest.xml. The problem is that the react-native init didn't create "android/app/src/main/AndroidManifest.xml " during the process. How does this get created and tie into my react-native app?</p>
0debug
compile time error - stackOverflow, while creating new class instance : <p>below is very simple program which is giving stackOverFlow error. Here is confuse with flow. can someone tell me the exact flow of this program and give me the reason for the corresponding error.</p> <pre><code>package test; class Test{ Test tt = new Test(); public static void main(String[] args) { new Test(); } } </code></pre> <p>OUTPUT -</p> <pre><code>Exception in thread "main" java.lang.StackOverflowError at test.Test.&lt;init&gt;(Test.java:4) at test.Test.&lt;init&gt;(Test.java:4) at test.Test.&lt;init&gt;(Test.java:4) at test.Test.&lt;init&gt;(Test.java:4) at test.Test.&lt;init&gt;(Test.java:4) at test.Test.&lt;init&gt;(Test.java:4) </code></pre>
0debug
Require JS in pentaho : without disable Require jS how can i use Click Action for drill down using popup component in pentaho? I enabled RequireJS and used the following coding. Bt its not working. function f(e){ var color = this.pvMark.fillStyle(); dashboard.fireChange('product', e.vars.category.value); dashboard.fireChange('param3_color',color.color); render_PopUpComp.popup($(this.event.target)); } Can anybody help me to do drill down by enabling RequireJS?
0debug
git Push failed: Failed with error: ssh variant 'simple' does not support setting port : <p>My git remote origin uses ssh url with port specified. I am getting an error while pushing using IntelliJ.</p> <p><strong>Push failed: Failed with error: ssh variant 'simple' does not support setting port</strong></p> <p>I encountered this error after upgrading to latest git 2.16.1</p> <p><a href="https://i.stack.imgur.com/2n2Q7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2n2Q7.png" alt="Push failed: Failed with error: ssh variant &#39;simple&#39; does not support setting port"></a></p>
0debug