problem
stringlengths
26
131k
labels
class label
2 classes
NullPointerException in GridWorld : <p>I know this type of question has been asked before, but in my case my code is different and I have no idea where this NullPointer is coming from.</p> <p>I am recreating Conway's Game of Life using GridWorld, and I am getting this NullPointerException. I have no clue where it is coming from because looking at the code, it should be working. The act method of this code runs every time GridWorld moves forward a "step". In the first step, the cells are removed and born fine. However, when the second iteration comes, there is a NullPointerException when I try to remove a cell from the grid, when there is a cell there.</p> <pre><code>int count=0; public void act() { if (!isDying) { count++; for (Location loc : this.getGrid().getOccupiedLocations()) { int nCount = this.getGrid().getOccupiedAdjacentLocations(loc).size(); if (nCount == 2 || nCount == 3) { //Do nothing } else if (nCount == 1 || nCount == 0) { //Die of loneliness if(!deathRow.contains(loc)) { deathRow.add(loc); } } else if(nCount&gt;=4) { //Die of overcrowding if(!deathRow.contains(loc)) { deathRow.add(loc); } } candidateNeighbors = this.getGrid().getEmptyAdjacentLocations(loc); for (Location candidate : candidateNeighbors) { int cCount = this.getGrid().getOccupiedAdjacentLocations(candidate).size(); if(cCount==3){ if(!birthList.contains(candidate)) { birthList.add(candidate); } } } } isDying=true; } else{ count++; System.out.println("\nAct: "+count); if(deathRow.size()!=0) { for (Location death : deathRow) { System.out.println("Death List: "+deathRow); System.out.println("Cell to Die: "+death); this.getGrid().get(death).removeSelfFromGrid(); } deathRow.clear(); } if(birthList.size()!=0) { for (Location birth : birthList) { System.out.println("Birth List: "+birthList); System.out.println("Cell to be born: "+birth); Cell newCell = new Cell(); newCell.putSelfInGrid(this.getGrid(), birth); } birthList.clear(); } isDying=false; } } </code></pre> <p>When I run the code, this is my console output:</p> <pre><code>Act: 2 Death List: [(9, 10), (11, 10)] Cell to Die: (9, 10) Death List: [(9, 10), (11, 10)] Cell to Die: (11, 10) Birth List: [(10, 11), (10, 9)] Cell to be born: (10, 11) Birth List: [(10, 11), (10, 9)] Cell to be born: (10, 9) Act: 2 Death List: [(10, 9), (10, 11)] Cell to Die: (10, 9) Death List: [(10, 9), (10, 11)] Cell to Die: (10, 11) Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at apcs.life.Cell.act(Cell.java:54) </code></pre> <p>Line 54 is <code>this.getGrid().get(death).removeSelfFromGrid();</code> Thank you for your guys' help!</p>
0debug
Interact with object values in JavaScript : <pre><code>a = [{name: James, Location: London}, {name: Martin, Location: Seattle},... {name: George, Location: New York}]; </code></pre> <p>How can I find the count of number of items present? How can I replace George with Suarez? How can I display only <em>"Martin from Seattle"</em> on the screen? How can I add a new object in between first and second?</p>
0debug
Android - Show BottomSheetDialogFragment above Keyboard : <p>I'm trying to show a <code>BottomSheetDialogFragment</code> with a few <code>EditText</code> fields for the user to enter information. I want to show it directly above the keyboard, but it keeps covering up the contents.</p> <p>This is what happens when I bring up the <code>BottomSheetDialogFragment</code>, you can see it's selecting <code>Card Number</code> <code>EditText</code>, but covering the other content.</p> <p><a href="https://i.stack.imgur.com/L6QiC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/L6QiC.png" alt="BottomSheetDialogFragment covering up content"></a></p> <p>Ideally, this is what I'm looking for, you can see both <code>EditTexts</code>, and the padding of the View.</p> <p><a href="https://i.stack.imgur.com/Htx0O.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Htx0O.png" alt="BottomSheetDialogFragment not covering up content"></a></p> <p>I've tried a lot of solutions revolving around <code>windowSoftInputMode</code>, but nothing seems to work. I've set it to <code>adjustResize</code> for the parent <code>Activity</code> and the actual <code>BottomSheetDialogFragment</code> via</p> <p><code> dialog.window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) </code></p> <p>And I've also tried modifying my layout, changing it from a <code>FrameLayout</code>, to a <code>ScrollView</code> to a <code>CoordinatorLayout</code> to see if that had any effect on the position of the layout, but nothing seems to work.</p> <p>If anyone knows how to accomplish this, that would be greatly appreciated, thank you.</p>
0debug
Delete rows from a text file with php : <p>I have a text file as follows</p> <pre><code>href='https://www.example.com/tv/xxxxxxxx/playlist.m3u8'&gt;TV 1 href='https://www.example.com/tv/xxxxxxxx/playlist.m3u8'&gt;TV 2 href='https://www.example.com/tv/xxxxxxxx/playlist.m3u8'&gt;TV 3 href='https://www.example.com/tv/xxxxxxxx/playlist.m3u8'&gt;TV 4 href='https://www.example.com/tv/xxxxxxxx/playlist.m3u8'&gt;TV 5 href='https://www.example.com/playlist/xxxxxxxx/playvod/vybz9h.mp4'&gt;Film 1 href='https://www.example.com/playlist/xxxxxxxx/playvod/tq5mzt.mp4'&gt;Film 2 href='https://www.example.com/playlist/xxxxxxxx/playvod/xegtnw.mp4'&gt;Film 3 href='https://www.example.com/playlist/xxxxxxxx/playvod/16c9os.mp4'&gt;Film 4 href='https://www.example.com/playlist/xxxxxxxx/playvod/r25dwc.mp4'&gt;Film 5 </code></pre> <p>being a very long text file, I'd like to eliminate the only lines of M3U8 connections and maintain only those with links to the films. It's possible to do it?</p>
0debug
A problematic if statement in Javascript : I have an if statement with two conditions and an or operator between them, it evaluates to be true after only one condition. because I used the || operator it checks the first condition and if it is true it will go into the if statement without checking the second one. if (checkPassword() == true || checkUserName() == true) evenet.preventDefault(); I expect it to go into the checkUserName function because there are crucial things in it that needs to be done, I can do it the long way but it will be cool if there is a way to make the if statement check the second condition even though it has the || operator and that's how programming works ( as far as I know)
0debug
What is the argument should an Indian trader pass to both these functions in R? : There is a documentation for backtesting in R in GitHub(https://timtrice.github.io/backtesting-strategies/). I have a query in two lines of code mentioned in this document. ##First line > `Sys.setenv(TZ = "UTC")` ##Second line > `currency('USD')` As you can see, the first line sets - system time to the US and the second line - sets the currency in which trading is occurring to the US. I am an Indian Trader and my job is to do back-testing with equity data for Indian companies. I use quantstrat and quantmod packages along with its dependencies. The data is downloaded from Yahoo Finance through R platform. - What is the argument should an Indian trader pass to both these functions(Sys.setenv and currency)???. The currency of Indian market is INR(Indian Nation Rupees) and the time of India is GMT+5:30
0debug
Support Multiple Label Printers : <p>We develop a desktop business application where we are going to add support to label printing.</p> <p>As there are lots of different printer makes and models out there, I want to discuss here what would be the best approach to manage all these different models/makes.</p> <p>Considering some printers use the windows spool (Brother, Dymo, etc) and other ones uses ZPL, EPL, etc. (Zebra, Argox, etc) or anything else, what would be the best approach to support different models.</p> <p>I was thinking about getting the printer description after the user selects its desired printer, and from them, my code will look for the specific implementation and if does not find it, alert the user.</p> <p>However, the user can change label description if I understand. </p> <p>How can I manage this?</p> <p>Thank you,</p> <p>Igor.</p>
0debug
How to access “Saved Queries” programmatically? : <p>In BigQuery Web UI, there is a “Saved Queries” Section.<br> Is there way to access (read/write) those programmatically?<br> Any API? </p>
0debug
void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst, ThreadFrame *ref, const VP56mv *mv, int x_off, int y_off, int block_w, int block_h, int width, int height, int linesize, vp8_mc_func mc_func[3][3]) { uint8_t *src = ref->f->data[0]; if (AV_RN32A(mv)) { int mx = (mv->x << 1)&7, mx_idx = subpel_idx[0][mx]; int my = (mv->y << 1)&7, my_idx = subpel_idx[0][my]; x_off += mv->x >> 2; y_off += mv->y >> 2; ff_thread_await_progress(ref, (3 + y_off + block_h + subpel_idx[2][my]) >> 4, 0); src += y_off * linesize + x_off; if (x_off < mx_idx || x_off >= width - block_w - subpel_idx[2][mx] || y_off < my_idx || y_off >= height - block_h - subpel_idx[2][my]) { s->vdsp.emulated_edge_mc(td->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize, block_w + subpel_idx[1][mx], block_h + subpel_idx[1][my], x_off - mx_idx, y_off - my_idx, width, height); src = td->edge_emu_buffer + mx_idx + linesize * my_idx; } mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my); } else { ff_thread_await_progress(ref, (3 + y_off + block_h) >> 4, 0); mc_func[0][0](dst, linesize, src + y_off * linesize + x_off, linesize, block_h, 0, 0); } }
1threat
manpath: can't set the locale; make sure $LC_* and $LANG are correct : <p>I just installed terminator terminal emulator on my linux mint. for some reason I don't understand, it sets my password to some of the locale options. I've tried several things but they only offer a temporary fix. each time I open the terminal, it resets the locale options to my password.</p> <pre><code>LANG=koldenod19* LANGUAGE= LC_CTYPE="mypassword" LC_NUMERIC=om_KE.UTF-8 LC_TIME="mypassword" LC_COLLATE="mypassword" LC_MONETARY=om_KE.UTF-8 LC_MESSAGES="mypassword" LC_PAPER=om_KE.UTF-8 LC_NAME=om_KE.UTF-8 LC_ADDRESS=om_KE.UTF-8 LC_TELEPHONE=om_KE.UTF-8 LC_MEASUREMENT=om_KE.UTF-8 LC_IDENTIFICATION=om_KE.UTF-8 LC_ALL= </code></pre> <p>I've tried using <code>sudo dpkg-reconfigure locales</code> and <code>export LC_ALL="eo_US.utf8"</code> and the problem still persists.</p>
0debug
static int webvtt_read_header(AVFormatContext *s) { WebVTTContext *webvtt = s->priv_data; AVBPrint header, cue; int res = 0; AVStream *st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); avpriv_set_pts_info(st, 64, 1, 1000); st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; st->codec->codec_id = AV_CODEC_ID_WEBVTT; st->disposition |= webvtt->kind; av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); av_bprint_init(&cue, 0, AV_BPRINT_SIZE_UNLIMITED); for (;;) { int i; int64_t pos; AVPacket *sub; const char *p, *identifier, *settings; int identifier_len, settings_len; int64_t ts_start, ts_end; ff_subtitles_read_chunk(s->pb, &cue); if (!cue.len) break; p = identifier = cue.str; pos = avio_tell(s->pb); if (!strncmp(p, "\xEF\xBB\xBFWEBVTT", 9) || !strncmp(p, "WEBVTT", 6)) continue; for (i = 0; p[i] && p[i] != '\n' && p[i] != '\r'; i++) { if (!strncmp(p + i, "-->", 3)) { identifier = NULL; break; } } if (!identifier) identifier_len = 0; else { identifier_len = strcspn(p, "\r\n"); p += identifier_len; if (*p == '\r') p++; if (*p == '\n') p++; } if ((ts_start = read_ts(p)) == AV_NOPTS_VALUE) break; if (!(p = strstr(p, "-->"))) break; p += 3; do p++; while (*p == ' ' || *p == '\t'); if ((ts_end = read_ts(p)) == AV_NOPTS_VALUE) break; p += strcspn(p, "\n\t "); while (*p == '\t' || *p == ' ') p++; settings = p; settings_len = strcspn(p, "\r\n"); p += settings_len; if (*p == '\r') p++; if (*p == '\n') p++; sub = ff_subtitles_queue_insert(&webvtt->q, p, strlen(p), 0); if (!sub) { res = AVERROR(ENOMEM); goto end; } sub->pos = pos; sub->pts = ts_start; sub->duration = ts_end - ts_start; #define SET_SIDE_DATA(name, type) do { \ if (name##_len) { \ uint8_t *buf = av_packet_new_side_data(sub, type, name##_len); \ if (!buf) { \ res = AVERROR(ENOMEM); \ goto end; \ } \ memcpy(buf, name, name##_len); \ } \ } while (0) SET_SIDE_DATA(identifier, AV_PKT_DATA_WEBVTT_IDENTIFIER); SET_SIDE_DATA(settings, AV_PKT_DATA_WEBVTT_SETTINGS); } ff_subtitles_queue_finalize(&webvtt->q); end: av_bprint_finalize(&cue, NULL); av_bprint_finalize(&header, NULL); return res; }
1threat
How would I extract a .GZ file from CMD using only commands built in to windows/java/portable program : <p>My team is working with .GZ files and they need some way, ANY WAY, to extract a .GZ from command line. It can be using Java commands (as long as it can be run from CMD). If it can be done with a third party PORTABLE executable that is fine as well, as long as it's free. I don't have much to go on here so I'm giving the most information as I can. Basically in a nutshell:</p> <ul> <li>I need to open .gz files</li> <li>It has to be done through a Batch file (CMD)</li> <li>It cannot use anything that must be installed apart from Java.</li> <li>It can use a portable EXE (toggleable from CMD)</li> </ul> <p>Thanks a bunch, sorry it is low on information! -Lucas E. Executive Programmer for EDG</p> <p><em>Side note: This goes along with minecraft, so, I know I can somehow make and extract them since minecraft saves it's log files in .gz format.</em> If the item I need comes with minecraft I can work with that.</p>
0debug
docker-compose - how to escape environment variables : <p>With <code>docker-compose</code> v2 environment variables can be set by simply:</p> <pre><code>enviroment: - MONGO_PATH=mongodb://db-mongo:27017 </code></pre> <p>The full <code>docker-compose.yml</code> file being:</p> <pre><code>version: '2' services: web: build: . environment: - MONGO_PATH=mongodb://db-mongo:27017 ports: - "3000:3000" volumes: - .:/app - /app/node_modules depends_on: - db-mongo - db-redis db-mongo: image: mongo restart: unless-stopped command: --smallfiles ports: - "27017:27017" volumes: - ./data:/data/db [...] </code></pre> <p>However, how can I escape environment variables that are not a plain string?</p> <pre><code>{"database": {"data": {"host": "mongo"}}} </code></pre> <p>I tried:</p> <pre><code>NODE_CONFIG=\{"database": \{"data"\: \{"host": "mongo"\}, "session": \{"host": "redis" \}\}\} NODE_CONFIG="\{"database": \{"data"\: \{"host": "mongo"\}, "session": \{"host": "redis" \}\}\}" NODE_CONFIG='{"database": {"data": {"host": "mongo"}, "session": {"host": "redis" }}}' </code></pre> <blockquote> <p>ERROR: yaml.parser.ParserError: while parsing a block mapping in "./docker-compose.yml", line 6, column 9 expected , but found '}' in "./docker-compose.yml", line 6, column 92</p> </blockquote>
0debug
void gen_intermediate_code_internal(LM32CPU *cpu, TranslationBlock *tb, bool search_pc) { CPUState *cs = CPU(cpu); CPULM32State *env = &cpu->env; struct DisasContext ctx, *dc = &ctx; uint16_t *gen_opc_end; uint32_t pc_start; int j, lj; uint32_t next_page_start; int num_insns; int max_insns; pc_start = tb->pc; dc->env = env; dc->tb = tb; gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE; dc->is_jmp = DISAS_NEXT; dc->pc = pc_start; dc->singlestep_enabled = cs->singlestep_enabled; dc->nr_nops = 0; if (pc_start & 3) { cpu_abort(env, "LM32: unaligned PC=%x\n", pc_start); } next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; lj = -1; num_insns = 0; max_insns = tb->cflags & CF_COUNT_MASK; if (max_insns == 0) { max_insns = CF_COUNT_MASK; } gen_tb_start(); do { check_breakpoint(env, dc); if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; if (lj < j) { lj++; while (lj < j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } tcg_ctx.gen_opc_pc[lj] = dc->pc; tcg_ctx.gen_opc_instr_start[lj] = 1; tcg_ctx.gen_opc_icount[lj] = num_insns; } LOG_DIS("%8.8x:\t", dc->pc); if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) { gen_io_start(); } decode(dc, cpu_ldl_code(env, dc->pc)); dc->pc += 4; num_insns++; } while (!dc->is_jmp && tcg_ctx.gen_opc_ptr < gen_opc_end && !cs->singlestep_enabled && !singlestep && (dc->pc < next_page_start) && num_insns < max_insns); if (tb->cflags & CF_LAST_IO) { gen_io_end(); } if (unlikely(cs->singlestep_enabled)) { if (dc->is_jmp == DISAS_NEXT) { tcg_gen_movi_tl(cpu_pc, dc->pc); } t_gen_raise_exception(dc, EXCP_DEBUG); } else { switch (dc->is_jmp) { case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; default: case DISAS_JUMP: case DISAS_UPDATE: tcg_gen_exit_tb(0); break; case DISAS_TB_JUMP: break; } } gen_tb_end(tb, num_insns); *tcg_ctx.gen_opc_ptr = INDEX_op_end; if (search_pc) { j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; lj++; while (lj <= j) { tcg_ctx.gen_opc_instr_start[lj++] = 0; } } else { tb->size = dc->pc - pc_start; tb->icount = num_insns; } #ifdef DEBUG_DISAS if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) { qemu_log("\n"); log_target_disas(env, pc_start, dc->pc - pc_start, 0); qemu_log("\nisize=%d osize=%td\n", dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf); } #endif }
1threat
Remove a service in ASP.Net Core Dependency Injection : <p>In an Asp.Net MVC Core (early versions, versions 1.0 or 1.1), dependency injection bindings are configured as follow in the Startup.cs class :</p> <pre><code>public class Startup { public void ConfigureServices(IServiceCollection services) { services.AddScoped&lt;IMyService, MyService&gt;(); // ... } } </code></pre> <p>In my applications, I usually have a base Startup class, where generic bindings are defined as a sequence of these lines :</p> <pre><code>public abstract class BaseStartup { public virtual void ConfigureServices(IServiceCollection services) { services.AddScoped&lt;IMyService1, MyService1&gt;(); services.AddScoped&lt;IMyService2, MyService2&gt;(); } } </code></pre> <p>Then in my application, I inherit the startup class, and inject other services as well :</p> <pre><code>public class Startup : BaseStartup { public override void ConfigureServices(IServiceCollection services) { base.ConfigureServices(services); services.AddScoped&lt;IMyService3, MyService3&gt;(); services.AddScoped&lt;IMyService4, MyService4&gt;(); } } </code></pre> <p>I now wonder : how can I kind of 'override' a previous binding ? I would like, for instance, to either remove, or modify a binding defined in the base class, like :</p> <pre><code>services.Remove&lt;IMyService1&gt;(); // Doesn't exist services.AddScoped&lt;IMyService1, MyBetterService1&gt;(); </code></pre> <p>Or simply update the binding :</p> <pre><code>services.AddScoped&lt;IMyService1, MyBetterService1&gt;(replacePreviousBinding: true); // Doesn't exist either ! </code></pre> <p>Is there a way to do that ? Or maybe simply declaring a new binding with the same interface as a previously defined binding will override that binding ?</p>
0debug
static int slice_end(AVCodecContext *avctx, AVFrame *pict) { Mpeg1Context *s1 = avctx->priv_data; MpegEncContext *s = &s1->mpeg_enc_ctx; if (!s1->mpeg_enc_ctx_allocated || !s->current_picture_ptr) return 0; if (s->avctx->hwaccel) { if (s->avctx->hwaccel->end_frame(s->avctx) < 0) av_log(avctx, AV_LOG_ERROR, "hardware accelerator failed to decode picture\n"); } #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) ff_xvmc_field_end(s); FF_ENABLE_DEPRECATION_WARNINGS #endif if ( !s->first_field) { ff_er_frame_end(&s->er); ff_mpv_frame_end(s); if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { int ret = av_frame_ref(pict, s->current_picture_ptr->f); if (ret < 0) return ret; ff_print_debug_info(s, s->current_picture_ptr); } else { if (avctx->active_thread_type & FF_THREAD_FRAME) s->picture_number++; if (s->last_picture_ptr != NULL) { int ret = av_frame_ref(pict, s->last_picture_ptr->f); if (ret < 0) return ret; ff_print_debug_info(s, s->last_picture_ptr); } } return 1; } else { return 0; } }
1threat
How to make document.querySelector accept div id as parameter? : <p>I have this function:</p> <pre><code>document.querySelector(".myDivClass"); </code></pre> <p>Which accepts a div css class as parameter. How to make it accept a div id as parameter instead?</p>
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
av_cold int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], int fullRange, int brightness, int contrast, int saturation) { const int isRgb = c->dstFormat==PIX_FMT_RGB32 || c->dstFormat==PIX_FMT_RGB32_1 || c->dstFormat==PIX_FMT_BGR24 || c->dstFormat==PIX_FMT_RGB565BE || c->dstFormat==PIX_FMT_RGB565LE || c->dstFormat==PIX_FMT_RGB555BE || c->dstFormat==PIX_FMT_RGB555LE || c->dstFormat==PIX_FMT_RGB444BE || c->dstFormat==PIX_FMT_RGB444LE || c->dstFormat==PIX_FMT_RGB8 || c->dstFormat==PIX_FMT_RGB4 || c->dstFormat==PIX_FMT_RGB4_BYTE || c->dstFormat==PIX_FMT_MONOBLACK; const int isNotNe = c->dstFormat==PIX_FMT_NE(RGB565LE,RGB565BE) || c->dstFormat==PIX_FMT_NE(RGB555LE,RGB555BE) || c->dstFormat==PIX_FMT_NE(RGB444LE,RGB444BE) || c->dstFormat==PIX_FMT_NE(BGR565LE,BGR565BE) || c->dstFormat==PIX_FMT_NE(BGR555LE,BGR555BE) || c->dstFormat==PIX_FMT_NE(BGR444LE,BGR444BE); const int bpp = c->dstFormatBpp; uint8_t *y_table; uint16_t *y_table16; uint32_t *y_table32; int i, base, rbase, gbase, bbase, abase, needAlpha; const int yoffs = fullRange ? 384 : 326; int64_t crv = inv_table[0]; int64_t cbu = inv_table[1]; int64_t cgu = -inv_table[2]; int64_t cgv = -inv_table[3]; int64_t cy = 1<<16; int64_t oy = 0; int64_t yb = 0; if (!fullRange) { cy = (cy*255) / 219; oy = 16<<16; } else { crv = (crv*224) / 255; cbu = (cbu*224) / 255; cgu = (cgu*224) / 255; cgv = (cgv*224) / 255; } cy = (cy *contrast ) >> 16; crv = (crv*contrast * saturation) >> 32; cbu = (cbu*contrast * saturation) >> 32; cgu = (cgu*contrast * saturation) >> 32; cgv = (cgv*contrast * saturation) >> 32; oy -= 256*brightness; c->uOffset= 0x0400040004000400LL; c->vOffset= 0x0400040004000400LL; c->yCoeff= roundToInt16(cy *8192) * 0x0001000100010001ULL; c->vrCoeff= roundToInt16(crv*8192) * 0x0001000100010001ULL; c->ubCoeff= roundToInt16(cbu*8192) * 0x0001000100010001ULL; c->vgCoeff= roundToInt16(cgv*8192) * 0x0001000100010001ULL; c->ugCoeff= roundToInt16(cgu*8192) * 0x0001000100010001ULL; c->yOffset= roundToInt16(oy * 8) * 0x0001000100010001ULL; c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy <<13); c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9); c->yuv2rgb_v2r_coeff= (int16_t)roundToInt16(crv<<13); c->yuv2rgb_v2g_coeff= (int16_t)roundToInt16(cgv<<13); c->yuv2rgb_u2g_coeff= (int16_t)roundToInt16(cgu<<13); c->yuv2rgb_u2b_coeff= (int16_t)roundToInt16(cbu<<13); crv = ((crv << 16) + 0x8000) / cy; cbu = ((cbu << 16) + 0x8000) / cy; cgu = ((cgu << 16) + 0x8000) / cy; cgv = ((cgv << 16) + 0x8000) / cy; av_free(c->yuvTable); switch (bpp) { case 1: c->yuvTable = av_malloc(1024); y_table = c->yuvTable; yb = -(384<<16) - oy; for (i = 0; i < 1024-110; i++) { y_table[i+110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7; yb += cy; } fill_table(c->table_gU, 1, cgu, y_table + yoffs); fill_gv_table(c->table_gV, 1, cgv); break; case 4: case 4|128: rbase = isRgb ? 3 : 0; gbase = 1; bbase = isRgb ? 0 : 3; c->yuvTable = av_malloc(1024*3); y_table = c->yuvTable; yb = -(384<<16) - oy; for (i = 0; i < 1024-110; i++) { int yval = av_clip_uint8((yb + 0x8000) >> 16); y_table[i+110 ] = (yval >> 7) << rbase; y_table[i+ 37+1024] = ((yval + 43) / 85) << gbase; y_table[i+110+2048] = (yval >> 7) << bbase; yb += cy; } fill_table(c->table_rV, 1, crv, y_table + yoffs); fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024); fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048); fill_gv_table(c->table_gV, 1, cgv); break; case 8: rbase = isRgb ? 5 : 0; gbase = isRgb ? 2 : 3; bbase = isRgb ? 0 : 6; c->yuvTable = av_malloc(1024*3); y_table = c->yuvTable; yb = -(384<<16) - oy; for (i = 0; i < 1024-38; i++) { int yval = av_clip_uint8((yb + 0x8000) >> 16); y_table[i+16 ] = ((yval + 18) / 36) << rbase; y_table[i+16+1024] = ((yval + 18) / 36) << gbase; y_table[i+37+2048] = ((yval + 43) / 85) << bbase; yb += cy; } fill_table(c->table_rV, 1, crv, y_table + yoffs); fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024); fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048); fill_gv_table(c->table_gV, 1, cgv); break; case 12: rbase = isRgb ? 8 : 0; gbase = 4; bbase = isRgb ? 0 : 8; c->yuvTable = av_malloc(1024*3*2); y_table16 = c->yuvTable; yb = -(384<<16) - oy; for (i = 0; i < 1024; i++) { uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); y_table16[i ] = (yval >> 4) << rbase; y_table16[i+1024] = (yval >> 4) << gbase; y_table16[i+2048] = (yval >> 4) << bbase; yb += cy; } if (isNotNe) for (i = 0; i < 1024*3; i++) y_table16[i] = av_bswap16(y_table16[i]); fill_table(c->table_rV, 2, crv, y_table16 + yoffs); fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024); fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048); fill_gv_table(c->table_gV, 2, cgv); break; case 15: case 16: rbase = isRgb ? bpp - 5 : 0; gbase = 5; bbase = isRgb ? 0 : (bpp - 5); c->yuvTable = av_malloc(1024*3*2); y_table16 = c->yuvTable; yb = -(384<<16) - oy; for (i = 0; i < 1024; i++) { uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16); y_table16[i ] = (yval >> 3) << rbase; y_table16[i+1024] = (yval >> (18 - bpp)) << gbase; y_table16[i+2048] = (yval >> 3) << bbase; yb += cy; } if(isNotNe) for (i = 0; i < 1024*3; i++) y_table16[i] = av_bswap16(y_table16[i]); fill_table(c->table_rV, 2, crv, y_table16 + yoffs); fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024); fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048); fill_gv_table(c->table_gV, 2, cgv); break; case 24: case 48: c->yuvTable = av_malloc(1024); y_table = c->yuvTable; yb = -(384<<16) - oy; for (i = 0; i < 1024; i++) { y_table[i] = av_clip_uint8((yb + 0x8000) >> 16); yb += cy; } fill_table(c->table_rV, 1, crv, y_table + yoffs); fill_table(c->table_gU, 1, cgu, y_table + yoffs); fill_table(c->table_bU, 1, cbu, y_table + yoffs); fill_gv_table(c->table_gV, 1, cgv); break; case 32: base = (c->dstFormat == PIX_FMT_RGB32_1 || c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0; rbase = base + (isRgb ? 16 : 0); gbase = base + 8; bbase = base + (isRgb ? 0 : 16); needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat); if (!needAlpha) abase = (base + 24) & 31; c->yuvTable = av_malloc(1024*3*4); y_table32 = c->yuvTable; yb = -(384<<16) - oy; for (i = 0; i < 1024; i++) { unsigned yval = av_clip_uint8((yb + 0x8000) >> 16); y_table32[i ] = (yval << rbase) + (needAlpha ? 0 : (255u << abase)); y_table32[i+1024] = yval << gbase; y_table32[i+2048] = yval << bbase; yb += cy; } fill_table(c->table_rV, 4, crv, y_table32 + yoffs); fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024); fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048); fill_gv_table(c->table_gV, 4, cgv); break; default: c->yuvTable = NULL; av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp); return -1; } return 0; }
1threat
Android sqlite get largest value of a row among multiple entries : My question is similar to the following post: https://stackoverflow.com/questions/35565309/find-largest-value-among-repeated-entries-in-an-sql-table but it is for mysql and and I cannot understand how it translates in sqlite. I want to get the max value of `pages` from my table `metadata` with multiple `file_ids` and multiple entries My table with the two columns I am interested in. `file_id pages 1 2 1 5 2 10 3 20 4 12 4 1 5 4 6 5 6 14 7 12` What I am looking for is `file_id pages 1 5 2 10 3 20 4 12 5 4 6 14 7 12` I am trying to make a query but don't know how String[]cols = {"file_id","pages"}; String groupBy = {"pages"}; all others params are null that's as far as I can think. What will be the query like. Please help.
0debug
It was suppose to be displayed in a table form but it displays in one line in the console after compilation : #include <iostream> using namespace std; int main (){ int array1[5][5]={{1,1,1,1,0},{1,1,1,0,2},{1,1,0,2,2},{1,0,2,2,2},{0,2,2,2,2}}; for ( int row = 0 ; row < 5 ; row ++){ for ( int col = 0 ; col < 5 ; col ++) { cout<< array1[row][col]<< " "; } } cout<<endl; }
0debug
static void pxa2xx_lcdc_dma0_redraw_rot180(PXA2xxLCDState *s, hwaddr addr, int *miny, int *maxy) { DisplaySurface *surface = qemu_console_surface(s->con); int src_width, dest_width; drawfn fn = NULL; if (s->dest_width) { fn = s->line_fn[s->transp][s->bpp]; } if (!fn) { return; } src_width = (s->xres + 3) & ~3; if (s->bpp == pxa_lcdc_19pbpp || s->bpp == pxa_lcdc_18pbpp) { src_width *= 3; } else if (s->bpp > pxa_lcdc_16bpp) { src_width *= 4; } else if (s->bpp > pxa_lcdc_8bpp) { src_width *= 2; } dest_width = s->xres * s->dest_width; *miny = 0; framebuffer_update_display(surface, s->sysmem, addr, s->xres, s->yres, src_width, -dest_width, -s->dest_width, s->invalidated, fn, s->dma_ch[0].palette, miny, maxy); }
1threat
Sort a table that is created using document.write() in javascript : I have written the following code that displays a table of 4 columns on ajax success. I wish to sort this table based on the 4 columns. I tried doing it using some readymade .js files available online. but, didn't succeed. How can I achieve the requirement? function Success(data) { var obj; obj=JSON.parse(data); document.write("<html><head><title>Service</title></head><body bgcolor=#FFFFFB>"); document.write("<div id=example-table>"); document.write("<h2 align=center>Details</h2>"); document.write("<table border-collapse=collapse, width=60%, border=1px solid #ddd, align=center>"); document.write("<tr bgcolor=#209D9D>"); document.write("<th height=50>"); document.write("Name"); document.write("</th>"); document.write("<th height=50>"); document.write("Number1"); document.write("</th>"); document.write("<th height=50>"); document.write("Number2"); document.write("</th>"); document.write("<th height=50>"); document.write("Number3"); document.write("</th>"); document.write("</tr>"); document.write("<br>"); for(i=0; i<obj.length; i=i+4) { document.write("<tr bgcolor=#ffffff>"); document.write("<td align=center>"); document.write(obj[i]); document.write("</td>"); document.write("<td align=center>"); document.write(obj[i+1]); document.write("</td>"); document.write("<td align=center>"); document.write(obj[i+2]); document.write("</td>"); document.write("<td align=center>"); document.write(obj[i+3]); document.write("</td>"); document.write("</tr>"); } document.write("</table>"); document.write("</div>"); document.write("</body></html>"); } </script>
0debug
static void init_dev(tc58128_dev * dev, const char *filename) { int ret, blocks; dev->state = WAIT; dev->flash_contents = g_malloc0(FLASH_SIZE); memset(dev->flash_contents, 0xff, FLASH_SIZE); if (!dev->flash_contents) { fprintf(stderr, "could not alloc memory for flash\n"); exit(1); } if (filename) { ret = load_image(filename, dev->flash_contents + 528 * 32); if (ret < 0) { fprintf(stderr, "ret=%d\n", ret); fprintf(stderr, "qemu: could not load flash image %s\n", filename); exit(1); } else { blocks = (ret + 528 * 32 - 1) / (528 * 32); dev->flash_contents[0] = blocks & 0xff; dev->flash_contents[1] = (blocks >> 8) & 0xff; dev->flash_contents[2] = (blocks >> 16) & 0xff; dev->flash_contents[3] = (blocks >> 24) & 0xff; fprintf(stderr, "loaded %d bytes for %s into flash\n", ret, filename); } } }
1threat
Dependencies are failed to resolve when migrated from Spring Boot 1.5.10 to 2.0.0 : <p>So, I migrated my basic application from Spring Boot 1.5.10 to 2.0.0. I am using Gradle and before the migration, I always excluded version numbers of the artifacts of the compile dependencies. After the migration, gradle build task started to throw an error like this:</p> <pre><code>BUILD FAILED in 0s 2 actionable tasks: 1 executed, 1 up-to-date During the build, one or more dependencies that were declared without a version failed to resolve: org.springframework.boot:spring-boot-starter-data-rest: org.springframework.boot:spring-boot-starter-web: org.springframework.boot:spring-boot-starter-data-jpa: Did you forget to apply the io.spring.dependency-management plugin to the llutrackr project? </code></pre> <p>My <code>build.gradle</code> (I excluded the irrelevant parts):</p> <pre><code>buildscript { repositories { mavenCentral() } dependencies { classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE") } } dependencies { compile("org.springframework.boot:spring-boot-starter-data-rest") compile('org.springframework.boot:spring-boot-starter-data-jpa') compile('org.springframework.boot:spring-boot-starter-web') } </code></pre> <p>After I add version numbers to the corresponding dependencies, then the problem is solved. Why is this change necessary to build Spring Boot 2.0 projects with gradle? Even spring guides don't include artifact version numbers. <a href="https://spring.io/guides/gs/rest-service/" rel="noreferrer">An example</a></p>
0debug
how to start the second activity from the first, directly, not through a button : All the textbooks/guides start the second activity via click a button. I thought I can start it directly by just removing the button codes. Obvious I was wrong. Below code reports "Unfortunately, the xxxx has stopped". So, my question: ow to start the second activity from the first? (I can't believe I am the only newbies need to seek help on this while others figured it out by themselves for I can not google the similar question) Thanks. public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent iCodes = new Intent(this, OtherActivity.class); startActivity(iCodes); }
0debug
const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p, const uint8_t *end, uint32_t *av_restrict state) { int i; assert(p <= end); if (p >= end) return end; for (i = 0; i < 3; i++) { uint32_t tmp = *state << 8; *state = tmp + *(p++); if (tmp == 0x100 || p == end) return p; } while (p < end) { if (p[-1] > 1 ) p += 3; else if (p[-2] ) p += 2; else if (p[-3]|(p[-1]-1)) p++; else { p++; break; } } p = FFMIN(p, end) - 4; *state = AV_RB32(p); return p + 4; }
1threat
Josh Smith Article on WPF: https://msdn.microsoft.com/en-us/magazine/dd419663.aspx : <p>How will i come to know that Hyperlink class can come under Text Block as given in the article from Josh Smith ? Sample:</p> <pre><code>&lt;DataTemplate&gt; &lt;TextBlock Margin="2,6"&gt; &lt;Hyperlink Command="{Binding Path=Command}"&gt; &lt;TextBlock Text="{Binding Path=DisplayName}" /&gt; &lt;/Hyperlink&gt; &lt;/TextBlock&gt; &lt;/DataTemplate&gt; </code></pre>
0debug
TypeScript type ignore case : <p>I have this type definition in TypeScript:</p> <pre><code>export type xhrTypes = "GET" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "CONNECT" | "HEAD"; </code></pre> <p>Sadly, this is case sensitive...is there any way to define it case insensitive?</p> <p>thanks</p>
0debug
Zero-cost properties with data member syntax : <p>I have (re?)invented this approach to zero-cost properties with data member syntax. By this I mean that the user can write:</p> <pre><code>some_struct.some_member = var; var = some_struct.some_member; </code></pre> <p>and these member accesses redirect to member functions with zero overhead.</p> <p>While initial tests show that the approach does work in practice, I'm far from sure that it is free from undefined behaviour. Here's the simplified code that illustrates the approach:</p> <pre><code>template &lt;class Owner, class Type, Type&amp; (Owner::*accessor)()&gt; struct property { operator Type&amp;() { Owner* optr = reinterpret_cast&lt;Owner*&gt;(this); return (optr-&gt;*accessor)(); } Type&amp; operator= (const Type&amp; t) { Owner* optr = reinterpret_cast&lt;Owner*&gt;(this); return (optr-&gt;*accessor)() = t; } }; union Point { int&amp; get_x() { return xy[0]; } int&amp; get_y() { return xy[1]; } std::array&lt;int, 2&gt; xy; property&lt;Point, int, &amp;Point::get_x&gt; x; property&lt;Point, int, &amp;Point::get_y&gt; y; }; </code></pre> <p>The test driver demonstrates that the approach works and it is indeed zero-cost (properties occupy no additional memory):</p> <pre><code>int main() { Point m; m.x = 42; m.y = -1; std::cout &lt;&lt; m.xy[0] &lt;&lt; " " &lt;&lt; m.xy[1] &lt;&lt; "\n"; std::cout &lt;&lt; sizeof(m) &lt;&lt; " " &lt;&lt; sizeof(m.x) &lt;&lt; "\n"; } </code></pre> <p>Real code is a bit more complicated but the gist of the approach is here. It is based on using a union of real data (<code>xy</code> in this example) and empty property objects. (Real data must be a standard layout class for this to work).</p> <p>The union is needed because otherwise properties needlessly occupy memory, despite being empty.</p> <p>Why do I think there's no UB here? The standard permits accessing the common initial sequence of standard-layout union members. Here, the common initial sequence is empty. Data members of <code>x</code> and <code>y</code> are not accessed at all, as there are no data members. My reading of the standard indicate that this is allowed. <code>reinterpret_cast</code> should be OK because we are casting a union member to its containing union, and these are pointer-interconvertible.</p> <p>Is this indeed allowed by the standard, or I'm missing some UB here?</p>
0debug
Highlight typos in the jupyter notebook markdown : <p>When I write something in the jupyter notebook markdown field, the typos are not highlighted and often I ended up with something like this:</p> <p><a href="https://i.stack.imgur.com/e7eNg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e7eNg.png" alt="enter image description here"></a></p> <p>In almost all IDEs I have used so far, the typos are highlighted with a curly underline which was very convenient for me. Something like this:</p> <p><a href="https://i.stack.imgur.com/SD64c.png" rel="noreferrer"><img src="https://i.stack.imgur.com/SD64c.png" alt="enter image description here"></a></p> <p>Up till now I have not found anything that allows me to see this type of highlights. Does it exist?</p>
0debug
How to implement bottom menus in iOS : <p>How are these menus called in iOS and how to implement them in Objective-C ?</p> <p><a href="https://i.stack.imgur.com/AfzDG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AfzDG.jpg" alt="enter image description here"></a></p>
0debug
Type 'Any' Has no Subscript Members in xcode 8 Swift 3 : <p>My App is supposed to go to a specific location to pull down the website it needs to load. In 2.3 it worked like a charm, but since I've updated xcode (which I don't have a ton of experience in) it is giving me the error "type 'Any' has no subscript members" and highlighting the "json" right before line three</p> <pre><code>...Retriever = json["WEB"]... </code></pre> <p>this is the code related to it.</p> <pre><code>let json = try JSONSerialization.jsonObject(with: data!, options:.allowFragments) if let Retriever = json["WEB"] as? [[String: AnyObject]] { for website in Retriever { if let name = website["URL"] as? String { self.loadAddressURL(name) </code></pre> <p>I feel like I am missing something small. If there is a better way to do this, I would love suggestions. The URL returns this JSON</p> <pre><code>{ "WEB" : [ { "URL" : "http://www.google.com" } ] } </code></pre> <p>but I would love it if I could simplify it to just</p> <pre><code>{"URL":"http://www.google.com"} </code></pre>
0debug
static uint64_t onenand_read(void *opaque, hwaddr addr, unsigned size) { OneNANDState *s = (OneNANDState *) opaque; int offset = addr >> s->shift; switch (offset) { case 0x0000 ... 0xc000: return lduw_le_p(s->boot[0] + addr); case 0xf000: return s->id.man; case 0xf001: return s->id.dev; case 0xf002: return s->id.ver; case 0xf003: return 1 << PAGE_SHIFT; case 0xf004: return 0x200; case 0xf005: return 1 | (2 << 8); case 0xf006: return 0; case 0xf100 ... 0xf107: return s->addr[offset - 0xf100]; case 0xf200: return (s->bufaddr << 8) | ((s->count - 1) & (1 << (PAGE_SHIFT - 10))); case 0xf220: return s->command; case 0xf221: return s->config[0] & 0xffe0; case 0xf222: return s->config[1]; case 0xf240: return s->status; case 0xf241: return s->intstatus; case 0xf24c: return s->unladdr[0]; case 0xf24d: return s->unladdr[1]; case 0xf24e: return s->wpstatus; case 0xff00: return 0x00; case 0xff01: case 0xff02: case 0xff03: case 0xff04: hw_error("%s: imeplement ECC\n", __FUNCTION__); return 0x0000; } fprintf(stderr, "%s: unknown OneNAND register %x\n", __FUNCTION__, offset); return 0; }
1threat
What source control is available for PHP / SQL projects : <p>I am working with a PHP web application that has a MS SQL back end. The development copy is hosted on a Windows server.</p> <p>There will be a few developers joining me on the project, and I need some sort of source control so that (obviously) we don't over-write each other's work. But since a PHP/SQL project has to be run from the server, we can't each work with local copies and then push the updates to the server...we all have to be working on the server itself.</p> <p>So I have three questions:</p> <ol> <li><p>My initial thought was a simple check-in, check-out system, which should be ok for our small team of 3-4 programmers. So, what is (currently) a good program for that?</p></li> <li><p>I also thought about each developer having his own folder in the wwwroot folder, his own full copy of the program, then pushing updates to a master copy, also on the same server. Is there a good program for doing that (file merging and conflict management)?</p></li> <li><p>Which method do you think would be better?</p></li> </ol>
0debug
Absolute positioning ignoring padding : <p>I am trying to position a div with buttons at the bottom of a parent div that has a padding.</p> <p><a href="https://i.stack.imgur.com/pQdi9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/pQdi9.png" alt="current result"></a></p> <p>The expected result is having the button resting on top of the padding (green area).</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.btn-default, .btn-default:hover, .btn-default:focus { color: #333; text-shadow: none; /* Prevent inheritence from `body` */ background-color: #fff; border: 1px solid #fff; } a, a:focus, a:hover { color: #fff; } body { background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.6)), url("../img/blank.jpg"); background-attachment: fixed; background-size: cover; background-repeat: no-repeat; background-position: center top; } html, body { height: 100%; } body { color: #fff; text-align: left; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); } #mcontainer { position: relative; float: left; padding: 10%; width: 100%; height: 100%; } #header h1 { margin: 0px; } #header { height: auto; } #footer .link-item a { display: table-cell; padding: 10px 10px; border: 2px solid white; } #footer { position: absolute; top: auto; bottom: 0%; height: auto; } #footer .link-item:first-child { border-spacing: 0px 10px; margin: 10px 10px 10px 0px; } #footer .link-item { border-spacing: 0px 10px; margin: 10px 10px; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;body&gt; &lt;div id="mcontainer"&gt; &lt;div id="header"&gt; &lt;h1&gt;Text&lt;/h1&gt; &lt;/div&gt; &lt;div id="footer"&gt; &lt;span class="link-item"&gt;&lt;a href="www.google.com" target="new"&gt;Button&lt;/a&gt; &lt;/span&gt; &lt;span class="link-item"&gt;&lt;a href="www.google.com" target="new"&gt;Button&lt;/a&gt; &lt;/span&gt; &lt;span class="link-item"&gt;&lt;a href="www.google.com" target="new"&gt;Button&lt;/a&gt; &lt;/span&gt; &lt;span class="link-item"&gt;&lt;a href="www.google.com" target="new"&gt;Button&lt;/a&gt; &lt;/span&gt; &lt;span class="link-item"&gt;&lt;a href="www.google.com" target="new"&gt;Button&lt;/a&gt; &lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p> <p>Any help would be appreciated.</p>
0debug
int av_image_fill_linesizes(int linesizes[4], enum PixelFormat pix_fmt, int width) { int i; const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; int max_step [4]; int max_step_comp[4]; memset(linesizes, 0, 4*sizeof(linesizes[0])); if ((unsigned)pix_fmt >= PIX_FMT_NB || desc->flags & PIX_FMT_HWACCEL) return AVERROR(EINVAL); if (desc->flags & PIX_FMT_BITSTREAM) { if (width > (INT_MAX -7) / (desc->comp[0].step_minus1+1)) return AVERROR(EINVAL); linesizes[0] = (width * (desc->comp[0].step_minus1+1) + 7) >> 3; return 0; } av_image_fill_max_pixsteps(max_step, max_step_comp, desc); for (i = 0; i < 4; i++) { int s = (max_step_comp[i] == 1 || max_step_comp[i] == 2) ? desc->log2_chroma_w : 0; int shifted_w = ((width + (1 << s) - 1)) >> s; if (max_step[i] > INT_MAX / shifted_w) return AVERROR(EINVAL); linesizes[i] = max_step[i] * shifted_w; } return 0; }
1threat
data.table - select first n rows within group : <p>As simple as it is, I don't know a <code>data.table</code> solution to select the first n rows in groups in a data table. Can you please help me out?</p>
0debug
def decode_list(alist): def aux(g): if isinstance(g, list): return [(g[1], range(g[0]))] else: return [(g, [0])] return [x for g in alist for x, R in aux(g) for i in R]
0debug
How to filter multiple words in Android Studio logcat : <p>I want to see just a couple of words in logcat. In other words, just a given tags. I tried to enable <em>Regex</em> and type <code>[Encoder|Decoder]</code> as filter, but it doesn't work.</p>
0debug
For loop with a variable upper bound : i wanted to make a for loop in python with a variable upper bound which is the length of list, the size of which is modified inside the loop. like this : l = [1,2,3,4,5,6] for i in range(len(l)): del l[i] thank you
0debug
How to find the highest number that a number can be divided : <p>Im trying to solve a problem on coding bat and i have to try to find if x number of 1 inch blocks and y number of 5 inch blocks are able to make a fence of z length</p> <p>In short im trying to find what's the max number of 5 inch blocks i can use without exceeding Z</p> <p>Is there a function similar to modulo whereby it returns such a number?</p>
0debug
How to programmatically scroll to the bottom of a Recycler View? : <p>I want to scroll to the bottom of a recycler view on click of a button, how do I do this?</p>
0debug
gradlew command not found? : <p>I am working on a Java project with gradlew. I use Ubuntu Linux as my OS. When I run "gradle" it runs, and gives me info. But when I run "gradlew", it outputs as "No command 'gradlew' found, did you mean: Command 'gradle' from package 'gradle' (universe) gradlew: command not found"</p> <p>I did my research, I have jdk, and I did sudo apt-get install gradle. I am totally clueless</p>
0debug
static void tcg_out_brcond2(TCGContext *s, TCGCond cond, TCGReg al, TCGReg ah, TCGReg bl, TCGReg bh, int label_index) { TCGCond b_cond = TCG_COND_NE; TCGReg tmp = TCG_TMP1; switch (cond) { case TCG_COND_EQ: case TCG_COND_NE: b_cond = cond; tmp = tcg_out_reduce_eq2(s, TCG_TMP0, TCG_TMP1, al, ah, bl, bh); break; default: if (mips_cmp_map[cond] & MIPS_CMP_INV) { cond = tcg_invert_cond(cond); b_cond = TCG_COND_EQ; } tcg_out_setcond2(s, cond, tmp, al, ah, bl, bh); break; } tcg_out_brcond(s, b_cond, tmp, TCG_REG_ZERO, label_index); }
1threat
Why do need to check null pointer in C++ but not in JAVA? : Supposed that, I hava a class named of `RequestType`. ``` RequestType requestType = new RequestType(); ``` Why need to check requestType is `null` or not in C++? But, in java, I can use `requestType` without such check. Thanks in advance.
0debug
static ssize_t proxy_llistxattr(FsContext *ctx, V9fsPath *fs_path, void *value, size_t size) { int retval; retval = v9fs_request(ctx->private, T_LLISTXATTR, value, "ds", size, fs_path); if (retval < 0) { errno = -retval; } return retval; }
1threat
Why is my external style sheet not working? : <p>This is my html below-</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;link rel="stylesheet" type="text/css" href="style.css"&gt; - as you can see I refer to the external style sheet. &lt;html&gt; &lt;head&gt; &lt;meta charset="UFT-8"&gt; &lt;meta name ="viewport" content="width=device-width,initial-scale=1.0"&gt; &lt;meta http-equiv="X-UA-Compatible" content="ie=edge"&gt; &lt;title&gt;Natours&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;header class ="header"&gt; This is some cool text... &lt;/header&gt; &lt;/body&gt; &lt;style type="text/css"&gt; *{margin:0; padding:0;} &lt;/style&gt; &lt;/html&gt; </code></pre> <p>I save the Html file as HTML, and save the CSS file as a CSS file, but after I click to save the external stylesheet as a CSS file, and click save, I go back to the file but its still set as a neutral file, not a CSS file.</p> <p>-Below is my CSS- body{background-color:black;}</p> <p>I've tried multiple times to use the forums, but many people say that I'm using it correctly.</p>
0debug
Distinct in a simple SQL query : when executing queries in SQL I have been trying to figure out the following: In this example,<br> SELECT DISTINCT AL.id, AL.name<br> FROM albums AL Why is there a need to specify distinct? I thought that the Id being a primary key was enough to avoid Duplicate results. Thanks in advance. Edit: I have been using and learning SQL for a year but this concept I cannot grasp.
0debug
AtributeError: 'module' object has no attribute 'plt' - Seaborn : <p>I'm very new with these libraries and i'm having troubles while plotting this:</p> <pre><code>import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import numpy as np import random df5 = pd.read_csv('../../../../datos/tiempos-exacto-variando-n-m0.csv', sep=', ', engine='python') print(df5) df5['n'] = df5['n'].apply(lambda x: x**2) sns.jointplot(df5['n'], df5['tiempoTotal'], kind="reg") sns.plt.show() </code></pre> <p>And i'm getting this output:</p> <pre><code> n m tiempoTotal 0 1 0 2274 1 2 0 3370 2 3 0 5709 3 4 0 8959 4 5 0 13354 5 6 0 18503 6 7 0 26329 7 8 0 33859 8 9 0 41110 9 10 0 52710 10 11 0 64364 11 12 0 74142 12 13 0 81072 13 14 0 69332 14 15 0 71027 15 16 0 89721 16 17 0 85459 17 18 0 95217 18 19 0 119210 19 20 0 136888 20 21 0 131903 21 22 0 138395 22 23 0 151222 23 24 0 163542 24 25 0 177236 25 26 0 192475 26 27 0 240162 27 28 0 260701 28 29 0 235752 29 30 0 250835 .. ... .. ... 580 581 0 88306854 581 582 0 89276420 582 583 0 87457875 583 584 0 90807004 584 585 0 87790003 585 586 0 89821530 586 587 0 89486585 587 588 0 88496901 588 589 0 89090661 589 590 0 89110803 590 591 0 90397942 591 592 0 94029839 592 593 0 92749859 593 594 0 105991135 594 595 0 95383921 595 596 0 105155207 596 597 0 114193414 597 598 0 98108892 598 599 0 97888966 599 600 0 103802453 600 601 0 97249346 601 602 0 101917488 602 603 0 104943847 603 604 0 98966140 604 605 0 97924262 605 606 0 97379587 606 607 0 97518808 607 608 0 99839892 608 609 0 100046492 609 610 0 103857464 [610 rows x 3 columns] --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) &lt;ipython-input-21-63146953b89d&gt; in &lt;module&gt;() 9 df5['n'] = df5['n'].apply(lambda x: x**2) 10 sns.jointplot(df5['n'], df5['tiempoTotal'], kind="reg") ---&gt; 11 sns.plt.show() AttributeError: 'module' object has no attribute 'plt' </code></pre> <p>I'm running this in my <code>Jupyter Notebook</code> with <code>Python 2.7.12</code>. Any ideas?</p>
0debug
override depricated method in android.support.v4.app.fragment : @Override public void onAttach(Activity activity) { super.onAttach(activity); try { activitycomander = (TopSectionListener) activity; }catch (ClassCastException e){ throw new ClassCastException(activity.toString()); } } this is the code of my java class linkig with MainActivity. there is issue with onattach method in android studio.. it shows as overline. and shows the message: onattach (android.app.activity) is deprecated: public void createMeme(String top, String bottom){ bottomsection fragmentbottom = (bottomsection) getSupportFragmentManager().findFragmentById(R.id.fragment2); fragmentbottom.setMemeText(top, bottom); } Above mentioned is mainactivity code in which topsection and bottomsection are the names of my java classes and its continuosly red and shows: connot reslove method i have done Clean project, rebuild project and checked the options to add or remove the imports automaticlly
0debug
how to copy only structure of table in android : i want to create a database.it has up to 9 tables in future it may exceed.But the structure(no of columns and column name) of table is same for all tables..i know that there is an option to copy the structure of table and rename it and use it. but i don't know how to do it in android exactly..please give me the relevant answer so that it reduces my code.
0debug
RaiseEvent on C sharp : <p>I know there is a lot of information about RaiseEvents on internet, but I can't understand them, somebody can help me with a simple example on C#.</p> <p>Thanks very much.</p>
0debug
Kotlin "internal" visibility modifier in Android : <p>Suppose you're writing an Android project (<strong>not a library</strong>). All the files are compiled together so... is there any sense to use an <code>internal</code> visibility modifier in this case?</p>
0debug
void usb_register_port(USBBus *bus, USBPort *port, void *opaque, int index, usb_attachfn attach) { port->opaque = opaque; port->index = index; port->attach = attach; TAILQ_INSERT_TAIL(&bus->free, port, next); bus->nfree++; }
1threat
Loop through JSON response using PHP : <p>I am making an API request via <em>PHP cURL</em>.</p> <p>When I run <code>echo $response</code> I get the following JSON:</p> <p><strong>JSON (application/json):</strong></p> <pre><code>{ "workers": [ { "email": "micky@mcgurk.com", "manager": { "email": "boss@mcgurk.com" } }, { "email": "michelle@mcgurk.com", "manager": { "email": "another_boss@mcgurk.com" } } ] } </code></pre> <p>I'd like to loop through the results &amp; echo out the email and associated manager. How do I do this?</p>
0debug
How to write just acronyms to a file : <p>I was wondering how you could input a country from the user then write ONLY the acronyms to a file for example if the user entered United Kingdom then UK would be written in the file. Help would be much appreciated.</p>
0debug
How is REST api versioning implemented technically? : <p>I am working on a REST api which needs to be refactored. This will be a breaking change so the original api is to be made as v1 and the new refactored api will be known as v2. The versioning will be implemented at url level.</p> <p>I want to understand technically how to approach this problem. Should I create a copy of the project and make the changes or should I make changes on the same project and then how do I expose the project as separate verisons?</p>
0debug
How to create a custom Spinner in Android : <p>I want to create custom spinner like below :</p> <p><a href="https://i.stack.imgur.com/0X9te.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0X9te.png" alt="enter image description here"></a></p> <p>Thanks</p>
0debug
static void reset_contexts(SnowContext *s){ int plane_index, level, orientation; for(plane_index=0; plane_index<2; plane_index++){ for(level=0; level<s->spatial_decomposition_count; level++){ for(orientation=level ? 1:0; orientation<4; orientation++){ memset(s->plane[plane_index].band[level][orientation].state, 0, sizeof(s->plane[plane_index].band[level][orientation].state)); } } } memset(s->mb_band.state, 0, sizeof(s->mb_band.state)); memset(s->mv_band[0].state, 0, sizeof(s->mv_band[0].state)); memset(s->mv_band[1].state, 0, sizeof(s->mv_band[1].state)); memset(s->header_state, 0, sizeof(s->header_state)); }
1threat
static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_ptr) { WtvContext *wtv = s->priv_data; ByteIOContext *pb = wtv->pb; while (!url_feof(pb)) { ff_asf_guid g; int len, sid, consumed; ff_get_guid(pb, &g); len = get_le32(pb); if (len < 32) break; sid = get_le32(pb) & 0x7FFF; url_fskip(pb, 8); consumed = 32; if (!ff_guidcmp(g, stream_guid)) { if (ff_find_stream_index(s, sid) < 0) { ff_asf_guid mediatype, subtype, formattype; int size; consumed += 20; url_fskip(pb, 16); if (get_le32(pb)) { url_fskip(pb, 8); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); url_fskip(pb, 12); ff_get_guid(pb, &formattype); size = get_le32(pb); parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); consumed += 72 + size; } } } else if (!ff_guidcmp(g, stream2_guid)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0 && !((WtvStream*)s->streams[stream_index]->priv_data)->seen_data) { ff_asf_guid mediatype, subtype, formattype; int size; url_fskip(pb, 12); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); url_fskip(pb, 12); ff_get_guid(pb, &formattype); size = get_le32(pb); parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size); consumed += 76 + size; } } else if (!ff_guidcmp(g, EVENTID_AudioDescriptorSpanningEvent) || !ff_guidcmp(g, EVENTID_CtxADescriptorSpanningEvent) || !ff_guidcmp(g, EVENTID_CSDescriptorSpanningEvent) || !ff_guidcmp(g, EVENTID_StreamIDSpanningEvent) || !ff_guidcmp(g, EVENTID_SubtitleSpanningEvent) || !ff_guidcmp(g, EVENTID_TeletextSpanningEvent)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { AVStream *st = s->streams[stream_index]; uint8_t buf[258]; const uint8_t *pbuf = buf; int buf_size; url_fskip(pb, 8); consumed += 8; if (!ff_guidcmp(g, EVENTID_CtxADescriptorSpanningEvent) || !ff_guidcmp(g, EVENTID_CSDescriptorSpanningEvent)) { url_fskip(pb, 6); consumed += 6; } buf_size = FFMIN(len - consumed, sizeof(buf)); get_buffer(pb, buf, buf_size); consumed += buf_size; ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, 0, 0, 0, 0); } } else if (!ff_guidcmp(g, EVENTID_DVBScramblingControlSpanningEvent)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { url_fskip(pb, 12); if (get_le32(pb)) av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index); consumed += 16; } } else if (!ff_guidcmp(g, EVENTID_LanguageSpanningEvent)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { AVStream *st = s->streams[stream_index]; uint8_t language[4]; url_fskip(pb, 12); get_buffer(pb, language, 3); if (language[0]) { language[3] = 0; av_metadata_set2(&st->metadata, "language", language, 0); } consumed += 15; } } else if (!ff_guidcmp(g, timestamp_guid)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { url_fskip(pb, 8); wtv->pts = get_le64(pb); consumed += 16; if (wtv->pts == -1) wtv->pts = AV_NOPTS_VALUE; else { wtv->last_valid_pts = wtv->pts; if (wtv->epoch == AV_NOPTS_VALUE || wtv->pts < wtv->epoch) wtv->epoch = wtv->pts; if (mode == SEEK_TO_PTS && wtv->pts >= seekts) { #define WTV_PAD8(x) (((x) + 7) & ~7) url_fskip(pb, WTV_PAD8(len) - consumed); return 0; } } } } else if (!ff_guidcmp(g, data_guid)) { int stream_index = ff_find_stream_index(s, sid); if (mode == SEEK_TO_DATA && stream_index >= 0) { WtvStream *wst = s->streams[stream_index]->priv_data; wst->seen_data = 1; if (len_ptr) { *len_ptr = len; } return stream_index; } } else if ( !ff_guidcmp(g, (const ff_asf_guid){0x14,0x56,0x1A,0x0C,0xCD,0x30,0x40,0x4F,0xBC,0xBF,0xD0,0x3E,0x52,0x30,0x62,0x07}) || !ff_guidcmp(g, (const ff_asf_guid){0x02,0xAE,0x5B,0x2F,0x8F,0x7B,0x60,0x4F,0x82,0xD6,0xE4,0xEA,0x2F,0x1F,0x4C,0x99}) || !ff_guidcmp(g, (const ff_asf_guid){0x12,0xF6,0x22,0xB6,0xAD,0x47,0x71,0x46,0xAD,0x6C,0x05,0xA9,0x8E,0x65,0xDE,0x3A}) || !ff_guidcmp(g, (const ff_asf_guid){0xCC,0x32,0x64,0xDD,0x29,0xE2,0xDB,0x40,0x80,0xF6,0xD2,0x63,0x28,0xD2,0x76,0x1F}) || !ff_guidcmp(g, (const ff_asf_guid){0xBE,0xBF,0x1C,0x50,0x49,0xB8,0xCE,0x42,0x9B,0xE9,0x3D,0xB8,0x69,0xFB,0x82,0xB3}) || !ff_guidcmp(g, (const ff_asf_guid){0xE5,0xC5,0x67,0x90,0x5C,0x4C,0x05,0x42,0x86,0xC8,0x7A,0xFE,0x20,0xFE,0x1E,0xFA}) || !ff_guidcmp(g, (const ff_asf_guid){0x80,0x6D,0xF3,0x41,0x32,0x41,0xC2,0x4C,0xB1,0x21,0x01,0xA4,0x32,0x19,0xD8,0x1B}) || !ff_guidcmp(g, (const ff_asf_guid){0x51,0x1D,0xAB,0x72,0xD2,0x87,0x9B,0x48,0xBA,0x11,0x0E,0x08,0xDC,0x21,0x02,0x43}) || !ff_guidcmp(g, (const ff_asf_guid){0x65,0x8F,0xFC,0x47,0xBB,0xE2,0x34,0x46,0x9C,0xEF,0xFD,0xBF,0xE6,0x26,0x1D,0x5C}) || !ff_guidcmp(g, (const ff_asf_guid){0xCB,0xC5,0x68,0x80,0x04,0x3C,0x2B,0x49,0xB4,0x7D,0x03,0x08,0x82,0x0D,0xCE,0x51}) || !ff_guidcmp(g, (const ff_asf_guid){0xBC,0x2E,0xAF,0x82,0xA6,0x30,0x64,0x42,0xA8,0x0B,0xAD,0x2E,0x13,0x72,0xAC,0x60}) || !ff_guidcmp(g, (const ff_asf_guid){0x1E,0xBE,0xC3,0xC5,0x43,0x92,0xDC,0x11,0x85,0xE5,0x00,0x12,0x3F,0x6F,0x73,0xB9}) || !ff_guidcmp(g, (const ff_asf_guid){0x3B,0x86,0xA2,0xB1,0xEB,0x1E,0xC3,0x44,0x8C,0x88,0x1C,0xA3,0xFF,0xE3,0xE7,0x6A}) || !ff_guidcmp(g, (const ff_asf_guid){0x4E,0x7F,0x4C,0x5B,0xC4,0xD0,0x38,0x4B,0xA8,0x3E,0x21,0x7F,0x7B,0xBF,0x52,0xE7}) || !ff_guidcmp(g, (const ff_asf_guid){0x63,0x36,0xEB,0xFE,0xA1,0x7E,0xD9,0x11,0x83,0x08,0x00,0x07,0xE9,0x5E,0xAD,0x8D}) || !ff_guidcmp(g, (const ff_asf_guid){0x70,0xE9,0xF1,0xF8,0x89,0xA4,0x4C,0x4D,0x83,0x73,0xB8,0x12,0xE0,0xD5,0xF8,0x1E}) || !ff_guidcmp(g, (const ff_asf_guid){0x96,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D}) || !ff_guidcmp(g, (const ff_asf_guid){0x97,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D}) || !ff_guidcmp(g, (const ff_asf_guid){0xA1,0xC3,0xD2,0xC2,0x7E,0x9A,0xDA,0x11,0x8B,0xF7,0x00,0x07,0xE9,0x5E,0xAD,0x8D})) { } else av_log(s, AV_LOG_WARNING, "unsupported chunk:"PRI_GUID"\n", ARG_GUID(g)); url_fskip(pb, WTV_PAD8(len) - consumed); } return AVERROR_EOF; }
1threat
keras vs. tensorflow.python.keras - which one to use? : <p>Which one is the recommended (or more future-proof) way to use Keras?</p> <p>What are the advantages/disadvantages of each?</p> <p>I guess there are more differences than simply saving one <code>pip install</code> step and writing <code>tensorflow.python.keras</code> instead of <code>keras</code>.</p>
0debug
Calling an async method from component constructor in Dart : <p>Let's assume that an initialization of MyComponent in Dart requires sending an HttpRequest to the server. Is it possible to construct an object synchronously and defer a 'real' initialization till the response come back?</p> <p>In the example below, the _init() function is not called until "done" is printed. Is it possible to fix this?</p> <pre><code>import 'dart:async'; import 'dart:io'; class MyComponent{ MyComponent() { _init(); } Future _init() async { print("init"); } } void main() { var c = new MyComponent(); sleep(const Duration(seconds: 1)); print("done"); } </code></pre> <p><strong>Output</strong>:</p> <pre><code>done init </code></pre>
0debug
Angular 8 : Merging two objects in an array : <p>I have a couple of objects inside of an array :</p> <pre><code>array1 =[{name : "Cena", age : 44},{job : "actor", location : "USA"}] </code></pre> <p>is there a way for me to merge these two objects to get something like : </p> <pre><code>array2 =[{name : "Cena", age : 44, job : "actor", location : "USA"}] </code></pre> <p>I tried looping through the elements but it is not a good option if the object is a big one, I guess. Any good solution using typescript?</p>
0debug
take more time filter from 3 crore records in hive table compare to mysql(Approx 3 GB Size) : I am working with `hive` table to execute one of sql to fetch some records from 3 crore records but it is taking more time to execute with map reduce process (300 seconds) and `mysql` fetch this information in less 1 seconds. Could you suggest me why `hive` take more time or any other way to fetch quick response. As I am using `Ambari` Cluster with `Tez` engine. Could you guide me for this. As I am confusing for moving database on `hadoop`. Let me know your concerns. Thanks in advance.
0debug
How to print to console in Spring Boot Web Application : <p>Coming from a Node background, what is the equivalent of console.log() in spring boot?</p> <p>For example I'd like to see in my console the job info in the following method.</p> <pre><code>@RequestMapping(value = "jobposts/create", method = RequestMethod.POST) public Job create(@RequestBody Job job){ System.out.println(job); return jobRepository.saveAndFlush(job); } </code></pre> <p>System.out.println(); is how I know to do it in Java but it doesn't seem to appear in my console. Using IntelliJ.</p>
0debug
Need to parse the json array using php : <p>i have a json array like below,</p> <pre><code>{ "months": { "1": ["1"], "2": ["10"] }, "days": { "1": ["1", "2"], "2": ["2", "3"] } } </code></pre> <p>i need to parse this in php. Need months and days values. Thanks in advance..</p>
0debug
static int hls_slice_header(HEVCContext *s) { GetBitContext *gb = &s->HEVClc->gb; SliceHeader *sh = &s->sh; int i, j, ret; sh->first_slice_in_pic_flag = get_bits1(gb); if ((IS_IDR(s) || IS_BLA(s)) && sh->first_slice_in_pic_flag) { s->seq_decode = (s->seq_decode + 1) & 0xff; s->max_ra = INT_MAX; if (IS_IDR(s)) ff_hevc_clear_refs(s); } sh->no_output_of_prior_pics_flag = 0; if (IS_IRAP(s)) sh->no_output_of_prior_pics_flag = get_bits1(gb); sh->pps_id = get_ue_golomb_long(gb); if (sh->pps_id >= MAX_PPS_COUNT || !s->pps_list[sh->pps_id]) { av_log(s->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", sh->pps_id); return AVERROR_INVALIDDATA; } if (!sh->first_slice_in_pic_flag && s->pps != (HEVCPPS*)s->pps_list[sh->pps_id]->data) { av_log(s->avctx, AV_LOG_ERROR, "PPS changed between slices.\n"); return AVERROR_INVALIDDATA; } s->pps = (HEVCPPS*)s->pps_list[sh->pps_id]->data; if (s->nal_unit_type == NAL_CRA_NUT && s->last_eos == 1) sh->no_output_of_prior_pics_flag = 1; if (s->sps != (HEVCSPS*)s->sps_list[s->pps->sps_id]->data) { const HEVCSPS* last_sps = s->sps; s->sps = (HEVCSPS*)s->sps_list[s->pps->sps_id]->data; if (last_sps && IS_IRAP(s) && s->nal_unit_type != NAL_CRA_NUT) { if (s->sps->width != last_sps->width || s->sps->height != last_sps->height || s->sps->temporal_layer[s->sps->max_sub_layers - 1].max_dec_pic_buffering != last_sps->temporal_layer[last_sps->max_sub_layers - 1].max_dec_pic_buffering) sh->no_output_of_prior_pics_flag = 0; } ff_hevc_clear_refs(s); ret = set_sps(s, s->sps, AV_PIX_FMT_NONE); if (ret < 0) return ret; s->seq_decode = (s->seq_decode + 1) & 0xff; s->max_ra = INT_MAX; } sh->dependent_slice_segment_flag = 0; if (!sh->first_slice_in_pic_flag) { int slice_address_length; if (s->pps->dependent_slice_segments_enabled_flag) sh->dependent_slice_segment_flag = get_bits1(gb); slice_address_length = av_ceil_log2(s->sps->ctb_width * s->sps->ctb_height); sh->slice_segment_addr = get_bits(gb, slice_address_length); if (sh->slice_segment_addr >= s->sps->ctb_width * s->sps->ctb_height) { av_log(s->avctx, AV_LOG_ERROR, "Invalid slice segment address: %u.\n", sh->slice_segment_addr); return AVERROR_INVALIDDATA; } if (!sh->dependent_slice_segment_flag) { sh->slice_addr = sh->slice_segment_addr; s->slice_idx++; } } else { sh->slice_segment_addr = sh->slice_addr = 0; s->slice_idx = 0; s->slice_initialized = 0; } if (!sh->dependent_slice_segment_flag) { s->slice_initialized = 0; for (i = 0; i < s->pps->num_extra_slice_header_bits; i++) skip_bits(gb, 1); sh->slice_type = get_ue_golomb_long(gb); if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || sh->slice_type == B_SLICE)) { av_log(s->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", sh->slice_type); return AVERROR_INVALIDDATA; } if (IS_IRAP(s) && sh->slice_type != I_SLICE) { av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); return AVERROR_INVALIDDATA; } sh->pic_output_flag = 1; if (s->pps->output_flag_present_flag) sh->pic_output_flag = get_bits1(gb); if (s->sps->separate_colour_plane_flag) sh->colour_plane_id = get_bits(gb, 2); if (!IS_IDR(s)) { int poc; sh->pic_order_cnt_lsb = get_bits(gb, s->sps->log2_max_poc_lsb); poc = ff_hevc_compute_poc(s, sh->pic_order_cnt_lsb); if (!sh->first_slice_in_pic_flag && poc != s->poc) { av_log(s->avctx, AV_LOG_WARNING, "Ignoring POC change between slices: %d -> %d\n", s->poc, poc); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; poc = s->poc; } s->poc = poc; sh->short_term_ref_pic_set_sps_flag = get_bits1(gb); if (!sh->short_term_ref_pic_set_sps_flag) { int pos = get_bits_left(gb); ret = ff_hevc_decode_short_term_rps(s, &sh->slice_rps, s->sps, 1); if (ret < 0) return ret; sh->short_term_ref_pic_set_size = pos - get_bits_left(gb); sh->short_term_rps = &sh->slice_rps; } else { int numbits, rps_idx; if (!s->sps->nb_st_rps) { av_log(s->avctx, AV_LOG_ERROR, "No ref lists in the SPS.\n"); return AVERROR_INVALIDDATA; } numbits = av_ceil_log2(s->sps->nb_st_rps); rps_idx = numbits > 0 ? get_bits(gb, numbits) : 0; sh->short_term_rps = &s->sps->st_rps[rps_idx]; } ret = decode_lt_rps(s, &sh->long_term_rps, gb); if (ret < 0) { av_log(s->avctx, AV_LOG_WARNING, "Invalid long term RPS.\n"); if (s->avctx->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } if (s->sps->sps_temporal_mvp_enabled_flag) sh->slice_temporal_mvp_enabled_flag = get_bits1(gb); else sh->slice_temporal_mvp_enabled_flag = 0; } else { s->sh.short_term_rps = NULL; s->poc = 0; } if (s->temporal_id == 0 && s->nal_unit_type != NAL_TRAIL_N && s->nal_unit_type != NAL_TSA_N && s->nal_unit_type != NAL_STSA_N && s->nal_unit_type != NAL_RADL_N && s->nal_unit_type != NAL_RADL_R && s->nal_unit_type != NAL_RASL_N && s->nal_unit_type != NAL_RASL_R) s->pocTid0 = s->poc; if (s->sps->sao_enabled) { sh->slice_sample_adaptive_offset_flag[0] = get_bits1(gb); if (s->sps->chroma_format_idc) { sh->slice_sample_adaptive_offset_flag[1] = sh->slice_sample_adaptive_offset_flag[2] = get_bits1(gb); } } else { sh->slice_sample_adaptive_offset_flag[0] = 0; sh->slice_sample_adaptive_offset_flag[1] = 0; sh->slice_sample_adaptive_offset_flag[2] = 0; } sh->nb_refs[L0] = sh->nb_refs[L1] = 0; if (sh->slice_type == P_SLICE || sh->slice_type == B_SLICE) { int nb_refs; sh->nb_refs[L0] = s->pps->num_ref_idx_l0_default_active; if (sh->slice_type == B_SLICE) sh->nb_refs[L1] = s->pps->num_ref_idx_l1_default_active; if (get_bits1(gb)) { sh->nb_refs[L0] = get_ue_golomb_long(gb) + 1; if (sh->slice_type == B_SLICE) sh->nb_refs[L1] = get_ue_golomb_long(gb) + 1; } if (sh->nb_refs[L0] > MAX_REFS || sh->nb_refs[L1] > MAX_REFS) { av_log(s->avctx, AV_LOG_ERROR, "Too many refs: %d/%d.\n", sh->nb_refs[L0], sh->nb_refs[L1]); return AVERROR_INVALIDDATA; } sh->rpl_modification_flag[0] = 0; sh->rpl_modification_flag[1] = 0; nb_refs = ff_hevc_frame_nb_refs(s); if (!nb_refs) { av_log(s->avctx, AV_LOG_ERROR, "Zero refs for a frame with P or B slices.\n"); return AVERROR_INVALIDDATA; } if (s->pps->lists_modification_present_flag && nb_refs > 1) { sh->rpl_modification_flag[0] = get_bits1(gb); if (sh->rpl_modification_flag[0]) { for (i = 0; i < sh->nb_refs[L0]; i++) sh->list_entry_lx[0][i] = get_bits(gb, av_ceil_log2(nb_refs)); } if (sh->slice_type == B_SLICE) { sh->rpl_modification_flag[1] = get_bits1(gb); if (sh->rpl_modification_flag[1] == 1) for (i = 0; i < sh->nb_refs[L1]; i++) sh->list_entry_lx[1][i] = get_bits(gb, av_ceil_log2(nb_refs)); } } if (sh->slice_type == B_SLICE) sh->mvd_l1_zero_flag = get_bits1(gb); if (s->pps->cabac_init_present_flag) sh->cabac_init_flag = get_bits1(gb); else sh->cabac_init_flag = 0; sh->collocated_ref_idx = 0; if (sh->slice_temporal_mvp_enabled_flag) { sh->collocated_list = L0; if (sh->slice_type == B_SLICE) sh->collocated_list = !get_bits1(gb); if (sh->nb_refs[sh->collocated_list] > 1) { sh->collocated_ref_idx = get_ue_golomb_long(gb); if (sh->collocated_ref_idx >= sh->nb_refs[sh->collocated_list]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid collocated_ref_idx: %d.\n", sh->collocated_ref_idx); return AVERROR_INVALIDDATA; } } } if ((s->pps->weighted_pred_flag && sh->slice_type == P_SLICE) || (s->pps->weighted_bipred_flag && sh->slice_type == B_SLICE)) { pred_weight_table(s, gb); } sh->max_num_merge_cand = 5 - get_ue_golomb_long(gb); if (sh->max_num_merge_cand < 1 || sh->max_num_merge_cand > 5) { av_log(s->avctx, AV_LOG_ERROR, "Invalid number of merging MVP candidates: %d.\n", sh->max_num_merge_cand); return AVERROR_INVALIDDATA; } } sh->slice_qp_delta = get_se_golomb(gb); if (s->pps->pic_slice_level_chroma_qp_offsets_present_flag) { sh->slice_cb_qp_offset = get_se_golomb(gb); sh->slice_cr_qp_offset = get_se_golomb(gb); } else { sh->slice_cb_qp_offset = 0; sh->slice_cr_qp_offset = 0; } if (s->pps->chroma_qp_offset_list_enabled_flag) sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb); else sh->cu_chroma_qp_offset_enabled_flag = 0; if (s->pps->deblocking_filter_control_present_flag) { int deblocking_filter_override_flag = 0; if (s->pps->deblocking_filter_override_enabled_flag) deblocking_filter_override_flag = get_bits1(gb); if (deblocking_filter_override_flag) { sh->disable_deblocking_filter_flag = get_bits1(gb); if (!sh->disable_deblocking_filter_flag) { sh->beta_offset = get_se_golomb(gb) * 2; sh->tc_offset = get_se_golomb(gb) * 2; } } else { sh->disable_deblocking_filter_flag = s->pps->disable_dbf; sh->beta_offset = s->pps->beta_offset; sh->tc_offset = s->pps->tc_offset; } } else { sh->disable_deblocking_filter_flag = 0; sh->beta_offset = 0; sh->tc_offset = 0; } if (s->pps->seq_loop_filter_across_slices_enabled_flag && (sh->slice_sample_adaptive_offset_flag[0] || sh->slice_sample_adaptive_offset_flag[1] || !sh->disable_deblocking_filter_flag)) { sh->slice_loop_filter_across_slices_enabled_flag = get_bits1(gb); } else { sh->slice_loop_filter_across_slices_enabled_flag = s->pps->seq_loop_filter_across_slices_enabled_flag; } } else if (!s->slice_initialized) { av_log(s->avctx, AV_LOG_ERROR, "Independent slice segment missing.\n"); return AVERROR_INVALIDDATA; } sh->num_entry_point_offsets = 0; if (s->pps->tiles_enabled_flag || s->pps->entropy_coding_sync_enabled_flag) { unsigned num_entry_point_offsets = get_ue_golomb_long(gb); if (sh->num_entry_point_offsets > get_bits_left(gb)) { av_log(s->avctx, AV_LOG_ERROR, "num_entry_point_offsets %d is invalid\n", num_entry_point_offsets); return AVERROR_INVALIDDATA; } sh->num_entry_point_offsets = num_entry_point_offsets; if (sh->num_entry_point_offsets > 0) { int offset_len = get_ue_golomb_long(gb) + 1; if (offset_len < 1 || offset_len > 32) { sh->num_entry_point_offsets = 0; av_log(s->avctx, AV_LOG_ERROR, "offset_len %d is invalid\n", offset_len); return AVERROR_INVALIDDATA; } av_freep(&sh->entry_point_offset); av_freep(&sh->offset); av_freep(&sh->size); sh->entry_point_offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(int)); sh->offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(int)); sh->size = av_malloc_array(sh->num_entry_point_offsets, sizeof(int)); if (!sh->entry_point_offset || !sh->offset || !sh->size) { sh->num_entry_point_offsets = 0; av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate memory\n"); return AVERROR(ENOMEM); } for (i = 0; i < sh->num_entry_point_offsets; i++) { unsigned val = get_bits_long(gb, offset_len); sh->entry_point_offset[i] = val + 1; } if (s->threads_number > 1 && (s->pps->num_tile_rows > 1 || s->pps->num_tile_columns > 1)) { s->enable_parallel_tiles = 0; s->threads_number = 1; } else s->enable_parallel_tiles = 0; } else s->enable_parallel_tiles = 0; } if (s->pps->slice_header_extension_present_flag) { unsigned int length = get_ue_golomb_long(gb); if (length*8LL > get_bits_left(gb)) { av_log(s->avctx, AV_LOG_ERROR, "too many slice_header_extension_data_bytes\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < length; i++) skip_bits(gb, 8); } sh->slice_qp = 26U + s->pps->pic_init_qp_minus26 + sh->slice_qp_delta; if (sh->slice_qp > 51 || sh->slice_qp < -s->sps->qp_bd_offset) { av_log(s->avctx, AV_LOG_ERROR, "The slice_qp %d is outside the valid range " "[%d, 51].\n", sh->slice_qp, -s->sps->qp_bd_offset); return AVERROR_INVALIDDATA; } sh->slice_ctb_addr_rs = sh->slice_segment_addr; if (!s->sh.slice_ctb_addr_rs && s->sh.dependent_slice_segment_flag) { av_log(s->avctx, AV_LOG_ERROR, "Impossible slice segment.\n"); return AVERROR_INVALIDDATA; } if (get_bits_left(gb) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Overread slice header by %d bits\n", -get_bits_left(gb)); return AVERROR_INVALIDDATA; } s->HEVClc->first_qp_group = !s->sh.dependent_slice_segment_flag; if (!s->pps->cu_qp_delta_enabled_flag) s->HEVClc->qp_y = s->sh.slice_qp; s->slice_initialized = 1; s->HEVClc->tu.cu_qp_offset_cb = 0; s->HEVClc->tu.cu_qp_offset_cr = 0; return 0; }
1threat
how to sort partition in apache spark : Hi i have a used the dataframe which contains the query df : Dataframe =spark.sql(s"show Partitions $yourtablename") now the number of partition changes everyday as it runs everyday the main concern is i need to fetch the latest partition. supoose i get the partition for a random table for a particular day like year=2019/month=1/day=1 year=2019/month=1/day=10 year=2019/month=1/day=2 year=2019/month=1/day=21 year=2019/month=1/day=22 year=2019/month=1/day=23 year=2019/month=1/day=24 year=2019/month=1/day=25 year=2019/month=1/day=26 year=2019/month=2/day=27 year=2019/month=2/day=3 Now of you can see have as the functionality that it sorts the partition after day=1 comes day=10 so this creates a problem as need to fetch the latest partition. I have managed to get the partition by using val df =dff.orderby(col("partition").desc.limit(1) but this gives me the tail -1 partition and not the latest partition . How can i get the latest partition from the tables overcoming hives's limitation of arranging partition. so suppose in the above example i need to pickup year=2019/month=2/day=27 and not year=2019/month=2/day=3 which is the last partition in the table
0debug
static void spapr_populate_pa_features(PowerPCCPU *cpu, void *fdt, int offset, bool legacy_guest) { CPUPPCState *env = &cpu->env; uint8_t pa_features_206[] = { 6, 0, 0xf6, 0x1f, 0xc7, 0x00, 0x80, 0xc0 }; uint8_t pa_features_207[] = { 24, 0, 0xf6, 0x1f, 0xc7, 0xc0, 0x80, 0xf0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00 }; uint8_t pa_features_300[] = { 66, 0, 0xf6, 0x1f, 0xc7, 0xc0, 0x80, 0xf0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0xC0, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, }; uint8_t *pa_features = NULL; size_t pa_size; if (ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_06, 0, cpu->compat_pvr)) { pa_features = pa_features_206; pa_size = sizeof(pa_features_206); } if (ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_2_07, 0, cpu->compat_pvr)) { pa_features = pa_features_207; pa_size = sizeof(pa_features_207); } if (ppc_check_compat(cpu, CPU_POWERPC_LOGICAL_3_00, 0, cpu->compat_pvr)) { pa_features = pa_features_300; pa_size = sizeof(pa_features_300); } if (!pa_features) { return; } if (env->ci_large_pages) { pa_features[3] |= 0x20; } if (kvmppc_has_cap_htm() && pa_size > 24) { pa_features[24] |= 0x80; } if (legacy_guest && pa_size > 40) { pa_features[40 + 2] &= ~0x80; } _FDT((fdt_setprop(fdt, offset, "ibm,pa-features", pa_features, pa_size))); }
1threat
How Can One Use gcloud To Enable APIs : <p>I'm not able to find a way to use the <code>gcloud</code> command line program to change a project's Enabled APIs. My hunch is that it's going to be in the billing "arena" but I've been trying to find this and having much luck.</p>
0debug
C# error cannot convert sytem.text.regularexpressions.match to string : <p>The following block of code captures text from an HTML page, but I get the compile error on the following line:</p> <pre><code>St = Regex.Match(St, @"(?i)(?&lt;= |^)order(?= |$) (?i)(?&lt;= |^)Term (?i)(?&lt;= |^)oF [0-9]* (?i)(?&lt;= |^)years (?&lt;= |^)or (?&lt;= |^)Longer"); </code></pre> <p><strong>The code Block</strong>: </p> <pre><code> if (textordernode.InnerHtml.Contains("Order Term")) { String St = textordernode.InnerHtml; St = St.Replace(@"\r", ""); St = St.Replace(@"\n", ""); St = Regex.Replace(St, @"&lt;[^&gt;]+&gt;|&amp;nbsp;", " ").Trim(); St = Regex.Match(St, @"(?i)(?&lt;= |^)order(?= |$) (?i)(?&lt;= |^)Term (?i)(?&lt;= |^)oF [0-9]* (?i)(?&lt;= |^)years (?&lt;= |^)or (?&lt;= |^)Longer"); int pFrom = St.IndexOf("Order Term of ") + "Order Term of ".Length; int pTo = St.LastIndexOf("or longer"); try { textorderterm = St.Substring(pFrom, pTo - pFrom) + "or longer"; break; } catch (Exception ex) { textorderterm = ""; Console.WriteLine(ex.Message); } } </code></pre> <p>Could I get some help with this please?</p>
0debug
static ssize_t rtl8139_do_receive(VLANClientState *nc, const uint8_t *buf, size_t size_, int do_interrupt) { RTL8139State *s = DO_UPCAST(NICState, nc, nc)->opaque; int size = size_; const uint8_t *dot1q_buf = NULL; uint32_t packet_header = 0; uint8_t buf1[MIN_BUF_SIZE + VLAN_HLEN]; static const uint8_t broadcast_macaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; DEBUG_PRINT((">>> RTL8139: received len=%d\n", size)); if (!s->clock_enabled) { DEBUG_PRINT(("RTL8139: stopped ==========================\n")); return -1; } if (!rtl8139_receiver_enabled(s)) { DEBUG_PRINT(("RTL8139: receiver disabled ================\n")); return -1; } if (s->RxConfig & AcceptAllPhys) { DEBUG_PRINT((">>> RTL8139: packet received in promiscuous mode\n")); } else { if (!memcmp(buf, broadcast_macaddr, 6)) { if (!(s->RxConfig & AcceptBroadcast)) { DEBUG_PRINT((">>> RTL8139: broadcast packet rejected\n")); ++s->tally_counters.RxERR; return size; } packet_header |= RxBroadcast; DEBUG_PRINT((">>> RTL8139: broadcast packet received\n")); ++s->tally_counters.RxOkBrd; } else if (buf[0] & 0x01) { if (!(s->RxConfig & AcceptMulticast)) { DEBUG_PRINT((">>> RTL8139: multicast packet rejected\n")); ++s->tally_counters.RxERR; return size; } int mcast_idx = compute_mcast_idx(buf); if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) { DEBUG_PRINT((">>> RTL8139: multicast address mismatch\n")); ++s->tally_counters.RxERR; return size; } packet_header |= RxMulticast; DEBUG_PRINT((">>> RTL8139: multicast packet received\n")); ++s->tally_counters.RxOkMul; } else if (s->phys[0] == buf[0] && s->phys[1] == buf[1] && s->phys[2] == buf[2] && s->phys[3] == buf[3] && s->phys[4] == buf[4] && s->phys[5] == buf[5]) { if (!(s->RxConfig & AcceptMyPhys)) { DEBUG_PRINT((">>> RTL8139: rejecting physical address matching packet\n")); ++s->tally_counters.RxERR; return size; } packet_header |= RxPhysical; DEBUG_PRINT((">>> RTL8139: physical address matching packet received\n")); ++s->tally_counters.RxOkPhy; } else { DEBUG_PRINT((">>> RTL8139: unknown packet\n")); ++s->tally_counters.RxERR; return size; } } if (size < MIN_BUF_SIZE + VLAN_HLEN) { memcpy(buf1, buf, size); memset(buf1 + size, 0, MIN_BUF_SIZE + VLAN_HLEN - size); buf = buf1; if (size < MIN_BUF_SIZE) { size = MIN_BUF_SIZE; } } if (rtl8139_cp_receiver_enabled(s)) { DEBUG_PRINT(("RTL8139: in C+ Rx mode ================\n")); #define CP_RX_OWN (1<<31) #define CP_RX_EOR (1<<30) #define CP_RX_BUFFER_SIZE_MASK ((1<<13) - 1) #define CP_RX_TAVA (1<<16) #define CP_RX_VLAN_TAG_MASK ((1<<16) - 1) int descriptor = s->currCPlusRxDesc; target_phys_addr_t cplus_rx_ring_desc; cplus_rx_ring_desc = rtl8139_addr64(s->RxRingAddrLO, s->RxRingAddrHI); cplus_rx_ring_desc += 16 * descriptor; DEBUG_PRINT(("RTL8139: +++ C+ mode reading RX descriptor %d from host memory at %08x %08x = %016" PRIx64 "\n", descriptor, s->RxRingAddrHI, s->RxRingAddrLO, (uint64_t)cplus_rx_ring_desc)); uint32_t val, rxdw0,rxdw1,rxbufLO,rxbufHI; cpu_physical_memory_read(cplus_rx_ring_desc, (uint8_t *)&val, 4); rxdw0 = le32_to_cpu(val); cpu_physical_memory_read(cplus_rx_ring_desc+4, (uint8_t *)&val, 4); rxdw1 = le32_to_cpu(val); cpu_physical_memory_read(cplus_rx_ring_desc+8, (uint8_t *)&val, 4); rxbufLO = le32_to_cpu(val); cpu_physical_memory_read(cplus_rx_ring_desc+12, (uint8_t *)&val, 4); rxbufHI = le32_to_cpu(val); DEBUG_PRINT(("RTL8139: +++ C+ mode RX descriptor %d %08x %08x %08x %08x\n", descriptor, rxdw0, rxdw1, rxbufLO, rxbufHI)); if (!(rxdw0 & CP_RX_OWN)) { DEBUG_PRINT(("RTL8139: C+ Rx mode : descriptor %d is owned by host\n", descriptor)); s->IntrStatus |= RxOverflow; ++s->RxMissed; ++s->tally_counters.RxERR; ++s->tally_counters.MissPkt; rtl8139_update_irq(s); return size_; } uint32_t rx_space = rxdw0 & CP_RX_BUFFER_SIZE_MASK; if (s->CpCmd & CPlusRxVLAN && be16_to_cpup((uint16_t *) &buf[ETHER_ADDR_LEN * 2]) == ETH_P_8021Q) { dot1q_buf = &buf[ETHER_ADDR_LEN * 2]; size -= VLAN_HLEN; if (size < MIN_BUF_SIZE) { size = MIN_BUF_SIZE; } rxdw1 &= ~CP_RX_VLAN_TAG_MASK; rxdw1 |= CP_RX_TAVA | le16_to_cpup((uint16_t *) &dot1q_buf[ETHER_TYPE_LEN]); DEBUG_PRINT(("RTL8139: C+ Rx mode : extracted vlan tag with tci: " "%u\n", be16_to_cpup((uint16_t *) &dot1q_buf[ETHER_TYPE_LEN]))); } else { rxdw1 &= ~CP_RX_TAVA; } if (size+4 > rx_space) { DEBUG_PRINT(("RTL8139: C+ Rx mode : descriptor %d size %d received %d + 4\n", descriptor, rx_space, size)); s->IntrStatus |= RxOverflow; ++s->RxMissed; ++s->tally_counters.RxERR; ++s->tally_counters.MissPkt; rtl8139_update_irq(s); return size_; } target_phys_addr_t rx_addr = rtl8139_addr64(rxbufLO, rxbufHI); if (dot1q_buf) { cpu_physical_memory_write(rx_addr, buf, 2 * ETHER_ADDR_LEN); cpu_physical_memory_write(rx_addr + 2 * ETHER_ADDR_LEN, buf + 2 * ETHER_ADDR_LEN + VLAN_HLEN, size - 2 * ETHER_ADDR_LEN); } else { cpu_physical_memory_write(rx_addr, buf, size); } if (s->CpCmd & CPlusRxChkSum) { } val = cpu_to_le32(crc32(0, buf, size_)); cpu_physical_memory_write( rx_addr+size, (uint8_t *)&val, 4); #define CP_RX_STATUS_FS (1<<29) #define CP_RX_STATUS_LS (1<<28) #define CP_RX_STATUS_MAR (1<<26) #define CP_RX_STATUS_PAM (1<<25) #define CP_RX_STATUS_BAR (1<<24) #define CP_RX_STATUS_RUNT (1<<19) #define CP_RX_STATUS_CRC (1<<18) #define CP_RX_STATUS_IPF (1<<15) #define CP_RX_STATUS_UDPF (1<<14) #define CP_RX_STATUS_TCPF (1<<13) rxdw0 &= ~CP_RX_OWN; rxdw0 |= CP_RX_STATUS_FS; rxdw0 |= CP_RX_STATUS_LS; if (packet_header & RxBroadcast) rxdw0 |= CP_RX_STATUS_BAR; if (packet_header & RxMulticast) rxdw0 |= CP_RX_STATUS_MAR; if (packet_header & RxPhysical) rxdw0 |= CP_RX_STATUS_PAM; rxdw0 &= ~CP_RX_BUFFER_SIZE_MASK; rxdw0 |= (size+4); val = cpu_to_le32(rxdw0); cpu_physical_memory_write(cplus_rx_ring_desc, (uint8_t *)&val, 4); val = cpu_to_le32(rxdw1); cpu_physical_memory_write(cplus_rx_ring_desc+4, (uint8_t *)&val, 4); ++s->tally_counters.RxOk; if (rxdw0 & CP_RX_EOR) { s->currCPlusRxDesc = 0; } else { ++s->currCPlusRxDesc; } DEBUG_PRINT(("RTL8139: done C+ Rx mode ----------------\n")); } else { DEBUG_PRINT(("RTL8139: in ring Rx mode ================\n")); int avail = MOD2(s->RxBufferSize + s->RxBufPtr - s->RxBufAddr, s->RxBufferSize); if (avail != 0 && size + 8 >= avail) { DEBUG_PRINT(("rx overflow: rx buffer length %d head 0x%04x read 0x%04x === available 0x%04x need 0x%04x\n", s->RxBufferSize, s->RxBufAddr, s->RxBufPtr, avail, size + 8)); s->IntrStatus |= RxOverflow; ++s->RxMissed; rtl8139_update_irq(s); return size_; } packet_header |= RxStatusOK; packet_header |= (((size+4) << 16) & 0xffff0000); uint32_t val = cpu_to_le32(packet_header); rtl8139_write_buffer(s, (uint8_t *)&val, 4); rtl8139_write_buffer(s, buf, size); val = cpu_to_le32(crc32(0, buf, size)); rtl8139_write_buffer(s, (uint8_t *)&val, 4); s->RxBufAddr = MOD2((s->RxBufAddr + 3) & ~0x3, s->RxBufferSize); DEBUG_PRINT((" received: rx buffer length %d head 0x%04x read 0x%04x\n", s->RxBufferSize, s->RxBufAddr, s->RxBufPtr)); } s->IntrStatus |= RxOK; if (do_interrupt) { rtl8139_update_irq(s); } return size_; }
1threat
Store php script output to a variable in Shell : <p>I wanna save the output of the following command to a variable:</p> <pre><code>#!/bin/bash php -f myFile.php </code></pre> <p>How can I do?</p>
0debug
CSS top not working : <p>i have this code html.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;e-Rario&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div style="height: 60px; background: blue;"&gt; &lt;div style="top: 25%; background: green;"&gt;e-Rario&lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Why is the top property nor working?</p>
0debug
static void unset_dirty_tracking(void) { BlkMigDevState *bmds; QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) { bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap); } }
1threat
How do I make an image act as a upload file button : <p>I want to make a image act like a button that when pressed it allows me to upload another image.</p> <p>What I have right now is the part in the snippet but I want to make it pull a image from my server to act as the button and then run some ajax to not have to reload the page then display the image that was chosen (the previous image should change to the one that was chosen).</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.Uploadbtn { position: relative; overflow: hidden; padding: 10px 20px; text-transform: uppercase; color: #fff; background: #000066; -webkit-border-radius: 4px; -moz-border-radius: 4px; -ms-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; width: 100px; text-align: center; cursor: pointer; } .Uploadbtn .input-upload { position: absolute; top: 0; right: 0; margin: 0; padding: 0; opacity: 0; height: 100%; width: 100%; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="Uploadbtn"&gt; &lt;input type="file" class="input-upload" /&gt; &lt;span&gt;IMAGE&lt;/span&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
0debug
How do I fix this script (Powershell) : Hi I am trying to get this short script to work and I dont understand why, Powershell gives somewhat garbled and useless error messages! Script:- $us = Read-Host 'Enter Your User Group Name:' |Get-ADGroup -Filter {name -like "*$us*"} -Properties Description,info | Select Name | Sort Name Error:- Get-ADGroup : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input. At line:1 char:42 + ... ser Name:' |Get-ADGroup -Filter {name -like "*$us*"} -Properties Desc ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (River:PSObject) [Get-ADGroup], ParameterBindingException + FullyQualifiedErrorId : InputObjectNotBound,Microsoft.ActiveDirectory.Management.Commands.GetADGroup
0debug
Understanding foldLeft in Scala : <p>Please help me understand the below statement. I couldn't understand how foldLeft works here:</p> <pre><code>scala&gt; l1 res71: List[Double] = List(1.0, 1.0, 1.0) scala&gt; l2 res72: List[Double] = List(1.5, 0.0) scala&gt; l1.foldLeft(l2) { (a,b) =&gt; (b + a.head) :: a} res73: List[Double] = List(4.5, 3.5, 2.5, 1.5, 0.0) </code></pre>
0debug
Sum of Numeric values in perl : Im new to PERL scripting and now working on a program to improve my knowledge in perl. For example i have a input file which has data in pattern date, transaction ID,name of website,amount), im trying here to get sum of all transactions that are made in www.example.com. Since there are two numeric fields (transaction ID & amount) <br/> im unable to pick using the below command $var =~ m/(\d+)/ Here is the sample input file. `26/06/2018 12890765 www.example.com 986.00` `31/08/2018 17464946 www.other.com 7627.00` `1/05/2018 65472345 www.example.com 14.00` Now help me how can i pick only 986 or 7627 or 14 from the file and So here if run a code with www.example.com as argument i should get sum as 1000.
0debug
static int qemu_chr_open_win_con(QemuOpts *opts, CharDriverState **chr) { return qemu_chr_open_win_file(GetStdHandle(STD_OUTPUT_HANDLE), chr); }
1threat
How to differentiate build triggers in Jenkins Pipeline : <p>I'm hoping to add a conditional stage to my Jenkinsfile that runs depending on how the build was triggered. Currently we are set up such that builds are either triggered by: </p> <ol> <li>changes to our git repo that are picked up on branch indexing </li> <li>a user manually triggering the build using the 'build now' button in the UI. </li> </ol> <p>Is there any way to run different pipeline steps depending on which of these actions triggered the build?</p>
0debug
Incorrect endDate in CMPedometerData : <p>I design app with CMPedometer and have one strange problem. I have logs from my client and i look this CMPedometerData, that i think really incorrect and i cant understand why this is so</p> <blockquote> <p>[2017-04-11 20:16:34 +0000] CMPedometerData, startDate 2017-04-11 20:16:32 +0000 endDate 2017-04-11 20:18:41 +0000 steps 3 distance 2.130000000004657 floorsAscended (null) floorsDescended (null) currentPace (null) currentCadence (null) averageActivePace 0></p> </blockquote> <p>As you can see my client (i cant reproduce this error) got pedometerData from method <code>startPedometerUpdatesFromDate</code> and endDate 2017-04-11 20:18:41 is bigger than now 2017-04-11 20:16:34 (it was first CMPedometerData after startPedometerUpdatesFromDate was launched after returning from background - <code>willEnterForeground</code> method). Maybe someone has already encountered a similar problem?</p> <p>The part of my code:</p> <pre><code>- (void)didEnterBackground { dispatch_async(dispatch_get_main_queue(), ^{ [[Pedometer sharedInstance].motionActivityManager stopActivityUpdates]; [[Pedometer sharedInstance].pedometer stopPedometerUpdates]; }); } - (void)willEnterForeground { NSDate *nowDate = [NSDate new]; /* here is request to get historical data from lastDateUpdate (store in database) to now date */ [[Pedometer sharedInstance] importDataFrom:lastDateUpdate endDate:nowDate completion:^{ dispatch_async(dispatch_get_main_queue(), ^{ /* show info */ }); }]; dispatch_async(dispatch_get_main_queue(), ^{ [self startUpdatingData:nowDate]; }); lastDateUpdate = nowDate; } - (void)startUpdatingData:(NSDate *)fromDate { NSOperationQueue *activityQueue = [[NSOperationQueue alloc] init]; [[Pedometer sharedInstance].motionActivityManager startActivityUpdatesToQueue:activityQueue withHandler:^(CMMotionActivity * _Nullable act) { ... }]; [[Pedometer sharedInstance].pedometer startPedometerUpdatesFromDate:fromDate withHandler:^(CMPedometerData * _Nullable pedometerData1, NSError * _Nullable error) { ... NSLog(@"%@", pedometerData1); ... lastDateUpdate = pedometerData1.endDate; ... }]; } </code></pre>
0debug
Simple script not working on my html code for my site : <p>I am learning HTML and Javascript, but it seems I did something wrong and I can't figure it out, why won't my script work? It is supposed to change the size of the image when you hover over with the mouse. I'm just investigating to learn how to do stuff.</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; Kikito's Sprites &lt;/title&gt; &lt;/head&gt; &lt;body style="background-color:#ffc299"&gt; &lt;div&gt; &lt;h1 style="color:white"&gt; Kikito Loco Sprite Showcaserino &lt;/h1&gt; &lt;img onmouseover="descriptiveTextImg(this)" onmouseout="normalImg(this)" src="monigoteTransparencia.png" alt="Amicable Anthony" style="position:absolute;top:100px;left:-50px;width:300px;height:300px;"&gt; &lt;img src="ballinBob.png" alt="Ballin Bob" style="position:absolute;top:90px;left:130px;width:300px;height:300px;"&gt; &lt;img src="severedArm.png" alt="just some pixel gore" style= "position:absolute;top:350px;left:-40px;width:300px;height:300px;"&gt; &lt;img src="shinySkin.png" alt="Shiny Skin" style="position:absolute;top:350px;left:200px;width:300px;height:300px;"&gt; &lt;img src="bigBall.png" alt="a cannonball" style= "position:absolute;top:640px;left:-40px;width:300px;height:300px;"&gt; &lt;/div&gt; &lt;script&gt; function descriptiveTextImg(x) { x.style.width = 400px; x.style.height = 400px; } function normalImg(x) { x.style.width = 300px; x.style.height = 300px; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
0debug
static int colo_do_checkpoint_transaction(MigrationState *s) { Error *local_err = NULL; colo_send_message(s->to_dst_file, COLO_MESSAGE_CHECKPOINT_REQUEST, &local_err); if (local_err) { goto out; } colo_receive_check_message(s->rp_state.from_dst_file, COLO_MESSAGE_CHECKPOINT_REPLY, &local_err); if (local_err) { goto out; } colo_send_message(s->to_dst_file, COLO_MESSAGE_VMSTATE_SEND, &local_err); if (local_err) { goto out; } colo_receive_check_message(s->rp_state.from_dst_file, COLO_MESSAGE_VMSTATE_RECEIVED, &local_err); if (local_err) { goto out; } colo_receive_check_message(s->rp_state.from_dst_file, COLO_MESSAGE_VMSTATE_LOADED, &local_err); if (local_err) { goto out; } return 0; out: if (local_err) { error_report_err(local_err); } return -EINVAL; }
1threat
Chrome Console SameSite Cookie Attribute Warning : <p>Is anybody else getting this Chrome console warning? </p> <blockquote> <p>A cookie associated with a cross-site resource at was set without the <code>SameSite</code> attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with <code>SameSite=None</code> and <code>Secure</code>. You can review cookies in developer tools under Application>Storage>Cookies and see more details at and .</p> </blockquote> <p>In Chrome Flags chrome://flags/ I've tried disabling both: </p> <ul> <li><p>SameSite by default cookies</p></li> <li><p>Cookies without SameSite must be secure</p></li> </ul> <p>And the warning won't go away. </p>
0debug
void iothread_stop(IOThread *iothread) { if (!iothread->ctx || iothread->stopping) { return; } iothread->stopping = true; aio_notify(iothread->ctx); if (atomic_read(&iothread->main_loop)) { g_main_loop_quit(iothread->main_loop); } qemu_thread_join(&iothread->thread); }
1threat
Maximum sum range in a array mod M and how many : Does any body know, an algorithm can give the maximum sum of a consecutive range of a array and how many times appears in the array
0debug
Using Import In NodeJS server : <p>At the moment all my module in my nodejs server are imported as require() ie:</p> <pre><code>let path = require('path'); let express = require('express'); let http = require('http'); let app = express(); </code></pre> <p>However the tutorial I am following shows them imported as:</p> <pre><code>import express from 'express' import path from 'path' </code></pre> <p>Which throws the error:</p> <pre><code>SyntaxError: Unexpected token import </code></pre> <p>My webpack.config.js is set up as:</p> <pre><code>module: { rules: [ { test: /\.js?$/, use: 'babel-loader', exclude: /node_modules/ } ] } </code></pre> <p>In bablerc:</p> <pre><code>{ "presets": ["es2015", "react"] } </code></pre> <p>My package versions:</p> <pre><code> "babel-core": "^6.7.6", "babel-loader": "^6.2.4", "babel-preset-es2015": "^6.6.0", "babel-preset-react": "^6.5.0", "react": "^15.0.1", "devDependencies": { "babel-cli": "^6.18.0", "babel-preset-env": "0.0.3", "webpack": "^2.2.1", "webpack-dev-middleware": "^1.10.1", "webpack-dev-server": "^2.4.1", "webpack-hot-middleware": "^2.17.1" } </code></pre> <p>Import works in all my react components files, just not server.js. How do I switch my server over to Import from require?</p>
0debug
Placement of const with clang-format : <p><code>clang-format</code> has tons of configuration options regarding whitespace and also some about code order (order of includes). Is it possible to reorder const-qualifiers so that they are placed to the right of the respective type?</p> <p>Example: The declaration <code>const int x = 0;</code> should be formatted to <code>int const x = 0;</code>.</p>
0debug
START_TEST(qdict_get_test) { QInt *qi; QObject *obj; const int value = -42; const char *key = "test"; qdict_put(tests_dict, key, qint_from_int(value)); obj = qdict_get(tests_dict, key); fail_unless(obj != NULL); qi = qobject_to_qint(obj); fail_unless(qint_get_int(qi) == value); }
1threat
How To Create MS Word Macro To Check Bold Paragraphs And Add Comments For Each : I've tried to create a macro to check bold paragraphs and add comments for each by using macro record function in word application. But it's not work for me. I need to create a macro for below criteria. 01. Search all bold paragraphs + without keep with next. 02. Then Add comments for each bold + without keep with next. (Ex Comment: Check Keep With Next) How do I do this.
0debug
Assigning Typescript constructor parameters : <p>I have interface :</p> <pre><code>export interface IFieldValue { name: string; value: string; } </code></pre> <p>And I have class that implements it :</p> <pre><code>class Person implements IFieldValue{ name: string; value: string; constructor (name: string, value: string) { this.name = name; this.value = value; } } </code></pre> <p>after reading <a href="https://www.stevefenton.co.uk/2013/04/stop-manually-assigning-typescript-constructor-parameters/" rel="noreferrer">this post</a> I've thinking about refactoring :</p> <pre><code>class Person implements IFieldValue{ constructor(public name: string, public value: string) { } } </code></pre> <p>Question : In first class I have fields which by default should be as <code>private</code>. In second sample I can only set them as <code>public</code>. Is it all correct or my understanding of default Access modifiers in TypeScript? </p>
0debug
static bool append_open_options(QDict *d, BlockDriverState *bs) { const QDictEntry *entry; QemuOptDesc *desc; bool found_any = false; for (entry = qdict_first(bs->options); entry; entry = qdict_next(bs->options, entry)) { if (strchr(qdict_entry_key(entry), '.')) { continue; } for (desc = bdrv_runtime_opts.desc; desc->name; desc++) { if (!strcmp(qdict_entry_key(entry), desc->name)) { break; } } if (desc->name) { continue; } qobject_incref(qdict_entry_value(entry)); qdict_put_obj(d, qdict_entry_key(entry), qdict_entry_value(entry)); found_any = true; } return found_any; }
1threat
translate aws cli code to python for lambda usage : I'm using a aws cli command to extract result for reporting and i must create a lambda that do the same job, but am facing many problem with synthax errors the aws cli : $ aws ec2 describe-instances --query 'Reservations[].Instances[].[Tags[?Key==`platform`]|[0].Value, Tags[?Key==`resource-version`]|[0].Value]| sort_by(@, &[0])' --output table --filter Name=tag:platform,Values=aip,mmt,pame --profile prod | uniq Could you help me to make the same code with python please ?
0debug
Firebase Hosting - password protect website? : <p>I have just deployed a website to Firebase hosting and it works great - setup was super easy.</p> <p>My question is, however, is there any way I can make accessing the website limited by authentication? It's an admin panel that only my team should be able to access. Is there any way I can password protect or privatize my website hosted on Firebase?</p> <p>Thanks!</p>
0debug
static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { AACEncContext *s = avctx->priv_data; float **samples = s->planar_samples, *samples2, *la, *overlap; ChannelElement *cpe; SingleChannelElement *sce; IndividualChannelStream *ics; int i, its, ch, w, chans, tag, start_ch, ret, frame_bits; int target_bits, rate_bits, too_many_bits, too_few_bits; int ms_mode = 0, is_mode = 0, tns_mode = 0, pred_mode = 0; int chan_el_counter[4]; FFPsyWindowInfo windows[AAC_MAX_CHANNELS]; if (s->last_frame == 2) return 0; if (frame) { if ((ret = ff_af_queue_add(&s->afq, frame)) < 0) return ret; } copy_input_samples(s, frame); if (s->psypp) ff_psy_preprocess(s->psypp, s->planar_samples, s->channels); if (!avctx->frame_number) return 0; start_ch = 0; for (i = 0; i < s->chan_map[0]; i++) { FFPsyWindowInfo* wi = windows + start_ch; tag = s->chan_map[i+1]; chans = tag == TYPE_CPE ? 2 : 1; cpe = &s->cpe[i]; for (ch = 0; ch < chans; ch++) { float clip_avoidance_factor; sce = &cpe->ch[ch]; ics = &sce->ics; s->cur_channel = start_ch + ch; overlap = &samples[s->cur_channel][0]; samples2 = overlap + 1024; la = samples2 + (448+64); if (!frame) la = NULL; if (tag == TYPE_LFE) { wi[ch].window_type[0] = ONLY_LONG_SEQUENCE; wi[ch].window_shape = 0; wi[ch].num_windows = 1; wi[ch].grouping[0] = 1; ics->num_swb = s->samplerate_index >= 8 ? 1 : 3; } else { wi[ch] = s->psy.model->window(&s->psy, samples2, la, s->cur_channel, ics->window_sequence[0]); } ics->window_sequence[1] = ics->window_sequence[0]; ics->window_sequence[0] = wi[ch].window_type[0]; ics->use_kb_window[1] = ics->use_kb_window[0]; ics->use_kb_window[0] = wi[ch].window_shape; ics->num_windows = wi[ch].num_windows; ics->swb_sizes = s->psy.bands [ics->num_windows == 8]; ics->num_swb = tag == TYPE_LFE ? ics->num_swb : s->psy.num_bands[ics->num_windows == 8]; ics->max_sfb = FFMIN(ics->max_sfb, ics->num_swb); ics->swb_offset = wi[ch].window_type[0] == EIGHT_SHORT_SEQUENCE ? ff_swb_offset_128 [s->samplerate_index]: ff_swb_offset_1024[s->samplerate_index]; ics->tns_max_bands = wi[ch].window_type[0] == EIGHT_SHORT_SEQUENCE ? ff_tns_max_bands_128 [s->samplerate_index]: ff_tns_max_bands_1024[s->samplerate_index]; clip_avoidance_factor = 0.0f; for (w = 0; w < ics->num_windows; w++) ics->group_len[w] = wi[ch].grouping[w]; for (w = 0; w < ics->num_windows; w++) { if (wi[ch].clipping[w] > CLIP_AVOIDANCE_FACTOR) { ics->window_clipping[w] = 1; clip_avoidance_factor = FFMAX(clip_avoidance_factor, wi[ch].clipping[w]); } else { ics->window_clipping[w] = 0; } } if (clip_avoidance_factor > CLIP_AVOIDANCE_FACTOR) { ics->clip_avoidance_factor = CLIP_AVOIDANCE_FACTOR / clip_avoidance_factor; } else { ics->clip_avoidance_factor = 1.0f; } apply_window_and_mdct(s, sce, overlap); if (s->options.ltp && s->coder->update_ltp) { s->coder->update_ltp(s, sce); apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, &sce->ltp_state[0]); s->mdct1024.mdct_calc(&s->mdct1024, sce->lcoeffs, sce->ret_buf); } if (isnan(cpe->ch->coeffs[0])) { av_log(avctx, AV_LOG_ERROR, "Input contains NaN\n"); return AVERROR(EINVAL); } avoid_clipping(s, sce); } start_ch += chans; } if ((ret = ff_alloc_packet2(avctx, avpkt, 8192 * s->channels, 0)) < 0) return ret; frame_bits = its = 0; do { init_put_bits(&s->pb, avpkt->data, avpkt->size); if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & AV_CODEC_FLAG_BITEXACT)) put_bitstream_info(s, LIBAVCODEC_IDENT); start_ch = 0; target_bits = 0; memset(chan_el_counter, 0, sizeof(chan_el_counter)); for (i = 0; i < s->chan_map[0]; i++) { FFPsyWindowInfo* wi = windows + start_ch; const float *coeffs[2]; tag = s->chan_map[i+1]; chans = tag == TYPE_CPE ? 2 : 1; cpe = &s->cpe[i]; cpe->common_window = 0; memset(cpe->is_mask, 0, sizeof(cpe->is_mask)); memset(cpe->ms_mask, 0, sizeof(cpe->ms_mask)); put_bits(&s->pb, 3, tag); put_bits(&s->pb, 4, chan_el_counter[tag]++); for (ch = 0; ch < chans; ch++) { sce = &cpe->ch[ch]; coeffs[ch] = sce->coeffs; sce->ics.predictor_present = 0; sce->ics.ltp.present = 0; memset(sce->ics.ltp.used, 0, sizeof(sce->ics.ltp.used)); memset(sce->ics.prediction_used, 0, sizeof(sce->ics.prediction_used)); memset(&sce->tns, 0, sizeof(TemporalNoiseShaping)); for (w = 0; w < 128; w++) if (sce->band_type[w] > RESERVED_BT) sce->band_type[w] = 0; } s->psy.bitres.alloc = -1; s->psy.bitres.bits = s->last_frame_pb_count / s->channels; s->psy.model->analyze(&s->psy, start_ch, coeffs, wi); if (s->psy.bitres.alloc > 0) { target_bits += s->psy.bitres.alloc * (s->lambda / (avctx->global_quality ? avctx->global_quality : 120)); s->psy.bitres.alloc /= chans; } s->cur_type = tag; for (ch = 0; ch < chans; ch++) { s->cur_channel = start_ch + ch; if (s->options.pns && s->coder->mark_pns) s->coder->mark_pns(s, avctx, &cpe->ch[ch]); s->coder->search_for_quantizers(avctx, s, &cpe->ch[ch], s->lambda); } if (chans > 1 && wi[0].window_type[0] == wi[1].window_type[0] && wi[0].window_shape == wi[1].window_shape) { cpe->common_window = 1; for (w = 0; w < wi[0].num_windows; w++) { if (wi[0].grouping[w] != wi[1].grouping[w]) { cpe->common_window = 0; break; } } } for (ch = 0; ch < chans; ch++) { sce = &cpe->ch[ch]; s->cur_channel = start_ch + ch; if (s->options.tns && s->coder->search_for_tns) s->coder->search_for_tns(s, sce); if (s->options.tns && s->coder->apply_tns_filt) s->coder->apply_tns_filt(s, sce); if (sce->tns.present) tns_mode = 1; if (s->options.pns && s->coder->search_for_pns) s->coder->search_for_pns(s, avctx, sce); } s->cur_channel = start_ch; if (s->options.intensity_stereo) { if (s->coder->search_for_is) s->coder->search_for_is(s, avctx, cpe); if (cpe->is_mode) is_mode = 1; apply_intensity_stereo(cpe); } if (s->options.pred) { for (ch = 0; ch < chans; ch++) { sce = &cpe->ch[ch]; s->cur_channel = start_ch + ch; if (s->options.pred && s->coder->search_for_pred) s->coder->search_for_pred(s, sce); if (cpe->ch[ch].ics.predictor_present) pred_mode = 1; } if (s->coder->adjust_common_pred) s->coder->adjust_common_pred(s, cpe); for (ch = 0; ch < chans; ch++) { sce = &cpe->ch[ch]; s->cur_channel = start_ch + ch; if (s->options.pred && s->coder->apply_main_pred) s->coder->apply_main_pred(s, sce); } s->cur_channel = start_ch; } if (s->options.mid_side) { if (s->options.mid_side == -1 && s->coder->search_for_ms) s->coder->search_for_ms(s, cpe); else if (cpe->common_window) memset(cpe->ms_mask, 1, sizeof(cpe->ms_mask)); apply_mid_side_stereo(cpe); } adjust_frame_information(cpe, chans); if (s->options.ltp) { for (ch = 0; ch < chans; ch++) { sce = &cpe->ch[ch]; s->cur_channel = start_ch + ch; if (s->coder->search_for_ltp) s->coder->search_for_ltp(s, sce, cpe->common_window); if (sce->ics.ltp.present) pred_mode = 1; } s->cur_channel = start_ch; if (s->coder->adjust_common_ltp) s->coder->adjust_common_ltp(s, cpe); } if (chans == 2) { put_bits(&s->pb, 1, cpe->common_window); if (cpe->common_window) { put_ics_info(s, &cpe->ch[0].ics); if (s->coder->encode_main_pred) s->coder->encode_main_pred(s, &cpe->ch[0]); if (s->coder->encode_ltp_info) s->coder->encode_ltp_info(s, &cpe->ch[0], 1); encode_ms_info(&s->pb, cpe); if (cpe->ms_mode) ms_mode = 1; } } for (ch = 0; ch < chans; ch++) { s->cur_channel = start_ch + ch; encode_individual_channel(avctx, s, &cpe->ch[ch], cpe->common_window); } start_ch += chans; } if (avctx->flags & CODEC_FLAG_QSCALE) { break; } frame_bits = put_bits_count(&s->pb); rate_bits = avctx->bit_rate * 1024 / avctx->sample_rate; rate_bits = FFMIN(rate_bits, 6144 * s->channels - 3); too_many_bits = FFMAX(target_bits, rate_bits); too_many_bits = FFMIN(too_many_bits, 6144 * s->channels - 3); too_few_bits = FFMIN(FFMAX(rate_bits - rate_bits/4, target_bits), too_many_bits); too_few_bits = too_few_bits - too_few_bits/8; too_many_bits = too_many_bits + too_many_bits/2; if ( its == 0 || (its < 5 && (frame_bits < too_few_bits || frame_bits > too_many_bits)) || frame_bits >= 6144 * s->channels - 3 ) { float ratio = ((float)rate_bits) / frame_bits; if (frame_bits >= too_few_bits && frame_bits <= too_many_bits) { ratio = sqrtf(sqrtf(ratio)); ratio = av_clipf(ratio, 0.9f, 1.1f); } else { ratio = sqrtf(ratio); } s->lambda = FFMIN(s->lambda * ratio, 65536.f); if (ratio > 0.9f && ratio < 1.1f) { break; } else { if (is_mode || ms_mode || tns_mode || pred_mode) { for (i = 0; i < s->chan_map[0]; i++) { chans = tag == TYPE_CPE ? 2 : 1; cpe = &s->cpe[i]; for (ch = 0; ch < chans; ch++) memcpy(cpe->ch[ch].coeffs, cpe->ch[ch].pcoeffs, sizeof(cpe->ch[ch].coeffs)); } } its++; } } else { break; } } while (1); if (s->options.ltp && s->coder->ltp_insert_new_frame) s->coder->ltp_insert_new_frame(s); put_bits(&s->pb, 3, TYPE_END); flush_put_bits(&s->pb); s->last_frame_pb_count = put_bits_count(&s->pb); s->lambda_sum += s->lambda; s->lambda_count++; if (!frame) s->last_frame++; ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts, &avpkt->duration); avpkt->size = put_bits_count(&s->pb) >> 3; *got_packet_ptr = 1; return 0; }
1threat
iam getting error in c++ 'PTHREAD_START_ROUTINE' was not declared in this scope : hey iam getting error saying \dll\dll.cpp|206|error: 'PTHREAD_START_ROUTINE' was not declared in this scope| \dll\dll.cpp|208|error: 'pfnThreadRtn' was not declared in this scope| |208|error: 'pfnThreadRtn' was not declared in this scope| how can i fix char CurPath[256]; strcpy(CurPath,dllpath); int len = (strlen(CurPath)+1)*2; WCHAR wCurPath[256]; MultiByteToWideChar(CP_ACP,0,CurPath,-1,wCurPath,256); pszLibFileRemote = (PWSTR) VirtualAllocEx(hRemoteProcess,NULL,len,MEM_COMMIT,PAGE_READWRITE); WriteProcessMemory(hRemoteProcess,pszLibFileRemote, (PVOID)wCurPath,len,NULL); PTHREAD_START_ROUTINE pfnThreadRtn = (PTHREAD_START_ROUTINE) GetProcAddress(GetModuleHandle(TEXT("Kernel32")), "LoadLibraryW"); hRemoteThread = CreateRemoteThread(hRemoteProcess,NULL,0,pfnThreadRtn,pszLibFileRemote,0,NULL); }
0debug
How to Build Transale System : I want build translate system o translate tex from english to arabic what kind of language should i use also what steps should if follow to build this system
0debug
def get_Pairs_Count(arr,n,sum): count = 0 for i in range(0,n): for j in range(i + 1,n): if arr[i] + arr[j] == sum: count += 1 return count
0debug