problem
stringlengths
26
131k
labels
class label
2 classes
static inline void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1, intptr_t arg2) { int opi, opx; assert(TCG_TARGET_REG_BITS == 64 || type == TCG_TYPE_I32); if (type == TCG_TYPE_I32) { opi = STW, opx = STWX; } else { opi = STD, opx = STDX; } tcg_out_mem_long(s, opi, opx, arg, arg1, arg2); }
1threat
how to get the middle index of a array in swift 4.1 : Hi I am having a bug with getting the middle index of a array heres the array CountedArray = ["Jake","Jacob","Sam","Tom","Ben","Joe","Bob","Chen","sara","Simon"] Thanks Arnav
0debug
Difference between tsconfig.json and tsconfig.app.json files in Angular : <p>I'm a newbie in Angular. I used <code>angular-cli</code> to learn about angular and I found the files <code>tsconfig.json</code> and <code>tsconfig.app.json</code>. Both of these are typescript related and I found <a href="https://stackoverflow.com/questions/48798431/use-of-tsconfig-app-json">this link</a> useful.</p> <p>But why two such files has been used? Why can't the configurations in these two files be combined in one file? Please help me figure this out.</p>
0debug
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
1threat
static av_always_inline void decode_bgr_1(HYuvContext *s, int count, int decorrelate, int alpha) { int i; OPEN_READER(re, &s->gb); for (i = 0; i < count && get_bits_left(&s->gb) > 0; i++) { unsigned int index; int code, n; UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); n = s->vlc[4].table[index][1]; if (n>0) { code = s->vlc[4].table[index][0]; *(uint32_t*)&s->temp[0][4 * i] = s->pix_bgr_map[code]; LAST_SKIP_BITS(re, &s->gb, n); } else { int nb_bits; if(decorrelate) { VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(code, s->vlc[0].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * i + B] = code + s->temp[0][4 * i + G]; UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(code, s->vlc[2].table, &s->gb, re, VLC_BITS, 3); s->temp[0][4 * i + R] = code + s->temp[0][4 * i + G]; } else { VLC_INTERN(s->temp[0][4 * i + B], s->vlc[0].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * i + G], s->vlc[1].table, &s->gb, re, VLC_BITS, 3); UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * i + R], s->vlc[2].table, &s->gb, re, VLC_BITS, 3); } if (alpha) { UPDATE_CACHE(re, &s->gb); index = SHOW_UBITS(re, &s->gb, VLC_BITS); VLC_INTERN(s->temp[0][4 * i + A], s->vlc[2].table, &s->gb, re, VLC_BITS, 3); } } } CLOSE_READER(re, &s->gb); }
1threat
Flyway 5.0.7 warning about using schema_version table : <p>We use the Flyway Gradle plugin to do our migrations offline (i.e. we migrate while the system is down). We recently upgraded to Flyway 5.0.7 and we see this warning now for migrations:</p> <p><em>Could not find schema history table <code>XXXXXXX</code>.<code>flyway_schema_history</code>, but found <code>XXXXXXX</code>.<code>schema_version</code> instead. You are seeing this message because Flyway changed its default for flyway.table in version 5.0.0 to flyway_schema_history and you are still relying on the old default (schema_version). Set flyway.table=schema_version in your configuration to fix this. This fallback mechanism will be removed in Flyway 6.0.0.</em></p> <p>(I've used the XXXXXXX to obscure the actual schema name).</p> <p>So, it appears that we can avoid the error by setting flyway.table=schema_version. But, it also says this mechanism will be removed in Flyway 6.0.0.</p> <p>Are we supposed to do something to make this compatible going forward? Do we have to manually rename the schema_version table to flyway_schema_history? Or is there a way to make Flyway do it? If not, what is going to happen when Flyway 6.0.0 comes out? Will it automatically migrate the data to the appropriate table name?</p>
0debug
Two versions of icu4c installed by Homebrew : <p>Whenever I attempted to run <code>npm --version</code> or <code>node --version</code> on my Mac, I was getting the following error:</p> <pre><code>$&gt; node --version dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.63.dylib Referenced from: /usr/local/bin/node Reason: image not found Abort trap: 6 </code></pre> <p>I found <a href="https://stackoverflow.com/questions/53828891/dyld-library-not-loaded-usr-local-opt-icu4c-lib-libicui18n-62-dylib-error-run">this helpful SO post</a> which suggested linking the appropriate version, and fixed my issue with:</p> <pre><code>$&gt; brew switch icu4c 63.1 Cleaning /usr/local/Cellar/icu4c/64.2 Cleaning /usr/local/Cellar/icu4c/63.1 Opt link created for /usr/local/Cellar/icu4c/63.1 </code></pre> <p>However after doing this, <strong>PHP</strong> stopped working:</p> <pre><code>$&gt; tail /usr/local/var/log/php-fpm.log Reason: image not found dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib Referenced from: /usr/local/opt/php/sbin/php-fpm Reason: image not found dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib Referenced from: /usr/local/opt/php/sbin/php-fpm Reason: image not found dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib Referenced from: /usr/local/opt/php/sbin/php-fpm Reason: image not found </code></pre> <p>I found <a href="https://stackoverflow.com/questions/53828891/dyld-library-not-loaded-usr-local-opt-icu4c-lib-libicui18n-62-dylib-error-run">this helpful SO post</a> which suggested linking the appropriate version, and fixed my issue with:</p> <pre><code>$&gt; brew switch icu4c 64.2 Cleaning /usr/local/Cellar/icu4c/64.2 Cleaning /usr/local/Cellar/icu4c/63.1 Opt link created for /usr/local/Cellar/icu4c/64.2 </code></pre> <p>But now NodeJS is broken again! How can I tell Homebrew to create <strong>both</strong> links, one for 63.1 and one for 64.2? Or is there a way to tell NodeJS to use the newer 64.2 instead?</p>
0debug
Android Shadow Effect on EditText Field. : <p><a href="http://i.stack.imgur.com/H6uk9.png" rel="nofollow">I need to add a shadow effect a the one shown in the image, below the blue color edit text field. How should I achieve the following. </a></p>
0debug
Finding last row in Excel VBA : <p>I get the run time error 1004: Application-defined or Object defined error</p> <pre><code>Set wsht = ThisWorkbook.Worksheets("Input Checklist") finalrow = wsht.Cells(wsht.Rows.Count, 1).End(x1Up).Row </code></pre> <p>What is the error related to?</p>
0debug
how to know when i CAN'T use list comprehension? : <p>so i'm in the MIT compsci class 6.00.1 and when going through the finger exercises and problems i'm trying to use list comprehension when possible, so far i've been able to.</p> <p>from the reading that i have done it says that you can always write a <code>for</code> loop from comprehension, yet not every <code>for</code> loop can be used with comprehension.</p> <p>i would like to know when i can't and when i can? do i have to write the loop and then try to put it into comprehension to find out if it will work or not? is there a way to know before i try to put it into comprehension?</p> <p>example:</p> <pre><code>def getAvailableLetters(lettersGuessed): from string import ascii_lowercase as letters letter_list = list(letters) for x in lettersGuessed: if x in letter_list: letter_list.remove(x) return ' '.join(letter_list) print(getAvailableLetters(['a', 'b', 'x', 'z'])) </code></pre> <p>comprehension:</p> <pre><code>def getAvailableLetters(lettersGuessed): from string import ascii_lowercase as letters letter_list = list(letters) return ''.join(x for x in lettersGuesseed for x in letter_list if letter_list.remove(x)) print(getAvailableLetters(['a', 'b', 'x', 'z'])) </code></pre> <p>now when i try the comprehension it's (my IDE, pycharm) saying that the second x is 'local variable not used' and that lettersGuessed is an 'unresolved reference'.</p> <p>is this one of the times that i can't use comprehension? and if so, how can i tell without having to try to write it out?</p>
0debug
long do_sigreturn(CPUM68KState *env) { struct target_sigframe *frame; abi_ulong frame_addr = env->aregs[7] - 4; target_sigset_t target_set; sigset_t set; int d0, i; if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) goto badframe; if (__get_user(target_set.sig[0], &frame->sc.sc_mask)) goto badframe; for(i = 1; i < TARGET_NSIG_WORDS; i++) { if (__get_user(target_set.sig[i], &frame->extramask[i - 1])) goto badframe; } target_to_host_sigset_internal(&set, &target_set); do_sigprocmask(SIG_SETMASK, &set, NULL); if (restore_sigcontext(env, &frame->sc, &d0)) goto badframe; unlock_user_struct(frame, frame_addr, 0); return d0; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
1threat
Flask - Active Directory Authentication : <p>I made a small Flask application and I would like users to be able to authenticate with their Windows NT IDs. I am not a part of the IT team, so I have limited insight into this area and my IT team is not experienced with Python.</p> <p>How easy would it be to configure this? I tried to do some Googling and I saw LDAP modules and Flask-Security. I am hoping for a quick guide or to be pointed into a specific direction.</p> <ul> <li>There is an existing Active Directory and a lot of our internal websites use NT authentication</li> <li>I made a Flask app that I will be porting to our internal network</li> <li>I want users to be able to login to the site with their NT ID</li> <li>I need to know what information I need (an LDAP server and port?) or what I need to do with IT to get this configured properly without breaking any security protocols</li> </ul> <p>Thanks!</p>
0debug
swift func execute lazy like haskell : hope to understand if swift compile chain calling func like haskell let x = [1, 2, 3, 4, 5] func doubleMe(x: Int) -> Int { return x * 2 } x.map(doubleMe) .map(doubleMe) .map(doubleMe)
0debug
Using reduce function fror json respone : I have the following JSON: ``` { "meta": { "totalPages": 13 }, "data": [{ "type": "articles", "id": "3", "attributes": { "title": "AAAAA", "body": "BBBB", "created": "2011-06-22T14:56:29.00z", "updated": "2011-06-22T14:56:28.00z" } }], "links": { "self": "http://example.com/articles?page[number]=3&page[size]=1", "first": "http://example.com/articles?page[number]=1&page[size]=1", "prev": "http://example.com/articles?page[number]=2&page[size]=1", "next": "http://example.com/articles?page[number]=4&page[size]=1", "last": "http://example.com/articles?page[number]=1&page[size]=1" } } ``` Suppose I'm getting this Json as response from a web server, is there a way somehow to use [reduce()](https://www.w3schools.com/jsref/jsref_reduce.asp) method here? I tried like: ``` $.ajax({ url:"http://...", type: "GET", headers:{"application/vnd+json"}, success: function(data){ var r = data.cells.reduce(function(array, object) { return array.concat(object.type); }, {}); console.log(r); } )}; ``` Is it possible at all to use reduce here? My task is to use reduce function for the given Json my AJAX is ok?
0debug
How to get the first key of many duplicated json key? : <p>for example `</p> <pre><code> $json = Array ( [1] =&gt; b [1] =&gt; c [1] =&gt; d ) </code></pre> <p>i just want to take the first one [1] => b and ignore the rest</p>
0debug
static void compute_default_clut(AVSubtitleRect *rect, int w, int h) { uint8_t list[256] = {0}; uint8_t list_inv[256]; int counttab[256] = {0}; int count, i, x, y; #define V(x,y) rect->data[0][(x) + (y)*rect->linesize[0]] for (y = 0; y<h; y++) { for (x = 0; x<w; x++) { int v = V(x,y) + 1; int vl = x ? V(x-1,y) + 1 : 0; int vr = x+1<w ? V(x+1,y) + 1 : 0; int vt = y ? V(x,y-1) + 1 : 0; int vb = y+1<h ? V(x,y+1) + 1 : 0; counttab[v-1] += !!((v!=vl) + (v!=vr) + (v!=vt) + (v!=vb)); } } #define L(x,y) list[ rect->data[0][(x) + (y)*rect->linesize[0]] ] for (i = 0; i<256; i++) { int scoretab[256] = {0}; int bestscore = 0; int bestv = 0; for (y = 0; y<h; y++) { for (x = 0; x<w; x++) { int v = rect->data[0][x + y*rect->linesize[0]]; int l_m = list[v]; int l_l = x ? L(x-1, y) : 1; int l_r = x+1<w ? L(x+1, y) : 1; int l_t = y ? L(x, y-1) : 1; int l_b = y+1<h ? L(x, y+1) : 1; int score; if (l_m) continue; scoretab[v] += l_l + l_r + l_t + l_b; score = 1024LL*scoretab[v] / counttab[v]; if (score > bestscore) { bestscore = score; bestv = v; } } } if (!bestscore) break; list [ bestv ] = 1; list_inv[ i ] = bestv; } count = i - 1; for (i--; i>=0; i--) { int v = i*255/count; AV_WN32(rect->data[1] + 4*list_inv[i], RGBA(v/2,v,v/2,v)); } }
1threat
int ff_h264_decode_mb_cavlc(const H264Context *h, H264SliceContext *sl) { int mb_xy; int partition_count; unsigned int mb_type, cbp; int dct8x8_allowed= h->pps.transform_8x8_mode; int decode_chroma = h->sps.chroma_format_idc == 1 || h->sps.chroma_format_idc == 2; const int pixel_shift = h->pixel_shift; mb_xy = sl->mb_xy = sl->mb_x + sl->mb_y*h->mb_stride; ff_tlog(h->avctx, "pic:%d mb:%d/%d\n", h->frame_num, sl->mb_x, sl->mb_y); cbp = 0; if (sl->slice_type_nos != AV_PICTURE_TYPE_I) { if (sl->mb_skip_run == -1) sl->mb_skip_run = get_ue_golomb(&sl->gb); if (sl->mb_skip_run--) { if (FRAME_MBAFF(h) && (sl->mb_y & 1) == 0) { if (sl->mb_skip_run == 0) sl->mb_mbaff = sl->mb_field_decoding_flag = get_bits1(&sl->gb); } decode_mb_skip(h, sl); return 0; } } if (FRAME_MBAFF(h)) { if ((sl->mb_y & 1) == 0) sl->mb_mbaff = sl->mb_field_decoding_flag = get_bits1(&sl->gb); } sl->prev_mb_skipped = 0; mb_type= get_ue_golomb(&sl->gb); if (sl->slice_type_nos == AV_PICTURE_TYPE_B) { if(mb_type < 23){ partition_count = ff_h264_b_mb_type_info[mb_type].partition_count; mb_type = ff_h264_b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } } else if (sl->slice_type_nos == AV_PICTURE_TYPE_P) { if(mb_type < 5){ partition_count = ff_h264_p_mb_type_info[mb_type].partition_count; mb_type = ff_h264_p_mb_type_info[mb_type].type; }else{ mb_type -= 5; goto decode_intra_mb; } }else{ assert(sl->slice_type_nos == AV_PICTURE_TYPE_I); if (sl->slice_type == AV_PICTURE_TYPE_SI && mb_type) mb_type--; decode_intra_mb: if(mb_type > 25){ av_log(h->avctx, AV_LOG_ERROR, "mb_type %d in %c slice too large at %d %d\n", mb_type, av_get_picture_type_char(sl->slice_type), sl->mb_x, sl->mb_y); return -1; } partition_count=0; cbp = ff_h264_i_mb_type_info[mb_type].cbp; sl->intra16x16_pred_mode = ff_h264_i_mb_type_info[mb_type].pred_mode; mb_type = ff_h264_i_mb_type_info[mb_type].type; } if (MB_FIELD(sl)) mb_type |= MB_TYPE_INTERLACED; h->slice_table[mb_xy] = sl->slice_num; if(IS_INTRA_PCM(mb_type)){ const int mb_size = ff_h264_mb_sizes[h->sps.chroma_format_idc] * h->sps.bit_depth_luma; sl->intra_pcm_ptr = align_get_bits(&sl->gb); if (get_bits_left(&sl->gb) < mb_size) { av_log(h->avctx, AV_LOG_ERROR, "Not enough data for an intra PCM block.\n"); return AVERROR_INVALIDDATA; } skip_bits_long(&sl->gb, mb_size); h->cur_pic.qscale_table[mb_xy] = 0; memset(h->non_zero_count[mb_xy], 16, 48); h->cur_pic.mb_type[mb_xy] = mb_type; return 0; } fill_decode_neighbors(h, sl, mb_type); fill_decode_caches(h, sl, mb_type); if(IS_INTRA(mb_type)){ int pred_mode; if(IS_INTRA4x4(mb_type)){ int i; int di = 1; if(dct8x8_allowed && get_bits1(&sl->gb)){ mb_type |= MB_TYPE_8x8DCT; di = 4; } for(i=0; i<16; i+=di){ int mode = pred_intra_mode(h, sl, i); if(!get_bits1(&sl->gb)){ const int rem_mode= get_bits(&sl->gb, 3); mode = rem_mode + (rem_mode >= mode); } if(di==4) fill_rectangle(&sl->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1); else sl->intra4x4_pred_mode_cache[scan8[i]] = mode; } write_back_intra_pred_mode(h, sl); if (ff_h264_check_intra4x4_pred_mode(sl->intra4x4_pred_mode_cache, h->avctx, sl->top_samples_available, sl->left_samples_available) < 0) return -1; }else{ sl->intra16x16_pred_mode = ff_h264_check_intra_pred_mode(h->avctx, sl->top_samples_available, sl->left_samples_available, sl->intra16x16_pred_mode, 0); if (sl->intra16x16_pred_mode < 0) return -1; } if(decode_chroma){ pred_mode= ff_h264_check_intra_pred_mode(h->avctx, sl->top_samples_available, sl->left_samples_available, get_ue_golomb_31(&sl->gb), 1); if(pred_mode < 0) return -1; sl->chroma_pred_mode = pred_mode; } else { sl->chroma_pred_mode = DC_128_PRED8x8; } }else if(partition_count==4){ int i, j, sub_partition_count[4], list, ref[2][4]; if (sl->slice_type_nos == AV_PICTURE_TYPE_B) { for(i=0; i<4; i++){ sl->sub_mb_type[i]= get_ue_golomb_31(&sl->gb); if(sl->sub_mb_type[i] >=13){ av_log(h->avctx, AV_LOG_ERROR, "B sub_mb_type %u out of range at %d %d\n", sl->sub_mb_type[i], sl->mb_x, sl->mb_y); return -1; } sub_partition_count[i] = ff_h264_b_sub_mb_type_info[sl->sub_mb_type[i]].partition_count; sl->sub_mb_type[i] = ff_h264_b_sub_mb_type_info[sl->sub_mb_type[i]].type; } if( IS_DIRECT(sl->sub_mb_type[0]|sl->sub_mb_type[1]|sl->sub_mb_type[2]|sl->sub_mb_type[3])) { ff_h264_pred_direct_motion(h, sl, &mb_type); sl->ref_cache[0][scan8[4]] = sl->ref_cache[1][scan8[4]] = sl->ref_cache[0][scan8[12]] = sl->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; } }else{ assert(sl->slice_type_nos == AV_PICTURE_TYPE_P); for(i=0; i<4; i++){ sl->sub_mb_type[i]= get_ue_golomb_31(&sl->gb); if(sl->sub_mb_type[i] >=4){ av_log(h->avctx, AV_LOG_ERROR, "P sub_mb_type %u out of range at %d %d\n", sl->sub_mb_type[i], sl->mb_x, sl->mb_y); return -1; } sub_partition_count[i] = ff_h264_p_sub_mb_type_info[sl->sub_mb_type[i]].partition_count; sl->sub_mb_type[i] = ff_h264_p_sub_mb_type_info[sl->sub_mb_type[i]].type; } } for (list = 0; list < sl->list_count; list++) { int ref_count = IS_REF0(mb_type) ? 1 : sl->ref_count[list] << MB_MBAFF(sl); for(i=0; i<4; i++){ if(IS_DIRECT(sl->sub_mb_type[i])) continue; if(IS_DIR(sl->sub_mb_type[i], 0, list)){ unsigned int tmp; if(ref_count == 1){ tmp= 0; }else if(ref_count == 2){ tmp= get_bits1(&sl->gb)^1; }else{ tmp= get_ue_golomb_31(&sl->gb); if(tmp>=ref_count){ av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", tmp); return -1; } } ref[list][i]= tmp; }else{ ref[list][i] = -1; } } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h, sl); for (list = 0; list < sl->list_count; list++) { for(i=0; i<4; i++){ if(IS_DIRECT(sl->sub_mb_type[i])) { sl->ref_cache[list][ scan8[4*i] ] = sl->ref_cache[list][ scan8[4*i]+1 ]; continue; } sl->ref_cache[list][ scan8[4*i] ]=sl->ref_cache[list][ scan8[4*i]+1 ]= sl->ref_cache[list][ scan8[4*i]+8 ]=sl->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; if(IS_DIR(sl->sub_mb_type[i], 0, list)){ const int sub_mb_type= sl->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &sl->mv_cache[list][ scan8[index] ]; pred_motion(h, sl, index, block_width, list, sl->ref_cache[list][ scan8[index] ], &mx, &my); mx += get_se_golomb(&sl->gb); my += get_se_golomb(&sl->gb); ff_tlog(h->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; } }else{ uint32_t *p= (uint32_t *)&sl->mv_cache[list][ scan8[4*i] ][0]; p[0] = p[1]= p[8] = p[9]= 0; } } } }else if(IS_DIRECT(mb_type)){ ff_h264_pred_direct_motion(h, sl, &mb_type); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; }else{ int list, mx, my, i; we should set ref_idx_l? to 0 if we use that later ... if(IS_16X16(mb_type)){ for (list = 0; list < sl->list_count; list++) { unsigned int val; if(IS_DIR(mb_type, 0, list)){ int rc = sl->ref_count[list] << MB_MBAFF(sl); if (rc == 1) { val= 0; } else if (rc == 2) { val= get_bits1(&sl->gb)^1; }else{ val= get_ue_golomb_31(&sl->gb); if (val >= rc) { av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } fill_rectangle(&sl->ref_cache[list][ scan8[0] ], 4, 4, 8, val, 1); } } for (list = 0; list < sl->list_count; list++) { if(IS_DIR(mb_type, 0, list)){ pred_motion(h, sl, 0, 4, list, sl->ref_cache[list][ scan8[0] ], &mx, &my); mx += get_se_golomb(&sl->gb); my += get_se_golomb(&sl->gb); ff_tlog(h->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(sl->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); } } } else if(IS_16X8(mb_type)){ for (list = 0; list < sl->list_count; list++) { for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ int rc = sl->ref_count[list] << MB_MBAFF(sl); if (rc == 1) { val= 0; } else if (rc == 2) { val= get_bits1(&sl->gb)^1; }else{ val= get_ue_golomb_31(&sl->gb); if (val >= rc) { av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&sl->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 1); } } for (list = 0; list < sl->list_count; list++) { for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, sl, 8*i, list, sl->ref_cache[list][scan8[0] + 16*i], &mx, &my); mx += get_se_golomb(&sl->gb); my += get_se_golomb(&sl->gb); ff_tlog(h->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(sl->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, val, 4); } } }else{ assert(IS_8X16(mb_type)); for (list = 0; list < sl->list_count; list++) { for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ optimize int rc = sl->ref_count[list] << MB_MBAFF(sl); if (rc == 1) { val= 0; } else if (rc == 2) { val= get_bits1(&sl->gb)^1; }else{ val= get_ue_golomb_31(&sl->gb); if (val >= rc) { av_log(h->avctx, AV_LOG_ERROR, "ref %u overflow\n", val); return -1; } } }else val= LIST_NOT_USED&0xFF; fill_rectangle(&sl->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 1); } } for (list = 0; list < sl->list_count; list++) { for(i=0; i<2; i++){ unsigned int val; if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, sl, i*4, list, sl->ref_cache[list][ scan8[0] + 2*i ], &mx, &my); mx += get_se_golomb(&sl->gb); my += get_se_golomb(&sl->gb); ff_tlog(h->avctx, "final mv:%d %d\n", mx, my); val= pack16to32(mx,my); }else val=0; fill_rectangle(sl->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, val, 4); } } } } if(IS_INTER(mb_type)) write_back_motion(h, sl, mb_type); if(!IS_INTRA16x16(mb_type)){ cbp= get_ue_golomb(&sl->gb); if(decode_chroma){ if(cbp > 47){ av_log(h->avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, sl->mb_x, sl->mb_y); return -1; } if (IS_INTRA4x4(mb_type)) cbp = ff_h264_golomb_to_intra4x4_cbp[cbp]; else cbp = ff_h264_golomb_to_inter_cbp[cbp]; }else{ if(cbp > 15){ av_log(h->avctx, AV_LOG_ERROR, "cbp too large (%u) at %d %d\n", cbp, sl->mb_x, sl->mb_y); return -1; } if(IS_INTRA4x4(mb_type)) cbp= golomb_to_intra4x4_cbp_gray[cbp]; else cbp= golomb_to_inter_cbp_gray[cbp]; } } if(dct8x8_allowed && (cbp&15) && !IS_INTRA(mb_type)){ mb_type |= MB_TYPE_8x8DCT*get_bits1(&sl->gb); } sl->cbp= h->cbp_table[mb_xy]= cbp; h->cur_pic.mb_type[mb_xy] = mb_type; if(cbp || IS_INTRA16x16(mb_type)){ int i4x4, i8x8, chroma_idx; int dquant; int ret; GetBitContext *gb = &sl->gb; const uint8_t *scan, *scan8x8; const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8); if(IS_INTERLACED(mb_type)){ scan8x8 = sl->qscale ? h->field_scan8x8_cavlc : h->field_scan8x8_cavlc_q0; scan = sl->qscale ? h->field_scan : h->field_scan_q0; }else{ scan8x8 = sl->qscale ? h->zigzag_scan8x8_cavlc : h->zigzag_scan8x8_cavlc_q0; scan = sl->qscale ? h->zigzag_scan : h->zigzag_scan_q0; } dquant= get_se_golomb(&sl->gb); sl->qscale += dquant; if (((unsigned)sl->qscale) > max_qp){ if (sl->qscale < 0) sl->qscale += max_qp + 1; else sl->qscale -= max_qp+1; if (((unsigned)sl->qscale) > max_qp){ av_log(h->avctx, AV_LOG_ERROR, "dquant out of range (%d) at %d %d\n", dquant, sl->mb_x, sl->mb_y); return -1; } } sl->chroma_qp[0] = get_chroma_qp(h, 0, sl->qscale); sl->chroma_qp[1] = get_chroma_qp(h, 1, sl->qscale); if ((ret = decode_luma_residual(h, sl, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 0)) < 0 ) { return -1; } h->cbp_table[mb_xy] |= ret << 12; if (CHROMA444(h)) { if (decode_luma_residual(h, sl, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 1) < 0 ) { return -1; } if (decode_luma_residual(h, sl, gb, scan, scan8x8, pixel_shift, mb_type, cbp, 2) < 0 ) { return -1; } } else if (CHROMA422(h)) { if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if (decode_residual(h, sl, gb, sl->mb + ((256 + 16*16*chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX + chroma_idx, ff_h264_chroma422_dc_scan, NULL, 8) < 0) { return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][sl->chroma_qp[chroma_idx]]; int16_t *mb = sl->mb + (16*(16 + 16*chroma_idx) << pixel_shift); for (i8x8 = 0; i8x8 < 2; i8x8++) { for (i4x4 = 0; i4x4 < 4; i4x4++) { const int index = 16 + 16*chroma_idx + 8*i8x8 + i4x4; if (decode_residual(h, sl, gb, mb, index, scan + 1, qmul, 15) < 0) return -1; mb += 16 << pixel_shift; } } } }else{ fill_rectangle(&sl->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&sl->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } else { if(cbp&0x30){ for(chroma_idx=0; chroma_idx<2; chroma_idx++) if (decode_residual(h, sl, gb, sl->mb + ((256 + 16 * 16 * chroma_idx) << pixel_shift), CHROMA_DC_BLOCK_INDEX + chroma_idx, ff_h264_chroma_dc_scan, NULL, 4) < 0) { return -1; } } if(cbp&0x20){ for(chroma_idx=0; chroma_idx<2; chroma_idx++){ const uint32_t *qmul = h->dequant4_coeff[chroma_idx+1+(IS_INTRA( mb_type ) ? 0:3)][sl->chroma_qp[chroma_idx]]; for(i4x4=0; i4x4<4; i4x4++){ const int index= 16 + 16*chroma_idx + i4x4; if( decode_residual(h, sl, gb, sl->mb + (16*index << pixel_shift), index, scan + 1, qmul, 15) < 0){ return -1; } } } }else{ fill_rectangle(&sl->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&sl->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } } }else{ fill_rectangle(&sl->non_zero_count_cache[scan8[ 0]], 4, 4, 8, 0, 1); fill_rectangle(&sl->non_zero_count_cache[scan8[16]], 4, 4, 8, 0, 1); fill_rectangle(&sl->non_zero_count_cache[scan8[32]], 4, 4, 8, 0, 1); } h->cur_pic.qscale_table[mb_xy] = sl->qscale; write_back_non_zero_count(h, sl); return 0; }
1threat
I am looking to search for a specific string in all text files in all directories using power shell : I am new to power shell. I am looking to search for a specific string in all text files in all directories. Here is my script but it is not searching sub directories. Select-String -Path D:\FLAG_FILES\*.* -pattern "admin" |Out-File D:\logs\FLAG_FILES.txt Appreciate your time. Regards, Naresh
0debug
How to add new data to Firebase database in android studio? : The problem itself is more complex than the question makes it seem, at least to me. [My database;][1] [1]: https://i.stack.imgur.com/hBVEZ.jpg The problem is that I am fairly new to using Firebase for my android app and I do not know how to add an entirely new User profile here. For example, if someone were to register, and it would then add a new "record" at "2" and so on. How do you do this?
0debug
static int hwmap_config_output(AVFilterLink *outlink) { AVFilterContext *avctx = outlink->src; HWMapContext *ctx = avctx->priv; AVFilterLink *inlink = avctx->inputs[0]; AVHWFramesContext *hwfc; AVBufferRef *device; const AVPixFmtDescriptor *desc; int err; av_log(avctx, AV_LOG_DEBUG, "Configure hwmap %s -> %s.\n", av_get_pix_fmt_name(inlink->format), av_get_pix_fmt_name(outlink->format)); av_buffer_unref(&ctx->hwframes_ref); device = avctx->hw_device_ctx; if (inlink->hw_frames_ctx) { hwfc = (AVHWFramesContext*)inlink->hw_frames_ctx->data; if (ctx->derive_device_type) { enum AVHWDeviceType type; type = av_hwdevice_find_type_by_name(ctx->derive_device_type); if (type == AV_HWDEVICE_TYPE_NONE) { av_log(avctx, AV_LOG_ERROR, "Invalid device type.\n"); goto fail; } err = av_hwdevice_ctx_create_derived(&device, type, hwfc->device_ref, 0); if (err < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to created derived " "device context: %d.\n", err); goto fail; } } desc = av_pix_fmt_desc_get(outlink->format); if (!desc) { err = AVERROR(EINVAL); goto fail; } if (inlink->format == hwfc->format && (desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) { if (!device) { av_log(avctx, AV_LOG_ERROR, "A device reference is " "required to map to a hardware format.\n"); err = AVERROR(EINVAL); goto fail; } err = av_hwframe_ctx_create_derived(&ctx->hwframes_ref, outlink->format, device, inlink->hw_frames_ctx, 0); if (err < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to create derived " "frames context: %d.\n", err); goto fail; } } else if ((outlink->format == hwfc->format && inlink->format == hwfc->sw_format) || inlink->format == hwfc->format) { ctx->hwframes_ref = av_buffer_ref(inlink->hw_frames_ctx); if (!ctx->hwframes_ref) { err = AVERROR(ENOMEM); goto fail; } } else { av_log(avctx, AV_LOG_ERROR, "Unsupported formats for " "hwmap: from %s (%s) to %s.\n", av_get_pix_fmt_name(inlink->format), av_get_pix_fmt_name(hwfc->format), av_get_pix_fmt_name(outlink->format)); err = AVERROR(EINVAL); goto fail; } } else if (avctx->hw_device_ctx) { if (!device) { av_log(avctx, AV_LOG_ERROR, "A device reference is " "required to create new frames with backwards " "mapping.\n"); err = AVERROR(EINVAL); goto fail; } ctx->map_backwards = 1; ctx->hwframes_ref = av_hwframe_ctx_alloc(device); if (!ctx->hwframes_ref) { err = AVERROR(ENOMEM); goto fail; } hwfc = (AVHWFramesContext*)ctx->hwframes_ref->data; hwfc->format = outlink->format; hwfc->sw_format = inlink->format; hwfc->width = inlink->w; hwfc->height = inlink->h; err = av_hwframe_ctx_init(ctx->hwframes_ref); if (err < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to create frame " "context for backward mapping: %d.\n", err); goto fail; } } else { av_log(avctx, AV_LOG_ERROR, "Mapping requires a hardware " "context (a device, or frames on input).\n"); return AVERROR(EINVAL); } outlink->hw_frames_ctx = av_buffer_ref(ctx->hwframes_ref); if (!outlink->hw_frames_ctx) { err = AVERROR(ENOMEM); goto fail; } outlink->w = inlink->w; outlink->h = inlink->h; return 0; fail: av_buffer_unref(&ctx->hwframes_ref); return err; }
1threat
Spin bottle with UIGestureRecognizer : <p>I am using this code now to spin bottle on button tap:</p> <pre><code>@IBAction func spinButton(sender: AnyObject) { let rotateView = CABasicAnimation() let randonAngle = arc4random_uniform(360) + 720 rotateView.fromValue = 0 rotateView.toValue = Float(randonAngle) * Float(M_PI) / 180.0 rotateView.duration = 3 rotateView.delegate = self rotateView.repeatCount = 0 rotateView.removedOnCompletion = false rotateView.fillMode = kCAFillModeForwards rotateView.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) bottleImageView.layer.addAnimation(rotateView, forKey: "transform.rotation.z") } </code></pre> <p>But how can I rotate the button using gesture? So the harder/faster I move my finger, the faster the bottle will spin</p>
0debug
int ff_probe_input_buffer(ByteIOContext **pb, AVInputFormat **fmt, const char *filename, void *logctx, unsigned int offset, unsigned int max_probe_size) { AVProbeData pd = { filename ? filename : "", NULL, -offset }; unsigned char *buf = NULL; int probe_size; if (!max_probe_size) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size > PROBE_BUF_MAX) { max_probe_size = PROBE_BUF_MAX; } else if (max_probe_size < PROBE_BUF_MIN) { return AVERROR(EINVAL); } if (offset >= max_probe_size) { return AVERROR(EINVAL); } for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt; probe_size<<=1){ int ret, score = probe_size < max_probe_size ? AVPROBE_SCORE_MAX/4 : 0; int buf_offset = (probe_size == PROBE_BUF_MIN) ? 0 : probe_size>>1; if (probe_size < offset) { continue; } buf = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE); if ((ret = get_buffer(*pb, buf + buf_offset, probe_size - buf_offset)) < 0) { av_free(buf); return ret; } pd.buf_size += ret; pd.buf = &buf[offset]; memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE); *fmt = av_probe_input_format2(&pd, 1, &score); if(*fmt){ if(score <= AVPROBE_SCORE_MAX/4){ av_log(logctx, AV_LOG_WARNING, "Format detected only with low score of %d, misdetection possible!\n", score); }else av_log(logctx, AV_LOG_DEBUG, "Probed with size=%d and score=%d\n", probe_size, score); } } av_free(buf); if (url_fseek(*pb, 0, SEEK_SET) < 0) { url_fclose(*pb); if (url_fopen(pb, filename, URL_RDONLY) < 0) return AVERROR(EIO); } return 0; }
1threat
int cpu_x86_gen_code(uint8_t *gen_code_buf, int max_code_size, int *gen_code_size_ptr, uint8_t *pc_start, uint8_t *cs_base, int flags) { DisasContext dc1, *dc = &dc1; uint8_t *pc_ptr; uint16_t *gen_opc_end; int gen_code_size; long ret; #ifdef DEBUG_DISAS struct disassemble_info disasm_info; #endif dc->code32 = (flags >> GEN_FLAG_CODE32_SHIFT) & 1; dc->ss32 = (flags >> GEN_FLAG_SS32_SHIFT) & 1; dc->addseg = (flags >> GEN_FLAG_ADDSEG_SHIFT) & 1; dc->f_st = (flags >> GEN_FLAG_ST_SHIFT) & 7; dc->cc_op = CC_OP_DYNAMIC; dc->cs_base = cs_base; gen_opc_ptr = gen_opc_buf; gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; gen_opparam_ptr = gen_opparam_buf; dc->is_jmp = 0; pc_ptr = pc_start; do { ret = disas_insn(dc, pc_ptr); if (ret == -1) { if (pc_ptr == pc_start) return -1; else break; } pc_ptr = (void *)ret; } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end); if (dc->cc_op != CC_OP_DYNAMIC) gen_op_set_cc_op(dc->cc_op); if (dc->is_jmp != 1) { gen_op_jmp_im(ret - (unsigned long)dc->cs_base); } *gen_opc_ptr = INDEX_op_end; #ifdef DEBUG_DISAS if (loglevel) { uint8_t *pc; int count; INIT_DISASSEMBLE_INFO(disasm_info, logfile, fprintf); #if 0 disasm_info.flavour = bfd_get_flavour (abfd); disasm_info.arch = bfd_get_arch (abfd); disasm_info.mach = bfd_get_mach (abfd); #endif disasm_info.endian = BFD_ENDIAN_LITTLE; if (dc->code32) disasm_info.mach = bfd_mach_i386_i386; else disasm_info.mach = bfd_mach_i386_i8086; fprintf(logfile, "----------------\n"); fprintf(logfile, "IN:\n"); disasm_info.buffer = pc_start; disasm_info.buffer_vma = (unsigned long)pc_start; disasm_info.buffer_length = pc_ptr - pc_start; pc = pc_start; while (pc < pc_ptr) { fprintf(logfile, "0x%08lx: ", (long)pc); count = print_insn_i386((unsigned long)pc, &disasm_info); fprintf(logfile, "\n"); pc += count; } fprintf(logfile, "\n"); fprintf(logfile, "OP:\n"); dump_ops(gen_opc_buf); fprintf(logfile, "\n"); } #endif optimize_flags(gen_opc_buf, gen_opc_ptr - gen_opc_buf); #ifdef DEBUG_DISAS if (loglevel) { fprintf(logfile, "AFTER FLAGS OPT:\n"); dump_ops(gen_opc_buf); fprintf(logfile, "\n"); } #endif gen_code_size = dyngen_code(gen_code_buf, gen_opc_buf, gen_opparam_buf); flush_icache_range((unsigned long)gen_code_buf, (unsigned long)(gen_code_buf + gen_code_size)); *gen_code_size_ptr = gen_code_size; #ifdef DEBUG_DISAS if (loglevel) { uint8_t *pc; int count; INIT_DISASSEMBLE_INFO(disasm_info, logfile, fprintf); #if 0 disasm_info.flavour = bfd_get_flavour (abfd); disasm_info.arch = bfd_get_arch (abfd); disasm_info.mach = bfd_get_mach (abfd); #endif #ifdef WORDS_BIGENDIAN disasm_info.endian = BFD_ENDIAN_BIG; #else disasm_info.endian = BFD_ENDIAN_LITTLE; #endif disasm_info.mach = bfd_mach_i386_i386; pc = gen_code_buf; disasm_info.buffer = pc; disasm_info.buffer_vma = (unsigned long)pc; disasm_info.buffer_length = *gen_code_size_ptr; fprintf(logfile, "OUT: [size=%d]\n", *gen_code_size_ptr); while (pc < gen_code_buf + *gen_code_size_ptr) { fprintf(logfile, "0x%08lx: ", (long)pc); count = print_insn_i386((unsigned long)pc, &disasm_info); fprintf(logfile, "\n"); pc += count; } fprintf(logfile, "\n"); fflush(logfile); } #endif return 0; }
1threat
Laravel 5.2 mail-tracker : <p>I build new project using laravel 5.2 and I want track emails opens,clicks and bounced emails . But I didn't found the best. If you know please point me</p>
0debug
int32_t helper_fdtoi(CPUSPARCState *env, float64 src) { int32_t ret; clear_float_exceptions(env); ret = float64_to_int32_round_to_zero(src, &env->fp_status); check_ieee_exceptions(env); return ret; }
1threat
uint32_t HELPER(tprot)(uint64_t a1, uint64_t a2) { return 0; }
1threat
Creating a button with JS : <p>I am trying to create a button and append it to HTML in Javascript.</p> <p>This is my code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; var btn=document.createElement("button"); btn.className = "YourClass"; btn.className += " YourClass2"; btn.id ='someId'; document.getElementById("main").appendChild(btn); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id = 'main'&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Unfortunately, this does not work and i don't understand why.</p>
0debug
int ff_v4l2_m2m_codec_init(AVCodecContext *avctx) { int ret = AVERROR(EINVAL); struct dirent *entry; char node[PATH_MAX]; DIR *dirp; V4L2m2mContext *s = avctx->priv_data; s->avctx = avctx; dirp = opendir("/dev"); if (!dirp) return AVERROR(errno); for (entry = readdir(dirp); entry; entry = readdir(dirp)) { if (strncmp(entry->d_name, "video", 5)) continue; snprintf(node, sizeof(node), "/dev/%s", entry->d_name); av_log(s->avctx, AV_LOG_DEBUG, "probing device %s\n", node); strncpy(s->devname, node, strlen(node) + 1); ret = v4l2_probe_driver(s); if (!ret) break; } closedir(dirp); if (ret) { av_log(s->avctx, AV_LOG_ERROR, "Could not find a valid device\n"); memset(s->devname, 0, sizeof(s->devname)); return ret; } av_log(s->avctx, AV_LOG_INFO, "Using device %s\n", node); return v4l2_configure_contexts(s); }
1threat
alloc_parameter_set(H264Context *h, void **vec, const unsigned int id, const unsigned int max, const size_t size, const char *name) { if(id>=max) { av_log(h->s.avctx, AV_LOG_ERROR, "%s_id (%d) out of range\n", name, id); return NULL; } if(!vec[id]) { vec[id] = av_mallocz(size); if(vec[id] == NULL) av_log(h->s.avctx, AV_LOG_ERROR, "cannot allocate memory for %s\n", name); } return vec[id]; }
1threat
Fill a new pandas column with row numbers : <p>I have the following DataFrame <code>data</code> with random index values:</p> <pre><code> A B 100 0 7 203 5 4 5992 0 10 2003 9 8 20 10 5 12 6 2 </code></pre> <p>I would like to add a new column 'C' with row numbers. For example:</p> <pre><code> A B C 100 0 7 0 203 5 4 1 5992 0 10 2 2003 9 8 3 20 10 5 4 12 6 2 5 </code></pre> <p>Thank you for your help!</p>
0debug
How does Android Paging Library know to load more data? : <p>Iʼm fairly new to developing Android apps and Iʼm trying to do everything “the right way.” So right now, Iʼm implementing the new Android Paging Library into my project, where I need to load a list of articles from a network server.</p> <p>I have an <code>ArticlesRepository</code> class that returns an <code>ArticleList</code> class containing instances of <code>ArticleListItem</code> that I would like to display in a RecyclerView. The list of articles is paginated already on the server, so the repository sends a request for the first page and returns an <code>ArticleList</code> with the <code>page</code> property set to <code>1</code> and the <code>articles</code> property containing a <code>List&lt;ArticleListItem&gt;</code> of articles on the requested page. I donʼt know how many articles can be on one page.</p> <p>Now, I was able to implement a <code>PageKeyedDataSource&lt;Integer, ArticleListItem&gt;</code>, but it only fetches the first page:</p> <pre><code>@Override public void loadInitial(@NonNull LoadInitialParams&lt;Integer&gt; params, @NonNull LoadInitialCallback&lt;Integer, ArticleListItem&gt; callback) { ArticleList list = load(1); if (list != null) { callback.onResult(list.articles, null, next(list)); } } @Override public void loadBefore(@NonNull LoadParams&lt;Integer&gt; params, @NonNull LoadCallback&lt;Integer, ArticleListItem&gt; callback) { ArticleList list = load(previous(params.key)); if (list != null) { callback.onResult(list.articles, previous(list)); } } @Override public void loadAfter(@NonNull LoadParams&lt;Integer&gt; params, @NonNull LoadCallback&lt;Integer, ArticleListItem&gt; callback) { ArticleList list = load(next(params.key)); if (list != null) { callback.onResult(list.articles, next(list)); } } </code></pre> <p>The <code>previous</code>/<code>next</code> functions return an <code>Integer</code> with the previous/next page number or <code>null</code> if there isnʼt one.</p> <p>In my ViewModel, I configure the PagedList like this:</p> <pre><code>PagedList.Config config = new PagedList.Config.Builder() .setEnablePlaceholders(false) .setInitialLoadSizeHint(1) .setPageSize(1) .setPrefetchDistance(1) .build(); </code></pre> <p>This way Iʼm able to load the first page, but when I scroll to the bottom of the RecyclerView (that is inside a NestedScrollView), nothing happens. Debugging shows that the <code>PageKeyedDataSource.loadAfter</code> method is not invoked.</p> <p>Do I have to somehow tell the PagedList that the next page has to be loaded, or is it the RecyclerView/DataSource/GodKnowsWhatElseʼs job and Iʼm just doing something wrong? Thanks for any advice.</p>
0debug
TypeError: list object is not an iterator : <p>Am trying to make a simple post api in flask-python but am getting this error :</p> <pre><code>TypeError: list object is not an iterator </code></pre> <p>but when i revise my code seems fine what could be the problem.</p> <p>My function which specifically has the problem:</p> <pre><code>def post(self,name): #return {'message': name} item = next(filter(lambda x: x['name'] == name, items), None) if item: return {'message':"An item with name '{}' already exixts. ".format(name)},400 data = request.get_json() item = {'name': name, 'price':data['price']} items.append(item) return item, 201 </code></pre> <p>When i try to post something on <strong>postman</strong> i get this <code>logcat</code> <strong>error</strong>:</p> <pre><code>[2018-06-07 10:41:02,849] ERROR in app: Exception on /item/test [POST] Traceback (most recent call last): File "C:\Python27\lib\site-packages\flask\app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "C:\Python27\lib\site-packages\flask\app.py", line 1598, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "C:\Python27\lib\site-packages\flask_restful\__init__.py", line 480, in wrapper resp = resource(*args, **kwargs) File "C:\Python27\lib\site-packages\flask\views.py", line 84, in view return self.dispatch_request(*args, **kwargs) File "C:\Python27\lib\site-packages\flask_restful\__init__.py", line 595, in dispatch_request resp = meth(*args, **kwargs) File "G:\flask_workspace\MealBookingApp\MealBookingApp\MealBookingApp\views.py", line 30, in post item = next(filter(lambda x: x['name'] == name, items), None) TypeError: list object is not an iterator 127.0.0.1 - - [07/Jun/2018 10:41:02] "POST /item/test HTTP/1.1" 500 - </code></pre> <p><strong>NB:</strong></p> <p><strong><em>line 30</em></strong> , is the line below :</p> <pre><code>item = next(filter(lambda x: x['name'] == name, items), None) </code></pre>
0debug
java.util.UUID.randomUUID().toString() length : <p>Does java.util.UUID.randomUUID().toString() length always equal to 36?</p> <p>I was not able to find info on that. <a href="http://docs.oracle.com/javase/7/docs/api/java/util/UUID.html" rel="noreferrer">Here</a> it is said only the following: </p> <blockquote> <p>public static UUID randomUUID() Static factory to retrieve a type 4 (pseudo randomly generated) UUID. The UUID is generated using a cryptographically strong pseudo random number generator. Returns: A randomly generated UUID</p> </blockquote> <p>And that <code>type 4</code> tells me nothing. I do not know what type 4 means in the case.</p>
0debug
not get mysql db data .... into html page with php (stumped) : I am working on an assignment, and it requires me to select a "slip_id" from the 3aStudent_Slip.html and pass it to the next html 4aservice_request.html and populate a table that is being built in the php code. I have NOT had any php classes so I am really struggling with why it's NOT getting any database from the "ProgrammingDatabase" on the server. using the following code ... <?php require_once('auth.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Service Requests</title> <link href="loginmodule.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="innerWrapper"> <h1>Service request by <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1> <a href="index.php">Login Page</a> | <a href="amenu.php">Menu Page</a> | <a href="logout.php">Logout</a> <?php $slip_id = strtoupper($_POST['slip_id']); echo("<h2>Services for Slip ID $slip_id</h2>"); //Verify Password $vlogin=$_SESSION['vlogin']; $vpassword=$_SESSION['vpasswd']; //Connection String $con=mysql_connect("localhost", $vlogin, $vpasswd); if(!$con) { die("Could not connect".mysql_error()); } //Select Database mysql_select_db("ProgrammingDatabase", $con); //The actual SQL code goes below into the structured variable $result $result=mysql_query("SELECT * FROM service_request"); //Constructing the table and column names echo "<table border='1'> <tr> <th>Service ID</th> <th>Description</th> </tr>"; //Looping until there are no more records from $result //If there are records, print the column for that row //do the while loop below with the variables from $result while($row=mysql_fetch_array($result)) { echo "<tr>"; echo "<td>".$row['service_id']."</td>"; echo "<td>".$row['description']."</td>"; echo "</tr>"; } echo "</table>"; //Close the SQL connection string mysql_close($con); ?> <br /> <form action="a4Services_Student.php " method="post"> <br /> </form> </div> </body> </html>
0debug
how can I have this in formula in excel please? : Cell > 0: Overdue Cell between 0 to -2: A Cell between -3 to -5: B Cell between -6 to -10: C Cell between -11 to 30: D
0debug
static int rate_get_samples (struct audio_pcm_info *info, SpiceRateCtl *rate) { int64_t now; int64_t ticks; int64_t bytes; int64_t samples; now = qemu_get_clock (vm_clock); ticks = now - rate->start_ticks; bytes = muldiv64 (ticks, info->bytes_per_second, get_ticks_per_sec ()); samples = (bytes - rate->bytes_sent) >> info->shift; if (samples < 0 || samples > 65536) { fprintf (stderr, "Resetting rate control (%" PRId64 " samples)\n", samples); rate_start (rate); samples = 0; } rate->bytes_sent += samples << info->shift; return samples; }
1threat
void hmp_info_memory_devices(Monitor *mon, const QDict *qdict) { Error *err = NULL; MemoryDeviceInfoList *info_list = qmp_query_memory_devices(&err); MemoryDeviceInfoList *info; MemoryDeviceInfo *value; PCDIMMDeviceInfo *di; for (info = info_list; info; info = info->next) { value = info->value; if (value) { switch (value->kind) { case MEMORY_DEVICE_INFO_KIND_DIMM: di = value->dimm; monitor_printf(mon, "Memory device [%s]: \"%s\"\n", MemoryDeviceInfoKind_lookup[value->kind], di->id ? di->id : ""); monitor_printf(mon, " addr: 0x%" PRIx64 "\n", di->addr); monitor_printf(mon, " slot: %" PRId64 "\n", di->slot); monitor_printf(mon, " node: %" PRId64 "\n", di->node); monitor_printf(mon, " size: %" PRIu64 "\n", di->size); monitor_printf(mon, " memdev: %s\n", di->memdev); monitor_printf(mon, " hotplugged: %s\n", di->hotplugged ? "true" : "false"); monitor_printf(mon, " hotpluggable: %s\n", di->hotpluggable ? "true" : "false"); break; default: break; } } } qapi_free_MemoryDeviceInfoList(info_list); }
1threat
static int ipvideo_decode_block_opcode_0xD(IpvideoContext *s) { int y; unsigned char P[2]; CHECK_STREAM_PTR(4); for (y = 0; y < 8; y++) { if (!(y & 3)) { P[0] = *s->stream_ptr++; P[1] = *s->stream_ptr++; } memset(s->pixel_ptr, P[0], 4); memset(s->pixel_ptr + 4, P[1], 4); s->pixel_ptr += s->stride; } return 0; }
1threat
How to access JavaScript variable from one function to another. : How to access JavaScript variable from one location click event function to another. I have a variable `imdid `, I wan to access this variable in my different click event, How Can i do that. $( document ).ready(function() { $(".img-upload").click(function(){ //$("#modal").modal('show'); var imdid = $(this).attr("imgid"); }); $(".img-gallary").click(function(){ var imgsrc = $(this).attr("src"); alert(imgsrc); alert(imdid); }); }); }); Many Thanks
0debug
remove duplicate(non-unique) paired values in stata, urgent : I'm working with an edge list in STATA, of the type: var1 var2 a 1 a 2 a 3 b 1 b 2 1 a 2 b I want to remove non-unique pairs such as 1a and 2b (which are same as a1 and b2 for me). How can I go about this?
0debug
Cannot create directory in android API 24 or higher devices : <p>I have developing my android app and testing it in the lowest supported SDK, which is API 18 Jellybean through an emulator (Genymotion). There is a use case where I have to download a pdf file and save it in the external storage. This works as expected in the API 18 emulator without any trouble. Then i decided to test it in my own device, which is a Huawei Honor6x with API 24, but i got a FileNotFoundException. After debugging i figured out that its not creating the directory in the external storage. To cross check if this is a problem specific to my own device, I installed 2 other emulators with API 24 (Pixel XL and Galaxy S7). I got the same error. Is there any security features blocking me from creating a folder in never versions? </p> <p>here is my code</p> <p>I have the following permissions</p> <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; </code></pre> <p>And here is the code where i create the directory</p> <pre><code>File directory = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), "/notespal"); if (!directory.exists()){ boolean created = directory.mkdirs(); } </code></pre> <p>Appreciate your assistance since i have been stuck in this for few days now. </p>
0debug
Flow types for react-native's Animated library : <p>I am trying to use <strong>react-native's Animated</strong> library alongside <strong>Flow</strong>. Unfortunately, I get a bunch of Flow errors that I cannot resolve (see Screenshot).</p> <p>In the example below I render a circle on the screen and want to make it move when it is being rendered using <code>Animated.spring</code>. Is there anything else I need to add to make react-native work with Flow?</p> <p>Flow version: 0.54.0 / react-native version: 0.48.0</p> <p>Currently, I am just ignoring Animated in <code>.flowconfig</code> :(</p> <pre><code>; Ignore Animated .*/react-native/Libraries/Animated/**/.* </code></pre> <p><a href="https://i.stack.imgur.com/iIXD3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iIXD3.png" alt="enter image description here"></a></p>
0debug
Can someone explain why is the total = 7 in the following code? with static int sum? : <p>Can someone explain why is the total = 7 in the following code? with static int sum? </p> <pre><code> #include &lt;stdio.h&gt; int i, j; int madness(int x); int main(void) { int i, total = 0; j = 1; for (i = 0; i&lt;3; i++) { total += madness(i); } printf("Total = %d\n", total); return 0; } int madness(int x) { static int i; static int sum = 0; for (i = 0; i&lt;x; i++, j++) { sum += j; } return sum; } </code></pre>
0debug
static void vnc_connect(VncDisplay *vd, int csock) { VncState *vs = qemu_mallocz(sizeof(VncState)); vs->csock = csock; VNC_DEBUG("New client on socket %d\n", csock); dcl->idle = 0; socket_set_nonblock(vs->csock); qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs); vs->vd = vd; vs->ds = vd->ds; vs->timer = qemu_new_timer(rt_clock, vnc_update_client, vs); vs->last_x = -1; vs->last_y = -1; vs->as.freq = 44100; vs->as.nchannels = 2; vs->as.fmt = AUD_FMT_S16; vs->as.endianness = 0; vnc_resize(vs); vnc_write(vs, "RFB 003.008\n", 12); vnc_flush(vs); vnc_read_when(vs, protocol_version, 12); memset(vs->old_data, 0, ds_get_linesize(vs->ds) * ds_get_height(vs->ds)); memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row)); vnc_update_client(vs); reset_keys(vs); vs->next = vd->clients; vd->clients = vs; }
1threat
How to disable selection of cells in ag-grid? : <p>I have a simple ag-grid in an Angular project and want to disable selection of cells in one of its columns. Simply removing the default blue outline during selection would also be fine. I just want no visual change to the cell when the user clicks inside it. How can I do this?</p> <p>I see that <code>ColDef</code> has a property <code>suppressNavigable</code> that sort of helps, since it disallows using the tab key to select the cells, but it still allows selection by clicking. Also, the grid itself seems to offer <code>suppressCellSelection</code> but it doesn't seem granular enough and doesn't seem to affect anything anyway. </p> <p>So, how can I remove this blue border cell selection?</p> <p>Here's the code I have for these column definitions:</p> <pre><code>this.columnDefs = [ { headerName: 'One', field: 'one' }, { headerName: 'Two', field: 'two' }, { // I want to disable selection of cells in this column headerName: 'I want no cell selection!', field: 'three', suppressNavigable: true, editable: false, } ]; </code></pre> <p>Here's an example stackblitz I was using to test with: <a href="https://stackblitz.com/edit/aggrid-want-to-disable-cell-selection" rel="noreferrer">https://stackblitz.com/edit/aggrid-want-to-disable-cell-selection</a></p> <p>Here's a screenshot of the blue border I don't want to see in this column: <a href="https://i.stack.imgur.com/G9RQK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/G9RQK.png" alt="I don&#39;t want to see the blue border"></a></p>
0debug
Where can I upload a JSON file and get JSONP support? : <p>I'm looking for a server where I can upload a JSON file and use it via JSONP afterwards. I'd usually use my work server for this type of stuff, but it doesn't support JSONP unfortunately. </p>
0debug
Get value from service.yml : <p>I would like to create constants value for all my application.</p> <p>In order to do that, the documentation seems to do something like that, in app/config/services.yml</p> <pre><code>parameters: #parameter_name: value CODE_OK: !php/const 200 CODE_CREATED: !php/const 201 CODE_MISSING_ARG : !php/const 400 CODE_INVALID_ARG : !php/const 419 </code></pre> <p>Now I would like to be able to use those values inside a Controller...but I can't find the good way.May be using the service.yml isn't the right way.</p>
0debug
How to use selector attribute for span hover : I have the following unique attribute assigned to a class: .subcategory1:hover span { background: url(entertainment-hover.png); } I have many such subcategory classes and I want to assign them additionally general attributes for `:hover span` and I came up with the following: [class*="subcategory"]:hover span { background-size: 20px; background-repeat: no-repeat; background-position: 0px 2px; But it doesnt work and I cant find the problem! Does anyone know what I have to amend to make this work assinging these attributes to all subcategory classes on :hover for span? Many thanks David
0debug
C++ difference between : , :: operators : <p>I new to programming. In stack overflow i couldn't see difference between <code>:</code> &amp; <code>::</code> is mentioned. Could anyone can explain in detail it helps to beginner learners like me. Thank you. </p>
0debug
File restrictions in android Nugget : I am getting image from gallery / capture with camera. then i want to resize the image if needed and save it to the same location. To do so i use the following code: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> File file = new File(photoLocation); file.setWritable(true); try { if(ContextCompat.checkSelfPermission(getApplicationContext(),Manifest.permission.WRITE_EXTERNAL_STORAGE)==PackageManager.PERMISSION_GRANTED) { FileOutputStream fileOutputStream = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 50, fileOutputStream); fileOutputStream.flush(); fileOutputStream.close(); }else{ requestPermissions(new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE},1); } <!-- end snippet --> Sadly i get FileNotFound error (permmission denaied), I tried the same code on Android 4 device and it works ok so I assume its because of the file access restrictions in android 7. How can I write to file now?
0debug
Understanding Spring Cloud Release Versions : <p>Spring folks do a great job of releasing lots of quality projects. One of them we have been using is Spring Cloud and its various sub-projects.</p> <p>One aspect that is really confusing to me is Spring Cloud version names. For ex., if you goto <a href="http://projects.spring.io/spring-cloud/" rel="noreferrer">Spring Cloud</a> it reads <code>Camden</code> or <code>Angel</code> or <code>Brixton</code>. Then if you goto specific project site, for ex., <a href="https://cloud.spring.io/spring-cloud-config/" rel="noreferrer">Spring Cloud Config</a> it shows versions like <code>1.3.0</code> or <code>1.2.3</code> </p> <p>Two questions about these.</p> <ol> <li><p>From named versions (camden, brixton, angel) it is hard to visualize which is the latest and its sequence. Is there a place it is well documented?</p></li> <li><p>How are named releases related to sub-projects numbered releases?</p></li> </ol> <p>Thank you for your time.</p>
0debug
csharp string comparision error : I am trying to check if value exists in a string array. The below one works but when I tried the next code block,it failed. bool exixts; string toCheck= "jupiter"; string[] printer = {"jupiter", "neptune", "pangea", "mercury", "sonic"}; if(printer.Contains(toCheck)) { exists = true; } How can I check for trim and casesensitivity I tried this bool exixts; string toCheck= "jupiter "; string[] printer = {"jupiter", "neptune", "pangea", "mercury", "sonic"}; if(printer.Contains(toCheck.Trim(),StringComparison.InvariantCultureIgnoreCase))) { exists = true; }
0debug
static void virtio_pci_device_unplugged(DeviceState *d) { PCIDevice *pci_dev = PCI_DEVICE(d); VirtIOPCIProxy *proxy = VIRTIO_PCI(d); virtio_pci_stop_ioeventfd(proxy); msix_uninit_exclusive_bar(pci_dev); }
1threat
Excel VBA Array Iteration - If Specific, do an If function : MyArray = Array("Jap", "Mcdonalds", "Chinese", "Pasta") I am trying to do an IF function IF MyArray is on array 'Chinese' however when I do If MyArray("Jap") Then .... it comes up with an error. How would I go about doing this?
0debug
Typescript: How to map over union array type? : <p>I have the following structure:</p> <pre><code>interface Test1 { number: number; } interface Test2 extends Test1 { text: string; } let test: Test1[] | Test2[] = []; test.map(obj =&gt; {}); // does not work </code></pre> <p>I am getting the error:</p> <blockquote> <p>Cannot invoke an expression whose type lacks a call signature. Type '{ (this: [Test1, Test1, Test1, Test1, Test1], callbackfn: (this: void, value: Test1, index: nu...' has no compatible call signatures</p> </blockquote> <p>How can I <code>map</code> over the test variable?</p>
0debug
sql query for reforing another column in same table : [this is my table][1] This is my table Now i need to right query to return name as "student name" and teacher_id as teacher name by referring in the same table. like below.. [I need result like this][2] [1]: https://i.stack.imgur.com/j6Z1N.png [2]: https://i.stack.imgur.com/eHZdn.png
0debug
mysql process 10M records table : recently I am using mySQL to process some tables with over 40M records. The detail scenario is as follows: Given two tables with same structure containing over 40M price info Table 1 product_id price date 101 5.7 2016/1/1 102 11.6 2016/1/1 104 8 2016/1/1 … … … Table 2 product_id price date 101 5.9 2016/1/2 103 20.3 2016/1/2 104 8 2016/1/2 … … … my goal is to find out how many product_id exist on both days, and I use the below query to search: SELECT count(*) FROM t1 a,t2 b where a.product_id=b.product_id ; SELECT count(*) FROM t1 a,t2 b on a.product_id=b.product_id ; It takes over half an hour to get the result, is there any way to improve the performance?
0debug
Jenkins - How to get and use upstream info in downstream : <p>Executing upstream job called "A". On success of A executing test cases which is downstream project "B". But while sending mail from B we have to incorporate upstream project details (upstream project name, build no) in mail. So we can easily map / corelate the test run with respective upstream job. </p> <p>In downstream project dashboard below details are displaying.</p> <pre><code>Started by upstream project Dev_RM_3.0_CI_Test build number 10 originally caused by: </code></pre> <p>I checked in <a href="https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project" rel="noreferrer">https://wiki.jenkins-ci.org/display/JENKINS/Building+a+software+project</a>. but couldnt find anything to inherit in downstream.</p> <p>Created sample job with below details to display the current job details.</p> <pre><code>echo $BUILD_NUMBER echo $JOB_NAME echo $BUILD_ID </code></pre> <p>But the output is</p> <pre><code>Building on master in workspace /var/lib/jenkins/workspace/env [env] $ /bin/sh -xe /tmp/hudson970280339057643719.sh + echo 1 1 + echo env env + echo 1 1 Finished: SUCCESS </code></pre> <ol> <li>Any help to inherit upstream details in downstream job?</li> <li>How to get current job details?</li> </ol>
0debug
static int virtio_ccw_set_vqs(SubchDev *sch, uint64_t addr, uint32_t align, uint16_t index, uint16_t num) { VirtIODevice *vdev = virtio_ccw_get_vdev(sch); if (index > VIRTIO_PCI_QUEUE_MAX) { return -EINVAL; } if (addr && (align != 4096)) { return -EINVAL; } if (!vdev) { return -EINVAL; } virtio_queue_set_addr(vdev, index, addr); if (!addr) { virtio_queue_set_vector(vdev, index, 0); } else { if (virtio_queue_get_num(vdev, index) > num) { return -EINVAL; } virtio_queue_set_vector(vdev, index, index); } vdev->config_vector = VIRTIO_PCI_QUEUE_MAX; return 0; }
1threat
Lunch android secret code via B4A App : How can i lunch *#*#xxxx#*#* code with B4A. Here is my code.. Dim st,stt As String Dim su As StringUtils Dim ph As Intent st = "#" stt = su.EncodeUrl(st,"UTF8") Dim ussd As String = "*"&stt&"3646633"&stt&"*"stt&"*" ph.Initialize(ph.ACTION_CALL,"tel:"&ussd) StartActivity(ph) After lunch app, it showed dialer only. I want to lunch engineering mode directly.
0debug
Ruby: No of times an element is repeated in an array : I know there are a lot more methods to solve this but I'm just curious to solve it using this way. Here is my code: a = [5,2,4,1,2] b=[] for i in a unless b.include?a[i] b << a[i] print i," appears ",a.count(i)," times\n" end end print b **NOTE: I added `print b` just to know find where I'm going wrong**.Here is the output I'm getting: ` 5 appears 1 times 2 appears 2 times 4 appears 1 times [nil, 4, 2]`
0debug
How can I customize the color of a Checkbox in material-ui : <p>I am using <a href="http://www.material-ui.com/" rel="noreferrer">material-ui</a> in my project, and I have a Checkbox within a div with a black background. But it doesn't look good because the Checkbox is black too. How can I change the color of the Checkbox from black to another color?</p>
0debug
static int vga_osi_call (CPUState *env) { static int vga_vbl_enabled; int linesize; #if 0 printf("osi_call R5=%016" PRIx64 "\n", ppc_dump_gpr(env, 5)); #endif switch(env->gpr[5]) { case 4: break; case 28: if (env->gpr[6] != 1 || env->gpr[7] != 0) env->gpr[3] = 1; else env->gpr[3] = 0; break; case 29: if (env->gpr[6] != 0) { if (env->gpr[6] != 1 || env->gpr[7] != 0) { env->gpr[3] = 1; break; } } env->gpr[3] = 0; env->gpr[4] = (1 << 16) | 1; env->gpr[5] = (1 << 16) | 0; env->gpr[6] = (graphic_width << 16) | graphic_height; env->gpr[7] = 85 << 16; env->gpr[8] = (graphic_depth + 7) & ~7; linesize = ((graphic_depth + 7) >> 3) * graphic_width; linesize = (linesize + 3) & ~3; env->gpr[9] = (linesize << 16) | 0; break; case 31: env->gpr[3] = 0; break; case 39: if (env->gpr[6] == 0 || env->gpr[6] == 1) vga_vbl_enabled = env->gpr[6]; env->gpr[3] = 0; break; case 47: break; case 59: env->gpr[3] = 0; break; case 64: env->gpr[3] = 0; break; case 116: break; default: fprintf(stderr, "unsupported OSI call R5=%016" PRIx64 "\n", ppc_dump_gpr(env, 5)); break; } return 1; }
1threat
How to watch the slice of array value in VS while debugging? : I want to debug multi dimension array like intel fortran in VS. In Intel Fortran( integrated in VS), assume arr is a 2 dimension array, and I can use "arr(2:5,3:8)" to see the slice of the array. [Debugging Intel Fortran in VS][1] in vs2010, Intel Fortran has already can do this. How can i achieve the same goal if i write a self define class (like CMultiDimensionArray) in c++ Thank you! [1]: http://i.stack.imgur.com/w1dG3.png
0debug
int init_vlc(VLC *vlc, int nb_bits, int nb_codes, const void *bits, int bits_wrap, int bits_size, const void *codes, int codes_wrap, int codes_size) { vlc->bits = nb_bits; vlc->table = NULL; vlc->table_allocated = 0; vlc->table_size = 0; #ifdef DEBUG_VLC printf("build table nb_codes=%d\n", nb_codes); #endif if (build_table(vlc, nb_bits, nb_codes, bits, bits_wrap, bits_size, codes, codes_wrap, codes_size, 0, 0) < 0) { av_free(vlc->table); return -1; } return 0; }
1threat
Place Backslash Between Words In String [Python] : I Want to convert com to newcom com = 'R.E.M. - Losing My Religion.mp3' newcom = 'R.E.M.\ -\ Losing\ My\ Religion.mp3' I am doing this because ubuntu terminal needs backslashes to specify spaces in paths. This is just a string manipulation , i just don't know what to do here , a piece of help would be appreciated! thanks
0debug
Please add a @Pipe/@Directive/@Component annotation. Error : <p>I am stuck in a situation here. I am getting an error like this. </p> <pre><code> compiler.es5.js:1694 Uncaught Error: Unexpected value 'LoginComponent' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation. at syntaxError (compiler.es5.js:1694) at compiler.es5.js:15595 at Array.forEach (&lt;anonymous&gt;) at CompileMetadataResolver.webpackJsonp.../../../compiler/@angular/compiler.es5.js.CompileMetadataResolver.getNgModuleMetadata (compiler.es5.js:15577) at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._loadModules (compiler.es5.js:26965) at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler._compileModuleAndComponents (compiler.es5.js:26938) at JitCompiler.webpackJsonp.../../../compiler/@angular/compiler.es5.js.JitCompiler.compileModuleAsync (compiler.es5.js:26867) at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_._bootstrapModuleWithZone (core.es5.js:4536) at PlatformRef_.webpackJsonp.../../../core/@angular/core.es5.js.PlatformRef_.bootstrapModule (core.es5.js:4522) at Object.../../../../../src/main.ts (main.ts:11) </code></pre> <p>My Login Component Looks like this</p> <pre><code>import { Component } from '@angular/Core'; @Component({ selector:'login-component', templateUrl:'./login.component.html' }) export class LoginComponent{} </code></pre> <p>app.module.ts</p> <pre><code>import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { CommonModule } from '@angular/common' import { HttpModule } from '@angular/http'; import { ReactiveFormsModule} from '@angular/forms'; import { RouterModule, Routes } from '@angular/router'; import { AppComponent } from './main/app.component'; import {LoginComponent} from './login/login.component'; const appRoutes: Routes = [ {path:'', redirectTo:'login', pathMatch:'full'}, { path: 'home', component: AppComponent }, { path: 'login', component: LoginComponent } ]; @NgModule({ imports: [ BrowserModule, RouterModule.forRoot(appRoutes), ], declarations: [ AppComponent, LoginComponent ], providers: [], bootstrap: [AppComponent] }) export class AppModule { } </code></pre> <p>I got this error when I try to import LoginComponent into declaration. Am I missing something here. </p>
0debug
write the code higher order function instead of usual loops/iterators : <p>Can anyone tell me how to write this below code using higher order functions.</p> <pre><code>var x = 10 while (x &lt; =10) { if (x &lt;= 5) print(x) x = x+1 } </code></pre>
0debug
how to remove page name url on wordpress : How to remove page name url in wordpress on frist page in picture red line. [enter image description here][1] [1]: https://i.stack.imgur.com/sxYMi.png Thanks you For you advice.
0debug
how to transfer some selected row from one dataset to another in c# : I have two dataset DataSet dsvoucherget = new DataSet(); dsvoucherget = queries.getDetails(sqlVoucherget); and DataSet dsbalamount = new DataSet(); what i want to do is dsbalamount.Tables.Add(dsvoucherget.Tables[0].Select("RegnNo=EM01224").CopyToDataTable()); buit not able to do so please help
0debug
Azure AD vs Azure AD B2C vs Azure AD B2B : <p>Before Azure AD B2C and Azure AD B2B come into the picture, usualy I added my applications to Azure AD of our tenancy and office 365 users could access the applications using their account (SSO).</p> <p>I am not a guru so I need to see code and read about exact examples to understand the concepts. </p> <p>Can I use B2C for SSO as I usually used Azure AD? otherwise how/when can I use B2C and B2B?</p> <p>Thanks and appreciate all kind of advice.</p>
0debug
splitting a list of integers into sublists given 0 as separator - python : I have this list of integer l = [6, 6, 0, 5, 4, 5, 0, 0, 4, 6] and I would have to generate this list res = [[6, 6], [5, 4, 5] , [4, 6]] Thank you in advance!
0debug
Why are class stored properties not supported in classes? : <p>Basically, Swift does not allow me to do this -</p> <p>//class stored properties not supported in classes did you mean 'static'. </p> <pre><code>class var hello = "hello" </code></pre> <p>However this is fine - </p> <pre><code>static var hi = "hi" </code></pre> <p>I know that the difference between Class and Static in Swift is that Class variables cannot store stored properties, while Static variables can. However, the fundamental difference between Class and Static variables is that static variables cannot be overridden in subclasses, while class variables can. This is a functionality that I wish to keep.</p> <p>I know that a simple fix to this issue is to make this a computed property using a hacky fix like this - </p> <pre><code>class var Greeting : String { return "Greeting" } </code></pre> <p>This does solve the problem, and I hope it helps some people online as well. However, I would like to know if anyone knows why Swift behaves this way, and does not allow for stored properties in class level variables.</p>
0debug
static int mov_read_stsc(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; MOVStreamContext *sc = (MOVStreamContext *)st->priv_data; int entries, i; print_atom("stsc", atom); get_byte(pb); get_byte(pb); get_byte(pb); get_byte(pb); entries = get_be32(pb); #ifdef DEBUG av_log(NULL, AV_LOG_DEBUG, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries); #endif sc->sample_to_chunk_sz = entries; sc->sample_to_chunk = (MOV_sample_to_chunk_tbl*) av_malloc(entries * sizeof(MOV_sample_to_chunk_tbl)); if (!sc->sample_to_chunk) return -1; for(i=0; i<entries; i++) { sc->sample_to_chunk[i].first = get_be32(pb); sc->sample_to_chunk[i].count = get_be32(pb); sc->sample_to_chunk[i].id = get_be32(pb); #ifdef DEBUG #endif } return 0; }
1threat
Excel: Move a row to another worksheet based on a cell content : I'm very new to VGA and I'm trying to write something that would COPY an entire row if a cell has a "Yes" in it. the source is on a worksheet called "Master List" the target worksheet is called "CE Class" If Column F has a "yes" then copy the row from "Master List" and put it on "CE Class" starting on row 4. Can someone help me?
0debug
sql db2 how to string match between two columns : Hi if I have two columns such as: col1 col2 ---- ---- 5qt exception for 5qt ammended 5qt exception for 5076 ammended 6d3 6d3 registered I want to string match so that if the value of `col1` exists in `col2`, return col2. So I get: exception for 5qt ammended 6d3 registered I have tried using `locate()` but not with much luck: select col2 from mytable where locate(col1,col2) = 1 I have previously had this working where `col2` began with the value of `col1` i.e. col1 col2 ---- ---- 5qt 5qt ammended 5qt 5076 ammended 6d3 6d3 registered but it seems the fact the value of `col1` can appear in any position of `col2` is throwing `locate()` off the trail. any advice would be grateful.
0debug
.JSON: Converting circles into polygons : I've a .json file which has annotations (in terms of circles and polygons) of objects I want to train my neural network with. The problem is however the traning code only accepts polygons from the .json file, thus giving an error since mine has circles. Does anyone know how to convert circles into polygons? I've already tried some solutions (like below) which did not work: import json from pprint import pprint with open('via_region_data(val).json') as f: data = json.load(f) for attr, val in data.items(): for attr2, val2 in val.items(): if attr2 == 'regions': for attr3, val3 in val2.items(): if val3['shape_attributes']['name'] == 'circle': cx = val3['shape_attributes']['cx'] cy = val3['shape_attributes']['cy'] r = val3['shape_attributes']['r'] all_points_x = [cx, cx - 1.5 * r, cx, cx + 1.5 * r, cx] all_points_y = [cy - 1.5 * r, cy, cy + 1.5 * r, cy, cy - 1.5 * r] val3['shape_attributes']['cx'] = all_points_x val3['shape_attributes']['cy'] = all_points_y val3['shape_attributes']['all_points_x'] = val3['shape_attributes'].pop('cx') val3['shape_attributes']['all_points_y'] = val3['shape_attributes'].pop('cy') val3['shape_attributes']['name'] = 'polygon' pprint(data) with open('via_region_data-val.json', 'w') as f: json.dump(data, f) throwing: Traceback (most recent call last): File "polygon_fixer.py", line 10, in <module> for attr3, val3 in val2.items(): AttributeError: 'list' object has no attribute 'items' Any thoughts?
0debug
struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta, qemu_irq irq, qemu_irq *drq, omap_clk fclk, omap_clk iclk) { int iomemtype; struct omap_eac_s *s = (struct omap_eac_s *) qemu_mallocz(sizeof(struct omap_eac_s)); s->irq = irq; s->codec.rxdrq = *drq ++; s->codec.txdrq = *drq; omap_eac_reset(s); #ifdef HAS_AUDIO AUD_register_card("OMAP EAC", &s->codec.card); iomemtype = cpu_register_io_memory(omap_eac_readfn, omap_eac_writefn, s); omap_l4_attach(ta, 0, iomemtype); #endif return s; }
1threat
What happend when we override union fields in C? : I am reading the implementation of Thompson algorithm for matching regular expression in C. [link][1]. I saw this snippet of code ```C /* * Since the out pointers in the list are always * uninitialized, we use the pointers themselves * as storage for the Ptrlists. */ union Ptrlist { Ptrlist *next; State *s; }; /* Create singleton list containing just outp. */ Ptrlist* list1(State **outp) { Ptrlist *l; l = (Ptrlist*)outp; l->next = NULL; return l; } ``` But as I understand, in `union` type, all fields share the same memory. So why can we set `l->next=NULL` after casting `l=(Ptrlist*)outp;` because by doing that, we that that memory location to `NULL` and `l` will become `NULL`? [1]: https://swtch.com/~rsc/regexp/nfa.c.txt
0debug
static void vnc_colordepth(DisplayState *ds) { int host_big_endian_flag; struct VncState *vs = ds->opaque; #ifdef WORDS_BIGENDIAN host_big_endian_flag = 1; #else host_big_endian_flag = 0; #endif switch (ds_get_bits_per_pixel(ds)) { case 8: vs->depth = 1; vs->server_red_max = 7; vs->server_green_max = 7; vs->server_blue_max = 3; vs->server_red_shift = 5; vs->server_green_shift = 2; vs->server_blue_shift = 0; break; case 16: vs->depth = 2; vs->server_red_max = 31; vs->server_green_max = 63; vs->server_blue_max = 31; vs->server_red_shift = 11; vs->server_green_shift = 5; vs->server_blue_shift = 0; break; case 32: vs->depth = 4; vs->server_red_max = 255; vs->server_green_max = 255; vs->server_blue_max = 255; vs->server_red_shift = 16; vs->server_green_shift = 8; vs->server_blue_shift = 0; break; default: return; } if (vs->csock != -1 && vs->has_WMVi) { vnc_write_u8(vs, 0); vnc_write_u8(vs, 0); vnc_write_u16(vs, 1); vnc_framebuffer_update(vs, 0, 0, ds_get_width(ds), ds_get_height(ds), 0x574D5669); pixel_format_message(vs); vnc_flush(vs); } else { if (vs->pix_bpp == 4 && vs->depth == 4 && host_big_endian_flag == vs->pix_big_endian && vs->client_red_max == 0xff && vs->client_green_max == 0xff && vs->client_blue_max == 0xff && vs->client_red_shift == 16 && vs->client_green_shift == 8 && vs->client_blue_shift == 0) { vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_32; } else if (vs->pix_bpp == 2 && vs->depth == 2 && host_big_endian_flag == vs->pix_big_endian && vs->client_red_max == 31 && vs->client_green_max == 63 && vs->client_blue_max == 31 && vs->client_red_shift == 11 && vs->client_green_shift == 5 && vs->client_blue_shift == 0) { vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_16; } else if (vs->pix_bpp == 1 && vs->depth == 1 && host_big_endian_flag == vs->pix_big_endian && vs->client_red_max == 7 && vs->client_green_max == 7 && vs->client_blue_max == 3 && vs->client_red_shift == 5 && vs->client_green_shift == 2 && vs->client_blue_shift == 0) { vs->write_pixels = vnc_write_pixels_copy; vs->send_hextile_tile = send_hextile_tile_8; } else { if (vs->depth == 4) { vs->send_hextile_tile = send_hextile_tile_generic_32; } else if (vs->depth == 2) { vs->send_hextile_tile = send_hextile_tile_generic_16; } else { vs->send_hextile_tile = send_hextile_tile_generic_8; } vs->write_pixels = vnc_write_pixels_generic; } } }
1threat
What happens to variabe x in this for loop in C? : In this code below, int main(){ int i; for(i = 0;i<4;i++){ int x = 1; x++; } // for close }// main close Here the variable 'x' is "auto" storage class,right..... So,will the variable 'x' gets created, I mean memory allocation happens when the statement is encountered and gets destroyed when it reaches the end of the loop and gets created/memory is allocated again for 'x'. I tried to print the address of 'x' in the loop and it prints the same address for 'x' every time.So,does it mean every time x is created and destroyed and it is using the same room/memory block for it ?!?!?! If it is creating and destroying like that,doesn't it effect CPU ?!?!? If so,Is there anyway to prevent it and maintain good memory health ? yeah,I'm so concerned about memory allocation and thinks it this way.don't laugh ;) Correct me if I'm wrong guys. Thanks in advance.
0debug
Calculating the average of user inputs in c (intro to programming) : disclaimer: I'm new to programming I'm working on this problem [enter image description here][1] [1]: https://i.stack.imgur.com/V5DNU.png so far ive written this which takes user inputs and calculates an average based on them https://repl.it/LsAl/0 but i cant figure out how to make the end of the data entry -1 so if possible can someone explain or give me an idea as to how to do it Thank you!
0debug
How to append a char var[] to a char ? C : <pre><code>char hi[10] = "bye"; char a = 'a'; strcat(hi, a); </code></pre> <p>Like the example above. How would I do this in C? Is there a more general string I cant let hi be?</p>
0debug
static void moxie_cpu_initfn(Object *obj) { CPUState *cs = CPU(obj); MoxieCPU *cpu = MOXIE_CPU(obj); static int inited; cs->env_ptr = &cpu->env; cpu_exec_init(cs, &error_abort); if (tcg_enabled() && !inited) { inited = 1; moxie_translate_init(); } }
1threat
Get docker-compose.yml file location from running container? : <p>I have a few running docker containers created by executing <code>docker-compose up</code>.</p> <p>Is there any way to get the exact file path of the corresponding <em>docker-compose.yml</em> file used to start these containers, just by inspecting the running containers?</p> <p>As far as I can see, <code>docker inspect CONTAINER_NAME</code> does not provide this information, nor does <em>docker-compose</em> provide a method to get compose-related information from a running container.</p> <p>What I'd like to do in a script:</p> <ul> <li>list certain running containers on a docker host</li> <li>get the corresponding <em>docker-compose.yml</em> file locations</li> <li>use <em>docker-compose</em> to restart all containers of the corresponding docker-compose projects at once</li> </ul>
0debug
Notepad++ copy text \folder1\folder2\ and append to end of line : I have a batch script in which I am trying to append 2 of the folder names on each line to the end of the line with a " as Folder2 sometimes has spaces. Folder1 is a date and Folder2 is a name. explexe "D:\I Drive\XY0\01022008\FIRST_LAST\0000\1.3.12.2.1107.5.1.4" "D:\I Drive\dump explexe "D:\I Drive\XY0\01162008\FIRST,_LAST\0000\1.2.392.200036.912.2196110" "D:\I Drive\dump explexe "D:\I Drive\XY0\04092008\FIRST_LAST___\0000\1.2.840.113680.5.1199306167.113468" "D:\I Drive\dump I need it to look like this. explexe "D:\I Drive\XY0\01022008\FIRST_LAST\0000\1.3.12.2.1107.5.1.4" "D:\I Drive\dump\01022008\FIRST_LAST\" explexe "D:\I Drive\XY0\01162008\FIRST,_LAST\0000\1.2.392.200036.912.2196110" "D:\I Drive\dump\01162008\FIRST,_LAST\" explexe "D:\I Drive\XY0\04092008\FIRST_LAST___\0000\1.2.840.113680.5.1199306167.113468" "D:\I Drive\dump\04092008\FIRST_LAST___\" Any help would be greatly appreciated!
0debug
static int init_image(TiffContext *s, ThreadFrame *frame) { int ret; switch (s->planar * 1000 + s->bpp * 10 + s->bppcount) { case 11: if (!s->palette_is_set) { s->avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; break; } case 21: case 41: case 81: s->avctx->pix_fmt = s->palette_is_set ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8; break; case 243: if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) { if (s->subsampling[0] == 1 && s->subsampling[1] == 1) { s->avctx->pix_fmt = AV_PIX_FMT_YUV444P; } else if (s->subsampling[0] == 2 && s->subsampling[1] == 1) { s->avctx->pix_fmt = AV_PIX_FMT_YUV422P; } else if (s->subsampling[0] == 4 && s->subsampling[1] == 1) { s->avctx->pix_fmt = AV_PIX_FMT_YUV411P; } else if (s->subsampling[0] == 1 && s->subsampling[1] == 2) { s->avctx->pix_fmt = AV_PIX_FMT_YUV440P; } else if (s->subsampling[0] == 2 && s->subsampling[1] == 2) { s->avctx->pix_fmt = AV_PIX_FMT_YUV420P; } else if (s->subsampling[0] == 4 && s->subsampling[1] == 4) { s->avctx->pix_fmt = AV_PIX_FMT_YUV410P; } else { av_log(s->avctx, AV_LOG_ERROR, "Unsupported YCbCr subsampling\n"); return AVERROR_PATCHWELCOME; } } else s->avctx->pix_fmt = AV_PIX_FMT_RGB24; break; case 161: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GRAY16LE : AV_PIX_FMT_GRAY16BE; break; case 162: s->avctx->pix_fmt = AV_PIX_FMT_YA8; break; case 322: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_YA16LE : AV_PIX_FMT_YA16BE; break; case 324: s->avctx->pix_fmt = AV_PIX_FMT_RGBA; break; case 483: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGB48LE : AV_PIX_FMT_RGB48BE; break; case 644: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGBA64LE : AV_PIX_FMT_RGBA64BE; break; case 1243: s->avctx->pix_fmt = AV_PIX_FMT_GBRP; break; case 1324: s->avctx->pix_fmt = AV_PIX_FMT_GBRAP; break; case 1483: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRP16LE : AV_PIX_FMT_GBRP16BE; break; case 1644: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRAP16LE : AV_PIX_FMT_GBRAP16BE; break; default: av_log(s->avctx, AV_LOG_ERROR, "This format is not supported (bpp=%d, bppcount=%d)\n", s->bpp, s->bppcount); return AVERROR_INVALIDDATA; } if (s->photometric == TIFF_PHOTOMETRIC_YCBCR) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); if((desc->flags & AV_PIX_FMT_FLAG_RGB) || desc->nb_components < 3) { av_log(s->avctx, AV_LOG_ERROR, "Unsupported YCbCr variant\n"); return AVERROR_INVALIDDATA; } } if (s->width != s->avctx->width || s->height != s->avctx->height) { ret = ff_set_dimensions(s->avctx, s->width, s->height); if (ret < 0) return ret; } if ((ret = ff_thread_get_buffer(s->avctx, frame, 0)) < 0) return ret; if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) { memcpy(frame->f->data[1], s->palette, sizeof(s->palette)); } return 0; }
1threat
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
Combining multidimensional Arrays of same length : Hello guys i have this array that i want it reformated to produce another array without the <code>array_keys</code> in it. Here is the original array and the desired array. <b>The original Array</b> <code> Array ( [0] => Array ( [id] => 75 [date] => 2017-05-18 [time] => 11:15:00 [dist_id] => ss0001 [order_no] => SS17137111520 [paid_amount] => 0 [balance] => 0 [status] => peding ) [1] => Array ( [id] => 76 [date] => 2017-05-18 [time] => 16:34:00 [dist_id] => ss0001 [order_no] => SS17137043422 [paid_amount] => 0 [balance] => 0 [status] => peding ) ) </code> <b>The Expected Array</b> <code> Array ( [0] => Array ( [0] => 75 [1] => 2017-05-18 [2] => 11:15:00 [3] => ss0001 [4] => SS17137111520 [5] => 0 [6] => 0 [7] => peding ) [1] => Array ( [1] => 76 [2] => 2017-05-18 [3] => 16:34:00 [4] => ss0001 [5] => SS17137043422 [6] => 0 [7] => 0 [8] => peding ) ) </code> Please assist me on this ASAP. Thank you
0debug
Error:1046 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax : I am newbie to php and sql. I was creating a website for myself and needed some help with Mysql. When I run the following query,I get the error 1046. I googled for solution and tried some solutions but failed to solve the issue. Please help me with this. CREATE TABLE BKMUV (MVNM VARCHAR2(30), LIKES VARCHAR2(30), THETR VARCHAR2(30), CITY VARCHAR2(30); CREATE TABLE CUMV (CMV VARCHAR2(30), UMV VARCHAR2(30); CREATE TABLE SEAT (DATE1 VARCHAR2(30), BOOKED VARCHAR2(30), USERNAME VARCHAR2(30), MVNM VARCHAR2(30), CITY VARCHAR2(30), CLASS VARCHAR2(30); INSERT INTO BKMUV VALUES((yeh jawani hai diwani,90,ANSAL,Greater Noida),(fukrey,50,spice, Noida),(Raanjhna,80,INNOX,Delhi)); INSERT INTO CUMV VALUES((images/fukrey.jpg,images/ce.jpg),(images/ranj.jpg,images/dhoom.jpg),(images/yjhd.jpg,images/gc.jpg),(images/gc.jpg,images/bmb.jpg));
0debug
how to select Details of every student's latest purchase in sql server just with 1 query? : I have 2 table like this picture: [![pic][1]][1] I want find Details of every student's latest purchase in SQL server just with 1 query. How can I do? [![enter image description here][2]][2] I have no idea. [1]: https://i.stack.imgur.com/YTk68.png [2]: https://i.stack.imgur.com/ZJCYH.png
0debug
def find_Divisor(x,y): if (x==y): return y return 2
0debug
Need Help in understanding AWK script logic : <p>I need help in understanding the below code logic written in AWK by one of our collegues in the past. Can anyone with good AWK knowledge help me to understand this code.</p> <p>Thanks, Sandeep</p> <pre><code>sed -i 's/\r//g' $1 $2 sed -i 's/,/;/g' $1 $2 awk -F"|" '{if(FILENAME=="Parameter.txt"){a[$1]=NR;aa[NR]=$1;d=NR;if(NR==1){e=$1}else{e=e","$1};} else if(FILENAME=="Traffic.csv"){h[FNR","$2]=$3;x[FNR","$4]=$5;k[FNR","$2","$3","$4","$5]=$1;y=FNR;} else if(FILENAME=="Filter.txt"){for(i=1;i&lt;=NF;i=i+3){if($(i+1)!="ne"){FE[FNR","$i]=$(i+2)}else{FNE[FNR","$i]=$(i+2)}};FILTER=FNR;FC[FNR]=(NF/3);} else{ if(g==""){print e",TRAFFIC_CASE";g=1}; for(i=1;i&lt;=d;i++){c[i]=""};l="";m="";z="";FINAL="";for(j=1;j&lt;=FILTER;j++){FI[j]=""}; for(i=1;i&lt;=NF;i++){ split($i,b,"="); if(a[b[1]]!=""){c[a[b[1]]]=b[2];}; for(j=1;j&lt;=y;j++){ if(h[j","a[b[1]]]==b[2] &amp;&amp; h[j","a[b[1]]]!=""){l=a[b[1]]","b[2]}; if(x[j","a[b[1]]]==b[2] &amp;&amp; x[j","a[b[1]]]!=""){z=a[b[1]]","b[2]}; if(k[j","l","z]!=""){m=k[j","l","z]};}; }; if(substr(FILENAME,20,3)=="SVC"){Q[c[a[MSISDN]]]=1} else if(Q[c[a[MSISDN]]]!=1){ for(i=1;i&lt;=d;i++){ if(i==1){f=c[1];}else{f=f","c[i]}; if(c[i]==""){c[i]="B"}; for(j=1;j&lt;=FILTER;j++){ if(FE[j","i]!=""){if(FE[j","i]==c[i] &amp;&amp; (FI[j]=="" || FI[j]&lt;=FC[j])){FI[j]=FI[j]+1;}else{FI[j]=FI[j]-1;}}; if(FNE[j","i]!=""){if(FNE[j","i]!=c[i] &amp;&amp; (FI[j]=="" || FI[j]&lt;=FC[j])){FI[j]=FI[j]+1;}else{FI[j]=FI[j]-1;}}; }; }; } for(j=1;j&lt;=FILTER;j++){if(FI[j]==FC[j]){FINAL=1};}; if(FINAL!=1){print f","m;}; }; }' Parameter.txt Traffic.csv Filter.txt $2 $1 </code></pre>
0debug
Enabling Hyper-V on Windows 10 adds new detected displays that do not physically exist : <p>I enabled Hyper-V on my HP Windows 10 Pro laptop today that has a 2nd monitor that is configured as extended display (the laptop is #1, the external monitor is #2). As soon as I restarted the computer, I noticed that my monitors were now duplicated (showing the same desktop on both monitors). </p> <p>When I went into the "Display Settings" screen, I noticed that there were several additional identified displays (3,4,5,6) that do not physically exist. I could no longer get back to my original display extended display configuration (#1 extended to #2), and could not get my physical monitors to be identified separately. </p> <p>The "Multiple Displays" dropdown just showed various options for duplicating the screen across combinations of the 6 identified displays. Trying to manipulate the configuration seem to cause problems, and the system seemed to freeze for a little while, and then revert to the first duplicated configuration.</p> <p>I tried just stopping the Hyper-v service, but that still didn't remove these "ghost" displays. </p> <p>The only way that I got back to a properly configurable display detection was to completed disable Hyper-V.</p> <p>So any ideas on what caused this? Are there any Hyper-V settings that can fix this?</p>
0debug
static void vfio_amd_xgbe_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); VFIOAmdXgbeDeviceClass *vcxc = VFIO_AMD_XGBE_DEVICE_CLASS(klass); vcxc->parent_realize = dc->realize; dc->realize = amd_xgbe_realize; dc->desc = "VFIO AMD XGBE"; dc->vmsd = &vfio_platform_amd_xgbe_vmstate; }
1threat
How to assign onclick to a variable in a canvas? : <p>I'm trying to make the circle I've made in canvas have an onclick event. I tried the following with no success. If anyone can offer some pointers, that would be great.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="type"&gt;&lt;/div&gt; &lt;canvas id="ctx2" width="500" height="500" style="border: solid 1px;"&gt;&lt;/canvas&gt; &lt;script&gt; var ctx = document.getElementById("ctx2").getContext("2d"); //var message = 'Hello John, this is your canvas.'; //ctx.fillStyle = 'red'; //ctx.font = '30px Arial'; //ctx.opacity = 0; //ctx.fillText(message,50,50); ctx.beginPath(); ctx.arc(100,75,50,0,2*Math.PI); ctx.stroke(); ctx.onclick = displayDate(); // This is what I used (stack overflow) function displayDate() { document.getElementById("type").innerHTML = Date(); } document.getElementById("type").innerHTML = typeof ctx &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
0debug
static av_cold int ffv1_encode_close(AVCodecContext *avctx) { av_frame_free(&avctx->coded_frame); ffv1_close(avctx); return 0; }
1threat
void ff_avg_h264_qpel16_mc02_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_vt_and_aver_dst_16x16_msa(src - (stride * 2), stride, dst, stride); }
1threat
PHP execution on networked Windows server : <p>I’m working on an internal application for a large entity, and I need to be able to do the following:</p> <p>From a web interface (hosted with Apache on Linux), constructed with PHP, connect to a Windows box that won’t have PHP installed, and move some files - live, triggered by Ajax.</p> <p>I have some flexibility, but I need it to be secure. A linked network drive is a possibility. Another possibility if I can’t directly move the files on the Windows machine, is to have some sort of watcher on a Windows machine that will respond to some trigger.</p> <p>SSH is not ideal, because I don’t want to install a server on the Windows machine. The files are not connected to a web server, so the installed IIS on the Windows server is not necessarily helpful.</p> <p>I think ideally, I’d do it over a network share - a linked directory on the remote machine, and either move the folders with PHP or if that won’t work, trigger a batch file or a Powershell script. However, I’m not sure what to watch out for in terms of permissions / security holes.</p> <p>Is there a ready made solution for this kind of thing? Failing that; are there any general guidelines that I should consider to do this effectively - libraries, extensions, etc?</p> <p>Thanks</p>
0debug
set adapter in fragment : <p>Getting this error: <a href="https://i.stack.imgur.com/HGf21.png" rel="nofollow"><img src="https://i.stack.imgur.com/HGf21.png" alt="enter image description here"></a> I am trying to show gridview in fragment but this error occurs while i am setting the adapter .</p> <p>My fragment is like this:</p> <pre><code>public class ExploreFragment extends Fragment { GridView gv; Context context; ArrayList prgmName; public static String [] prgmNameList={"Adventure","Animals","Automotive","Foods","Diy","Business","Technology","Creative Art","Entertainment"}; public static int [] prgmImages={R.drawable.adventure,R.drawable.animals,R.drawable.automobiles,R.drawable.food_and_drinks,R.drawable.diy,R.drawable.business,R.drawable.technology,R.drawable.creativity,R.drawable.entertainment}; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_explore,container,false); gv=(GridView) view.findViewById(R.id.fragment_explore_gridView1); gv.setAdapter(new CustomAdapter((MainActivity) getContext().getApplicationContext(),prgmNameList,prgmImages)); } </code></pre> <p>Please correct me here.</p>
0debug