problem
stringlengths
26
131k
labels
class label
2 classes
static void arm_post_translate_insn(CPUARMState *env, DisasContext *dc) { if (dc->condjmp && !dc->base.is_jmp) { gen_set_label(dc->condlabel); dc->condjmp = 0; } if (dc->base.is_jmp == DISAS_NEXT && (dc->pc >= dc->next_page_start || (dc->pc >= dc->next_page_start - 3 && insn_crosses_page(env, dc)))) { dc->base.is_jmp = DISAS_TOO_MANY; } dc->base.pc_next = dc->pc; translator_loop_temp_check(&dc->base); }
1threat
Manifest merge failed. : I have tried to add recyclerView to android dependencies , but after adding that library it produce this error [enter image description here][1] [1]: https://i.stack.imgur.com/wzFl9.png I have added it via project structure
0debug
static void ipvideo_decode_opcodes(IpvideoContext *s, AVFrame *frame) { int x, y; unsigned char opcode; int ret; GetBitContext gb; bytestream2_skip(&s->stream_ptr, 14); if (!s->is_16bpp) { memcpy(frame->data[1], s->pal, AVPALETTE_SIZE); s->stride = frame->linesize[0]; } else { s->stride = frame->linesize[0] >> 1; s->mv_ptr = s->stream_ptr; bytestream2_skip(&s->mv_ptr, bytestream2_get_le16(&s->stream_ptr)); } s->line_inc = s->stride - 8; s->upper_motion_limit_offset = (s->avctx->height - 8) * frame->linesize[0] + (s->avctx->width - 8) * (1 + s->is_16bpp); init_get_bits(&gb, s->decoding_map, s->decoding_map_size * 8); for (y = 0; y < s->avctx->height; y += 8) { for (x = 0; x < s->avctx->width; x += 8) { if (get_bits_left(&gb) < 4) return; opcode = get_bits(&gb, 4); ff_tlog(s->avctx, " block @ (%3d, %3d): encoding 0x%X, data ptr offset %d\n", x, y, opcode, bytestream2_tell(&s->stream_ptr)); if (!s->is_16bpp) { s->pixel_ptr = frame->data[0] + x + y*frame->linesize[0]; ret = ipvideo_decode_block[opcode](s, frame); } else { s->pixel_ptr = frame->data[0] + x*2 + y*frame->linesize[0]; ret = ipvideo_decode_block16[opcode](s, frame); } if (ret != 0) { av_log(s->avctx, AV_LOG_ERROR, "decode problem on frame %d, @ block (%d, %d)\n", s->avctx->frame_number, x, y); return; } } } if (bytestream2_get_bytes_left(&s->stream_ptr) > 1) { av_log(s->avctx, AV_LOG_DEBUG, "decode finished with %d bytes left over\n", bytestream2_get_bytes_left(&s->stream_ptr)); } }
1threat
VueJs vue-router linking an external website : <p>This may be simple, but I've looked over documentation and can't find anything about it. I want to have my 'github' link redirect to say, github.com. However, its just appending '<a href="https://github.com" rel="noreferrer">https://github.com</a>' to my url instead of following the link. Here is a snippet:</p> <pre><code> &lt;BreadcrumbItem to='https://github.com'&gt; &lt;Icon type="social-github"&gt;&lt;/Icon&gt; &lt;/BreadcrumbItem&gt; </code></pre> <p>(This is using iView for custom CSS, but 'to' works in the same way as router-link).</p> <p>What ends up happening is this: <a href="https://i.stack.imgur.com/sJieR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sJieR.png" alt="enter image description here"></a></p>
0debug
Property '' does not exist on type 'Object'. Observable subscribe : <p>I have just started with Angular2 and I've got an issue I cannot really understand.</p> <p>I have some mock data created as such:</p> <pre><code>export const WORKFLOW_DATA: Object = { "testDataArray" : [ { key: "1", name: "Don Meow", source: "cat1.png" }, { key: "2", parent: "1", name: "Roquefort", source: "cat2.png" }, { key: "3", parent: "1", name: "Toulouse", source: "cat3.png" }, { key: "4", parent: "3", name: "Peppo", source: "cat4.png" }, { key: "5", parent: "3", name: "Alonzo", source: "cat5.png" }, { key: "6", parent: "2", name: "Berlioz", source: "cat6.png" } ] }; </code></pre> <p>Which is then imported in a service and "observed"</p> <pre><code>import { Injectable } from '@angular/core'; import { WORKFLOW_DATA } from './../mock-data/workflow' import {Observable} from "rxjs"; @Injectable() export class ApiService { constructor() { } getWorkflowForEditor(): Observable&lt;Object&gt; { return Observable.of( WORKFLOW_DATA ); } } </code></pre> <p>I then have a component which, in the constructor:</p> <pre><code>constructor( private apiService: ApiService) { this.apiService.getWorkflowForEditor().subscribe( WORKFLOW_DATA =&gt; { console.log( WORKFLOW_DATA); console.log( WORKFLOW_DATA.testDataArray ); } ); } </code></pre> <p>The first console.log logs an Object of type Object which contains the testDataArray property.</p> <p>The second console.log, results in an error at compile time:</p> <pre><code>Property 'testDataArray' does not exist on type 'Object'. </code></pre> <p>While still logging an array of objects [Object, Object, ..] as intended.</p> <p>I really do not understand why, I am sure I am doing something wrong, I would love an explanation.</p> <p>Thank you for any help!</p>
0debug
JavaScript: add the JSON data of one JS object to another : In the function there is an empty JS object var globalDataObject = [{}]; Then, there is a loop that goes over an array of users, stores the properties of each user in variables (ex. name, lastName) and creates an object for each user: //create an object containing the current name const currentObject = { 'profile': { 'name': nameVariable, 'lastName': lastNameVariable } }; QUESTION: what is the right way to add the data of currentObject to the globalDataObject once it's created? So that at the end the globalDataObject should be: var globalDataObject = [ 'profile': { 'name': 'John', 'lastName': 'Smith' } 'profile': { 'name': 'Ann', 'lastName': 'Lee' } 'profile': { 'name': 'Dan', 'lastName': 'Brown' } ]; Sorry if that's too simple but I really couldn't come up with the right way to do that. Important thing is that globalDataObject must be the JS object of the specified format (not the object containing multiple object and not the JSON array) since once it's created it is going to be converted into XML. Thank you for any help with this!
0debug
How to access Rest APIs mentioned in Cotroller class of a Jar file in my Spring Boot Application : I am new to Spring / Spring Boot. In my Spring Boot Application, I have a **JAR** file which has a Controller class and corresponding Service Interface (not class). I have implemented the Service interface and created a Service class with some logic. Now I want to access the APIs (/v1/getDetails) present in Controller class of JAR file. Can we access the REST APIs present in Controller class of JAR file? If so then please guide me. PS: I have tried to search on internet but didn't get a clear answer.
0debug
$ is not defined Javascript : <p>I'm writing a piece of code currently in tampermonkey and I can't work out why i get this error in the console of google chrome,"Execution of script 'PalaceBOT' failed! $ is not defined", I have another script that uses the same principals and I do not experience these issues.</p> <p>Script:</p> <pre><code>// ==UserScript== // @name SupremeBOT // @namespace // @version 0.1 // @description // @author @alfiefogg_ // @match http://www.supremenewyork.com/shop/* // @exclude http://wwww.supremenewyork.com/shop/cart // @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js // @grant none // ==/UserScript== var mySize = "large"; //Change to appropriate size var productSort = "accessories"; //Change to appropriate size (function() { var articles = $(".product-grid-item clearfix"); if(productSort != "all"){ for(var i = 0; i &lt; articles.length;i++) { var category = $(articles[i]).find("a").attr("href"); if(category.indexOf(productSort) == -1){ articles[i].remove(); document.getElementsByClassName("product-grid-item clearfix")[4].click(); } } } waitForKeyElements("#img-main", exe); })(); function exe(){ selectSize(); goCheckout(); } function goCheckout(){ var x = document.getElementById("add-remove-buttons"); var z = x.getElementsByClassName("button")[0]; if(z.className != "button remove"){ z.click(); setTimeout(goCheckout ,100); }else{ window.location = "https://www.supremenewyork.com/checkout"; } } function selectSize(){ var sizeObj = document.getElementById("size"); for(var i=0,sL=sizeObj.length;i&lt;sL;i++){ if(sizeObj.options[i].text == mySize){ sizeObj.selectedIndex = i; break; } } } </code></pre> <p>Do bear in mind that this is not a finished script.</p>
0debug
How long is the "JobService execution time limit" mentioned in Android's JobIntentService docs? : <p>While converting an app to be ready for Android Oreo, I read the docs on <code>JobIntentService</code> <a href="https://developer.android.com/reference/android/support/v4/app/JobIntentService.html" rel="noreferrer">over here</a>.</p> <p>In there I find (important part emphasised):</p> <blockquote> <p>When running as a pre-O service, the normal service execution semantics apply: [...] When running as a Job, the <strong>typical JobService execution time limit will apply, after which the job will be stopped (cleanly, not by killing the process)</strong> and rescheduled to continue its execution later.</p> </blockquote> <p>If I look at the <a href="https://developer.android.com/about/versions/oreo/background.html#services" rel="noreferrer">documented limitations</a> there is no word about any execution time limits. Also <code>JobScheduler</code> does <a href="https://developer.android.com/reference/android/app/job/JobScheduler.html" rel="noreferrer">not mention anything</a>.</p> <ul> <li>Is this a time limit I should simply not be concerned about?</li> <li>Is it undocumented?</li> <li>Or is the execution time limit not/no longer existing?</li> <li>Or will I have to redesign my services in a way that they can be interrupted and restarted at any given point in time? Best practices?</li> </ul>
0debug
static int rtmp_write(URLContext *s, const uint8_t *buf, int size) { RTMPContext *rt = s->priv_data; int size_temp = size; int pktsize, pkttype; uint32_t ts; const uint8_t *buf_temp = buf; uint8_t c; int ret; do { if (rt->skip_bytes) { int skip = FFMIN(rt->skip_bytes, size_temp); buf_temp += skip; size_temp -= skip; rt->skip_bytes -= skip; continue; if (rt->flv_header_bytes < 11) { const uint8_t *header = rt->flv_header; int copy = FFMIN(11 - rt->flv_header_bytes, size_temp); bytestream_get_buffer(&buf_temp, rt->flv_header + rt->flv_header_bytes, copy); rt->flv_header_bytes += copy; size_temp -= copy; if (rt->flv_header_bytes < 11) break; pkttype = bytestream_get_byte(&header); pktsize = bytestream_get_be24(&header); ts = bytestream_get_be24(&header); ts |= bytestream_get_byte(&header) << 24; bytestream_get_be24(&header); rt->flv_size = pktsize; if (((pkttype == RTMP_PT_VIDEO || pkttype == RTMP_PT_AUDIO) && ts == 0) || pkttype == RTMP_PT_NOTIFY) { if (pkttype == RTMP_PT_NOTIFY) pktsize += 16; rt->prev_pkt[1][RTMP_SOURCE_CHANNEL].channel_id = 0; if ((ret = ff_rtmp_packet_create(&rt->out_pkt, RTMP_SOURCE_CHANNEL, pkttype, ts, pktsize)) < 0) rt->out_pkt.extra = rt->main_channel_id; rt->flv_data = rt->out_pkt.data; if (pkttype == RTMP_PT_NOTIFY) ff_amf_write_string(&rt->flv_data, "@setDataFrame"); if (rt->flv_size - rt->flv_off > size_temp) { bytestream_get_buffer(&buf_temp, rt->flv_data + rt->flv_off, size_temp); rt->flv_off += size_temp; size_temp = 0; } else { bytestream_get_buffer(&buf_temp, rt->flv_data + rt->flv_off, rt->flv_size - rt->flv_off); size_temp -= rt->flv_size - rt->flv_off; rt->flv_off += rt->flv_size - rt->flv_off; if (rt->flv_off == rt->flv_size) { rt->skip_bytes = 4; if ((ret = ff_rtmp_packet_write(rt->stream, &rt->out_pkt, rt->chunk_size, rt->prev_pkt[1])) < 0) ff_rtmp_packet_destroy(&rt->out_pkt); rt->flv_size = 0; rt->flv_off = 0; rt->flv_header_bytes = 0; } while (buf_temp - buf < size);
1threat
What is wrong with this program? It runs but nothing shows up on output screen. Python 2.7 : The program runs fine. But with no output on output screen. Its just blank. Its Python 2.7. And I have added Python to Environment Variables as well but nothing shows up on shell as well. #Code for Rock Paper and Scissors import random import time rock = 1 paper = 2 scissors = 3 names = { rock: "Rock" , paper: "Paper" , scissors: "Scissors" } rules = { rock: scissors , paper :rock , scissors: paper } player_score = 0 computer_score = 0 def start(): print "Let's play a game of rock paper and scissors" while game(): pass scores() def game(): player = move() computer = random.randint(1,3) result(player, computer) return play_again() def move(): while True: print player = raw_int("Rock = 1\nPaper = 2\nScissors =3\nMake a move: ") try: player = int(player) if player in (1,2,3): return player except ValueError: pass print "Oops! I didn't understand that. Please enter 1,2 or 3." def result(player, computer): print "1..." time.sleep(1) print "2..." time.sleep(1) print "3..." time.sleep(0.5) print "Computer threw {0)!".format(names[computer]) global player_score,computer_score if player == computer: print "Tie game." else: if rules[player] == computer: print "Your victory has been assured." player_score += 1 else: print" The computer laughs as you realise you have been defeated." computer_score += 1 def play_again(): answer = raw_input("Would you like to play again? y/n: ") if answer in ("Y", "Y" , "yes" , "Yes" , "Of course!"): return answer else: print "Thank you very much for playing our game.See your next time!" def scores(): global player_score,computer_score print "High Scores" print "Player:" , player_score print "Computer:", computer_score if _name_ == '_main_': start()
0debug
How to add Web Animations API polyfill to an Angular 2 project created with Angular CLI : <p>The <a href="https://angular.io/docs/ts/latest/guide/animations.html" rel="noreferrer">Angular 2 animations documentation</a> refers to the <a href="https://github.com/web-animations/web-animations-js" rel="noreferrer">Web Animations API polyfill</a> for browsers that don't support the native one.</p> <p><strong>What's the <em>proper</em> way to add this polyfill to an Angular 2 project created with Angular CLI?</strong></p> <p>(I am using angular-cli: 1.0.0-beta.10)</p> <p>With no luck, I have tried the ideas and solutions mentioned here:</p> <ul> <li><a href="https://github.com/angular/angular-cli/issues/949" rel="noreferrer">https://github.com/angular/angular-cli/issues/949</a></li> <li><a href="https://github.com/angular/angular-cli/issues/1015" rel="noreferrer">https://github.com/angular/angular-cli/issues/1015</a></li> <li><a href="https://github.com/angular/angular-cli/issues/718#issuecomment-225493863" rel="noreferrer">https://github.com/angular/angular-cli/issues/718#issuecomment-225493863</a></li> </ul> <p>I downloaded it via NPM and added it to <code>system-config.ts</code>. I believe this is along the lines of what's <em>recommended</em> but the polyfill doesn't get loaded (I can tell because the animations don't work in Safari).</p> <p>I only got this to work by including the polyfill in <code>index.html</code>, which I know it's not the proper way:</p> <pre><code> &lt;script src="https://rawgit.com/web-animations/web-animations-js/master/web-animations.min.js"&gt;&lt;/script&gt; </code></pre> <p>I will add here any details that may help clarify my question, but if you need to see the code, I have it on Github: </p> <p><a href="https://github.com/cmermingas/connect-four" rel="noreferrer">https://github.com/cmermingas/connect-four</a></p> <p>Thanks in advance!</p>
0debug
PHP - Remove everything inside () in a string : <p>I want to remove everything inside () in a string. For example if my string is <code>$string = "this is an example string (this is the part i want to remove)";</code></p> <p>I tried it with str_replace but naturally it just replaces "(" and not the content inside it. How can I do that since i won't know the contents beforehand?</p>
0debug
Android: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.content.SharedPreferences.contains(java.lang.String)' : <p>I am encountering an error here. I have designed an app, which involves a User Registration Page and Login Page. User Registration is happening successfully, with data also getting added and Posted to SQLITE.</p> <p>However, during LOGIN, I am facing an issue. I have to open a new page, once the user logsin. But, the error which I am facing, due to sharedpreference is null pointer exception.</p> <p>This is my login page , and after I hit the <code>login</code> button, I am encountering the error.</p> <p><a href="https://i.stack.imgur.com/TG7dg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TG7dg.png" alt="enter image description here"></a></p> <pre><code>com.example.dell.digitalwallet E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.dell.digitalwallet, PID: 3206 java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.content.SharedPreferences.contains(java.lang.String)' on a null object reference at com.example.dell.digitalwallet.Login$1.onClick(Login.java:56) at android.view.View.performClick(View.java:6597) at android.view.View.performClickInternal(View.java:6574) at android.view.View.access$3100(View.java:778) at android.view.View$PerformClick.run(View.java:25881) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6649) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826) </code></pre> <p>06-02 12:39:50.866 3206-3206/com.example.dell.digitalwallet I/Process: Sending signal. PID: 3206 SIG: 9</p> <p>I have created the following classes:</p> <pre><code>Login.java package com.example.dell.digitalwallet; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class Login extends AppCompatActivity { private static TextView username; private static TextView password; private static EditText User_Name; private static EditText User_Password; private static Button login_btn, Registration, passwd_btn, Add_Person; private SharedPreferences sharedPreferences; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); Click_Button(); } public void Click_Button() { username = (TextView)findViewById(R.id.User_Name); password = (TextView)findViewById(R.id.Password); Registration = (Button) findViewById(R.id.button_registration); login_btn = (Button)findViewById(R.id.button_login); passwd_btn=(Button) findViewById(R.id.button_password); User_Name = (EditText) findViewById(R.id.Name); User_Password = (EditText) findViewById(R.id.User_Password); Add_Person = (Button) findViewById(R.id.add_person); login_btn.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { String username = User_Name.getText().toString(); String password = User_Password.getText().toString(); // Validate if username, password is filled if(username.trim().length() &gt; 0 &amp;&amp; password.trim().length() &gt; 0){ String uName = null; String uPassword =null; if (sharedPreferences.contains(username)) { uName = sharedPreferences.getString(username,""); } if (sharedPreferences.contains(password)) { uPassword = sharedPreferences.getString(password, ""); } if (username.equals(uName) &amp;&amp; password.equals(uPassword)){ Toast.makeText(Login.this,"User and Password is correct", Toast.LENGTH_SHORT).show(); //Starting the User's Home Page Add_Person.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Login.this, Parson_Details.class)); } }); } else { Toast.makeText(Login.this,"User and Password is not correct", Toast.LENGTH_SHORT).show(); } } } } ); Registration.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Login.this, Users.class)); } }); passwd_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(Login.this, Password.class)); } } ); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_login, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } Parson_Details.java package com.example.dell.digitalwallet; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.annotation.Nullable; import android.telephony.PhoneNumberFormattingTextWatcher; import android.text.TextUtils; import android.util.Log; import android.util.Patterns; import android.view.View; import android.os.Bundle; import android.widget.EditText; import android.widget.TextView; import android.widget.Button; import android.widget.Toast; import java.lang.String; public class Parson_Details extends AppCompatActivity { private String FirstName; private String MiddleName; private String LastName; private String Address; private int PhoneNumber; private int TotalCrBal; private int TotalDbBal; private static TextView First_Name; private static TextView Middle_Name; private static TextView Last_Name; private static TextView Address_Person; private static TextView Phone_Number; private static TextView Total_Cr_Bal; private static TextView Total_Db_Bal; private static Button Save; private static EditText First_N; private static EditText Middle_N; private static EditText Last_N; private static EditText Addr; private static EditText Phone_N; private static EditText Cr_Bal; private static EditText Db_Bal; private static Button save; public String getFirst_Name() {return FirstName;} public void setFirst_Name(String FirstName) {this.FirstName = FirstName;} public String getMiddle_Name() {return MiddleName;} public void setMiddle_Name(String Middle_Name) {this.MiddleName = Middle_Name;} public String getLast_Name() {return LastName;} public void setLast_Name(String Last_Name) {this.LastName = Last_Name;} public String getAddress() {return Address;} public void setAddress(String Address) {this.Address = Address;} public int getPhone_Number() {return PhoneNumber;} public void setPhone_Number(int Phone_Number) {this.PhoneNumber = Phone_Number;} public int getTotal_Cr_Bal() {return TotalCrBal;} public void setTotal_Cr_Bal(int TotalCrBal) {this.TotalCrBal = TotalCrBal;} public int getTotalDbBal() {return TotalDbBal;} public void setTotalDbBal(int TotalDbBal) {this.TotalDbBal = TotalDbBal;} @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_homescreen); getSupportActionBar().hide(); Click_Save_Button(); } public void Click_Save_Button() { First_Name = (TextView) findViewById(R.id.First_Name); Middle_Name = (TextView)findViewById(R.id.Middle_Name); Last_Name = (TextView) findViewById(R.id.Last_Name); Address_Person= (TextView) findViewById(R.id.Address); Phone_Number=(TextView) findViewById(R.id.Phone_Number); Total_Cr_Bal = (TextView) findViewById(R.id.Total_Cr_Bal); Total_Db_Bal = (TextView) findViewById(R.id.Total_Db_Bal); Save = (Button) findViewById(R.id.save); First_N = (EditText) findViewById(R.id.First_N); Middle_N = (EditText)findViewById(R.id.Middle_N); Last_N = (EditText) findViewById(R.id.Last_N); Addr = (EditText)findViewById(R.id.Addr); Phone_N=(EditText) findViewById(R.id.Phone_N); Cr_Bal = (EditText) findViewById(R.id.Cr_Bal); Db_Bal = (EditText) findViewById(R.id.Db_Bal); Save = (Button) findViewById(R.id.save); } } </code></pre> <p>Parson_Details.java is not complete. I need to first reach to the homescreen of the added user, once the login button is clicked, and here, a new activity, called Add_Person has to be launched.</p> <p><a href="https://i.stack.imgur.com/TG7dg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TG7dg.png" alt="Add Person Layout"></a></p> <p><a href="https://i.stack.imgur.com/z9Kw5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/z9Kw5.png" alt="enter image description here"></a></p> <p>What exactly am I doing wrong?</p>
0debug
Javascript - Scope of variables within and outside functions : <p>I have an ajax request where i have a variable that i need to get outside the function. For some reason i am not able to get the values outside the function. For simplicity i am changing my function.</p> <pre><code> var myEvents = "hi"; $.ajax({ url: 'http://mywebsite.com/events', type: "post", success: function (response) { myEvents = 'hello'; } }); alert(myEvents); // shows "hi" but i want it to show "hello" </code></pre>
0debug
Sub Resource Integrity value for //maps.google.com/maps/api/js : <p>Where do i find the sub resource integrity value for the script //maps.google.com/maps/api/js?</p> <p>For example: </p> <pre><code>&lt;script src="//maps.google.com/maps/api/js" integrity="sha256-????" crossorigin="anonymous"&gt;&lt;/script&gt; </code></pre>
0debug
My linear map function is not giving right answers : <p>This formula kinda don't work</p> <p>I tried to use this formula but it looks like it won't give me right answers, I hope that I can use all values for a linear mapping I hope you guys can help me :) if I need to rewrite this post I would not mind</p> <blockquote> <p>All of the input is: map(200,1, value,0,1); It never gives between 0 1. Thank you again, guys, here is code </p> </blockquote> <pre><code>function map(max_value, first_bottom, first_top, second_top, second_bottom){ y=(max_value - first_bottom) / (first_top - first_bottom) * (second_top - second_bottom) + second_bottom; } </code></pre>
0debug
VB.net saving a list to user settings : I am trying to save a list variable to my.settings, but I cannot find a type that works. I am using Visual Studio 2017
0debug
Use different paths for public and private resources Jersey + Spring boot : <p>I'm using Spring boot + Jersey + Spring security, I want to have public and private endpoints, I want an schema as follow:</p> <ul> <li><strong>/rest</strong> -- My root context </li> <li><strong>/public</strong> -- I want to place my public endpoints in this context, It must be inside of the root context like <code>/rest/public/pings</code></li> <li><strong>/private</strong> -- I want to place my private endpoints in this context, It must be inside of the root context like <code>/rest/private/accounts</code></li> </ul> <p>I have my configuration as follow:</p> <p><strong>Jersey</strong> configuration:</p> <pre><code>@Configuration @ApplicationPath("/rest") public class RestConfig extends ResourceConfig { public RestConfig() { register(SampleResource.class); } } </code></pre> <p><strong>Spring security</strong> configuration:</p> <pre><code>@Configuration public class SecurityConfiguration extends WebSecurityConfigurerAdapter { ........ protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/rest/public/**").permitAll(); http.antMatcher("/rest/**").authorizeRequests().anyRequest().fullyAuthenticated().and().httpBasic(); http.csrf().disable(); } } </code></pre> <p>The question is how can I register two application paths inside of my /rest context, one for /public and the other one for /private ?</p> <p>NOTE: I tried to create another ResourceConfig as follow:</p> <pre><code>@Configuration @ApplicationPath("/rest/public") public class RestPublicConfig extends ResourceConfig{ public RestPublicConfig() { register(PingResource.class); } } </code></pre> <p>But I'm getting the next error:</p> <pre><code> No qualifying bean of type [org.glassfish.jersey.server.ResourceConfig] is defined: expected single matching bean but found 2: restConfig,restPublicConfig </code></pre> <p>Thanks for your help :)</p>
0debug
static void ccid_handle_bulk_out(USBCCIDState *s, USBPacket *p) { CCID_Header *ccid_header; if (p->iov.size + s->bulk_out_pos > BULK_OUT_DATA_SIZE) { goto err; } usb_packet_copy(p, s->bulk_out_data + s->bulk_out_pos, p->iov.size); s->bulk_out_pos += p->iov.size; if (s->bulk_out_pos < 10) { DPRINTF(s, 1, "%s: header incomplete\n", __func__); goto err; } ccid_header = (CCID_Header *)s->bulk_out_data; if (p->iov.size == CCID_MAX_PACKET_SIZE) { DPRINTF(s, D_VERBOSE, "usb-ccid: bulk_in: expecting more packets (%zd/%d)\n", p->iov.size, ccid_header->dwLength); return; } DPRINTF(s, D_MORE_INFO, "%s %x %s\n", __func__, ccid_header->bMessageType, ccid_message_type_to_str(ccid_header->bMessageType)); switch (ccid_header->bMessageType) { case CCID_MESSAGE_TYPE_PC_to_RDR_GetSlotStatus: ccid_write_slot_status(s, ccid_header); break; case CCID_MESSAGE_TYPE_PC_to_RDR_IccPowerOn: DPRINTF(s, 1, "%s: PowerOn: %d\n", __func__, ((CCID_IccPowerOn *)(ccid_header))->bPowerSelect); s->powered = true; if (!ccid_card_inserted(s)) { ccid_report_error_failed(s, ERROR_ICC_MUTE); } ccid_write_data_block_atr(s, ccid_header); break; case CCID_MESSAGE_TYPE_PC_to_RDR_IccPowerOff: ccid_reset_error_status(s); s->powered = false; ccid_write_slot_status(s, ccid_header); break; case CCID_MESSAGE_TYPE_PC_to_RDR_XfrBlock: ccid_on_apdu_from_guest(s, (CCID_XferBlock *)s->bulk_out_data); break; case CCID_MESSAGE_TYPE_PC_to_RDR_SetParameters: ccid_reset_error_status(s); ccid_set_parameters(s, ccid_header); ccid_write_parameters(s, ccid_header); break; case CCID_MESSAGE_TYPE_PC_to_RDR_ResetParameters: ccid_reset_error_status(s); ccid_reset_parameters(s); ccid_write_parameters(s, ccid_header); break; case CCID_MESSAGE_TYPE_PC_to_RDR_GetParameters: ccid_reset_error_status(s); ccid_write_parameters(s, ccid_header); break; case CCID_MESSAGE_TYPE_PC_to_RDR_Mechanical: ccid_report_error_failed(s, 0); ccid_write_slot_status(s, ccid_header); break; default: DPRINTF(s, 1, "handle_data: ERROR: unhandled message type %Xh\n", ccid_header->bMessageType); ccid_report_error_failed(s, ERROR_CMD_NOT_SUPPORTED); ccid_write_slot_status(s, ccid_header); break; } s->bulk_out_pos = 0; return; err: p->status = USB_RET_STALL; s->bulk_out_pos = 0; return; }
1threat
Iam trying to find the retirement date from joining date at the age of 58 years in php : Iam trying to find the retirement date from joining date at the age of 58 years in php. $retire_date = date('Y-m-d', strtotime($joining_date. '+58 years')); it's showing 1970-01-01 , Up to "+40 years" it's showing correctly.can anyone contribute to find this one
0debug
how to access current/same/self row column value in sql query : Problem: I have companies who submits audit reports. I need to prepare a report column to show what is NextDueDate based on two conditions. 1. if any FormF table has more than one rows, then one year from latest form's End date i.e. "ReportingTo" 2. if only one FormF record found then one year from "RegistrationDate" >select F.[ID] >,enty.[Title (Title)] >,format(F.[ReportingFrom], 'MM/dd/yyyy') as 'ReportingFrom' >,format(F.[ReportingTo], 'MM/dd/yyyy') as 'ReportingTo' >,format(enty.[RegistrationDate], 'MM/dd/yyyy') as 'RegistrationDate' >,CASE WHEN ((select count(F.ID) from [db_owner].[FormF] F where >F.[EntityID]=F.[EntityID])>0) > THEN format(DATEADD(year, 1, (select top 1 F.[ReportingTo] from >[db_owner].[FormF] F where F.[EntityID]=F.[EntityID] order by F.ID desc))+1, >'MM/dd/yyyy') >ELSE format(DATEADD(year, 1, enty.[RegistrationDate])+1, 'MM/dd/yyyy') >END as 'AuditDueDate',F.[EntityID] from [db_owner].FormF F join entity >enty on F.[EntityID] = enty.ID where F.[EntityID]=F.[EntityID] ---------- [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/jrpag.png
0debug
Randomly Choose Music From a Folder on my Website : <p>I was wondering if there was some way to randomly choose a song and play it when my website loads. The goal is this -</p> <p>I have a place where users can upload their own songs. The songs are placed in a folder called "music" </p> <p>I want it to load a random song from that folder. I've searched all over but the only answers were me manually putting the songs in the code. I don't want to do that.</p> <p>Thanks for any help!</p>
0debug
Using jq with bash to run command for each object in array : <p>How can I run a bash command for every json object in a json array using jq? So far I have this:</p> <pre><code>cat credentials.json | jq -r '.[] | .user, .date, .email' | mycommand -u {user} -d {date} -e {email} </code></pre> <p>This doesn't seem to work. How can I take the parameters out of the json array into my command?</p> <p>My json file looks something like this:</p> <pre><code>[ "user": "danielrvt", "date": "11/10/1988", "email": "myemail@domain.com", ... ] </code></pre>
0debug
static int mov_write_tapt_tag(AVIOContext *pb, MOVTrack *track) { int32_t width = av_rescale(track->enc->sample_aspect_ratio.num, track->enc->width, track->enc->sample_aspect_ratio.den); int64_t pos = avio_tell(pb); avio_wb32(pb, 0); ffio_wfourcc(pb, "tapt"); avio_wb32(pb, 20); ffio_wfourcc(pb, "clef"); avio_wb32(pb, 0); avio_wb32(pb, width << 16); avio_wb32(pb, track->enc->height << 16); avio_wb32(pb, 20); ffio_wfourcc(pb, "enof"); avio_wb32(pb, 0); avio_wb32(pb, track->enc->width << 16); avio_wb32(pb, track->enc->height << 16); return updateSize(pb, pos); };
1threat
python combinators list with constraints without itertools : <p>suppose I have a list with following elements [a,b,c,d,e]</p> <p>how can I generate all possible combinations in such a way that every value can be moved to right, left or at the same position. For example with the above list all possible required combinations are </p> <pre><code>(a, b, c, d, e) (a, b, c, e, d) (a, b, d, c, e) (a, c, b, d, e) (a, c, b, e, d) (b, a, c, d, e) (b, a, c, e, d) (b, a, d, c, e) </code></pre> <p>One way I can think of is, find all permutations and then filter according to the conditions described above but itertools won't work when the list size is 15 for example. Any idea how can I do this for large list?</p>
0debug
Cosmo Db sql Azure- Reading unique documents in parallel. : 1) We are having services which interacts with cosmo db documents . Each service are having multiple instances so that can fetch the documents in parallel. 2) Our requirement is to ensure that every instance should fetch/process only unique documents.. For e.g. i have master service "S" having instances s1,s2,s3,s4 and having documents d1,d2,d3,d4.........d20. We need s1 to fetch first batch only ( D1,d2,d3,d4,d5) and other instances should not fetch same documents. Each of instance should have unique documents batch. The output should be like below s1- Process d1,d2,d3,d4,d5 s2- d6,d7,d8,d9,10 s3 - d11,d12,d13,d14,d15 s4 - d16,17,18,19,20. 3) What i am looking for is : a) Any read and lock document mechanism in cosmo DB -If yes,i can use them to lock documents for n seconds so that another service instance should not pick them . Any inbuilt flag. b) IF we do not have any in-built mechanism,then i can use etags or stored procedure to replace docs and add new property which reflects their states(Lock) .But i am not sure about scenario where two service instance will try to write /replace at the same time and both will be able to lock it. Any help/suggestion would be appreciated here. Thanks .
0debug
While building a simple application using bazel getting error Couldn't find java at '/usr/lib/java/jdk1.8.0_74/bin/java' : <p><a href="https://i.stack.imgur.com/wKaUr.png" rel="nofollow noreferrer">terminal view at the time error occured</a></p> <p>I was building a simple app using bazel building tool. But i got the this error stating that java is not found <i>(Couldn't find java at '/usr/lib/java/jdk1.8.0_74/bin/java'</i>). Although i have java installed on my system. Now, i want to know that in any way can't we let bazel know that java is installed and how to look for that?</p>
0debug
int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size) { int ret = -ENOSYS; KVMState *s = kvm_state; if (s->coalesced_mmio) { struct kvm_coalesced_mmio_zone zone; zone.addr = start; zone.size = size; ret = kvm_vm_ioctl(s, KVM_UNREGISTER_COALESCED_MMIO, &zone); } return ret; }
1threat
How to exclude webpack from bundling .spec.js files : <p>my Package.bundle reads </p> <pre><code>var reqContext = require.context('./', true, /\.js$/); reqContext.keys().map(reqContext); </code></pre> <p>Which basically includes all .js files.</p> <p>I want the expression to exclude any ***.spec.js files . Any regexp here to exclude .spec.js files ?</p>
0debug
static int apng_encode_frame(AVCodecContext *avctx, const AVFrame *pict, APNGFctlChunk *best_fctl_chunk, APNGFctlChunk *best_last_fctl_chunk) { PNGEncContext *s = avctx->priv_data; int ret; unsigned int y; AVFrame* diffFrame; uint8_t bpp = (s->bits_per_pixel + 7) >> 3; uint8_t *original_bytestream, *original_bytestream_end; uint8_t *temp_bytestream = 0, *temp_bytestream_end; uint32_t best_sequence_number; uint8_t *best_bytestream; size_t best_bytestream_size = SIZE_MAX; APNGFctlChunk last_fctl_chunk = *best_last_fctl_chunk; APNGFctlChunk fctl_chunk = *best_fctl_chunk; if (avctx->frame_number == 0) { best_fctl_chunk->width = pict->width; best_fctl_chunk->height = pict->height; best_fctl_chunk->x_offset = 0; best_fctl_chunk->y_offset = 0; best_fctl_chunk->blend_op = APNG_BLEND_OP_SOURCE; return encode_frame(avctx, pict); } diffFrame = av_frame_alloc(); if (!diffFrame) return AVERROR(ENOMEM); diffFrame->format = pict->format; diffFrame->width = pict->width; diffFrame->height = pict->height; if ((ret = av_frame_get_buffer(diffFrame, 32)) < 0) goto fail; original_bytestream = s->bytestream; original_bytestream_end = s->bytestream_end; temp_bytestream = av_malloc(original_bytestream_end - original_bytestream); temp_bytestream_end = temp_bytestream + (original_bytestream_end - original_bytestream); if (!temp_bytestream) { ret = AVERROR(ENOMEM); goto fail; } for (last_fctl_chunk.dispose_op = 0; last_fctl_chunk.dispose_op < 3; ++last_fctl_chunk.dispose_op) { for (fctl_chunk.blend_op = 0; fctl_chunk.blend_op < 2; ++fctl_chunk.blend_op) { uint32_t original_sequence_number = s->sequence_number, sequence_number; uint8_t *bytestream_start = s->bytestream; size_t bytestream_size; if (last_fctl_chunk.dispose_op != APNG_DISPOSE_OP_PREVIOUS) { diffFrame->width = pict->width; diffFrame->height = pict->height; av_frame_copy(diffFrame, s->last_frame); if (last_fctl_chunk.dispose_op == APNG_DISPOSE_OP_BACKGROUND) { for (y = last_fctl_chunk.y_offset; y < last_fctl_chunk.y_offset + last_fctl_chunk.height; ++y) { size_t row_start = diffFrame->linesize[0] * y + bpp * last_fctl_chunk.x_offset; memset(diffFrame->data[0] + row_start, 0, bpp * last_fctl_chunk.width); } } } else { if (!s->prev_frame) continue; diffFrame->width = pict->width; diffFrame->height = pict->height; av_frame_copy(diffFrame, s->prev_frame); } if (apng_do_inverse_blend(diffFrame, pict, &fctl_chunk, bpp) < 0) continue; ret = encode_frame(avctx, diffFrame); sequence_number = s->sequence_number; s->sequence_number = original_sequence_number; bytestream_size = s->bytestream - bytestream_start; s->bytestream = bytestream_start; if (ret < 0) goto fail; if (bytestream_size < best_bytestream_size) { *best_fctl_chunk = fctl_chunk; *best_last_fctl_chunk = last_fctl_chunk; best_sequence_number = sequence_number; best_bytestream = s->bytestream; best_bytestream_size = bytestream_size; if (best_bytestream == original_bytestream) { s->bytestream = temp_bytestream; s->bytestream_end = temp_bytestream_end; } else { s->bytestream = original_bytestream; s->bytestream_end = original_bytestream_end; } } } } s->sequence_number = best_sequence_number; s->bytestream = original_bytestream + best_bytestream_size; s->bytestream_end = original_bytestream_end; if (best_bytestream != original_bytestream) memcpy(original_bytestream, best_bytestream, best_bytestream_size); ret = 0; fail: av_freep(&temp_bytestream); av_frame_free(&diffFrame); return ret; }
1threat
install Docker CE 17.03 on RHEL7 : <p>Is it possible to install DockerCE in the specific version 17.03 on RHEL7 ?</p> <ul> <li><p>There is information here:</p> <ul> <li><a href="https://docs.docker.com/engine/installation/linux/rhel/#install-using-the-repository" rel="noreferrer">https://docs.docker.com/engine/installation/linux/rhel/#install-using-the-repository</a> about the installing Docker on RHEL but there is no version info.</li> </ul></li> <li><p>and here with Docker 17.03 but only in Docker EE not <strong>Docker CE</strong></p> <ul> <li><a href="https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/7.0_Release_Notes/sect-Red_Hat_Enterprise_Linux-7.0_Release_Notes-Linux_Containers_with_Docker_Format-Using_Docker.html" rel="noreferrer">https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/7.0_Release_Notes/sect-Red_Hat_Enterprise_Linux-7.0_Release_Notes-Linux_Containers_with_Docker_Format-Using_Docker.html</a> but they talk about Docker v 0.12 </li> </ul></li> </ul>
0debug
how to render window xaml in c# without visual studio? : I want to run and display xaml gui from the command prompt. the steps I follow is write the cs code and compile it through the command line but i end up with errors dealing with InitializeComponent or really anything to do with the gui components. The code below is just many of codes i copy and paste that just error out. I don't have visual studio. I didn't need it to compile my cs code i just needed to find the file that contain the csc.exe command to compile my code. No additional tools unless window 10 or any window don't provide this out the box. No other questions come close to my questions. Please don't point out download visual studio. I will down vote. ``` using System; using System.Drawing; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.Text = "Change Prperties Through Coding"; this.BackColor = Color.Brown; this.Size = new Size(350, 125); this.Location = new Point(300, 300); this.MaximizeBox = false; } } } ```
0debug
static float32 roundAndPackFloat32( flag zSign, int16 zExp, uint32_t zSig STATUS_PARAM) { int8 roundingMode; flag roundNearestEven; int8 roundIncrement, roundBits; flag isTiny; roundingMode = STATUS(float_rounding_mode); roundNearestEven = ( roundingMode == float_round_nearest_even ); roundIncrement = 0x40; if ( ! roundNearestEven ) { if ( roundingMode == float_round_to_zero ) { roundIncrement = 0; } else { roundIncrement = 0x7F; if ( zSign ) { if ( roundingMode == float_round_up ) roundIncrement = 0; } else { if ( roundingMode == float_round_down ) roundIncrement = 0; } } } roundBits = zSig & 0x7F; if ( 0xFD <= (uint16_t) zExp ) { if ( ( 0xFD < zExp ) || ( ( zExp == 0xFD ) && ( (int32_t) ( zSig + roundIncrement ) < 0 ) ) ) { float_raise( float_flag_overflow | float_flag_inexact STATUS_VAR); return packFloat32( zSign, 0xFF, - ( roundIncrement == 0 )); } if ( zExp < 0 ) { if ( STATUS(flush_to_zero) ) return packFloat32( zSign, 0, 0 ); isTiny = ( STATUS(float_detect_tininess) == float_tininess_before_rounding ) || ( zExp < -1 ) || ( zSig + roundIncrement < 0x80000000 ); shift32RightJamming( zSig, - zExp, &zSig ); zExp = 0; roundBits = zSig & 0x7F; if ( isTiny && roundBits ) float_raise( float_flag_underflow STATUS_VAR); } } if ( roundBits ) STATUS(float_exception_flags) |= float_flag_inexact; zSig = ( zSig + roundIncrement )>>7; zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven ); if ( zSig == 0 ) zExp = 0; return packFloat32( zSign, zExp, zSig ); }
1threat
Calculating average of all bytes in a given file in C : <p>I wrote the program but couldn't find the problem. Its reading file well but gives result 0. Did I do anything wrong on passing the file pointer?</p> <pre><code>#include &lt;stdio.h&gt; unsigned char average(const char *filename){ unsigned int BLOCK_SIZE=512; unsigned int nlen=0, nround=0; unsigned char avg = 0; FILE *fp; unsigned char tmp[512]; if ( (fp = fopen(filename,"r")) == NULL){ printf("\nThe file did not open\n."); return 500; } while(!feof(fp)){ if(fread(tmp, 1, BLOCK_SIZE, fp)){ nlen+=BLOCK_SIZE; nround++; }else{ BLOCK_SIZE=BLOCK_SIZE/2; } } avg=(unsigned char)(nlen/nround); return avg; } int main(void){ printf(" The average of all bytes in the file : %d \n" ,average("v") ); return 0; } ` </code></pre>
0debug
Show Only checked Values using popup in table : I have no idea, is there any ways to show only selected or checked attributes in a table
0debug
How to properly create class global variable : <p>Why the following counter does not work, and how to fix it:</p> <pre><code>class Test(): def __init__(self): self.counter = 0 def increment(self): print counter++ </code></pre> <p>Thank you.</p>
0debug
static int colo_packet_compare_common(Packet *ppkt, Packet *spkt, int offset) { if (trace_event_get_state(TRACE_COLO_COMPARE_MISCOMPARE)) { char pri_ip_src[20], pri_ip_dst[20], sec_ip_src[20], sec_ip_dst[20]; strcpy(pri_ip_src, inet_ntoa(ppkt->ip->ip_src)); strcpy(pri_ip_dst, inet_ntoa(ppkt->ip->ip_dst)); strcpy(sec_ip_src, inet_ntoa(spkt->ip->ip_src)); strcpy(sec_ip_dst, inet_ntoa(spkt->ip->ip_dst)); trace_colo_compare_ip_info(ppkt->size, pri_ip_src, pri_ip_dst, spkt->size, sec_ip_src, sec_ip_dst); } offset = ppkt->vnet_hdr_len + offset; if (ppkt->size == spkt->size) { return memcmp(ppkt->data + offset, spkt->data + offset, spkt->size - offset); } else { trace_colo_compare_main("Net packet size are not the same"); return -1; } }
1threat
Simple java loop statement with if statements not running correctly? : <p>I am brushing up on my Java and cannot get this program to work correctly. It is a while counter loop counting up to 100. If the counter is divisible by 3 it will output "On", if the counter is divisible by 7 it will output "Base", if the counter is divisible by 7 and 3 it will output "OnBase", otherwise it will output the number. Right now the program will not even compile and I have no idea what the issue is. Here is my program, any help is appreciated.</p> <pre><code>public class Counter { public static void main(String[] args) { int i = 1; while(i &lt;= 100) { if((i % 3) == 0){ system.out.println("On"); i++; continue; } if((i % 7) == 0){ system.out.println("Base"); i++; continue; } if((i % (3*7) == 0){ system.out.println("OnBase"); i++; continue; } system.out.println(i); i++; } } } </code></pre>
0debug
How to open files with .ett format c# : <p>I have .ett file and I need to open it with c#.This files are created by Kingsoft SpreadSheets, but I can`t find any library to open it. Do you have some ideas?</p>
0debug
static void av_estimate_timings_from_pts(AVFormatContext *ic) { AVPacket pkt1, *pkt = &pkt1; AVStream *st; int read_size, i, ret; int64_t start_time, end_time, end_time1; int64_t filesize, offset, duration; url_fseek(&ic->pb, 0, SEEK_SET); read_size = 0; for(;;) { if (read_size >= DURATION_MAX_READ_SIZE) break; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time == AV_NOPTS_VALUE) break; } if (i == ic->nb_streams) break; ret = av_read_packet(ic, pkt); if (ret != 0) break; read_size += pkt->size; st = ic->streams[pkt->stream_index]; if (pkt->pts != AV_NOPTS_VALUE) { if (st->start_time == AV_NOPTS_VALUE) st->start_time = (int64_t)((double)pkt->pts * ic->pts_num * (double)AV_TIME_BASE / ic->pts_den); } av_free_packet(pkt); } start_time = MAXINT64; for(i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time != AV_NOPTS_VALUE && st->start_time < start_time) start_time = st->start_time; } fprintf(stderr, "start=%lld\n", start_time); if (start_time != MAXINT64) ic->start_time = start_time; filesize = ic->file_size; offset = filesize - DURATION_MAX_READ_SIZE; if (offset < 0) offset = 0; flush_packet_queue(ic); url_fseek(&ic->pb, offset, SEEK_SET); read_size = 0; for(;;) { if (read_size >= DURATION_MAX_READ_SIZE) break; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration == AV_NOPTS_VALUE) break; } if (i == ic->nb_streams) break; ret = av_read_packet(ic, pkt); if (ret != 0) break; read_size += pkt->size; st = ic->streams[pkt->stream_index]; if (pkt->pts != AV_NOPTS_VALUE) { end_time = (int64_t)((double)pkt->pts * ic->pts_num * (double)AV_TIME_BASE / ic->pts_den); duration = end_time - st->start_time; if (duration > 0) { if (st->duration == AV_NOPTS_VALUE || st->duration < duration) st->duration = duration; } } av_free_packet(pkt); } end_time = MININT64; for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration != AV_NOPTS_VALUE) { end_time1 = st->start_time + st->duration; if (end_time1 > end_time) end_time = end_time1; } } if (ic->start_time != AV_NOPTS_VALUE) { for(i = 0; i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->start_time == AV_NOPTS_VALUE) st->start_time = ic->start_time; } } if (end_time != MININT64) { for(i = 0;i < ic->nb_streams; i++) { st = ic->streams[i]; if (st->duration == AV_NOPTS_VALUE && st->start_time != AV_NOPTS_VALUE) st->duration = end_time - st->start_time; } ic->duration = end_time - ic->start_time; } url_fseek(&ic->pb, 0, SEEK_SET); }
1threat
How to set '-Xuse-experimental=kotlin.experimental' in IntelliJ : <p>while trying to build a Kotlin/Ktor application in IntelliJ, multiple warnings of the form</p> <pre><code>Warning:(276, 6) Kotlin: This class can only be used with the compiler argument '-Xuse-experimental=kotlin.Experimental' </code></pre> <p>are output. The warnings refer to</p> <pre><code>@UseExperimental(KtorExperimentalLocationsAPI::class) </code></pre> <p>so I expected to satisfy the warning by setting <em>Settings -> Build -> Compiler -> Kotlin Compiler -> Additional command line parameters</em> to <strong>-version -Xuse-experimental=kotlin.Experimental</strong>. (<strong>-version</strong> was already there). But the warning is still generated. How do I satisfy it? Thanks in expectation.</p>
0debug
Visual studio code comment in HTML files : <p>I am trying Visual Studio Code lately and i've noticed that when i try to add a line comment in an HTML file (using Ctrl+/ or Ctrl+K Ctrl+C) instead of this: <code>&lt;!-- --&gt;</code>, i get this <code>{# #}</code>.</p> <p>In JS or CSS files the key bindings work just fine and produce the expected result.</p> <p>So how can i get the proper type of comments in HTML files?</p>
0debug
Deallocate a stack object before execution gets out of the scope of the stack object? : <p>In C++, does RAII imply that a stack object (an object allocated on a stack, e.g. a local variable in a function) is deallocated only when execution gets out of the scope of the stack object?</p> <p>What if I would like to deallocate a stack object a little bit before execution reaches the end of the scope of the stack object?</p> <p>Thanks.</p>
0debug
def chunk_tuples(test_tup, N): res = [test_tup[i : i + N] for i in range(0, len(test_tup), N)] return (res)
0debug
Redirect header php to success page : <p>I have a contact contact form that after submitting a message, if it is sucess it should go to the success.php page, but im having a issue, i want this page only be available when the user is redirect from the sendForm.php. How should i make this permission in my script?</p>
0debug
Terminate docker compose when test container finishes : <p>I am currently running a docker-compose stack for basic integration tests with a protractor test runner, a nodejs server serving a web page and a wildfly server serving a java backend.</p> <p>The stack is run from a dind(docker in docker) container in my build server(concourse ci).</p> <p>But it appears that the containers does not terminate on finishing the protractor tests.</p> <p><em>So since the containers for wildfly, and nodejs are still running the build task never finishes...</em></p> <p><strong>How can I make the compose end in success or failure when the tests are finished?</strong></p> <pre><code># Test runner test-runner: image: "${RUNNER_IMG}" privileged: true links: - client - server volumes: - /Users/me/frontend_test/client-devops:/protractor/project - /dev/shm:/dev/shm entrypoint: - /entrypoint.sh - --baseUrl=http://client:9000/dist/ - /protractor/conf-dev.js - --suite=remember # Client deployment client: image: "${CLIENT_IMG}" links: - server # Server deployment server: image: "${SERVER_IMG}" </code></pre>
0debug
React Redux unexpected key passed to create store : <p>I am getting the error <code>Unexpected key "characters" found in initialState argument passed to createStore. Expected to find one of the known reducer keys instead: "marvelReducer", "routing". Unexpected keys will be ignored.</code> </p> <p>rootReducer : </p> <pre><code> import { combineReducers } from 'redux'; import { routerReducer } from 'react-router-redux'; import marvelReducer from './marvelReducer'; const rootReducer = combineReducers({ marvelReducer, routing: routerReducer }); export default rootReducer; </code></pre> <p>marvelReducer : </p> <pre><code>import { FETCH_MARVEL } from '../constants/constants'; import objectAssign from 'object-assign'; export default function marvelReducer(state = [], action) { switch (action.type) { case FETCH_MARVEL: return objectAssign({}, state, {characters: action.data}); default: return state; } } </code></pre> <p>store : </p> <pre><code>import { createStore } from 'redux'; import { syncHistoryWithStore } from 'react-router-redux'; import { browserHistory } from 'react-router'; import rootReducer from '../reducers/index'; const initialState = { characters: [] }; const store = createStore(rootReducer, initialState); export const history = syncHistoryWithStore(browserHistory, store); if (module.hot) { module.hot.accept('../reducers/', () =&gt; { const nextRootReducer = require('../reducers/index').default; store.replaceReducer(nextRootReducer); }); } export default store; </code></pre> <p>I have very similar code in another application and it's working fine. Not sure what's going on here</p>
0debug
How to get the lists' length in one column in dataframe spark? : <p>I have a df whose 'products' column are lists like below:</p> <pre><code>+----------+---------+--------------------+ |member_srl|click_day| products| +----------+---------+--------------------+ | 12| 20161223| [2407, 5400021771]| | 12| 20161226| [7320, 2407]| | 12| 20170104| [2407]| | 12| 20170106| [2407]| | 27| 20170104| [2405, 2407]| | 28| 20161212| [2407]| | 28| 20161213| [2407, 100093]| | 28| 20161215| [1956119]| | 28| 20161219| [2407, 100093]| | 28| 20161229| [7905970]| | 124| 20161011| [5400021771]| | 6963| 20160101| [103825645]| | 6963| 20160104|[3000014912, 6626...| | 6963| 20160111|[99643224, 106032...| </code></pre> <p>How to add a new column <code>product_cnt</code> which are the length of <code>products</code> list? And how to filter df to get specified rows with condition of given products length ? Thanks.</p>
0debug
void css_conditional_io_interrupt(SubchDev *sch) { if (!(sch->curr_status.scsw.ctrl & SCSW_STCTL_STATUS_PEND)) { S390CPU *cpu = s390_cpu_addr2state(0); uint8_t isc = (sch->curr_status.pmcw.flags & PMCW_FLAGS_MASK_ISC) >> 11; trace_css_io_interrupt(sch->cssid, sch->ssid, sch->schid, sch->curr_status.pmcw.intparm, isc, "(unsolicited)"); sch->curr_status.scsw.ctrl &= ~SCSW_CTRL_MASK_STCTL; sch->curr_status.scsw.ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND; s390_io_interrupt(cpu, css_build_subchannel_id(sch), sch->schid, sch->curr_status.pmcw.intparm, (0x80 >> isc) << 24); } }
1threat
how to cancel timer in neworderfragment from utilmethod.java class...when iam logout from homeactivity..in Adroid : when Iam logout from homeactivity, shows fragment processing though timer inside it.I want to cancel timer from utilmethod java class where logoutalertdialog exits.when iam pressing yes timer should cancel their
0debug
static abi_long do_ipc(unsigned int call, abi_long first, abi_long second, abi_long third, abi_long ptr, abi_long fifth) { int version; abi_long ret = 0; version = call >> 16; call &= 0xffff; switch (call) { case IPCOP_semop: ret = do_semop(first, ptr, second); break; case IPCOP_semget: ret = get_errno(semget(first, second, third)); break; case IPCOP_semctl: { abi_ulong atptr; get_user_ual(atptr, ptr); ret = do_semctl(first, second, third, atptr); break; } case IPCOP_msgget: ret = get_errno(msgget(first, second)); break; case IPCOP_msgsnd: ret = do_msgsnd(first, ptr, second, third); break; case IPCOP_msgctl: ret = do_msgctl(first, second, ptr); break; case IPCOP_msgrcv: switch (version) { case 0: { struct target_ipc_kludge { abi_long msgp; abi_long msgtyp; } *tmp; if (!lock_user_struct(VERIFY_READ, tmp, ptr, 1)) { ret = -TARGET_EFAULT; break; } ret = do_msgrcv(first, tswapal(tmp->msgp), second, tswapal(tmp->msgtyp), third); unlock_user_struct(tmp, ptr, 0); break; } default: ret = do_msgrcv(first, ptr, second, fifth, third); } break; case IPCOP_shmat: switch (version) { default: { abi_ulong raddr; raddr = do_shmat(first, ptr, second); if (is_error(raddr)) return get_errno(raddr); if (put_user_ual(raddr, third)) return -TARGET_EFAULT; break; } case 1: ret = -TARGET_EINVAL; break; } break; case IPCOP_shmdt: ret = do_shmdt(ptr); break; case IPCOP_shmget: ret = get_errno(shmget(first, second, third)); break; case IPCOP_shmctl: ret = do_shmctl(first, second, ptr); break; default: gemu_log("Unsupported ipc call: %d (version %d)\n", call, version); ret = -TARGET_ENOSYS; break; } return ret; }
1threat
can't run: The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe : when i try to run my program it gives this error : The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe
0debug
how to get multiple instances of same bean in spring? : <p>By default, spring beans are singletons. I am wondering if there is a way to get multiple instances of same bean for processing.</p> <p>Here is what I do currently</p> <pre><code> @Configuration public class ApplicationMain { @Value("${service.num: not configured}") private int num; //more code @PostConstruct public void run(){ for (int i = 0; i &lt; num ; i++) { MyService ser = new MyService(i); Future&lt;?&gt; tasks = executor.submit(ser); } } } </code></pre> <p>Here is the Service class</p> <pre><code> public class MyService implements Runnable { private String name; public Myservice(int i){ name=String.ValueOf(i); } } </code></pre> <p>I have simplified my usecase here. I want to have MyService as spring bean and get as many as possible based on configuartion (which is <code>num</code>) in the above for-loop? wondering how that is possible.</p> <p>Thanks</p>
0debug
How to get a consecutive same set of character from the string which are stored in array ? For example' INPUT: sword|word|cord output: ord : <p>how to get consecutive set of character from a string which are stored in a array? for example: input: sword cord word OUTPUT: ord</p>
0debug
what is the explain to the solution of the qustion Implement an algorithm to determine if a string has all unique characters? : I don't understand the solution Can I get explain of that: public static boolean isUniqueChars(String str) { int checker = 0; for (int i = 0; i < str.length(); ++i) { int val = str.charAt(i) - ‘a’; if ((checker & (1 << val)) > 0) return false; checker |= (1 << val); } return true; }
0debug
Session on wordpress site, : Please help, I have a client page coded in php. The page then goes to a wordpress page, The session is there on this page is remembered, but when I load a new page from this wordpress page. The session is not remembered and take back to the login page .. This code is on the login page .. my_session_register('user_id'); $_SESSION['user_id']=$user_id; header('Location: booking_user.php'); Then is code checks the session if (!my_session_is_registered('user_id')) { header('Location: login.php'); } I just dont no how I would keep this alive in this page and stop ending the session Thanks
0debug
How can I navigate the VS Code Explorer & open a file via keyboard only? : <p>I'm doing a code review of a project, which means cycling through all the files in it. I want to keep my hands on the keyboard but neither do I want to have to <kbd>CMD</kbd>+<kbd>P</kbd> and type in the name of each file.</p> <p>I've bound <kbd>CMD</kbd>+<kbd>K</kbd>,<kbd>CMD</kbd>+<kbd>E</kbd> to <code>workbench.files.action.focusFilesExplorer</code> which enables me to easily get to the Explorer, but then I can only <code>explorer.openToSide</code>, which isn't exactly what I want. I want to be able to open them directly, full-screen even if I have other windows open.</p> <p>Are there commands for this that I can bind to? I suspect this isn't a feature yet.</p>
0debug
Angular Abstract control remove error : <p>I want a way to remove a specific error from a form control and not clear all error.</p> <pre><code>control.setError({'firstError': true}) </code></pre> <p>and to remove that specific error like</p> <pre><code>control.removeError({'firstError}) and not control.setError({null}) </code></pre> <p>I tried </p> <pre><code>control.setError({'firstError': false}) </code></pre> <p>but didn't work.</p> <p>Any help. Thanks</p> <p>angular 4.1.1</p>
0debug
oracle database query adding table 1 values and display in table 2 : tried the query in the mentioned image but could not crack in mysql database. can anyone help me out with the solution as soon as possible. thanks in advance. [enter image description here][1] [1]: https://i.stack.imgur.com/XebM2.png
0debug
jQuery change logo on section : <p>I have for so long searched on how to do like this website has done with their logo:</p> <p><a href="http://www.shiftbrain.co.jp/works/dcc_2015" rel="nofollow">http://www.shiftbrain.co.jp/works/dcc_2015</a></p> <p>The logo changes, what I believe on reaching a section. Does anyone know how to make this with jQuery?</p> <p>Say I have 2 different sections, one with the class "white" and the other with the class "dark". On reaching the "white" section, I'd like a logo to swap to a dark logo and vice versa. </p>
0debug
Implementation of Memory game in C++ - keep out of range at memory location error : <p>So, I keep getting an error saying: Unhandled exception at _______ in ProgCW.exe: Microsoft C++ exception: std::out_of_range at memory location ________.</p> <p>I have found this code online and have implemented it, but there seems to be something wrong with my implementation.</p> <p>I have used a class to do this.</p> <p>This is the code:</p> <pre><code>dispGrid::dispGrid(const int gRows, const int gCols){ //declaration and allocation for creating a grid and cardstatus std::vector&lt;std::vector&lt;int&gt;&gt; cGrid; int** cardStatus = new int*[gRows]; for (int i = 0; i &lt; gRows; i++) { cardStatus[i] = new int[gCols]; } //initialisation of variables int r1, c1, r2, c2; int moves; bool gameOver = false; cardShuffle(cGrid, gRows, gCols); while (gameOver != true) { //allows to repeat over the game moves = 0; /////////////////////////////// // prints grid // ///////////////////////////// //prints the coordinates std::cout &lt;&lt; "\t "; for (int nCols = 0; nCols &lt; gCols; nCols++) { std::cout &lt;&lt; nCols + 1 &lt;&lt; " "; } std::cout &lt;&lt; std::endl; //initialisation //displays the starred grid according to difficulty level the user chose and sets cardstatus as false, for face down for (int nRows = 0; nRows &lt; gRows; nRows++) { std::cout &lt;&lt; "\t" &lt;&lt; nRows + 1 &lt;&lt; " | "; for (int nCols = 0; nCols &lt; gCols; nCols++) { std::cout &lt;&lt; "* "; cardStatus[nRows][nCols] = false; } std::cout &lt;&lt; std::endl; } /******************************/ /* game mechanics */ /*****************************/ do { //allows execution of thr input as long the card status is not false at that card //user input for the first card's coordinates std::cout &lt;&lt; "Enter the first cards row: " &lt;&lt; std::endl; std::cin &gt;&gt; r1; std::cout &lt;&lt; "Enter the first cards column: " &lt;&lt; std::endl; std::cin &gt;&gt; c1; if ((r1 &amp;&amp; c1) == 0) { //checks to see whether user has input the values 0 std::cout &lt;&lt; "#NOTE : There are no coordinates of that value." &lt;&lt; std::endl; } } while (cardStatus[r1 - 1][c1 - 1] != false); do { //allows execution of thr input as long the card status is not false at that card //user input for the second card's coordinates std::cout &lt;&lt; "Enter the second cards row: " &lt;&lt; std::endl; std::cin &gt;&gt; r2; std::cout &lt;&lt; "Enter the second cards column: " &lt;&lt; std::endl; std::cin &gt;&gt; c2; if ((r2 &amp;&amp; c2) == 0) {//checks to see whether user has input the values 0 std::cout &lt;&lt; "#NOTE : There are no coordinates of that value." &lt;&lt; std::endl; } else if (cardStatus[r2 - 1][c2 - 1] = true) { //if the cardstatus of the second card is true then output the care is already flipped std::cout &lt;&lt; "#NOTE : This card is already flipped." &lt;&lt; std::endl; } else if ((r2 == r1) &amp;&amp; (c2 == c1)) { //if the cards are the same then the card is already flipped std::cout &lt;&lt; "#NOTE : You have already chosen this card." &lt;&lt; std::endl; continue; } } while (cardStatus[r2 - 1][c2 - 1] != false); r1--; c1--; r2--; c2--; //reaveal cards //prints the coordinates std::cout &lt;&lt; "\t "; for (int nCols = 0; nCols &lt; gCols; nCols++) { std::cout &lt;&lt; nCols + 1 &lt;&lt; " "; } std::cout &lt;&lt; std::endl; //initialisation //displays grid with blank spaces according to the coordinates then picked, setting up to replace blank spaces for values for (int nRows = 0; nRows &lt; gRows; nRows++) { std::cout &lt;&lt; "\t" &lt;&lt; nRows + 1 &lt;&lt; " | "; for (int nCols = 0; nCols &lt; gCols; nCols++) { if ((nRows == r1) &amp; (nCols == c1)) { std::cout &lt;&lt; cGrid[nRows][nCols] &lt;&lt; " "; } else if ((nRows == r2) &amp;&amp; (nCols == c2)) { std::cout &lt;&lt; cGrid[nRows][nCols] &lt;&lt; " "; } else if (cardStatus[nRows][nCols] = true) { std::cout &lt;&lt; cGrid[nRows][nCols] &lt;&lt; " "; } else { std::cout &lt;&lt; "* "; } } std::cout &lt;&lt; std::endl; } //if match? if (cGrid[r1][c1] == cGrid[r2][c2]) { std::cout &lt;&lt; "#NOTE : Cards Match!" &lt;&lt; std::endl; cardStatus[r1][c1] = true; cardStatus[r2][c2] = true; } std::cin.get(); std::cin.get(); /*********************************************************/ /* prints to blank screen */ /*********************************************************/ for (int z = 0; z &lt;= 30; z++) { std::cout &lt;&lt; std::endl; } //reprint the board //prints the coordinates std::cout &lt;&lt; "\t "; for (int nCols = 0; nCols &lt; gCols; nCols++) { std::cout &lt;&lt; nCols + 1 &lt;&lt; " "; } std::cout &lt;&lt; std::endl; //initialisation //displays the starred grid according to difficulty level the user chose and sets cardstatus as false, for face down for (int nRows = 0; nRows &lt; gRows; nRows++) { std::cout &lt;&lt; "\t" &lt;&lt; nRows + 1 &lt;&lt; " | "; for (int nCols = 0; nCols &lt; gCols; nCols++) { if (cardStatus[nRows][nCols] = true) { std::cout &lt;&lt; cGrid[nRows][nCols] &lt;&lt; " "; } else { std::cout &lt;&lt; "* "; } } std::cout &lt;&lt; std::endl; } gameOver = true; //checks all card status, should all be set to true for (int nRows = 0; nRows &lt; gRows; nRows++) { for (int nCols = 0; nCols &lt; gCols; nCols++) { if (cardStatus[nRows][nCols] == false) { gameOver = false; break; } } if (gameOver == false) { break; } } moves++; //counts moves } std::cout &lt;&lt; "#NOTE : You have matched all the tiles" &lt;&lt; std::endl; std::cout &lt;&lt; "#NOTE: You had " &lt;&lt; moves &lt;&lt; "moves." &lt;&lt; std::endl &lt;&lt; std::endl; } </code></pre> <p>The problem seems to be when the cards need to be shuffled.</p> <p>The function for shuffling the cards:</p> <pre><code>void dispGrid::cardShuffle(std::vector&lt;std::vector&lt;int&gt;&gt; &amp;gCards, int rows, int cols)//parameters of a 2d vector and the number of rows and columns { int numOfElem = rows*cols;//total number of random number should be made std::vector&lt;int&gt; randNum; //generate same random numbers for (int x = 0; x &lt; (numOfElem / 2); x++) { const int fNum = rand() % 100 + 1; //generate num between 1 and 100 int sNum; do { sNum = rand() % 100 + 1; } while (fNum == sNum); randNum.push_back(fNum); randNum.push_back(sNum); } for (int s = 0; s &lt;= 20; s++) { for (int x = 0; x &lt; numOfElem; x++) { srand((unsigned)time(NULL));//initialise random seed int i = rand() % (numOfElem - 1) + 1; //chooses a number between the length of the array int temp = randNum.at(x); //sets temp as the value in the at that indes in the start array randNum.at(x) = randNum.at(i); //sets the value at that index in the start array as the value of the index at the start array randNum.at(i) = temp; } } int i = 0; for (int nRows = 0; nRows &lt; rows; nRows++) {// for every row and column for (int nCols = 0; nCols &lt; cols; nCols++) { gCards.at(nRows).at(nCols) = randNum.at(i);//card at that coordinate will be equal to std::cout &lt;&lt; gCards[nRows][nCols]; i = i + 1; } std::cout &lt;&lt; std::endl; }} </code></pre> <p>I am using Microsoft Visual Studio, and when I put the breakpoint in, the problem was appearing at the point:</p> <pre><code>gCards.at(nRows).at(nCols) = randNum.at(i); //card at that coordinate will be equal to </code></pre> <p>Many thanks for the help.</p>
0debug
How to return a value from JSON function? : I have a JSON object with a few functions. I am not able to retrieve the returned value when I access the utils.run function, Please help. var utils = { "init" : function(){ console.log("init"); }, "run" : function(value1){ return "hello"+value1; } }
0debug
QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops) { QEMUFile *f; f = g_malloc0(sizeof(QEMUFile)); f->opaque = opaque; f->ops = ops; return f; }
1threat
Cannot find module that is defined in tsconfig `paths` : <p>I am trying to setup aliases for my mock server. Whenever I try to compile <code>ts</code> files, it returns error that it couldn't find proper modules even though those are defined in <code>tsconfig,json</code>-><code>paths</code></p> <p>Folder structure:</p> <pre class="lang-sh prettyprint-override"><code>├── server │   └── src │   └──/json ├── src │   └──/modules ├── tsconfig.json </code></pre> <p>Here is my <code>tsconfig.json</code></p> <pre><code>{ "compilerOptions": { "baseUrl": "./src", "experimentalDecorators": true, "jsx": "react", "lib": [ "dom", "es2015", "es2015.promise" ], "module": "commonjs", "moduleResolution": "node", "noImplicitAny": true, "noUnusedLocals": true, "esModuleInterop": true, "paths": { "@project/app/modules/*": [ "modules/*" ], "@project/server/data/*": [ "../server/src/json/*" ] }, "sourceMap": true, "target": "es5" }, "exclude": [ "node_modules", "tools" ] } </code></pre> <p>Error: <code>Error: Cannot find module '@project/server/data/accounts/accountsList'</code></p>
0debug
static void omap_rtc_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { struct omap_rtc_s *s = (struct omap_rtc_s *) opaque; int offset = addr & OMAP_MPUI_REG_MASK; struct tm new_tm; time_t ti[2]; if (size != 1) { return omap_badwidth_write8(opaque, addr, value); } switch (offset) { case 0x00: #ifdef ALMDEBUG printf("RTC SEC_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_sec; s->ti += from_bcd(value); return; case 0x04: #ifdef ALMDEBUG printf("RTC MIN_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_min * 60; s->ti += from_bcd(value) * 60; return; case 0x08: #ifdef ALMDEBUG printf("RTC HRS_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_hour * 3600; if (s->pm_am) { s->ti += (from_bcd(value & 0x3f) & 12) * 3600; s->ti += ((value >> 7) & 1) * 43200; } else s->ti += from_bcd(value & 0x3f) * 3600; return; case 0x0c: #ifdef ALMDEBUG printf("RTC DAY_REG <-- %02x\n", value); #endif s->ti -= s->current_tm.tm_mday * 86400; s->ti += from_bcd(value) * 86400; return; case 0x10: #ifdef ALMDEBUG printf("RTC MTH_REG <-- %02x\n", value); #endif memcpy(&new_tm, &s->current_tm, sizeof(new_tm)); new_tm.tm_mon = from_bcd(value); ti[0] = mktimegm(&s->current_tm); ti[1] = mktimegm(&new_tm); if (ti[0] != -1 && ti[1] != -1) { s->ti -= ti[0]; s->ti += ti[1]; } else { s->ti -= s->current_tm.tm_mon * 2592000; s->ti += from_bcd(value) * 2592000; } return; case 0x14: #ifdef ALMDEBUG printf("RTC YRS_REG <-- %02x\n", value); #endif memcpy(&new_tm, &s->current_tm, sizeof(new_tm)); new_tm.tm_year += from_bcd(value) - (new_tm.tm_year % 100); ti[0] = mktimegm(&s->current_tm); ti[1] = mktimegm(&new_tm); if (ti[0] != -1 && ti[1] != -1) { s->ti -= ti[0]; s->ti += ti[1]; } else { s->ti -= (s->current_tm.tm_year % 100) * 31536000; s->ti += from_bcd(value) * 31536000; } return; case 0x18: return; case 0x20: #ifdef ALMDEBUG printf("ALM SEC_REG <-- %02x\n", value); #endif s->alarm_tm.tm_sec = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x24: #ifdef ALMDEBUG printf("ALM MIN_REG <-- %02x\n", value); #endif s->alarm_tm.tm_min = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x28: #ifdef ALMDEBUG printf("ALM HRS_REG <-- %02x\n", value); #endif if (s->pm_am) s->alarm_tm.tm_hour = ((from_bcd(value & 0x3f)) % 12) + ((value >> 7) & 1) * 12; else s->alarm_tm.tm_hour = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x2c: #ifdef ALMDEBUG printf("ALM DAY_REG <-- %02x\n", value); #endif s->alarm_tm.tm_mday = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x30: #ifdef ALMDEBUG printf("ALM MON_REG <-- %02x\n", value); #endif s->alarm_tm.tm_mon = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x34: #ifdef ALMDEBUG printf("ALM YRS_REG <-- %02x\n", value); #endif s->alarm_tm.tm_year = from_bcd(value); omap_rtc_alarm_update(s); return; case 0x40: #ifdef ALMDEBUG printf("RTC CONTROL <-- %02x\n", value); #endif s->pm_am = (value >> 3) & 1; s->auto_comp = (value >> 2) & 1; s->round = (value >> 1) & 1; s->running = value & 1; s->status &= 0xfd; s->status |= s->running << 1; return; case 0x44: #ifdef ALMDEBUG printf("RTC STATUSL <-- %02x\n", value); #endif s->status &= ~((value & 0xc0) ^ 0x80); omap_rtc_interrupts_update(s); return; case 0x48: #ifdef ALMDEBUG printf("RTC INTRS <-- %02x\n", value); #endif s->interrupts = value; return; case 0x4c: #ifdef ALMDEBUG printf("RTC COMPLSB <-- %02x\n", value); #endif s->comp_reg &= 0xff00; s->comp_reg |= 0x00ff & value; return; case 0x50: #ifdef ALMDEBUG printf("RTC COMPMSB <-- %02x\n", value); #endif s->comp_reg &= 0x00ff; s->comp_reg |= 0xff00 & (value << 8); return; default: OMAP_BAD_REG(addr); return; } }
1threat
static uint64_t cchip_read(void *opaque, target_phys_addr_t addr, unsigned size) { CPUAlphaState *env = cpu_single_env; TyphoonState *s = opaque; uint64_t ret = 0; if (addr & 4) { return s->latch_tmp; } switch (addr) { case 0x0000: break; case 0x0040: break; case 0x0080: ret = s->cchip.misc | (env->cpu_index & 3); break; case 0x00c0: break; case 0x0100: case 0x0140: case 0x0180: case 0x01c0: break; case 0x0200: ret = s->cchip.dim[0]; break; case 0x0240: ret = s->cchip.dim[1]; break; case 0x0280: ret = s->cchip.dim[0] & s->cchip.drir; break; case 0x02c0: ret = s->cchip.dim[1] & s->cchip.drir; break; case 0x0300: ret = s->cchip.drir; break; case 0x0340: break; case 0x0380: ret = s->cchip.iic[0]; break; case 0x03c0: ret = s->cchip.iic[1]; break; case 0x0400: case 0x0440: case 0x0480: case 0x04c0: break; case 0x0580: break; case 0x05c0: break; case 0x0600: ret = s->cchip.dim[2]; break; case 0x0640: ret = s->cchip.dim[3]; break; case 0x0680: ret = s->cchip.dim[2] & s->cchip.drir; break; case 0x06c0: ret = s->cchip.dim[3] & s->cchip.drir; break; case 0x0700: ret = s->cchip.iic[2]; break; case 0x0740: ret = s->cchip.iic[3]; break; case 0x0780: break; case 0x0c00: case 0x0c40: case 0x0c80: case 0x0cc0: break; default: cpu_unassigned_access(cpu_single_env, addr, 0, 0, 0, size); return -1; } s->latch_tmp = ret >> 32; return ret; }
1threat
Does the master branch gets modified when I merge it into another branch? : <p>Simple question:</p> <p>I recently found out that you can merge your <code>master</code> into derived feature <code>branches</code> (to update your feature branch with the latest <code>master</code> changes).</p> <p>By doing so, am I modifying the <code>master</code> in any way? Or is it completely unaltered by that operation?</p>
0debug
static int vc1_decode_p_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp; int mqdiff, mquant; int ttmb = v->ttfrm; int mb_has_coeffs = 1; int dmv_x, dmv_y; int index, index1; int val, sign; int first_block = 1; int dst_idx, off; int skipped, fourmv; int block_cbp = 0, pat, block_tt = 0, block_intra = 0; mquant = v->pq; if (v->mv_type_is_raw) fourmv = get_bits1(gb); else fourmv = v->mv_type_mb_plane[mb_pos]; if (v->skip_is_raw) skipped = get_bits1(gb); else skipped = v->s.mbskip_table[mb_pos]; if (!fourmv) { if (!skipped) { GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; } s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; vc1_pred_mv(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->ac_pred = get_bits1(gb); cbp = 0; } else if (mb_has_coeffs) { if (s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); } else { mquant = v->pq; cbp = 0; } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); if (!s->mb_intra) vc1_mc_1mv(v, 0); dst_idx = 0; for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); v->mb_type[0][s->block_index[i]] = s->mb_intra; if (s->mb_intra) { v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) for (j = 0; j < 64; j++) s->block[i][j] <<= 1; s->idsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if (v->pq >= 9 && v->overlap) { if (v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if (v->a_avail) v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } block_cbp |= 0xF << (i << 2); block_intra |= 1 << i; } else if (val) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { s->mb_intra = 0; for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.qscale_table[mb_pos] = 0; vc1_pred_mv(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0, 0); vc1_mc_1mv(v, 0); } } else { if (!skipped ) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (i = 0; i < 6; i++) { val = ((cbp >> (5 - i)) & 1); s->dc_val[0][s->block_index[i]] = 0; s->mb_intra = 0; if (i < 4) { dmv_x = dmv_y = 0; s->mb_intra = 0; mb_has_coeffs = 0; if (val) { GET_MVDATA(dmv_x, dmv_y); } vc1_pred_mv(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); if (!s->mb_intra) vc1_mc_4mv_luma(v, i, 0, 0); intra_count += s->mb_intra; is_intra[i] = s->mb_intra; is_coded[i] = mb_has_coeffs; } if (i & 4) { is_intra[i] = (intra_count >= 3); is_coded[i] = val; } if (i == 4) vc1_mc_4mv_chroma(v, 0); v->mb_type[0][s->block_index[i]] = is_intra[i]; if (!coded_inter) coded_inter = !is_intra[i] && is_coded[i]; } dst_idx = 0; if (!intra_count && !coded_inter) goto end; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; { int intrapred = 0; for (i = 0; i < 6; i++) if (is_intra[i]) { if (((!s->first_slice_line || (i == 2 || i == 3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) || ((s->mb_x || (i == 1 || i == 3)) && v->mb_type[0][s->block_index[i] - 1])) { intrapred = 1; break; } } if (intrapred) s->ac_pred = get_bits1(gb); else s->ac_pred = 0; } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (i = 0; i < 6; i++) { dst_idx += i >> 2; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->mb_intra = is_intra[i]; if (is_intra[i]) { v->a_avail = v->c_avail = 0; if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (v->rangeredfrm) for (j = 0; j < 64; j++) s->block[i][j] <<= 1; s->idsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize); if (v->pq >= 9 && v->overlap) { if (v->c_avail) v->vc1dsp.vc1_h_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); if (v->a_avail) v->vc1dsp.vc1_v_overlap(s->dest[dst_idx] + off, i & 4 ? s->uvlinesize : s->linesize); } block_cbp |= 0xF << (i << 2); block_intra |= 1 << i; } else if (is_coded[i]) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize, (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { MB s->mb_intra = 0; s->current_picture.qscale_table[mb_pos] = 0; for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } for (i = 0; i < 4; i++) { vc1_pred_mv(v, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0], 0, 0); vc1_mc_4mv_luma(v, i, 0, 0); } vc1_mc_4mv_chroma(v, 0); s->current_picture.qscale_table[mb_pos] = 0; } } end: v->cbp[s->mb_x] = block_cbp; v->ttblk[s->mb_x] = block_tt; v->is_intra[s->mb_x] = block_intra; return 0; }
1threat
How can i display pdf file in my ASP.net web application? : <p>I want to click my linkbutton and open my pdf file that project has. How can i do this? </p> <p>in aspx page: </p> <p>in cs page: private void pdfShow_Click(){</p> <p>///Please help this. }</p>
0debug
Firebase: How to set default notification channel in Android app? : <p>How to set <strong>default</strong> notification channel for <em>notification messages</em> that come when an app is in the background? By default, these messages use "Miscellaneous" channel.</p>
0debug
Will be Instagram login totally deprecated? : <p>Instagram announced the <strong>Instagram Platform API deprecation</strong>:</p> <p><em>"To continuously improve Instagram users' privacy and security, we are accelerating the deprecation of Instagram API Platform"</em></p> <p>Their documentation and changelog says to refer to <strong>new Instagram Graph API</strong>.</p> <p>Is it clear that many, almost every old endpoints are now deprecated, but nothing is said about login functionality.</p> <p>The "new Instagram Graph API" seems to refer only to business oriented behaviour, so my question is: are they deprecating also Instagram Login feature for authentication?</p> <p>FYI:</p> <ul> <li><p><a href="https://www.instagram.com/developer/changelog/" rel="noreferrer">https://www.instagram.com/developer/changelog/</a></p></li> <li><p><a href="https://developers.facebook.com/products/instagram/" rel="noreferrer">https://developers.facebook.com/products/instagram/</a></p></li> </ul>
0debug
static int xen_pt_bar_reg_read(XenPCIPassthroughState *s, XenPTReg *cfg_entry, uint32_t *value, uint32_t valid_mask) { XenPTRegInfo *reg = cfg_entry->reg; uint32_t valid_emu_mask = 0; uint32_t bar_emu_mask = 0; int index; index = xen_pt_bar_offset_to_index(reg->offset); if (index < 0 || index >= PCI_NUM_REGIONS - 1) { XEN_PT_ERR(&s->dev, "Internal error: Invalid BAR index [%d].\n", index); return -1; } *value = base_address_with_flags(&s->real_device.io_regions[index]); switch (s->bases[index].bar_flag) { case XEN_PT_BAR_FLAG_MEM: bar_emu_mask = XEN_PT_BAR_MEM_EMU_MASK; break; case XEN_PT_BAR_FLAG_IO: bar_emu_mask = XEN_PT_BAR_IO_EMU_MASK; break; case XEN_PT_BAR_FLAG_UPPER: bar_emu_mask = XEN_PT_BAR_ALLF; break; default: break; } valid_emu_mask = bar_emu_mask & valid_mask; *value = XEN_PT_MERGE_VALUE(*value, cfg_entry->data, ~valid_emu_mask); return 0; }
1threat
How would I switch to and maximize an outside application using VB.NET : Someone may have already posted about this, but I am working on an application in VB.NET that requires me to switch to another open window and maximize it. I cannot for my life figure out a reliable way to do this (I gave up and called an autohotkey script, but even that broke). Any help is greatly appreciated!
0debug
Pytthon / TXT: code to copy text after string : <p>I have a txt file that will be different for different users, it looks something like:</p> <pre><code>NAME: Joe Bloggs USERNAME: BLOGJOE EMAIL: Joe.Bloggs@JB.com PASSWORD: IAMJOE </code></pre> <p>I am trying to make an function where I can choose optional inputs for example, I want username and Password, then it will just return those 2 from the function, but have the ability to return all. How would I do this?</p>
0debug
Represent SQL Entry As PHP Page : <p>Can anyone here to solve my query.</p> <ol> <li>I want to manage many PDFs on base of php and mysql. So, i make a script to show list of books with their author name and size from mysql and i were also categorize them. <strong><em>Now i want to show a detailed page (where download link, author name, size, screenshots, description will show) of each book, this detailed page will open when someone click on book name only.</em></strong></li> </ol> <p><strong>Script For List Of Books:</strong></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;?php $server = "localhost"; $username = "root"; $password = "mysql"; $dbname = "db-gs"; // Create connection $connect = mysqli_connect($server, $username, $password, $dbname); // Check connection if (!$connect) { die("Connection failed: " . mysqli_connect_error()); } // Selection of data $sql = "SELECT id, bname, aname, size, cat, lang FROM books"; $result = mysqli_query($connect, $sql); if (mysqli_num_rows($result) &gt; 0) { echo "&lt;table&gt;&lt;tr&gt;&lt;th&gt;SNo:&lt;/th&gt;&lt;th&gt;Books&lt;/th&gt;&lt;th&gt;Size&lt;/th&gt;&lt;th&gt;Language&lt;/th&gt;&lt;/tr&gt;"; // output data of each row while($row = mysqli_fetch_assoc($result)) { echo "&lt;tr&gt;&lt;td&gt;".$row["id"]."&lt;/td&gt;&lt;td&gt;".$row["bname"]."&lt;/td&gt;&lt;td&gt;".$row["size"]."&lt;/td&gt;&lt;td&gt;".$row["lang"]."&lt;/td&gt;&lt;/tr&gt;"; } echo "&lt;/table&gt;"; } else { echo "0 results"; } mysqli_close($connect); ?&gt;</code></pre> </div> </div> </p>
0debug
Sidekiq list all jobs [queued + running] : <p>Is there a way to get a list of all the jobs currently in the queue and running? Basically, I want to know if a job of given class is already there, I don't want to insert my other job. I've seen other option but I want to do it this way.</p> <p>I can see <a href="https://github.com/mperham/sidekiq/wiki/API" rel="noreferrer">here</a> how to get the list of jobs in the queue.</p> <pre><code>queue = Sidekiq::Queue.new("mailer") queue.each do |job| job.klass # =&gt; 'MyWorker' end </code></pre> <p>from what I understand this will not include processing/running jobs. Any way to get them?</p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
if condition in Python's list comprehension is not working : <p>I have the following simple code in python giving <strong>SyntaxError: invalid syntax</strong></p> <p>I want a new list with non zero values.</p> <pre><code>data = [11,2,0,34,8,4] new_data = [ if x for x in data ] print( new_data ) </code></pre>
0debug
static int fd_open(BlockDriverState *bs) { BDRVRawState *s = bs->opaque; int last_media_present; if (s->type != FTYPE_FD) return 0; last_media_present = (s->fd >= 0); if (s->fd >= 0 && (qemu_get_clock(rt_clock) - s->fd_open_time) >= FD_OPEN_TIMEOUT) { close(s->fd); s->fd = -1; raw_close_fd_pool(s); #ifdef DEBUG_FLOPPY printf("Floppy closed\n"); #endif } if (s->fd < 0) { if (s->fd_got_error && (qemu_get_clock(rt_clock) - s->fd_error_time) < FD_OPEN_TIMEOUT) { #ifdef DEBUG_FLOPPY printf("No floppy (open delayed)\n"); #endif return -EIO; } s->fd = open(bs->filename, s->fd_open_flags); if (s->fd < 0) { s->fd_error_time = qemu_get_clock(rt_clock); s->fd_got_error = 1; if (last_media_present) s->fd_media_changed = 1; #ifdef DEBUG_FLOPPY printf("No floppy\n"); #endif return -EIO; } #ifdef DEBUG_FLOPPY printf("Floppy opened\n"); #endif } if (!last_media_present) s->fd_media_changed = 1; s->fd_open_time = qemu_get_clock(rt_clock); s->fd_got_error = 0; return 0; }
1threat
Create full-rank matrix in matlab : I wanna to create a full-ranked matrix (named <code>A</code>) with 100 column and 100 rows. How can I do it in Matlab?
0debug
static int alsa_poll_helper (snd_pcm_t *handle, struct pollhlp *hlp, int mask) { int i, count, err; struct pollfd *pfds; count = snd_pcm_poll_descriptors_count (handle); if (count <= 0) { dolog ("Could not initialize poll mode\n" "Invalid number of poll descriptors %d\n", count); return -1; } pfds = audio_calloc ("alsa_poll_helper", count, sizeof (*pfds)); if (!pfds) { dolog ("Could not initialize poll mode\n"); return -1; } err = snd_pcm_poll_descriptors (handle, pfds, count); if (err < 0) { alsa_logerr (err, "Could not initialize poll mode\n" "Could not obtain poll descriptors\n"); g_free (pfds); return -1; } for (i = 0; i < count; ++i) { if (pfds[i].events & POLLIN) { err = qemu_set_fd_handler (pfds[i].fd, alsa_poll_handler, NULL, hlp); } if (pfds[i].events & POLLOUT) { if (conf.verbose) { dolog ("POLLOUT %d %d\n", i, pfds[i].fd); } err = qemu_set_fd_handler (pfds[i].fd, NULL, alsa_poll_handler, hlp); } if (conf.verbose) { dolog ("Set handler events=%#x index=%d fd=%d err=%d\n", pfds[i].events, i, pfds[i].fd, err); } if (err) { dolog ("Failed to set handler events=%#x index=%d fd=%d err=%d\n", pfds[i].events, i, pfds[i].fd, err); while (i--) { qemu_set_fd_handler (pfds[i].fd, NULL, NULL, NULL); } g_free (pfds); return -1; } } hlp->pfds = pfds; hlp->count = count; hlp->handle = handle; hlp->mask = mask; return 0; }
1threat
Android - Can I make an app think I'm in a different country? : <p>I have a downloaded app which works only in <strong>poland</strong>, and recently had to move to the <strong>usa</strong> for a short period of time. </p> <p>I would like to run the application here but am getting the "video can only be played in poland" message.</p> <p>Is there any way I could make the app think I am in my country?</p>
0debug
add sequential number at the beginning of files in Bash : I have 5 files I wan to add sequential numbers and tabulation at the beginning of each file but the second file should start with the last number from the first file and so on here's an example: file1 line1 line2 .... line13 file2 line1 line2 file5 line1 line2 output file1 1 line1 ........ 13 line13 output file2 14 line1 15 line2 and so on
0debug
static int spapr_fixup_cpu_dt(void *fdt, sPAPREnvironment *spapr) { int ret = 0, offset, cpus_offset; CPUState *cs; char cpu_model[32]; int smt = kvmppc_smt_threads(); uint32_t pft_size_prop[] = {0, cpu_to_be32(spapr->htab_shift)}; CPU_FOREACH(cs) { PowerPCCPU *cpu = POWERPC_CPU(cs); DeviceClass *dc = DEVICE_GET_CLASS(cs); int index = ppc_get_vcpu_dt_id(cpu); uint32_t associativity[] = {cpu_to_be32(0x5), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(cs->numa_node), cpu_to_be32(index)}; if ((index % smt) != 0) { continue; } snprintf(cpu_model, 32, "%s@%x", dc->fw_name, index); cpus_offset = fdt_path_offset(fdt, "/cpus"); if (cpus_offset < 0) { cpus_offset = fdt_add_subnode(fdt, fdt_path_offset(fdt, "/"), "cpus"); if (cpus_offset < 0) { return cpus_offset; } } offset = fdt_subnode_offset(fdt, cpus_offset, cpu_model); if (offset < 0) { offset = fdt_add_subnode(fdt, cpus_offset, cpu_model); if (offset < 0) { return offset; } } if (nb_numa_nodes > 1) { ret = fdt_setprop(fdt, offset, "ibm,associativity", associativity, sizeof(associativity)); if (ret < 0) { return ret; } } ret = fdt_setprop(fdt, offset, "ibm,pft-size", pft_size_prop, sizeof(pft_size_prop)); if (ret < 0) { return ret; } ret = spapr_fixup_cpu_smt_dt(fdt, offset, cpu, smp_threads); if (ret < 0) { return ret; } } return ret; }
1threat
How to create dialog which have textview in android : I already tried create alert dialog in android and set textview using alert dialog object.settype(textviewobject) but i will not get exact result. I want to create dialog and which have textview . i want to set text in textview. Thanks in advance. [1]: https://i.stack.imgur.com/Myfwq.png
0debug
static gboolean gd_window_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque) { GtkDisplayState *s = opaque; GtkAccelGroupEntry *entries; guint n_entries = 0; gboolean propagate_accel = TRUE; gboolean handled = FALSE; entries = gtk_accel_group_query(s->accel_group, key->keyval, key->state, &n_entries); if (n_entries) { const char *quark = g_quark_to_string(entries[0].accel_path_quark); if (gd_is_grab_active(s) && strstart(quark, "<QEMU>/File/", NULL)) { propagate_accel = FALSE; } } if (!handled && propagate_accel) { handled = gtk_window_activate_key(GTK_WINDOW(widget), key); } if (handled) { gtk_release_modifiers(s); } else { handled = gtk_window_propagate_key_event(GTK_WINDOW(widget), key); } return handled; }
1threat
Mutually-dependent C++ classes, held by std::vector : <p>I was curious if was possible to create two classes, each of which holds a <code>std::vector</code> of the other. My first guess was that it would not be possible, because <code>std::vector</code> requires a complete type, not just a forward declaration.</p> <pre><code>#include &lt;vector&gt; class B; class A { std::vector&lt;B&gt; b; }; class B { std::vector&lt;A&gt; a; }; </code></pre> <p>I would think that the declaration of <code>std::vector&lt;B&gt;</code> would cause an immediate failure, because <code>B</code> has an incomplete type at this point. However, this compiles successfully under both gcc and clang, without any warnings. Why doesn't this cause an error?</p>
0debug
Nested dictionary for Fetching value : >>>> d = {'k1':[1,2,3,{'tricky':['oh','man','inception',{'target':[1,2,3,'hello']}]}]} '''how to fecth the word hello'''
0debug
offline location tracking in android : I want to draw employee's live location and travelled path , I am running a service in background continuously to get location details and storing to server , at admin side i ma drawing the path by those records stored in db.[i am getting the path like a square in offline while am able to clearly in online ][1] how can i store the correct lat long values in server in offline, i want to draw the path clearly in offline also ,how can i achieve that ,please suggest me a way , thank you [1]: https://i.stack.imgur.com/ewtUQ.png
0debug
How to know if a class is inherited from another class in PHP? : <p>I only have the class string not a object. And to <code>new</code> a new object might not be the best solution.</p>
0debug
Is there a way to create a Scatterplot in manim? : <p>I am wondering if there is a way to create a Scatterplot in manim.</p> <p>Has anyone ever done it? if yes, what is the best way to do it?</p>
0debug
python - if item in list does not contain "string" add a "string2" to item : in Python I have a list of that sort: list = ["item.1", "https://sdfhkjdsffs/THIS-STRING", "http://fsdhfjsdhfsdf/THIS-STRING", item4/THIS-STRING, item5] how do i go about adding "some string" for each item in list that does NOT contain "THIS-STRING"? Thanks!
0debug
BlockDriverState *check_to_replace_node(const char *node_name, Error **errp) { BlockDriverState *to_replace_bs = bdrv_find_node(node_name); AioContext *aio_context; if (!to_replace_bs) { error_setg(errp, "Node name '%s' not found", node_name); return NULL; } aio_context = bdrv_get_aio_context(to_replace_bs); aio_context_acquire(aio_context); if (bdrv_op_is_blocked(to_replace_bs, BLOCK_OP_TYPE_REPLACE, errp)) { to_replace_bs = NULL; goto out; } if (!bdrv_is_first_non_filter(to_replace_bs)) { error_setg(errp, "Only top most non filter can be replaced"); to_replace_bs = NULL; goto out; } out: aio_context_release(aio_context); return to_replace_bs; }
1threat
static void RENAME(yuv2rgb32_2)(SwsContext *c, const uint16_t *buf0, const uint16_t *buf1, const uint16_t *ubuf0, const uint16_t *ubuf1, const uint16_t *vbuf0, const uint16_t *vbuf1, const uint16_t *abuf0, const uint16_t *abuf1, uint8_t *dest, int dstW, int yalpha, int uvalpha, int y) { if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) { #if ARCH_X86_64 __asm__ volatile( YSCALEYUV2RGB(%%r8, %5) YSCALEYUV2RGB_YA(%%r8, %5, %6, %7) "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" "packuswb %%mm7, %%mm1 \n\t" WRITEBGR32(%4, 8280(%5), %%r8, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "r" (dest), "a" (&c->redDither), "r" (abuf0), "r" (abuf1) : "%r8" ); #else *(const uint16_t **)(&c->u_temp)=abuf0; *(const uint16_t **)(&c->v_temp)=abuf1; __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "push %0 \n\t" "push %1 \n\t" "mov "U_TEMP"(%5), %0 \n\t" "mov "V_TEMP"(%5), %1 \n\t" YSCALEYUV2RGB_YA(%%REGBP, %5, %0, %1) "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" "packuswb %%mm7, %%mm1 \n\t" "pop %1 \n\t" "pop %0 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm1, %%mm0, %%mm7, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); #endif } else { __asm__ volatile( "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" "mov %4, %%"REG_b" \n\t" "push %%"REG_BP" \n\t" YSCALEYUV2RGB(%%REGBP, %5) "pcmpeqd %%mm7, %%mm7 \n\t" WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6) "pop %%"REG_BP" \n\t" "mov "ESP_OFFSET"(%5), %%"REG_b" \n\t" :: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest), "a" (&c->redDither) ); } }
1threat
how to find element locator from HTML code for selenium python, when nothing is given even xpath is not working : Actually this button is located inside container. Please provide syntax for **python** Here this property has unique name, but dont know how to use this [data-control-name="job_search_category_suggestion_it"] <button class="jobs-search-category-suggestions__button button-secondary-medium-muted mb2 mr2" data-control-name="job_search_category_suggestion_it" data-ember-action="" data-ember-action-8126="8126"> <li-icon aria-hidden="true" type="search-icon" size="small"><svg viewBox="0 0 24 24" width="24px" height="24px" x="0" y="0" preserveAspectRatio="xMinYMin meet" class="artdeco-icon" focusable="false"><path d="M14,12.67L11.13,9.8A5,5,0,1,0,9.8,11.13L12.67,14ZM3.88,7A3.13,3.13,0,1,1,7,10.13,3.13,3.13,0,0,1,3.88,7Z" class="small-icon" style="fill-opacity: 1"></path></svg></li-icon>IT </button> I used this code: elem = driver.find_elements_by_xpath('//button[@data-control-name="job_search_category_suggestion_it]').click()
0debug
Synax Error In Function - MYSQL : im trying to make a function that does a simple `insert` into a table called `poli`, the purpose of this fuction: - returns 1 when it inserts the values to the table - in any other case it returns 0. This is the code in mysql that i wrote: CREATE OR REPLACE FUNCTION ADDPOLI ( ID IN NUMBER, NAME IN VARCHAR2 , LON IN FLOAT , LAT IN FLOAT , STATUS OUT NUMBER ) return status IS cursor poli_count is select count(id) from poli; BEGIN declare number_of_cities int; fetch poli_c into number_of_cities; if number_of_cities<= 15 and number_of_cities>=0 then insert into poli values(id,name,lat,lon); return 1; else return 0; end if; END ADDPOLI; > i have a syntax error here: fetch poli_c into number_of_cities; how can i fix it ?
0debug
static char *tcg_get_arg_str_idx(TCGContext *s, char *buf, int buf_size, int idx) { assert(idx >= 0 && idx < s->nb_temps); return tcg_get_arg_str_ptr(s, buf, buf_size, &s->temps[idx]); }
1threat
How can I act on cursor activity originating from mouse clicks and not keyboard actions? : <p>I want to do something when a user moves the cursor to another location via a mouse click, but not do it when it's done via a keyboard action (arrows, pageup/pagedown, home/end).</p> <ul> <li>I can't just listen to <code>cursorActivity</code> since it triggers on both keyboard and mouse actions.</li> <li>I'm not sure I can listen to <code>mousedown</code>, because it might be the start of something which is not a cursor location change (e.g. selecting, dragging).</li> </ul> <p>What's the best way to catch those mouse-originated cursor movements?</p>
0debug
I want to return data from doInBackground method and compair with other string in other method : what i do in this code for comparing retrieved data from server to other string, please tell me changes. ArrayList<HashMap<String, String>> matchStudentsList = new ArrayList<HashMap<String, String>>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.third_sem); present = (Button) findViewById(R.id.button2); bt= BluetoothAdapter.getDefaultAdapter(); // Call Async task to get the match fixture new GetFixture().execute(); } private class GetFixture extends AsyncTask<String, Void, String> { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(String... arg0) { ServiceHandler serviceClient = new ServiceHandler(); Log.d("url: ", "> " + URL_Students); String json = serviceClient.makeServiceCall(URL_Students,ServiceHandler.GET); // print the json response in the log Log.d("Get match fixture response: ", "> " + json); if (json != null) { try { Log.d("try", "in the try"); JSONObject jsonObj = new JSONObject(json); Log.d("jsonObject", "new json Object"); // Getting JSON Array node matchRecords = jsonObj.getJSONArray(TAG_Table); Log.d("json aray", "user point array"); int len = matchRecords.length(); Log.d("len", "get array length"); for (int i = 0; i <len; i++) { JSONObject c = matchRecords.getJSONObject(i); String RollNo = c.getString(TAG_Roll_No); Log.d("RollNo", RollNo); String FirstName = c.getString(TAG_First_Name); Log.d("FirstName", FirstName); String LastName = c.getString(TAG_Last_Name); Log.d("LastName", LastName); // hashmap for single match HashMap<String, String> matchFixture = new HashMap<String, String>(); // adding each child node to HashMap key => value matchFixture.put(TAG_Roll_No, RollNo); matchFixture.put(TAG_First_Name, FirstName); matchFixture.put(TAG_Last_Name, LastName); matchStudentsList.add(matchFixture); } } catch (JSONException e) { Log.d("catch", "in the catch"); e.printStackTrace(); } } else { Log.e("JSON Data", "Didn't receive any data from server!"); } return null; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); ListAdapter adapter = new SimpleAdapter( ThirdSem.this, matchStudentsList, R.layout.list_checkitem, new String[]{TAG_Roll_No, TAG_First_Name, TAG_Last_Name, TAG_BAddress} , new int[]{R.id.RollNo, R.id.FirstName, R.id.LastName } ); setListAdapter(adapter); } } } it will be very very helpful for me please, thanx in advance whose can solve it
0debug