problem
stringlengths
26
131k
labels
class label
2 classes
Create a copy of object, then deleted an element only from the copy, not the original : <p>How do I make <code>obj2</code> the same as <code>obj1</code> but not affected by the deletion?</p> <p>Currently the <code>name: 42</code> entry will be deleted from both objects.</p> <p>Is it because of hoisting - that is, the deletion occurs before <code>obj2</code> is created?</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-js lang-js prettyprint-override"><code>var obj1 = { 'name': 'John', 'age': 42, } var obj2 = obj1 delete obj1['name'] console.log(obj1) console.log(obj2)</code></pre> </div> </div> </p>
0debug
MANIFEST.MF (The system cannot find the path specified) : <p>I am trying to create the project as set out in the tutorial "<a href="http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/" rel="noreferrer">http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/</a>". I have followed all the steps but I get thee POM error ....</p> <p>Description Resource Path Location Type C:\Users\xxxxxx\workspace\CrunchifyRESTJerseyExample\target\m2e-wtp\web-resources\META-INF\MANIFEST.MF (The system cannot find the path specified) pom.xml /CrunchifyRESTJerseyExample line 1 Maven Configuration Problem</p> <p>I've noticed that I have 2 Web Content folders: One under Deployed Resources, which does contain my MANIFEST.MF file and another at the same level as the Deployed Resources folder. Eclipse seems to be looking for it in the second WebContent folder where it is not located. Is there a simple fix for this?</p>
0debug
different result when using stream and parallelStream for redusing same array of data? : I used reduce with stream and also parallelStream on the same array with same Lambda Expression and I expected the same result but the output is different. I don't Understand why!? following is the code: System.out.println("Reduce me..."); Integer[] arrx = {1,2,3,4}; // Reducing the Array Arrays .stream(arrx) .reduce((s1, s2) -> (int)Math.pow(s1,2) + (int)Math.pow(s2,2)) .ifPresent(System.out::println); Arrays.asList(arrx) .parallelStream() .reduce((s1, s2) -> (int)Math.pow(s1,2) + (int)Math.pow(s2,2)) .ifPresent(System.out::println); and the Output is: 1172 650
0debug
How to add progress bar over dialog : <p>Whenever I want to show progress bar into my app, I call this method and this method adds ProgressBar into my layout. </p> <p><strong>Problem :</strong> I want to show this progress bar over Dialog, but Dialog is always shown above. What can be done for this situation?</p> <pre><code>public static void showProgressBar(@NonNull final Activity activity) { try { if (activity == null) { LogManager.printStackTrace(new NullActivityException()); return; } View view = activity.findViewById(android.R.id.content); if (view == null) { LogManager.printStackTrace(new NullPointerException("content view is null")); return; } View rootView = activity.findViewById(android.R.id.content).getRootView(); if (rootView == null || !(rootView instanceof ViewGroup)) { LogManager.printStackTrace(new NullPointerException("rootView is null or not an instance of ViewGroup")); return; } final ViewGroup layout = (ViewGroup) rootView; final ProgressBar progressBar = new ProgressBar(activity); progressBar.setIndeterminate(true); if (Build.VERSION.SDK_INT &lt; Build.VERSION_CODES.LOLLIPOP) { Drawable wrapDrawable = DrawableCompat.wrap(progressBar.getIndeterminateDrawable()); DrawableCompat.setTint(wrapDrawable, ContextCompat.getColor(activity, R.color.colorAccent)); progressBar.setIndeterminateDrawable(DrawableCompat.unwrap(wrapDrawable)); } RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); final RelativeLayout rl = new RelativeLayout(activity); rl.setBackgroundColor(ActivityCompat.getColor(activity, R.color.tc_hint_grey_alpha)); rl.setClickable(true); rl.setTag("#$UniqueProgressBar"); ViewGroup.LayoutParams params2 = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 120); rl.setGravity(Gravity.CENTER); rl.addView(progressBar, params2); LogManager.i("ProgressBar", "ProgressUtils.showProgressBar-&gt;called"); layout.addView(rl, params); mRunnable = new Runnable() { @Override public void run() { LogManager.i("ProgressBar", "ProgressUtils.showProgressBar-&gt;120 secs timeout"); hideProgressBar(activity); } }; mHandler = new Handler(); mHandler.postDelayed(mRunnable, 120000); LogManager.i("ProgressBar", "Added"); } catch (Exception e) { LogManager.printStackTrace(e); } } </code></pre>
0debug
How to achieve behavior of setTimeout in Elm : <p>I'm writing a web game in Elm with lot of time-dependent events and I'm looking for a way to schedule an event at a specific time delay.</p> <p>In JavaScript I used <code>setTimeout(f, timeout)</code>, which obviously worked very well, but - for various reasons - I want to avoid JavaScript code and use Elm alone. </p> <p>I'm aware that I can <code>subscribe</code> to <code>Tick</code> at specific interval and recieve clock ticks, but this is not what I want - my delays have no reasonable common denominator (for example, two of the delays are 30ms and 500ms), and I want to avoid having to handle a lot of unnecessary ticks.</p> <p>I also came across <code>Task</code> and <code>Process</code> - it seems that by using them I am somehow able to what I want with <code>Task.perform failHandler successHandler (Process.sleep Time.second)</code>. </p> <p>This works, but is not very intuitive - my handlers simply ignore all possible input and send same message. Moreover, I do not expect the timeout to ever fail, so creating the failure handler feels like feeding the library, which is not what I'd expect from such an elegant language. </p> <p>Is there something like <code>Task.delayMessage time message</code> which would do exactly what I need to (send me a copy of its message argument after specified time), or do I have to make my own wrapper for it?</p>
0debug
static int spapr_create_pci_child_dt(sPAPRPHBState *phb, PCIDevice *dev, void *fdt, int node_offset) { int offset, ret; char nodename[FDT_NAME_MAX]; pci_get_node_name(nodename, FDT_NAME_MAX, dev); offset = fdt_add_subnode(fdt, node_offset, nodename); ret = spapr_populate_pci_child_dt(dev, fdt, offset, phb); g_assert(!ret); if (ret) { return 0; } return offset; }
1threat
How to call a function on append-icon click in Vuetify.js? : <p>I need the <code>append-icon="close"</code> to call <code>@click="clearSearch()"</code></p> <p>Right now I'm implementing it with a dedicated button:</p> <pre><code> &lt;v-text-field v-model="search" class="search" label="search" prepend-icon="search" append-icon="close"&gt; &lt;/v-text-field&gt; &lt;v-btn @click="clearSearch()"&gt;&lt;/v-btn&gt; </code></pre> <hr> <ul> <li>I've tried adding <code>append-icon-cb="clearSearch()"</code> but it doesn't work and I don't know why</li> <li>I've also tried simply using <code>clearable</code>, it clears the input but all the elements stay "filtered". I don't know how <code>clearable</code> works but my <code>clearSearch()</code> method simply does: <code>clearSearch() {this.search = ""}</code> and it works, that's why I use the custom <strong>clear input</strong> method</li> </ul>
0debug
static void filter(AVFilterContext *ctx) { IDETContext *idet = ctx->priv; int y, i; int64_t alpha[2]={0}; int64_t delta=0; Type type, best_type; int match = 0; for (i = 0; i < idet->csp->nb_components; i++) { int w = idet->cur->video->w; int h = idet->cur->video->h; int refs = idet->cur->linesize[i]; if (i && i<3) { w >>= idet->csp->log2_chroma_w; h >>= idet->csp->log2_chroma_h; } for (y = 2; y < h - 2; y++) { uint8_t *prev = &idet->prev->data[i][y*refs]; uint8_t *cur = &idet->cur ->data[i][y*refs]; uint8_t *next = &idet->next->data[i][y*refs]; alpha[ y &1] += idet->filter_line(cur-refs, prev, cur+refs, w); alpha[(y^1)&1] += idet->filter_line(cur-refs, next, cur+refs, w); delta += idet->filter_line(cur-refs, cur, cur+refs, w); } } if (alpha[0] / (float)alpha[1] > idet->interlace_threshold){ type = TFF; }else if(alpha[1] / (float)alpha[0] > idet->interlace_threshold){ type = BFF; }else if(alpha[1] / (float)delta > idet->progressive_threshold){ type = PROGRSSIVE; }else{ type = UNDETERMINED; } memmove(idet->history+1, idet->history, HIST_SIZE-1); idet->history[0] = type; best_type = UNDETERMINED; for(i=0; i<HIST_SIZE; i++){ if(idet->history[i] != UNDETERMINED){ if(best_type == UNDETERMINED) best_type = idet->history[i]; if(idet->history[i] == best_type) { match++; }else{ match=0; break; } } } if(idet->last_type == UNDETERMINED){ if(match ) idet->last_type = best_type; }else{ if(match>2) idet->last_type = best_type; } if (idet->last_type == TFF){ idet->cur->video->top_field_first = 1; idet->cur->video->interlaced = 1; }else if(idet->last_type == BFF){ idet->cur->video->top_field_first = 0; idet->cur->video->interlaced = 1; }else if(idet->last_type == PROGRSSIVE){ idet->cur->video->interlaced = 0; } idet->prestat [ type] ++; idet->poststat[idet->last_type] ++; av_log(ctx, AV_LOG_DEBUG, "Single frame:%s, Multi frame:%s\n", type2str(type), type2str(idet->last_type)); }
1threat
In while, i'm expected that in every loop it will take an another (next one) char. but switch satatement working just for once. how can i repair this? : // this code should take every char and see if its 'A' or 'T'. Then if it takes an'A' it should ignore the next 'A'characters until it takes an 'T'. it kinda like matching the 'A' and 'T' like a dna chain. #include <stdio.h> int main(){ int a=0,t=0,i=0; //definitions char c; c = getchar(); while (i<25){ //only the first 25 characters will be processed. switch (c){ case 'A': a++; break; case 'T': t++; break; } if (a>t+1){ c = c - 'A'; a--; } if (t>a+1){ c = c - 'T'; t--; } i++; } putchar(c); return 0; }
0debug
Unable to push files to git due to: failed to push some refs : <p>I have a directory that i want to turn into a git project.</p> <p>I created a new project in gitlab and then i did the following:</p> <pre><code>git init git remote add origin git@gitlab.com:a/b/c.git git add . git commit -m "Initial commit" git push -u origin master </code></pre> <p>In addition, I created the following <code>.gitignore</code> file:</p> <pre><code>* !*/scripts !*/jobs </code></pre> <p>After running <code>git push -u origin master</code> i got the following error:</p> <pre><code>Counting objects: 33165, done. Delta compression using up to 2 threads. Compressing objects: 100% (32577/32577), done. Writing objects: 100% (33165/33165), 359.84 MiB | 1.70 MiB/s, done. Total 33165 (delta 21011), reused 0 (delta 0) remote: Resolving deltas: 100% (21011/21011), done. remote: GitLab: remote: A default branch (e.g. master) does not yet exist for a/b/c remote: Ask a project Owner or Maintainer to create a default branch: remote: remote: https://gitlab.com/a/b/c/project_members remote: To gitlab.com:a/b/c.git ! [remote rejected] master -&gt; master (pre-receive hook declined) error: failed to push some refs to 'git@gitlab.com:a/b/c.git' </code></pre> <p>What could be the issue? Please advise</p>
0debug
let my function work always when my app is off : actually i am developing an alarm so i need to retrieve times from database the code explain how i iterate my database and retrieve hour and minutes and then set it in calendar how can i let that function working always and always looping in my database to compare with current time and then ring? what about requestcode ? i read that its important and i should take id of row in my database and put it requestcode !! private void ringalarms(){ Cursor data = myDB.getListContents(); int hr,mt = 0; alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); final Calendar calendar = Calendar.getInstance(); final Intent myIntent = new Intent(this.context, Alarm_Receiver.class); data.moveToFirst(); while (!data.isAfterLast()) { hr=Integer.parseInt(data.getString(0)); mt=Integer.parseInt(data.getString(1)); calendar.set(Calendar.HOUR_OF_DAY, hr); calendar.set(Calendar.MINUTE, mt); myIntent.putExtra("extra", "yes"); //myIntent.putExtra("id", i); pending_intent = PendingIntent.getBroadcast(Add_Alarm.this, 0, myIntent, PendingIntent.FLAG_UPDATE_CURRENT); alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),AlarmManager.INTERVAL_DAY, pending_intent); data.moveToNext(); } } > Blockquote public Cursor getListContents(){ SQLiteDatabase db = this.getWritableDatabase(); Cursor data = db.rawQuery("SELECT Hour, Minutes FROM " + TABLE_NAME, null); return data; }
0debug
When to use const with objects in JavaScript? : <p>I recently read about ES6 <code>const</code> keyword and I can understand its importance when having something like this:</p> <pre><code>(function(){ const PI = 3.14; PI = 3.15; // Uncaught TypeError: Assignment to constant variable })(); </code></pre> <p>So, nobody can change my <code>PI</code> variable.</p> <p>The misunderstanding I have is that I don't understand in which situation the use of <code>const</code> with objects can make sense (other than preventing people to do <code>myObj = newValue;</code>).</p> <pre><code>(function(){ const obj = {a:1 ,b: 2, c:3}; //obj = {x:7 , y:8, z: 9} //This is good //TypeError: Assignment to constant variable. obj.a=7; obj.b=8 ; obj.c=9; console.log(obj); //outputs: {a: 7, b: 8, c: 9} })(); </code></pre> <p>So when declaring an object: when should I say: Now I <strong>must</strong> declare my object with <code>const</code>?</p>
0debug
How to correctly use Vue JS watch with lodash debounce : <p>I'm using lodash to call a debounce function on a component like so:</p> <pre><code>... import _ from 'lodash'; export default { store, data: () =&gt; { return { foo: "", } }, watch: { searchStr: _.debounce(this.default.methods.checkSearchStr(str), 100) }, methods: { checkSearchStr(string) { console.log(this.foo) // &lt;-- ISSUE 1 console.log(this.$store.dispatch('someMethod',string) // &lt;-- ISSUE 2 } } } </code></pre> <ul> <li>Issue 1 is that my method <code>checkSearchStr</code> doesn't know about <code>foo</code></li> <li>Issue 2 is that my store is <code>undefined</code> as well</li> </ul> <p>Why doesn't my method know <code>this</code> when called through <code>_.debounce</code>? And what is the correct usage?</p>
0debug
PHP performance difference conditions of if statement : <p>Hey quick question anyone knows if there is any performance difference between these 2 codes (PHP-7):</p> <pre><code>public function isActive() : bool { if ($cond1) { if ($cond2) { return true; } } return false; } </code></pre> <p>and</p> <pre><code>public function isActive() : bool { if ($cond1 &amp;&amp; $cond2) { return true; } return false; } </code></pre> <p>(Yes I know the variables are not defined, question is about the if statements not the variables)</p> <p>I ask this question because I'm focusing on readability of my code, but at same time maintaining my performance the best I can.</p> <p>Even if it is just a very tiny performance difference (e.g 0.000000001%) I still like to know the answer.</p>
0debug
Getting "guard body may not fall through" error when setting up Google Analytics on iOS Project (in Swift) : <p>I am getting the following error when trying to archive my build on XCode:</p> <blockquote> <p>/Users/AppDelegate.swift:18:9: 'guard' body may not fall through, consider using 'return' or 'break' to exit the scope</p> </blockquote> <p>It is a little frustrating, because it is the exact code that Google Analytics (I just copied/pasted) suggests you to put in appdelegate to set-up their analytics. Also, it only occurs when archiving my build. It does not occur when just running my code in the simulator.</p> <p>Would appreciate if anyone had some ideas.</p> <p><em>EDIT: I also tried placing a break or continue after the assert, but I got an error...Something about it not being a loop.</em></p> <pre><code>import UIKit import Firebase @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool { FIRApp.configure() //Google Analytics guard let gai = GAI.sharedInstance() else { assert(false, "Google Analytics not configured correctly") } gai.tracker(withTrackingId: "xxxxxxxxxxx") // Optional: automatically report uncaught exceptions. gai.trackUncaughtExceptions = true // Optional: set Logger to VERBOSE for debug information. // Remove before app release. gai.logger.logLevel = .verbose; return true } </code></pre>
0debug
How to check array size in c++ avoiding empty spaces : <p>I am making a password program, when you input a password from a character array and i want to check if all the array spaces are used. If c++ auto fills empty brackets how can i evaluate?</p>
0debug
static void openpic_update_irq(OpenPICState *opp, int n_IRQ) { IRQSource *src; bool active, was_active; int i; src = &opp->src[n_IRQ]; active = src->pending; if ((src->ivpr & IVPR_MASK_MASK) && !src->nomask) { DPRINTF("%s: IRQ %d is disabled\n", __func__, n_IRQ); active = false; } was_active = !!(src->ivpr & IVPR_ACTIVITY_MASK); if (!active && !was_active) { DPRINTF("%s: IRQ %d is already inactive\n", __func__, n_IRQ); return; } if (active) { src->ivpr |= IVPR_ACTIVITY_MASK; } else { src->ivpr &= ~IVPR_ACTIVITY_MASK; } if (src->idr == 0) { DPRINTF("%s: IRQ %d has no target\n", __func__, n_IRQ); return; } if (src->idr == (1 << src->last_cpu)) { IRQ_local_pipe(opp, src->last_cpu, n_IRQ, active, was_active); } else if (!(src->ivpr & IVPR_MODE_MASK)) { for (i = 0; i < opp->nb_cpus; i++) { if (src->destmask & (1 << i)) { IRQ_local_pipe(opp, i, n_IRQ, active, was_active); } } } else { for (i = src->last_cpu + 1; i != src->last_cpu; i++) { if (i == opp->nb_cpus) { i = 0; } if (src->destmask & (1 << i)) { IRQ_local_pipe(opp, i, n_IRQ, active, was_active); src->last_cpu = i; break; } } } }
1threat
Reverse a string in C++ with string(name.rbegin(),name.rend()); : string is = "text"; string(is.rbegin(),is.rend()); I have found this method for reversing a string but I don't understand how it works. Can you provide me with an explanation?
0debug
static void ohci_sysbus_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = ohci_realize_pxa; set_bit(DEVICE_CATEGORY_USB, dc->categories); dc->desc = "OHCI USB Controller"; dc->props = ohci_sysbus_properties; dc->reset = usb_ohci_reset_sysbus; }
1threat
how to use spring annotations like @Autowired or @Value in kotlin for primitive types? : <p>Autowiring a non-primitive with spring annotations like</p> <pre><code>@Autowired lateinit var metaDataService: MetaDataService </code></pre> <p>works.</p> <p>But this doesn't work:</p> <pre><code>@Value("\${cacheTimeSeconds}") lateinit var cacheTimeSeconds: Int </code></pre> <p>with an error: </p> <blockquote> <p>lateinit modifier is not allowed for primitive types.</p> </blockquote> <p>How to autowire primitve properties into kotlin classes?</p>
0debug
static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data) { SVQ1Context * const s = avctx->priv_data; AVFrame *pict = data; AVFrame * const p= (AVFrame*)&s->picture; AVFrame temp; int i; if(avctx->pix_fmt != PIX_FMT_YUV410P){ av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n"); return -1; } if(!s->current_picture.data[0]){ avctx->get_buffer(avctx, &s->current_picture); avctx->get_buffer(avctx, &s->last_picture); s->scratchbuf = av_malloc(s->current_picture.linesize[0] * 16); } temp= s->current_picture; s->current_picture= s->last_picture; s->last_picture= temp; init_put_bits(&s->pb, buf, buf_size); *p = *pict; p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ? FF_P_TYPE : FF_I_TYPE; p->key_frame = p->pict_type == FF_I_TYPE; svq1_write_header(s, p->pict_type); for(i=0; i<3; i++){ if(svq1_encode_plane(s, i, s->picture.data[i], s->last_picture.data[i], s->current_picture.data[i], s->frame_width / (i?4:1), s->frame_height / (i?4:1), s->picture.linesize[i], s->current_picture.linesize[i]) < 0) return -1; } while(put_bits_count(&s->pb) & 31) put_bits(&s->pb, 1, 0); flush_put_bits(&s->pb); return put_bits_count(&s->pb) / 8; }
1threat
-how to get the contents of a class or id, with a url that leads to the page in question! "sorry for my english :p" : I would like to retrieve the content of a (class), and I would like to recover it just with the url, kind I give the url and he gives me the content of a class I hope you understand what I want to say it's knowing you let me code you, or redirect me on the same case as me :) thank you! (^^ sorry for my english) http://fr.fetchfile.net/ it's the same principle with this site! what I am looking for!!!! we enter url of the page and it recupere automatically the url of the video that seeks for it.
0debug
static BlockDriverState *bdrv_new_open(const char *filename, const char *fmt, int flags, bool require_io, bool quiet) { BlockDriverState *bs; BlockDriver *drv; char password[256]; Error *local_err = NULL; int ret; bs = bdrv_new("image"); if (fmt) { drv = bdrv_find_format(fmt); if (!drv) { error_report("Unknown file format '%s'", fmt); goto fail; } } else { drv = NULL; } ret = bdrv_open(&bs, filename, NULL, NULL, flags, drv, &local_err); if (ret < 0) { error_report("Could not open '%s': %s", filename, error_get_pretty(local_err)); error_free(local_err); goto fail; } if (bdrv_is_encrypted(bs) && require_io) { qprintf(quiet, "Disk image '%s' is encrypted.\n", filename); if (read_password(password, sizeof(password)) < 0) { error_report("No password given"); goto fail; } if (bdrv_set_key(bs, password) < 0) { error_report("invalid password"); goto fail; } } return bs; fail: bdrv_unref(bs); return NULL; }
1threat
How do i make tab button clickable? : I am trying to make my navigation bar clickable. For example when a user clicks data a data web page opens up. But in my code i am unable to do so. When i click the tab button nothing happens. Can someone help me so that when i click the tab button shows the content? Note i am using bootstrap nav-nav tab bar Below is my code: <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content=""> <meta name="author" content=""> <title>Sales</title> <!-- Bootstrap Core CSS --> <link href="css/bootstrap.min.css" rel="stylesheet"> <!-- Custom CSS --> <link href="css/shop-item.css" rel="stylesheet"> <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> </head> <body> <ul class="nav nav-tabs" data-tabs="tabs" id="myTab"> <li class="active"><a data-toggle="tab" href="#home"> Main</a></li> <li><a data-toggle="tab" href="persons/data.html"> data </a></li> <li><a data-toggle="tab" href="teams/teamI.html"> teams </a></li> </ul> <div class="tab-content"> <div id="home" class="tab-pane fade in active"> <div class="container-fluid"> <div class="row"> <div id= "mapContainer" class="col-md-12"> <div id="map-canvas"></div> </div> <div id = "panelContainer" class="col-md-3 hidden"> <div id="right-panel"></div> </div> </div> </div> <!-- /.container --> <div class="container"> <hr> </div> </div> <!-- /.container --> <!-- jQuery --> <script src="js/jquery.js"></script> <!-- Bootstrap Core JavaScript --> <script src="js/bootstrap.min.js"></script> </body> </html>
0debug
How can I compute element-wise conditionals on batches in TensorFlow? : <p>I basically have a batch of neuron activations of a layer in a tensor <code>A</code> of shape <code>[batch_size, layer_size]</code>. Let <code>B = tf.square(A)</code>. Now I want to compute the following conditional on each element in each vector in this batch: <code>if abs(e) &lt; 1: e ← 0 else e ← B(e)</code> where <code>e</code> is the element in <code>B</code> that is at the same position as <code>e</code>. Can I somehow vectorize the entire operation with a single <code>tf.cond</code> operation?</p>
0debug
how to get full access to printer using python or java? : can we use python or java (my priority is python) to write a program that run on raspberry pi and have control over our printer, i.e. just by pushing a button on raspberry pi, the printer do the nozzle check, or head cleaning. is it possible ? and what language (python / java) is most suitable to do that ?
0debug
Mysql selecting hour range : [![DB][1]][1] How can I Select all start time that is >= 8:00:00 and < 16:00:00? [1]: https://i.stack.imgur.com/Fz4mT.png
0debug
Pattern for rich error handling in gRPC : <p>What is the pattern for sending more details about errors to the client using gRPC?</p> <p>For example, suppose I have a form for registering a user, that sends a message</p> <pre><code>message RegisterUser { string email = 1; string password = 2; } </code></pre> <p>where the email has to be properly formatted and unique, and the password must be at least 8 characters long.</p> <p>If I was writing a JSON API, I'd return a 400 error with the following body:</p> <pre><code>{ "errors": [{ "field": "email", "message": "Email does not have proper format." }, { "field": "password", "message": "Password must be at least 8 characters." }], } </code></pre> <p>and the client could provide nice error messages to the user (i.e. by highlighting the password field and specifically telling the user that there's something wrong with their input to it).</p> <p>With gRPC is there a way to do something similar? It seems that in most client languages, an error results in an exception being thrown, with no way to grab the response.</p> <p>For example, I'd like something like</p> <pre><code>message ValidationError { string field = 1; string message = 2; } message RegisterUserResponse { repeated ValidationError validation_errors = 1; ... } </code></pre> <p>or similar.</p>
0debug
How to create a complex side-by-side bar chart with SE bars in R Studio : I am creating a side-by-side bar chart with Standard Error bars from a Two-way ANOVA table in R studio. The complete version of bar chart should look like this: [example bar chart][1] The data we are working with is in Excel: [Raw Data][2] Currently I have created a table in R studio, but I don't know what to do next and how to calculate the mean, standard errors etc. A part of the table I've created is in this link: [two-way ANOVA table][3] [1]: https://i.stack.imgur.com/LlbCO.png [2]: https://i.stack.imgur.com/n3vnG.png [3]: https://i.stack.imgur.com/r7Xe4.png Can someone help me to create a bar chart from the table above please? Because I've tried to do this myself for over 24 hours and it just keep telling me errors. Thank you very much!
0debug
Protractor - ScriptTimeoutError: asynchronous script timeout: result was not received in 20 seconds : <p>I'm new to Protractor and I am trying to run my script. </p> <pre><code>describe('Navigator homepage', function() { it('should proceed to login', function() { browser.get('url'); }) it('Clicks the proceed button',function() { const proceedButton = element(by.id('auth-login-page-button')); proceedButton.click(); }); }); </code></pre> <p>But whenever I run it the browser opens up and proceeds to the website and then waits for 20 sec and I get Error: <code>ScriptTimeoutError: asynchronous script timeout: result was not received in 20 seconds</code>. The element is clearly there and can be clicked, however not for the protractor. Am I doing something wrong? Config file looks like this:</p> <pre><code>// An example configuration file. exports.config = { directConnect: true, // Capabilities to be passed to the webdriver instance. capabilities: { 'browserName': 'chrome' }, // Framework to use. Jasmine is recommended. framework: 'jasmine', // Spec patterns are relative to the current working directory when // protractor is called. specs: ['login_spec.js'], allScriptsTimeout: 20000, getPageTimeout: 15000, framework: 'jasmine', jasmineNodeOpts: { isVerbose: false, showColors: true, includeStackTrace: false, defaultTimeoutInterval: 40000 } }; </code></pre>
0debug
Array to sort worlds by word class in a text : <p>How can I make a script that sorts words in a text field by word class. Verb and adjectives etc. </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-js lang-js prettyprint-override"><code>array()</code></pre> </div> </div> </p>
0debug
Replicare rows in Matrix : I ve a Matrix A<- DOG. 4 CAT. 3 MOUSE. 6 PIG. 1 HORSE. 9 Names of animals are rownames Now I 've the matrix B <- A1. A2. A3. A4. A5. A6. AGE. 16. 15. 4. 9. 11. 12 I would to replicate the row age for how many are the rownames in matrix A. Example: A1. A2. A3. A4. A5. A6. DOG. 16. 15. 4. 9. 11. 12 CAT 16. 15. 4. 9. 11. 12 MOUSE 16. 15. 4. 9. 11. 12 HORSE 16. 15. 4. 9. 11. 12 PIG 16. 15. 4. 9. 11. 12 Suggestions?
0debug
static int theora_decode_header(AVCodecContext *avctx, GetBitContext gb) { Vp3DecodeContext *s = avctx->priv_data; s->theora = get_bits_long(&gb, 24); av_log(avctx, AV_LOG_INFO, "Theora bitstream version %X\n", s->theora); if (s->theora < 0x030200) { s->flipped_image = 1; av_log(avctx, AV_LOG_DEBUG, "Old (<alpha3) Theora bitstream, flipped image\n"); } s->width = get_bits(&gb, 16) << 4; s->height = get_bits(&gb, 16) << 4; if(avcodec_check_dimensions(avctx, s->width, s->height)){ av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s->height); s->width= s->height= 0; return -1; } if (s->theora >= 0x030400) { skip_bits(&gb, 32); skip_bits(&gb, 32); skip_bits(&gb, 4); skip_bits(&gb, 32); skip_bits(&gb, 24); skip_bits(&gb, 24); } else { skip_bits(&gb, 24); skip_bits(&gb, 24); } skip_bits(&gb, 8); skip_bits(&gb, 8); skip_bits(&gb, 32); skip_bits(&gb, 32); skip_bits(&gb, 24); skip_bits(&gb, 24); if (s->theora < 0x030200) skip_bits(&gb, 5); skip_bits(&gb, 8); if (s->theora >= 0x030400) skip_bits(&gb, 2); skip_bits(&gb, 24); skip_bits(&gb, 6); if (s->theora >= 0x030200) { skip_bits(&gb, 5); if (s->theora < 0x030400) skip_bits(&gb, 5); } avctx->width = s->width; avctx->height = s->height; return 0; }
1threat
Do I always need to call URL.revokeObjectURL() explicitly? : <p>I'm using blob to download files, Problem is I want to keep Object URL even after downloading the file, without making major changes in code base. </p> <p>So one of the option is not to call <code>URL.revokeObjectURL();</code></p> <p>Is it safe to depend on browser's garbage collector to avoid any memory leak?</p> <p>Do I always need to call <code>URL.revokeObjectURL();</code> explicitly ?</p>
0debug
COUNT(*) Includes Null Values? : <p><a href="https://msdn.microsoft.com/en-us/library/ms175997.aspx" rel="noreferrer">MSDN</a> documentation states:</p> <blockquote> <p>COUNT(*) returns the number of items in a group. This includes NULL values and duplicates.</p> </blockquote> <p>How can you have a null value in a group? Can anyone explain the point they're trying to make?</p>
0debug
mips assembly code to shift the bit programming : <p>Read in your Student ID and save it to a register, and read in the number “10010000x” as the initial memory address. Then shift your student ID number to the right one bit at a time, and save it to the memory address which is 4 bytes increment from the previous memory address, until your student ID number is smaller than 1, then save your final student ID number which is NOT smaller than 1, and save the last memory address, and how many iterations to 3 different memory addresses. Turn in the hardcopy of the MARS graphic printout which has the MIPS Assembly code showing your student ID, and memory addresses and all registers values, and also answer the following three questions on the hard copy paper :<br> (1) How many shift right you have to do to get your student ID number to be smaller than 1 ? (2) What is your last NOT smaller than 1 binary student id number ? (3) What is the last memory address that saves that last NOT smaller than 1 student ID ? </p>
0debug
Add header to CSV without loading CSV : <p>Is there a way to add a header row to a CSV without loading the CSV into memory in python? I have an 18GB CSV I want to add a header to, and all the methods I've seen require loading the CSV into memory, which is obviously unfeasible. </p>
0debug
why it is not giving output in c/c++? : #include<stdio.h> /*I want to find pairs with given sum such that elements of pair are in different rows.*/ int main() { int a[5][5]={{-1,2,3,4}, {5,3,-2,1}, {6,7,2,-3}, {2,9,1,4}, {2,1,-2,0}}; int sum=11; int i,j; for(i=0;i<5;i++) { for(j=0;j<5;j++) { if(a[i][j]+a[j][i]==sum && i!=j) { printf("%d %d\n",i,j); } } } }
0debug
appending from a list of listts : <p>I have the following list:</p> <pre><code>beerlist = [['', 'beer', 'uerige-doppel-sticke', '46158', ''], ['', 'beer', 'schumacher-1838er', '211568', ''], ['', 'beer', 'schlussel-stike', '53106', '']] </code></pre> <p>and I would like to iterate through the list and print the 3rd value from each entry. </p> <p>I can access this individually, for example:</p> <pre><code>beerList[2][3] </code></pre> <p>But when I try to iterate through the list:</p> <pre><code>for beer in beerList: print(beer[2]) </code></pre> <p>I get the following error:</p> <pre><code>IndexError: list index out of range </code></pre> <p>I think I am misunderstanding something about accessing objects in a loop, what am I not getting here?</p>
0debug
av_cold int ff_mpv_common_init(MpegEncContext *s) { int i; int nb_slices = (HAVE_THREADS && s->avctx->active_thread_type & FF_THREAD_SLICE) ? s->avctx->thread_count : 1; if (s->encoding && s->avctx->slices) nb_slices = s->avctx->slices; if (s->codec_id == AV_CODEC_ID_MPEG2VIDEO && !s->progressive_sequence) s->mb_height = (s->height + 31) / 32 * 2; else s->mb_height = (s->height + 15) / 16; if (s->avctx->pix_fmt == AV_PIX_FMT_NONE) { av_log(s->avctx, AV_LOG_ERROR, "decoding to AV_PIX_FMT_NONE is not supported.\n"); return -1; } if (nb_slices > MAX_THREADS || (nb_slices > s->mb_height && s->mb_height)) { int max_slices; if (s->mb_height) max_slices = FFMIN(MAX_THREADS, s->mb_height); else max_slices = MAX_THREADS; av_log(s->avctx, AV_LOG_WARNING, "too many threads/slices (%d)," " reducing to %d\n", nb_slices, max_slices); nb_slices = max_slices; } if ((s->width || s->height) && av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; dct_init(s); avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift); FF_ALLOCZ_OR_GOTO(s->avctx, s->picture, MAX_PICTURE_COUNT * sizeof(Picture), fail); for (i = 0; i < MAX_PICTURE_COUNT; i++) { s->picture[i].f = av_frame_alloc(); if (!s->picture[i].f) goto fail; } memset(&s->next_picture, 0, sizeof(s->next_picture)); memset(&s->last_picture, 0, sizeof(s->last_picture)); memset(&s->current_picture, 0, sizeof(s->current_picture)); memset(&s->new_picture, 0, sizeof(s->new_picture)); s->next_picture.f = av_frame_alloc(); if (!s->next_picture.f) goto fail; s->last_picture.f = av_frame_alloc(); if (!s->last_picture.f) goto fail; s->current_picture.f = av_frame_alloc(); if (!s->current_picture.f) goto fail; s->new_picture.f = av_frame_alloc(); if (!s->new_picture.f) goto fail; if (init_context_frame(s)) goto fail; s->parse_context.state = -1; s->context_initialized = 1; s->thread_context[0] = s; if (nb_slices > 1) { for (i = 1; i < nb_slices; i++) { s->thread_context[i] = av_malloc(sizeof(MpegEncContext)); memcpy(s->thread_context[i], s, sizeof(MpegEncContext)); } for (i = 0; i < nb_slices; i++) { if (init_duplicate_context(s->thread_context[i]) < 0) goto fail; s->thread_context[i]->start_mb_y = (s->mb_height * (i) + nb_slices / 2) / nb_slices; s->thread_context[i]->end_mb_y = (s->mb_height * (i + 1) + nb_slices / 2) / nb_slices; } } else { if (init_duplicate_context(s) < 0) goto fail; s->start_mb_y = 0; s->end_mb_y = s->mb_height; } s->slice_context_count = nb_slices; return 0; fail: ff_mpv_common_end(s); return -1; }
1threat
window.location.href = 'http://attack.com?user=' + user_input;
1threat
Not able to hide div if it conatin text : Hello Everyone I need help I have two div inside li and two buttons I want to hide button if second_div class div is present or it contain text please help I have tried various solution hasclass not working <li> <div class="first_div"></div> <button></button> <div class="second_div"></div> </li> <script type="text/javascript"> if( jQuery(".second_div").is(':empty') ){ if(jQuery( this ).hasClass( "second_div" )){ jQuery(" .button").css("display":"none"); } //jQuery("ul.products li.product .button").css("display":"none"); } </script>
0debug
static void test_bmdma_no_busmaster(void) { QPCIDevice *dev; void *bmdma_base, *ide_base; uint8_t status; dev = get_pci_device(&bmdma_base, &ide_base); PrdtEntry prdt[4096] = { }; status = send_dma_request(CMD_READ_DMA | CMDF_NO_BM, 0, 512, prdt, ARRAY_SIZE(prdt), NULL); g_assert_cmphex(status, ==, BM_STS_ACTIVE | BM_STS_INTR); assert_bit_clear(qpci_io_readb(dev, ide_base + reg_status), DF | ERR); }
1threat
Color change agter swift migration to swift 4.2 : I upgraded my swift project to swift 4.2 and a very strange change occurred. The white color of my button became blue. In the story board, the color remains white but when I run the application, the color turns blue. I do not know what I have to do so any one with guidance should kindly put me through.
0debug
In CodeIgniter, how To display a view page in a particular div element : I am working on a project using codeIgniter. I got stuck in a UI part. I need to display a view page inside a div element, but instead of displaying in the div either it is getting displayed in the new tab or nothing is working. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> <script type="text/javascript"> $('.aboutus').click(function(){ $('#about').load('controller/method'); });</script> <!-- end snippet --> Can anyone provide me the solution for this ?
0debug
pre-increment and post-increment in C : <p>First of all, I would like to apologize, if this question has been asked before in this forum. I searched, but could't find any similar problem.</p> <p>I am a beginner in C. I was going through a tutorial and came across a code, the solution of which I can't understand. </p> <p>Here is the code - </p> <pre><code>#include &lt;stdio.h&gt; #define PRODUCT(x) (x*x) int main() { int i=3, j, k; j = PRODUCT(i++); k = PRODUCT(++i); return 1; } </code></pre> <p>I tried running the code through compiler and got the solution as "j = 12" and "k = 49". </p> <p>I know how #define works. It replace every occurrence of PRODUCT(x) by (x*x), but what I can't grasp is how j and k got the values 12 and 49, respectively. </p> <p>Any help would be appreciated. </p> <p>Thank you for your time.</p>
0debug
static void tcg_out_bpcc(TCGContext *s, int scond, int flags, int label) { TCGLabel *l = &s->labels[label]; int off19; if (l->has_value) { off19 = INSN_OFF19(tcg_pcrel_diff(s, l->u.value_ptr)); } else { off19 = *s->code_ptr & INSN_OFF19(-1); tcg_out_reloc(s, s->code_ptr, R_SPARC_WDISP19, label, 0); } tcg_out_bpcc0(s, scond, flags, off19); }
1threat
static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; fd_set rfds; int n, tcp_fd; struct timeval tv; AVFormatContext *rtpctx; int ret; tcp_fd = url_get_file_handle(rt->rtsp_hd); while (1) { FD_ZERO(&rfds); FD_SET(tcp_fd, &rfds); tv.tv_sec = 0; tv.tv_usec = 0; n = select(tcp_fd + 1, &rfds, NULL, NULL, &tv); if (n <= 0) break; if (FD_ISSET(tcp_fd, &rfds)) { RTSPMessageHeader reply; ret = ff_rtsp_read_reply(s, &reply, NULL, 1, NULL); if (ret < 0) return AVERROR(EPIPE); if (ret == 1) ff_rtsp_skip_packet(s); if (rt->state != RTSP_STATE_STREAMING) return AVERROR(EPIPE); } } if (pkt->stream_index < 0 || pkt->stream_index >= rt->nb_rtsp_streams) return AVERROR_INVALIDDATA; rtsp_st = rt->rtsp_streams[pkt->stream_index]; rtpctx = rtsp_st->transport_priv; ret = ff_write_chained(rtpctx, 0, pkt, s); if (!ret && rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) ret = tcp_write_packet(s, rtsp_st); return ret; }
1threat
How can i minimize this code? because excel said it has more than 64 conditions. thank you : note: those texts equivalent to $C$1 is a dropdown list.[see picture for reference][1] =IF($C$1="","",IF($C$1="AGLAYAN 1",T4,IF($C$1="AGLAYAN 2",AI4,IF($C$1="ALABEL",AX4,IF($C$1="BABAK 1",BM4,IF($C$1="BABAK 2",CB4,IF($C$1="BANAYBANAY",CQ4,IF($C$1="BANGA",DF4,IF($C$1="BANSALAN",DU4,IF($C$1="BANSALAN 2",EJ4,IF($C$1="BANSALAN 3",EY4,IF($C$1="BAROBO",FN4,IF($C$1="BATOBATO",GC4,IF($C$1="BAYUGAN",GR4,IF($C$1="BUHANGIN",HG4,IF($C$1="CALINAN",HV4,IF($C$1="CARMEN",IK4,IF($C$1="COMPOSTELA 1",IZ4,IF($C$1="COMPOSTELA 2",JO4,IF($C$1="CUGMAN",KD4,IF($C$1="DIGOS 1",KS4,IF($C$1="DIGOS 2",LH4,IF($C$1="DIGOS 3",LW4,IF($C$1="DON CARLOS 1",ML4,IF($C$1="ESPERANZA 1",NA4,IF($C$1="ESPERANZA 2",NP4,IF($C$1="ESPERANZA 3",OE4,IF($C$1="GENSAN",OT4,IF($C$1="HAGONOY",PI4,IF($C$1="HINATUAN",PX4,IF($C$1="ISULAN 1",QM4,IF($C$1="KABAKAN 1",RB4,IF($C$1="KABAKAN 2",RQ4,IF($C$1="KALILANGAN",SF4,IF($C$1="KAPALONG",SU4,IF($C$1="KIDAPAWAN 2",TJ4,IF($C$1="KIDAPAWAN 3",TY4,IF($C$1="KIDAPAWAN 4",UN4,IF($C$1="KIDAPAWAN 5",VC4,IF($C$1="KIDAPAWAN 6",VR4,IF($C$1="KIDAPAWAN 7",WG4,IF($C$1="KIDAPAWAN 8",WV4,IF($C$1="KRINKLES 1",XK4,IF($C$1="KRINKLES 2",XZ4,IF($C$1="LUPON 1",YO4,IF($C$1="LUPON 2",ZD4,IF($C$1="MAASIM",ZS4,IF($C$1="MAGPET",AAH4,IF($C$1="MAGSAYSAY",AAW4,IF($C$1="MAITUM",ABL4,IF($C$1="MAKILALA",ACA4,IF($C$1="MALAYBALAY",ACP4,IF($C$1="MALITA",ADE4,IF($C$1="MANGAGOY",ADT4,IF($C$1="MARAMAG 1",AEI4,IF($C$1="MARAMAG 2",AEX4,IF($C$1="MARBEL 1",AFM4,IF($C$1="MARBEL 2",AGB4,IF($C$1="MARIKIT",AGQ4,IF($C$1="MATALAM",AHF4,IF($C$1="MATANAO",AHU4,IF($C$1="MIDSAYAP",AIJ4,IF($C$1="MLANG",AIY4,IF($C$1="MONKAYO",AJN4,IF($C$1="NABUNTURAN 1",AKC4,IF($C$1="NABUNTURAN 2",AKR4,IF($C$1="NABUNTURAN 3",AKG4,IF($C$1="OZAMIZ",ALV4,IF($C$1="PADADA",AMK4,IF($C$1="PANABO 2",AMZ4,IF($C$1="PANABO 3",ANO4,IF($C$1="PANABO 5",AOD4,IF($C$1="PANABO MAIN",AOS4,IF($C$1="PANABO PDP 1",APH4,IF($C$1="PANABO PDP 2",APW4,IF($C$1="PANTUKAN",AQL4,IF($C$1="PEÑAPLATA",ARA4,IF($C$1="PIGKAWAYAN",ARP4,IF($C$1="POLOMOLOK 1",ASE4,IF($C$1="POLOMOLOK 2",AST4,IF($C$1="PUERTO",ATI4,IF($C$1="QUEZON",ATX4,IF($C$1="SAN FRANCISCO 1",AUM4,IF($C$1="STA. MARIA",AVB4,IF($C$1="STO NIÑO",AVQ4,IF($C$1="STO. TOMAS",AWF4,IF($C$1="SULOP",AWU4,IF($C$1="SURIGAO 2",AXJ4,IF($C$1="TACORONG 1",AXY4,IF($C$1="TACORONG 2",AYN4,IF($C$1="TAGBINA",AZC4,IF($C$1="TAGUM 4",AZR4,IF($C$1="TIBUNGCO 1",BAG4,IF($C$1="TIBUNGCO 2",BAV4,IF($C$1="TORIL 1",BBK4,IF($C$1="TORIL 2",BBZ4,IF($C$1="TRENTO",BCO4,IF($C$1="TULUNAN",BDD4,IF($C$1="TUPI",BDS4,""))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) [1]: https://i.stack.imgur.com/Mrys4.png
0debug
SSRS report definition is newer than Server : <p>I created some reports in Visual Studio 2015 with all the latest updates. However, when I try to deploy the reports I get this message:</p> <blockquote> <p>The definition of this report is not valid or supported by this version of Reporting Services.<br> 11:40:28 Error<br> The report definition may have been created with a later version of Reporting Services, or contain content that is not<br> 11:40:28 Error<br> well-formed or not valid based on Reporting Services schemas. Details: The report definition has an invalid target<br> 11:40:28 Error<br> namespace '<a href="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" rel="noreferrer">http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition</a>' which cannot be upgraded.</p> </blockquote> <p>The first lines of the .rdl file are set up like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Report MustUnderstand="df" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:df="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition/defaultfontfamily"&gt; </code></pre> <p>Can I change the schema definition? If so, to what? I tried just changing 2016 to 2014 or 2012, but neither worked. </p> <p>Is there a place I can go to see valid definitions?</p>
0debug
Can't using windows form : I'm making a simple app, but when i'm adding a windows form, i see a error. I trie modify ".NET desktop development" and add "C++/CLI support" but it wont work. [1]: https://i.stack.imgur.com/fzSE5.png Anyone help me please !!!
0debug
How to solve unhandled NameError in Python : <p>So while running the codes on the following error is generated. It says that the NameError is left unhandled by the user code.</p> <p>The error:</p> <pre><code>Traceback (most recent call last): File "D:\3rd sem\Object Oriented Programming\Lab\VS\PythonApplication1\PythonApplication1\PythonApplication1.py", line 50, in &lt;module&gt; main() File "D:\3rd sem\Object Oriented Programming\Lab\VS\PythonApplication1\PythonApplication1\PythonApplication1.py", line 10, in main grade=str(input("Enter the grade: ")) File "&lt;string&gt;", line 1, in &lt;module&gt; NameError: name 'a' is not defined </code></pre> <p>The code goes like this:</p> <pre><code>classnum=int(input("Enter the num of classes: ")) def main(): totalcredit=0 totalgpa=0 for i in range(1,classnum+1): print "class", i credit=int(input("Enter the credit: ")) grade=str(input("Enter the grade: ")) totalgpa+=coursePoints(credit,grade) totalcredit+=credit totalcourse=classnum semestergpa=totalgpa/totalcredit print("Semester summary") print("courses taken: ", classnum) print("credits taken: ", totalcredit) print("GPA points: ", totalgpa) print("Semester GPA: ", semestergpa) def coursePoints(Credit,Grade): if Grade == 'A+' or Grade == 'a+': return 4*Credit elif Grade == 'A' or Grade == 'a': return 4*Credit elif Grade == 'A-' or Grade == 'a-': return 3.67*Credit elif Grade == 'B+' or Grade == 'b+': return 3.33*Credit elif Grade == 'B' or Grade =='b': return 3*Credit elif Grade == 'B-' or Grade == 'b-': return 2.67*Credit elif Grade == 'C+' or Grade == 'c+': return 2.33*Credit elif Grade == 'C' or Grade == 'c': return 2*Credit elif Grade == 'C-' or Grade == 'c-': return 1.67*Credit elif Grade =='D+' or Grade == 'd+': return 1.33*Credit elif Grade == 'D' or Grade == 'd': return 1*Credit elif Grade == 'D-' or Grade == 'd-': return 0.33*Credit else: return 0 main() </code></pre> <p>Can anyone help for solutions.</p> <p>Thanks in advance.</p>
0debug
Insert Query Not working at a particular time of the day in VS 2015! Exact same time everyday. : A Windows application using Winforms and MYSQL SERVER in VS 2015. Project works fine at all times except from 10:00AM to 1:00PM CST. ======= $During this time of the day every other query like DELETE/UPDATE works but Insert Query does not seem to insert any data inside my Data table. I am using ExecuteNonQuery() to get My data inserted in my SQL Table. This is a very strange problem and I do not get any error, my query works fine at other times. Please help me if anyone has any idea! Thank you! SqlConnection STDB = new SqlConnection(@"Data Source= (LocalDB)\MSSQLLocalDB; AttachDbFilename=C:\VS\MainProject\ MainProject\STDB.mdf;Integrated Security=True"); STDB.Open(); DialogResult result = MessageBox.Show("Do you want to save changes?", "Confirmation", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { string query10 = $"INSERT INTO [dbo].[Inbound](TrailerNo, ShipperNo, SealNo, ReceivedBy, ReceivingShift, Carrier, Supplier, Vendor, Contents, Location, Comments, Date, Time, Status) VALUES ('{textBox1.Text}','{textBox2.Text}','{textBox3.Text}', '{comboBox5.Text}','{comboBox1.Text}','{comboBox6.Text}', '{textBox4.Text}','{textBox5.Text}','{comboBox2.Text}', '{comboBox3.Text}','{TextBox6.Text}','{dateTimePicker1.Text}', '{dateTimePicker2.Text}','{textBox7.Text}')"; SqlDataAdapter SDA30 = new SqlDataAdapter(query10, STDB); SDA30.SelectCommand.ExecuteNonQuery(); MessageBox.Show("Information Saved!"); clear(); } else { //do nothing } STDB.Close();
0debug
IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive) { DeviceState *dev; dev = qdev_create(&bus->qbus, drive->media_cd ? "ide-cd" : "ide-hd"); qdev_prop_set_uint32(dev, "unit", unit); qdev_prop_set_drive_nofail(dev, "drive", blk_bs(blk_by_legacy_dinfo(drive))); qdev_init_nofail(dev); return DO_UPCAST(IDEDevice, qdev, dev); }
1threat
Just Happened ... it was working fine ... issue with Android Studio 2.3.3 : Iam getting the following error... I am new at this and hate to mess with the gradle or any file ... can anyone please help... the errors: " The SDK platform tools version (25.0.6) is too old to check APIs compiled with API 26; please update This check scans through all ANDroid API calls in the application and warns about any calls that are not available on all versionstargeted by the application (according to its minimum SDK attribute in the manifest). If you really want to use this API and don’t need to support older devices just set the minSdkVersion in the build.gradle or AndroidManifest.xml files If your code is deliberately accessing newer APIs and you have ensured (e.g. with conditional execution) that this code will only ever be called on a supported platform, then you can annotate you class or methodwith the @TargetApi annotation specifying the local minimum SDK to Apply, such as @TargetApi(11), such that this check considers 11 rather than you manifest file’s minimum SDK as the required API level. If you are deliberately setting android: attributes in style definitions, make sure you place this in values-xxx folder in order to avoid running into runtime conflicts on certain devices where manufacturers have added custom attributes whose ids conflict with new ones or later platforms. Similarly, you can use tooltargetApi=”11” in an XML file to indicate that the elements will only be inflated in an adequate context." I also get the package name up top as an error, but i just created the new App and even though it indicates an error. it compiles and runs on the emulator on the targeted device. Help.
0debug
static int mpc7_decode_init(AVCodecContext * avctx) { int i, j; MPCContext *c = avctx->priv_data; GetBitContext gb; uint8_t buf[16]; static int vlc_inited = 0; if(avctx->extradata_size < 16){ av_log(avctx, AV_LOG_ERROR, "Too small extradata size (%i)!\n", avctx->extradata_size); return -1; } memset(c->oldDSCF, 0, sizeof(c->oldDSCF)); av_init_random(0xDEADBEEF, &c->rnd); dsputil_init(&c->dsp, avctx); c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4); ff_mpc_init(); init_get_bits(&gb, buf, 128); c->IS = get_bits1(&gb); c->MSS = get_bits1(&gb); c->maxbands = get_bits(&gb, 6); if(c->maxbands >= BANDS){ av_log(avctx, AV_LOG_ERROR, "Too many bands: %i\n", c->maxbands); return -1; } skip_bits(&gb, 88); c->gapless = get_bits1(&gb); c->lastframelen = get_bits(&gb, 11); av_log(avctx, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\n", c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands); c->frames_to_skip = 0; if(vlc_inited) return 0; av_log(avctx, AV_LOG_DEBUG, "Initing VLC\n"); if(init_vlc(&scfi_vlc, MPC7_SCFI_BITS, MPC7_SCFI_SIZE, &mpc7_scfi[1], 2, 1, &mpc7_scfi[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init SCFI VLC\n"); return -1; } if(init_vlc(&dscf_vlc, MPC7_DSCF_BITS, MPC7_DSCF_SIZE, &mpc7_dscf[1], 2, 1, &mpc7_dscf[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init DSCF VLC\n"); return -1; } if(init_vlc(&hdr_vlc, MPC7_HDR_BITS, MPC7_HDR_SIZE, &mpc7_hdr[1], 2, 1, &mpc7_hdr[0], 2, 1, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init HDR VLC\n"); return -1; } for(i = 0; i < MPC7_QUANT_VLC_TABLES; i++){ for(j = 0; j < 2; j++){ if(init_vlc(&quant_vlc[i][j], 9, mpc7_quant_vlc_sizes[i], &mpc7_quant_vlc[i][j][1], 4, 2, &mpc7_quant_vlc[i][j][0], 4, 2, INIT_VLC_USE_STATIC)){ av_log(avctx, AV_LOG_ERROR, "Cannot init QUANT VLC %i,%i\n",i,j); return -1; } } } vlc_inited = 1; return 0; }
1threat
on_host_init(VSCMsgHeader *mhHeader, VSCMsgInit *incoming) { uint32_t *capabilities = (incoming->capabilities); int num_capabilities = 1 + ((mhHeader->length - sizeof(VSCMsgInit)) / sizeof(uint32_t)); int i; QemuThread thread_id; incoming->version = ntohl(incoming->version); if (incoming->version != VSCARD_VERSION) { if (verbose > 0) { printf("warning: host has version %d, we have %d\n", verbose, VSCARD_VERSION); } } if (incoming->magic != VSCARD_MAGIC) { printf("unexpected magic: got %d, expected %d\n", incoming->magic, VSCARD_MAGIC); return -1; } for (i = 0 ; i < num_capabilities; ++i) { capabilities[i] = ntohl(capabilities[i]); } send_msg(VSC_ReaderRemove, VSCARD_MINIMAL_READER_ID, NULL, 0); qemu_thread_create(&thread_id, "vsc/event", event_thread, NULL, 0); return 0; }
1threat
How many intermediate steps should you use when programming? : <p>I am not new to programming and can solve most my daily programming problems alone, but I have a question, which will most likely be closed in a few minutes/hours. But still, I am interested in what you guys have to say about this.</p> <p>Let's look at this simple Python code snippet for example:</p> <pre><code>word = "cake" loud_word = word.upper() word_length = len(word) print("%s -&gt; %s, length: %s" % (word, loud_word, word_length)) </code></pre> <p>And now look at this:</p> <pre><code>word = "cake" print("%s -&gt; %s, length: %s" % (word, word.upper(), len(word))) </code></pre> <p>They do exactly the same thing. Which one should you use though? Avoid many variables and output directly, or not?</p> <p>I didn't find anything regarding this in PEP0008.</p> <p>(I know, this may be a stupid question but I am obsessed with using next to no variables right now and I want to hear your opinion.)</p>
0debug
C++ program to compute the surface area and volume of a cylinder using two separate functions : <pre><code>#include&lt;stdio.h&gt; #include&lt;iostream&gt; using namespace std; class Calculate //class form { int r,h ; public: void getdata() //input data { cout&lt;&lt;"Enter the radius and height"; cin&gt;&gt;r&gt;&gt;h; } void Surfacearea() { float a; a= ( ( 2 * 3.14 * r * r ) + ( 2 * 3.14 * r * h ) ); cout&lt;&lt;"the sa of cylinder is"&lt;&lt;a; } void volume() { float v; v = ( 3.14 * r * r * h ); cout&lt;&lt;"the volume of cylinder is"&lt;&lt;v; } }; Calculate a1,a2,g; int main() { g.getdata(); a1.Surfacearea(); a2.volume(); } </code></pre> <p>I am getting surfacearea and volume as zero,i am unable to find error in code,please help me..........................................................................................................................</p>
0debug
static void x86_cpu_realizefn(DeviceState *dev, Error **errp) { CPUState *cs = CPU(dev); X86CPU *cpu = X86_CPU(dev); X86CPUClass *xcc = X86_CPU_GET_CLASS(dev); CPUX86State *env = &cpu->env; Error *local_err = NULL; static bool ht_warned; if (xcc->kvm_required && !kvm_enabled()) { char *name = x86_cpu_class_get_model_name(xcc); error_setg(&local_err, "CPU model '%s' requires KVM", name); g_free(name); goto out; } if (cpu->apic_id == UNASSIGNED_APIC_ID) { error_setg(errp, "apic-id property was not initialized properly"); return; } x86_cpu_load_features(cpu, &local_err); if (local_err) { goto out; } if (x86_cpu_filter_features(cpu) && (cpu->check_cpuid || cpu->enforce_cpuid)) { x86_cpu_report_filtered_features(cpu); if (cpu->enforce_cpuid) { error_setg(&local_err, kvm_enabled() ? "Host doesn't support requested features" : "TCG doesn't support requested features"); goto out; } } if (IS_AMD_CPU(env)) { env->features[FEAT_8000_0001_EDX] &= ~CPUID_EXT2_AMD_ALIASES; env->features[FEAT_8000_0001_EDX] |= (env->features[FEAT_1_EDX] & CPUID_EXT2_AMD_ALIASES); } if (env->features[FEAT_8000_0001_EDX] & CPUID_EXT2_LM) { if (kvm_enabled()) { uint32_t host_phys_bits = x86_host_phys_bits(); static bool warned; if (cpu->host_phys_bits) { cpu->phys_bits = host_phys_bits; } if (cpu->phys_bits != host_phys_bits && cpu->phys_bits != 0 && !warned) { error_report("Warning: Host physical bits (%u)" " does not match phys-bits property (%u)", host_phys_bits, cpu->phys_bits); warned = true; } if (cpu->phys_bits && (cpu->phys_bits > TARGET_PHYS_ADDR_SPACE_BITS || cpu->phys_bits < 32)) { error_setg(errp, "phys-bits should be between 32 and %u " " (but is %u)", TARGET_PHYS_ADDR_SPACE_BITS, cpu->phys_bits); return; } } else { if (cpu->phys_bits && cpu->phys_bits != TCG_PHYS_ADDR_BITS) { error_setg(errp, "TCG only supports phys-bits=%u", TCG_PHYS_ADDR_BITS); return; } } if (cpu->phys_bits == 0) { cpu->phys_bits = TCG_PHYS_ADDR_BITS; } } else { if (cpu->phys_bits != 0) { error_setg(errp, "phys-bits is not user-configurable in 32 bit"); return; } if (env->features[FEAT_1_EDX] & CPUID_PSE36) { cpu->phys_bits = 36; } else { cpu->phys_bits = 32; } } cpu_exec_init(cs, &error_abort); if (tcg_enabled()) { tcg_x86_init(); } #ifndef CONFIG_USER_ONLY qemu_register_reset(x86_cpu_machine_reset_cb, cpu); if (cpu->env.features[FEAT_1_EDX] & CPUID_APIC || smp_cpus > 1) { x86_cpu_apic_create(cpu, &local_err); if (local_err != NULL) { goto out; } } #endif mce_init(cpu); #ifndef CONFIG_USER_ONLY if (tcg_enabled()) { AddressSpace *newas = g_new(AddressSpace, 1); cpu->cpu_as_mem = g_new(MemoryRegion, 1); cpu->cpu_as_root = g_new(MemoryRegion, 1); memory_region_init(cpu->cpu_as_root, OBJECT(cpu), "memory", ~0ull); memory_region_set_enabled(cpu->cpu_as_root, true); memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), "memory", get_system_memory(), 0, ~0ull); memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0); memory_region_set_enabled(cpu->cpu_as_mem, true); address_space_init(newas, cpu->cpu_as_root, "CPU"); cs->num_ases = 1; cpu_address_space_init(cs, newas, 0); cpu->machine_done.notify = x86_cpu_machine_done; qemu_add_machine_init_done_notifier(&cpu->machine_done); } #endif qemu_init_vcpu(cs); if (!IS_INTEL_CPU(env) && cs->nr_threads > 1 && !ht_warned) { error_report("AMD CPU doesn't support hyperthreading. Please configure" " -smp options properly."); ht_warned = true; } x86_cpu_apic_realize(cpu, &local_err); if (local_err != NULL) { goto out; } cpu_reset(cs); xcc->parent_realize(dev, &local_err); out: if (local_err != NULL) { error_propagate(errp, local_err); return; } }
1threat
static int decode_plane(Indeo3DecodeContext *ctx, AVCodecContext *avctx, Plane *plane, const uint8_t *data, int32_t data_size, int32_t strip_width) { Cell curr_cell; int num_vectors; num_vectors = bytestream_get_le32(&data); ctx->mc_vectors = num_vectors ? data : 0; init_get_bits(&ctx->gb, &data[num_vectors * 2], data_size << 3); ctx->skip_bits = 0; ctx->need_resync = 0; ctx->last_byte = data + data_size - 1; curr_cell.xpos = curr_cell.ypos = 0; curr_cell.width = plane->width >> 2; curr_cell.height = plane->height >> 2; curr_cell.tree = 0; curr_cell.mv_ptr = 0; return parse_bintree(ctx, avctx, plane, INTRA_NULL, &curr_cell, CELL_STACK_MAX, strip_width); }
1threat
If statement issue prints all the phrases : <p>Here is the code. I want to write a different phrase that needs to be printed according to the Q1 response but the program doesn't work properly and prints all the phrases. </p> <pre><code>print ('Pet animals') #choose an animal print ('A. Dog') print ('B. Cat') print ('C. Hamster') print ('D. Bird') print ('E. None') Q1response= input('I have a ') if(Q1response == "A" or "a"): print ('They are so cute') elif (Q1response == "B" or "b"): print ('They are so haughty') </code></pre>
0debug
static always_inline int isnormal (float64 d) { CPU_DoubleU u; u.d = d; uint32_t exp = (u.ll >> 52) & 0x7FF; return ((0 < exp) && (exp < 0x7FF)); }
1threat
av_cold int MPV_encode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int i; int chroma_h_shift, chroma_v_shift; MPV_encode_defaults(s); switch (avctx->codec_id) { case CODEC_ID_MPEG2VIDEO: if(avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 and YUV422 are supported\n"); return -1; } break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: if(avctx->pix_fmt != PIX_FMT_YUVJ420P && avctx->pix_fmt != PIX_FMT_YUVJ422P && avctx->pix_fmt != PIX_FMT_RGB32 && ((avctx->pix_fmt != PIX_FMT_YUV420P && avctx->pix_fmt != PIX_FMT_YUV422P) || avctx->strict_std_compliance>FF_COMPLIANCE_INOFFICIAL)){ av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n"); return -1; } break; default: if(avctx->pix_fmt != PIX_FMT_YUV420P){ av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n"); return -1; } } switch (avctx->pix_fmt) { case PIX_FMT_YUVJ422P: case PIX_FMT_YUV422P: s->chroma_format = CHROMA_422; break; case PIX_FMT_YUVJ420P: case PIX_FMT_YUV420P: default: s->chroma_format = CHROMA_420; break; } s->bit_rate = avctx->bit_rate; s->width = avctx->width; s->height = avctx->height; if(avctx->gop_size > 600 && avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){ av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n"); avctx->gop_size=600; } s->gop_size = avctx->gop_size; s->avctx = avctx; s->flags= avctx->flags; s->flags2= avctx->flags2; s->max_b_frames= avctx->max_b_frames; s->codec_id= avctx->codec->id; s->luma_elim_threshold = avctx->luma_elim_threshold; s->chroma_elim_threshold= avctx->chroma_elim_threshold; s->strict_std_compliance= avctx->strict_std_compliance; s->data_partitioning= avctx->flags & CODEC_FLAG_PART; s->quarter_sample= (avctx->flags & CODEC_FLAG_QPEL)!=0; s->mpeg_quant= avctx->mpeg_quant; s->rtp_mode= !!avctx->rtp_payload_size; s->intra_dc_precision= avctx->intra_dc_precision; s->user_specified_pts = AV_NOPTS_VALUE; if (s->gop_size <= 1) { s->intra_only = 1; s->gop_size = 12; } else { s->intra_only = 0; } s->me_method = avctx->me_method; s->fixed_qscale = !!(avctx->flags & CODEC_FLAG_QSCALE); s->adaptive_quant= ( s->avctx->lumi_masking || s->avctx->dark_masking || s->avctx->temporal_cplx_masking || s->avctx->spatial_cplx_masking || s->avctx->p_masking || s->avctx->border_masking || (s->flags&CODEC_FLAG_QP_RD)) && !s->fixed_qscale; s->obmc= !!(s->flags & CODEC_FLAG_OBMC); s->loop_filter= !!(s->flags & CODEC_FLAG_LOOP_FILTER); s->alternate_scan= !!(s->flags & CODEC_FLAG_ALT_SCAN); s->intra_vlc_format= !!(s->flags2 & CODEC_FLAG2_INTRA_VLC); s->q_scale_type= !!(s->flags2 & CODEC_FLAG2_NON_LINEAR_QUANT); if(avctx->rc_max_rate && !avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, for encoding with a maximum bitrate\n"); return -1; } if(avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isn't recommended!\n"); } if(avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate){ av_log(avctx, AV_LOG_ERROR, "bitrate below min bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate){ av_log(avctx, AV_LOG_INFO, "bitrate above max bitrate\n"); return -1; } if(avctx->rc_max_rate && avctx->rc_max_rate == avctx->bit_rate && avctx->rc_max_rate != avctx->rc_min_rate){ av_log(avctx, AV_LOG_INFO, "impossible bitrate constraints, this will fail\n"); } if(avctx->rc_buffer_size && avctx->bit_rate*av_q2d(avctx->time_base) > avctx->rc_buffer_size){ av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n"); return -1; } if(avctx->bit_rate*av_q2d(avctx->time_base) > avctx->bit_rate_tolerance){ av_log(avctx, AV_LOG_ERROR, "bitrate tolerance too small for bitrate\n"); return -1; } if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == CODEC_ID_MPEG2VIDEO) && 90000LL * (avctx->rc_buffer_size-1) > s->avctx->rc_max_rate*0xFFFFLL){ av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF (=VBR) as the specified vbv buffer is too large for the given bitrate!\n"); } if((s->flags & CODEC_FLAG_4MV) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P && s->codec_id != CODEC_ID_FLV1){ av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); return -1; } if(s->obmc && s->avctx->mb_decision != FF_MB_DECISION_SIMPLE){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with simple mb decision\n"); return -1; } if(s->obmc && s->codec_id != CODEC_ID_H263 && s->codec_id != CODEC_ID_H263P){ av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with H263(+)\n"); return -1; } if(s->quarter_sample && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n"); return -1; } if(s->data_partitioning && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "data partitioning not supported by codec\n"); return -1; } if(s->max_b_frames && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n"); return -1; } if((s->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)) && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n"); return -1; } if(s->mpeg_quant && s->codec_id != CODEC_ID_MPEG4){ av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n"); return -1; } if((s->flags & CODEC_FLAG_CBP_RD) && !avctx->trellis){ av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n"); return -1; } if((s->flags & CODEC_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD){ av_log(avctx, AV_LOG_ERROR, "QP RD needs mbd=2\n"); return -1; } if(s->avctx->scenechange_threshold < 1000000000 && (s->flags & CODEC_FLAG_CLOSED_GOP)){ av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection are not supported yet, set threshold to 1000000000\n"); return -1; } if((s->flags2 & CODEC_FLAG2_INTRA_VLC) && s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "intra vlc table not supported by codec\n"); return -1; } if(s->flags & CODEC_FLAG_LOW_DELAY){ if (s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg2\n"); return -1; } if (s->max_b_frames != 0){ av_log(avctx, AV_LOG_ERROR, "b frames cannot be used with low delay\n"); return -1; } } if(s->q_scale_type == 1){ if(s->codec_id != CODEC_ID_MPEG2VIDEO){ av_log(avctx, AV_LOG_ERROR, "non linear quant is only available for mpeg2\n"); return -1; } if(avctx->qmax > 12){ av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n"); return -1; } } if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != CODEC_ID_MPEG2VIDEO && (s->codec_id != CODEC_ID_H263P || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))){ av_log(avctx, AV_LOG_ERROR, "multi threaded encoding not supported by codec\n"); return -1; } if(s->avctx->thread_count < 1){ av_log(avctx, AV_LOG_ERROR, "automatic thread number detection not supported by codec, patch welcome\n"); return -1; } if(s->avctx->thread_count > 1) s->rtp_mode= 1; if(!avctx->time_base.den || !avctx->time_base.num){ av_log(avctx, AV_LOG_ERROR, "framerate not set\n"); return -1; } i= (INT_MAX/2+128)>>8; if(avctx->me_threshold >= i){ av_log(avctx, AV_LOG_ERROR, "me_threshold too large, max is %d\n", i - 1); return -1; } if(avctx->mb_threshold >= i){ av_log(avctx, AV_LOG_ERROR, "mb_threshold too large, max is %d\n", i - 1); return -1; } if(avctx->b_frame_strategy && (avctx->flags&CODEC_FLAG_PASS2)){ av_log(avctx, AV_LOG_INFO, "notice: b_frame_strategy only affects the first pass\n"); avctx->b_frame_strategy = 0; } i= av_gcd(avctx->time_base.den, avctx->time_base.num); if(i > 1){ av_log(avctx, AV_LOG_INFO, "removing common factors from framerate\n"); avctx->time_base.den /= i; avctx->time_base.num /= i; } if(s->codec_id==CODEC_ID_MJPEG){ s->intra_quant_bias= 1<<(QUANT_BIAS_SHIFT-1); s->inter_quant_bias= 0; }else if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || s->codec_id==CODEC_ID_MPEG2VIDEO){ s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); s->inter_quant_bias= 0; }else{ s->intra_quant_bias=0; s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); } if(avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS) s->intra_quant_bias= avctx->intra_quant_bias; if(avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS) s->inter_quant_bias= avctx->inter_quant_bias; avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_h_shift, &chroma_v_shift); if(avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > (1<<16)-1){ av_log(avctx, AV_LOG_ERROR, "timebase not supported by mpeg 4 standard\n"); return -1; } s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; switch(avctx->codec->id) { case CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; s->low_delay= !!(s->flags & CODEC_FLAG_LOW_DELAY); avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); s->rtp_mode= 1; break; case CODEC_ID_LJPEG: case CODEC_ID_MJPEG: s->out_format = FMT_MJPEG; s->intra_only = 1; if(avctx->codec->id == CODEC_ID_MJPEG || avctx->pix_fmt != PIX_FMT_BGRA){ s->mjpeg_vsample[0] = 2; s->mjpeg_vsample[1] = 2>>chroma_v_shift; s->mjpeg_vsample[2] = 2>>chroma_v_shift; s->mjpeg_hsample[0] = 2; s->mjpeg_hsample[1] = 2>>chroma_h_shift; s->mjpeg_hsample[2] = 2>>chroma_h_shift; }else{ s->mjpeg_vsample[0] = s->mjpeg_hsample[0] = s->mjpeg_vsample[1] = s->mjpeg_hsample[1] = s->mjpeg_vsample[2] = s->mjpeg_hsample[2] = 1; } if (!(CONFIG_MJPEG_ENCODER || CONFIG_LJPEG_ENCODER) || ff_mjpeg_encode_init(s) < 0) return -1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H261: if (!CONFIG_H261_ENCODER) return -1; if (ff_h261_get_picture_format(s->width, s->height) < 0) { av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the H.261 codec.\nValid sizes are 176x144, 352x288\n", s->width, s->height); return -1; } s->out_format = FMT_H261; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263: if (!CONFIG_H263_ENCODER) return -1; if (h263_get_picture_format(s->width, s->height) == 7) { av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for the H.263 codec.\nValid sizes are 128x96, 176x144, 352x288, 704x576, and 1408x1152. Try H.263+.\n", s->width, s->height); return -1; } s->out_format = FMT_H263; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_H263P: s->out_format = FMT_H263; s->h263_plus = 1; s->umvplus = (avctx->flags & CODEC_FLAG_H263P_UMV) ? 1:0; s->h263_aic= (avctx->flags & CODEC_FLAG_AC_PRED) ? 1:0; s->modified_quant= s->h263_aic; s->alt_inter_vlc= (avctx->flags & CODEC_FLAG_H263P_AIV) ? 1:0; s->obmc= (avctx->flags & CODEC_FLAG_OBMC) ? 1:0; s->loop_filter= (avctx->flags & CODEC_FLAG_LOOP_FILTER) ? 1:0; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; s->h263_slice_structured= (s->flags & CODEC_FLAG_H263P_SLICE_STRUCT) ? 1:0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_FLV1: s->out_format = FMT_H263; s->h263_flv = 2; s->unrestricted_mv = 1; s->rtp_mode=0; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV10: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_RV20: s->out_format = FMT_H263; avctx->delay=0; s->low_delay=1; s->modified_quant=1; s->h263_aic=1; s->h263_plus=1; s->loop_filter=1; s->unrestricted_mv= s->obmc || s->loop_filter || s->umvplus; break; case CODEC_ID_MPEG4: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->low_delay= s->max_b_frames ? 0 : 1; avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1); break; case CODEC_ID_MSMPEG4V1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 2; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_MSMPEG4V3: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 3; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV1: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 4; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; case CODEC_ID_WMV2: s->out_format = FMT_H263; s->h263_msmpeg4 = 1; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version= 5; s->flipflop_rounding=1; avctx->delay=0; s->low_delay=1; break; default: return -1; } avctx->has_b_frames= !s->low_delay; s->encoding = 1; s->progressive_frame= s->progressive_sequence= !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME|CODEC_FLAG_ALT_SCAN)); if (MPV_common_init(s) < 0) return -1; if(!s->dct_quantize) s->dct_quantize = dct_quantize_c; if(!s->denoise_dct) s->denoise_dct = denoise_dct_c; s->fast_dct_quantize = s->dct_quantize; if(avctx->trellis) s->dct_quantize = dct_quantize_trellis_c; if((CONFIG_H263P_ENCODER || CONFIG_RV20_ENCODER) && s->modified_quant) s->chroma_qscale_table= ff_h263_chroma_qscale_table; s->quant_precision=5; ff_set_cmp(&s->dsp, s->dsp.ildct_cmp, s->avctx->ildct_cmp); ff_set_cmp(&s->dsp, s->dsp.frame_skip_cmp, s->avctx->frame_skip_cmp); if (CONFIG_H261_ENCODER && s->out_format == FMT_H261) ff_h261_encode_init(s); if (CONFIG_ANY_H263_ENCODER && s->out_format == FMT_H263) h263_encode_init(s); if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version) ff_msmpeg4_encode_init(s); if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) && s->out_format == FMT_MPEG1) ff_mpeg1_encode_init(s); for(i=0;i<64;i++) { int j= s->dsp.idct_permutation[i]; if(CONFIG_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->mpeg_quant){ s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i]; }else if(s->out_format == FMT_H263 || s->out_format == FMT_H261){ s->intra_matrix[j] = s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; }else { s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; } if(s->avctx->intra_matrix) s->intra_matrix[j] = s->avctx->intra_matrix[i]; if(s->avctx->inter_matrix) s->inter_matrix[j] = s->avctx->inter_matrix[i]; } if (s->out_format != FMT_MJPEG) { ff_convert_matrix(&s->dsp, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, avctx->qmin, 31, 1); ff_convert_matrix(&s->dsp, s->q_inter_matrix, s->q_inter_matrix16, s->inter_matrix, s->inter_quant_bias, avctx->qmin, 31, 0); } if(ff_rate_control_init(s) < 0) return -1; return 0; }
1threat
static int decode_byterun(uint8_t *dst, int dst_size, const uint8_t *buf, const uint8_t *const buf_end) { const uint8_t *const buf_start = buf; unsigned x; for (x = 0; x < dst_size && buf < buf_end;) { unsigned length; const int8_t value = *buf++; if (value >= 0) { length = value + 1; memcpy(dst + x, buf, FFMIN3(length, dst_size - x, buf_end - buf)); buf += length; } else if (value > -128) { length = -value + 1; memset(dst + x, *buf++, FFMIN(length, dst_size - x)); } else { continue; } x += length; } if (x < dst_size) { av_log(NULL, AV_LOG_WARNING, "decode_byterun ended before plane size\n"); memset(dst+x, 0, dst_size - x); } return buf - buf_start; }
1threat
static void external_snapshot_prepare(BlkActionState *common, Error **errp) { int flags = 0, ret; QDict *options = NULL; Error *local_err = NULL; const char *device; const char *node_name; const char *snapshot_ref; const char *new_image_file; ExternalSnapshotState *state = DO_UPCAST(ExternalSnapshotState, common, common); TransactionAction *action = common->action; switch (action->type) { case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT: { BlockdevSnapshot *s = action->u.blockdev_snapshot; device = s->node; node_name = s->node; new_image_file = NULL; snapshot_ref = s->overlay; } break; case TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC: { BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync; device = s->has_device ? s->device : NULL; node_name = s->has_node_name ? s->node_name : NULL; new_image_file = s->snapshot_file; snapshot_ref = NULL; } break; default: g_assert_not_reached(); } if (action_check_completion_mode(common, errp) < 0) { return; } state->old_bs = bdrv_lookup_bs(device, node_name, errp); if (!state->old_bs) { return; } state->aio_context = bdrv_get_aio_context(state->old_bs); aio_context_acquire(state->aio_context); bdrv_drained_begin(state->old_bs); if (!bdrv_is_inserted(state->old_bs)) { error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device); return; } if (bdrv_op_is_blocked(state->old_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, errp)) { return; } if (!bdrv_is_read_only(state->old_bs)) { if (bdrv_flush(state->old_bs)) { error_setg(errp, QERR_IO_ERROR); return; } } if (!bdrv_is_first_non_filter(state->old_bs)) { error_setg(errp, QERR_FEATURE_DISABLED, "snapshot"); return; } if (action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_SNAPSHOT_SYNC) { BlockdevSnapshotSync *s = action->u.blockdev_snapshot_sync; const char *format = s->has_format ? s->format : "qcow2"; enum NewImageMode mode; const char *snapshot_node_name = s->has_snapshot_node_name ? s->snapshot_node_name : NULL; if (node_name && !snapshot_node_name) { error_setg(errp, "New snapshot node name missing"); return; } if (snapshot_node_name && bdrv_lookup_bs(snapshot_node_name, snapshot_node_name, NULL)) { error_setg(errp, "New snapshot node name already in use"); return; } flags = state->old_bs->open_flags; mode = s->has_mode ? s->mode : NEW_IMAGE_MODE_ABSOLUTE_PATHS; if (mode != NEW_IMAGE_MODE_EXISTING) { int64_t size = bdrv_getlength(state->old_bs); if (size < 0) { error_setg_errno(errp, -size, "bdrv_getlength failed"); return; } bdrv_img_create(new_image_file, format, state->old_bs->filename, state->old_bs->drv->format_name, NULL, size, flags, &local_err, false); if (local_err) { error_propagate(errp, local_err); return; } } options = qdict_new(); if (s->has_snapshot_node_name) { qdict_put(options, "node-name", qstring_from_str(snapshot_node_name)); } qdict_put(options, "driver", qstring_from_str(format)); flags |= BDRV_O_NO_BACKING; } assert(state->new_bs == NULL); ret = bdrv_open(&state->new_bs, new_image_file, snapshot_ref, options, flags, errp); if (ret != 0) { return; } if (state->new_bs->blk != NULL) { error_setg(errp, "The snapshot is already in use by %s", blk_name(state->new_bs->blk)); return; } if (bdrv_op_is_blocked(state->new_bs, BLOCK_OP_TYPE_EXTERNAL_SNAPSHOT, errp)) { return; } if (state->new_bs->backing != NULL) { error_setg(errp, "The snapshot already has a backing image"); return; } if (!state->new_bs->drv->supports_backing) { error_setg(errp, "The snapshot does not support backing images"); } }
1threat
static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, long width, long height, long lumStride, long chromStride, long dstStride) { RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2); }
1threat
struct pxa2xx_state_s *pxa255_init(unsigned int sdram_size, DisplayState *ds) { struct pxa2xx_state_s *s; struct pxa2xx_ssp_s *ssp; int iomemtype, i; s = (struct pxa2xx_state_s *) qemu_mallocz(sizeof(struct pxa2xx_state_s)); s->env = cpu_init(); cpu_arm_set_model(s->env, "pxa255"); register_savevm("cpu", 0, 0, cpu_save, cpu_load, s->env); cpu_register_physical_memory(PXA2XX_SDRAM_BASE, sdram_size, qemu_ram_alloc(sdram_size) | IO_MEM_RAM); cpu_register_physical_memory(PXA2XX_INTERNAL_BASE, PXA2XX_INTERNAL_SIZE, qemu_ram_alloc(PXA2XX_INTERNAL_SIZE) | IO_MEM_RAM); s->pic = pxa2xx_pic_init(0x40d00000, s->env); s->dma = pxa255_dma_init(0x40000000, s->pic[PXA2XX_PIC_DMA]); pxa25x_timer_init(0x40a00000, &s->pic[PXA2XX_PIC_OST_0]); s->gpio = pxa2xx_gpio_init(0x40e00000, s->env, s->pic, 85); s->mmc = pxa2xx_mmci_init(0x41100000, s->pic[PXA2XX_PIC_MMC], s->dma); for (i = 0; pxa255_serial[i].io_base; i ++) if (serial_hds[i]) serial_mm_init(pxa255_serial[i].io_base, 2, s->pic[pxa255_serial[i].irqn], serial_hds[i], 1); else break; if (serial_hds[i]) s->fir = pxa2xx_fir_init(0x40800000, s->pic[PXA2XX_PIC_ICP], s->dma, serial_hds[i]); if (ds) s->lcd = pxa2xx_lcdc_init(0x44000000, s->pic[PXA2XX_PIC_LCD], ds); s->cm_base = 0x41300000; s->cm_regs[CCCR >> 4] = 0x02000210; s->clkcfg = 0x00000009; iomemtype = cpu_register_io_memory(0, pxa2xx_cm_readfn, pxa2xx_cm_writefn, s); cpu_register_physical_memory(s->cm_base, 0xfff, iomemtype); register_savevm("pxa2xx_cm", 0, 0, pxa2xx_cm_save, pxa2xx_cm_load, s); cpu_arm_set_cp_io(s->env, 14, pxa2xx_cp14_read, pxa2xx_cp14_write, s); s->mm_base = 0x48000000; s->mm_regs[MDMRS >> 2] = 0x00020002; s->mm_regs[MDREFR >> 2] = 0x03ca4000; s->mm_regs[MECR >> 2] = 0x00000001; iomemtype = cpu_register_io_memory(0, pxa2xx_mm_readfn, pxa2xx_mm_writefn, s); cpu_register_physical_memory(s->mm_base, 0xfff, iomemtype); register_savevm("pxa2xx_mm", 0, 0, pxa2xx_mm_save, pxa2xx_mm_load, s); for (i = 0; pxa255_ssp[i].io_base; i ++); s->ssp = (struct pxa2xx_ssp_s **) qemu_mallocz(sizeof(struct pxa2xx_ssp_s *) * i); ssp = (struct pxa2xx_ssp_s *) qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i); for (i = 0; pxa255_ssp[i].io_base; i ++) { s->ssp[i] = &ssp[i]; ssp[i].base = pxa255_ssp[i].io_base; ssp[i].irq = s->pic[pxa255_ssp[i].irqn]; iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn, pxa2xx_ssp_writefn, &ssp[i]); cpu_register_physical_memory(ssp[i].base, 0xfff, iomemtype); register_savevm("pxa2xx_ssp", i, 0, pxa2xx_ssp_save, pxa2xx_ssp_load, s); } if (usb_enabled) { usb_ohci_init_pxa(0x4c000000, 3, -1, s->pic[PXA2XX_PIC_USBH1]); } s->pcmcia[0] = pxa2xx_pcmcia_init(0x20000000); s->pcmcia[1] = pxa2xx_pcmcia_init(0x30000000); s->rtc_base = 0x40900000; iomemtype = cpu_register_io_memory(0, pxa2xx_rtc_readfn, pxa2xx_rtc_writefn, s); cpu_register_physical_memory(s->rtc_base, 0xfff, iomemtype); pxa2xx_rtc_init(s); register_savevm("pxa2xx_rtc", 0, 0, pxa2xx_rtc_save, pxa2xx_rtc_load, s); s->i2c[0] = pxa2xx_i2c_init(0x40301600, s->pic[PXA2XX_PIC_I2C], 1); s->i2c[1] = pxa2xx_i2c_init(0x40f00100, s->pic[PXA2XX_PIC_PWRI2C], 0); s->pm_base = 0x40f00000; iomemtype = cpu_register_io_memory(0, pxa2xx_pm_readfn, pxa2xx_pm_writefn, s); cpu_register_physical_memory(s->pm_base, 0xfff, iomemtype); register_savevm("pxa2xx_pm", 0, 0, pxa2xx_pm_save, pxa2xx_pm_load, s); s->i2s = pxa2xx_i2s_init(0x40400000, s->pic[PXA2XX_PIC_I2S], s->dma); pxa2xx_gpio_handler_set(s->gpio, 1, pxa2xx_reset, s); return s; }
1threat
ERROR in The Angular Compiler requires TypeScript >=3.6.4 and <3.8.0 but 3.8.2 was found instead : <p>I ran</p> <pre><code>ng version </code></pre> <p>and got the following output:</p> <pre><code>Angular CLI: 9.0.3 Node: 12.16.1 OS: win32 x64 Angular: 9.0.2 ... animations, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router Ivy Workspace: Yes Package Version ----------------------------------------------------------- @angular-devkit/architect 0.803.25 @angular-devkit/build-angular 0.803.25 @angular-devkit/build-optimizer 0.803.25 @angular-devkit/build-webpack 0.803.25 @angular-devkit/core 8.3.25 @angular-devkit/schematics 9.0.3 @angular/cdk 8.2.3 @angular/cli 9.0.3 @angular/material 8.2.3 @ngtools/webpack 8.3.25 @schematics/angular 9.0.3 @schematics/update 0.900.3 rxjs 6.5.4 typescript 3.8.2 webpack 4.39.2 </code></pre> <p>If I try set the type script lower it complains the project is Angular 9 and can't use that type of type script. Not sure what to do, any help welcomed, thanks.</p>
0debug
target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr) { return addr; }
1threat
static void virtio_gpu_reset(VirtIODevice *vdev) { VirtIOGPU *g = VIRTIO_GPU(vdev); struct virtio_gpu_simple_resource *res, *tmp; int i; g->enable = 0; QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) { virtio_gpu_resource_destroy(g, res); } for (i = 0; i < g->conf.max_outputs; i++) { #if 0 g->req_state[i].x = 0; g->req_state[i].y = 0; if (i == 0) { g->req_state[0].width = 1024; g->req_state[0].height = 768; } else { g->req_state[i].width = 0; g->req_state[i].height = 0; } #endif g->scanout[i].resource_id = 0; g->scanout[i].width = 0; g->scanout[i].height = 0; g->scanout[i].x = 0; g->scanout[i].y = 0; g->scanout[i].ds = NULL; } g->enabled_output_bitmask = 1; #ifdef CONFIG_VIRGL if (g->use_virgl_renderer) { virtio_gpu_virgl_reset(g); g->use_virgl_renderer = 0; } #endif }
1threat
windows form application sequential ShowDialog()s : well i have a funny problem with closing dialog forms. here is the problem: I run application and open second form (through menu strip) as `showdialog();` and then from second form open third form. when i open third form by `button 1` and then close it everything is alright, but when i open the third form by `button 2` and then close it, third form will be closed and then it closes the second form also. !!! in second form when i show a `messageBox` and close it also the second form will be closed. here is my codes: open second form from first form codes: private void settingsToolMenu_Click(object sender, EventArgs e) { settingsForm s1 = new settingsForm(this); s1.ShowDialog(); } open third form from second by button 1 form codes: private void addReportButton_Click(object sender, EventArgs e) { addReport a1 = new addReport(this); a1.ShowDialog(); } open third form from second by button 2 form codes: private void editReportButton_Click(object sender, EventArgs e) { addReport a2 = new addReport(this); a2.ShowDialog(); } as you see there is no differences between `button 1` and `button 2` [here][1] is a video from application running. [1]: https://www.4shared.com/s/fXRU47LQ3ca
0debug
How do I open an external url in flutter web in new tab or in same tab : <p>I have a simple web app I have created with flutter web. I would like to know how I can open new an <code>external url</code> either in a <code>new tab</code> or in <code>the same tab</code> in my flutter web app. say I want to open the url <a href="https://stackoverflow.com/questions/ask">https://stackoverflow.com/questions/ask</a></p>
0debug
How to Copy Rows from one CSV to other CSV File using python : I'm trying to coping rows from one CSV to other and trying to remove row after being copied from the first file.. please see the code it's working for only copy specific rows from one csv to other import csv import os File1 = 'in.csv' File2 = 'out.csv' with open(File1, "r") as r, open(File2, "a") as w: reader = csv.reader(r, lineterminator = "\n") writer = csv.writer(w, lineterminator = "\n") for counter,row in enumerate(reader): if counter<0: continue if counter>50:break writer.writerow(row) Please let me know how this would work after coping the rows to the File 2 and remove that rows from File 1
0debug
React - Call parent method in child component : <p>I have a parent and child compoents and I want to call a parent method in the child component like this:</p> <pre><code>import Parent from './parent.js'; class Child extends React.Component { constructor(props) { super(props); }; click() { Parent.someMethod(); } render() { &lt;div&gt;Hello Child onClick={this.click}&lt;/&gt; } } class Parent extends React.Component { constructor(props) { super(props); }; someMethod() { console.log('bar'); } render() { &lt;div&gt;Hello Parent&lt;/&gt; } } </code></pre> <p>This returns an error message:</p> <p><code>Uncaught TypeError: _Parent2.default.someMethod is not a function</code></p> <p>How can this parent method be called in the child component?</p>
0debug
How to increment the counter inside a Liquid for loop? : <p>I am struggling to figure out how to increment the index variable within a for loop in Liquid/Jekyll. Currently, I have something along the lines of </p> <pre><code>{% for i in (0..num_posts) %} {% if i &lt; some_value %} do_thing {% else %} {% endif %} {% assign i = i|plus:1 %} {% if i&lt;some_value %} do_another_thing {% else %} {% endif %} {% endfor %} </code></pre> <p>The problem is, instead of incrementing i, it leaves i as the same value.</p> <p>Things I have tried:</p> <ol> <li>Using <code>{% assign i = i|plus:1 %}</code>.</li> <li>Using <code>{% increment i %}</code>. </li> <li><p>Using</p> <pre><code>{% assign j = i|plus:1 %} {% assign i = j %} </code></pre></li> </ol> <p>I can't use the <code>offset</code> command either since the code doesn't always check only 2 if statements in the loop. </p> <p>Any ideas?</p>
0debug
Difference between Dense(2) and Dense(1) as the final layer of a binary classification CNN? : <p>In a CNN for binary classification of images, should the shape of output be (number of images, 1) or (number of images, 2)? Specifically, here are 2 kinds of last layer in a CNN:</p> <pre><code>keras.layers.Dense(2, activation = 'softmax')(previousLayer) </code></pre> <p>or</p> <pre><code>keras.layers.Dense(1, activation = 'softmax')(previousLayer) </code></pre> <p>In the first case, for every image there are 2 output values (probability of belonging to group 1 and probability of belonging to group 2). In the second case, each image has only 1 output value, which is its label (0 or 1, label=1 means it belongs to group 1).</p> <p>Which one is correct? Is there intrinsic difference? I don't want to recognize any object in those images, just divide them into 2 groups.</p> <p>Thanks a lot!</p>
0debug
My application crashed : import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.EditText; public class MainActivity extends AppCompatActivity { EditText a; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); a = (EditText) findViewById(R.id.a); int i = Integer.parseInt(a.getText().toString()); } } java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.shoaib.demo/com.example.shoaib.demo.MainActivity}: java.lang.NumberFormatException: For input string: "" at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2892) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3027) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:101) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:73) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1786) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6656) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823) Caused by: java.lang.NumberFormatException: For input string: "" at java.lang.Integer.parseInt(Integer.java:629) at java.lang.Integer.parseInt(Integer.java:652) at com.example.shoaib.demo.MainActivity.onCreate(MainActivity.java:17) at android.app.Activity.performCreate(Activity.java:7117) at android.app.Activity.performCreate(Activity.java:7108) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1262)
0debug
Using images in responsive web design : <p>What is the correct method to use an image for different sizes. Like Thumbnail, Large Devices, Medium Devices and Small Devices? Mainly I'm using Bootstrap. I have used .img-responsive class. Is there any easy way to use the same image for these different screen sizes except calling different size images for different screen sizes? What is the correct common method to do such work? </p>
0debug
Hiding Duplicate Toolbars Items in Eclipse : <p>I don't know how, but my STS has got duplicate toolbars items and I am not sure how to remove them. Here is how my duplicated toolbar looks like.</p> <p><a href="https://i.stack.imgur.com/KMPku.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KMPku.png" alt="enter image description here"></a></p> <p>I want to get rid of these. I tried to hide the toolbar but that didn't help. Does anybody have any idea how to get rid of the duplicate ones?</p>
0debug
convert String to Util date in "dd-MMM-yyyy" fromat : <p>I am working in Eclipse . I have string date = "12-DEC-2016" </p> <p>now i want to convert it into util date in same format. Please help me with this query.</p>
0debug
How can I instantiate a lambda closure type in C++11/14? : <p>I'm <a href="https://stackoverflow.com/questions/55708180/lambda-closure-type-constructors">aware</a> that there's no default constructor for lambda closure type. But does that mean it's impossible to instantiate it after it being passed as a template parameter?</p> <p>Consider the following <a href="https://ideone.com/QnPYL8" rel="noreferrer">minimal example</a>:</p> <pre><code>#include &lt;iostream&gt; template &lt;typename FuncType&gt; std::pair&lt;int,int&gt; DoSomething() { return FuncType()(std::make_pair(1,1)); } int main() { auto myLambda = [](std::pair&lt;int,int&gt; x) { return std::make_pair(x.first*2,x.second*2); }; std::pair&lt;int,int&gt; res = DoSomething&lt;decltype(myLambda)&gt;(); return 0; } </code></pre> <p>For performance reasons, <a href="https://stackoverflow.com/questions/5057382/what-is-the-performance-overhead-of-stdfunction">I can't use <code>std::function</code></a> to avoid virtual pointer calls. Is there a way to do this? I need to instantiate that lambda once and use it many times inside that function. </p> <p>How does the standard library make it work when <code>decltype(myLambda)</code> is passed to something like <code>std::map</code> comparators in the template parameter?</p>
0debug
static void spapr_msi_setmsg(PCIDevice *pdev, hwaddr addr, bool msix, unsigned first_irq, unsigned req_num) { unsigned i; MSIMessage msg = { .address = addr, .data = first_irq }; if (!msix) { msi_set_message(pdev, msg); trace_spapr_pci_msi_setup(pdev->name, 0, msg.address); return; } for (i = 0; i < req_num; ++i, ++msg.data) { msix_set_message(pdev, i, msg); trace_spapr_pci_msi_setup(pdev->name, i, msg.address); } }
1threat
void ide_init2(IDEBus *bus, DriveInfo *hd0, DriveInfo *hd1, qemu_irq irq) { IDEState *s; static int drive_serial = 1; int i, cylinders, heads, secs; uint64_t nb_sectors; for(i = 0; i < 2; i++) { s = bus->ifs + i; s->bus = bus; s->unit = i; if (i == 0 && hd0) s->bs = hd0->bdrv; if (i == 1 && hd1) s->bs = hd1->bdrv; s->io_buffer = qemu_blockalign(s->bs, IDE_DMA_BUF_SECTORS*512 + 4); if (s->bs) { bdrv_get_geometry(s->bs, &nb_sectors); bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs); s->cylinders = cylinders; s->heads = heads; s->sectors = secs; s->nb_sectors = nb_sectors; s->smart_enabled = 1; s->smart_autosave = 1; s->smart_errors = 0; s->smart_selftest_count = 0; s->smart_selftest_data = qemu_blockalign(s->bs, 512); if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) { s->is_cdrom = 1; bdrv_set_change_cb(s->bs, cdrom_change_cb, s); } } s->drive_serial = drive_serial++; strncpy(s->drive_serial_str, drive_get_serial(s->bs), sizeof(s->drive_serial_str)); if (strlen(s->drive_serial_str) == 0) snprintf(s->drive_serial_str, sizeof(s->drive_serial_str), "QM%05d", s->drive_serial); s->sector_write_timer = qemu_new_timer(vm_clock, ide_sector_write_timer_cb, s); ide_reset(s); } bus->irq = irq; }
1threat
How to change a td without it's id? : Actually i'm trying to make something "strange" i have a row in a table where i have the head of the row and 96 td item. Each row is clickable by the following function $("#table tr").click(function(){}); Now by getting a value from 0 to 96 i need to get the td in the place X and do a colspan on it. As in the form i get value 40 i need to make the colspan on the 40th td in the clicked row. How can i implement something like that in javascript or jquery?
0debug
Is it faster to concatenate a string or an array in JavaScript? : <p>Which is faster?</p> <pre><code>var str = ''; for(var i=0; i&lt;1000; i++) { str += i; } </code></pre> <p>or</p> <pre><code>var arr = []; for(var i=0; i&lt;1000; i++) { arr.push(i); } var str = arr.join(''); </code></pre> <p>I ask because I have written a CSS parser which works really well, but is very slow for larger stylesheets (understandably). I am trying to find ways of making it faster, I wondered if this would make a difference. Thanks in advance!</p>
0debug
mysql query with conditions check : I have a table where it contains user details. Now I need to execute a mysql query which satisfies the below conditions There are two tables 1) user table - which contains userid,name,firstname, 2) category table - which containts categoryid, category type, assinged userid Now I want to execute the query which satisfies the below condition A User can only sees a category with a type of simple,complex and which are assigned only to his userid and that category shouldn't get assigned to any another userid. Anyone please help me in this.
0debug
mpi c++ you want to treat each number with each number separately : i have problem with mpi c++. i have array `int tab = [1,2,3,4,5,6,7,8,9,10,11]` I want to divide the tables due to the number of processes if I have two processes, divide eg one process [1,2,3,4,5,6] two process [7,8,9,10,11] if i have three process divide eg one process [1,2,3,] two process [4,5,6,7] three process [8,9,10,11] I do not know how to do it depending on the -n parameter how should I send these parts of the board to processes? thank you for your help, I would ask for an example
0debug
type A requires that type B be a class type swift 4 : <p>the following code gives me a compile error </p> <blockquote> <p>'WeakReference' requires that 'ServiceDelegate' be a class type</p> </blockquote> <pre><code>protocol ServiceDelegate: AnyObject { func doIt() } class SomeClass() { // compile error occurs in this line private var observers = [WeakReference&lt;ServiceDelegate&gt;]() } </code></pre> <p>WeakReference code:</p> <pre><code>final class WeakReference&lt;T: AnyObject&gt; { private(set) weak var value: T? init(value: T?) { self.value = value } } </code></pre> <p>How can I fix this error? Delegate should be declared correctly as per this <a href="https://useyourloaf.com/blog/class-only-protocols-in-swift-4/" rel="noreferrer">site</a>.</p> <p>What I have tried so far:</p> <ul> <li>Changing the delegate protocol conformance from <code>AnyObject</code> to <code>class</code> does not solve the problem.</li> <li>Try the above code in a clean playground.</li> </ul>
0debug
Pop to root view controller from modal : <p>I am trying to pop to the root view controller using the following code:</p> <pre><code>self.navigationController!.popToRootViewController(animated: true) </code></pre> <p>This usually works, but I get an error when trying to use this code when the current view is a modal. How do I go about popping back to the root view controller in this situation?</p> <p>Thanks in advance.</p>
0debug
External files in Airflow DAG : <p>I'm trying to access external files in a Airflow Task to read some sql, and I'm getting "file not found". Has anyone come across this?</p> <pre><code>from airflow import DAG from airflow.operators.python_operator import PythonOperator from datetime import datetime, timedelta dag = DAG( 'my_dat', start_date=datetime(2017, 1, 1), catchup=False, schedule_interval=timedelta(days=1) ) def run_query(): # read the query query = open('sql/queryfile.sql') # run the query execute(query) tas = PythonOperator( task_id='run_query', dag=dag, python_callable=run_query) </code></pre> <p>The log state the following:</p> <pre><code>IOError: [Errno 2] No such file or directory: 'sql/queryfile.sql' </code></pre> <p>I understand that I could simply copy and paste the query inside the same file, it's really not at neat solution. There are multiple queries and the text is really big, embed it with the Python code would compromise readability. </p>
0debug
ThreadPool *aio_get_thread_pool(AioContext *ctx) { if (!ctx->thread_pool) { ctx->thread_pool = thread_pool_new(ctx); } return ctx->thread_pool; }
1threat
solution architecture in c# where winforms and asp.mvc share business logic and Data access : <p>I have a c# winforms solution which includes the below projects:-</p> <ol> <li>UI Layer</li> <li>BLL</li> <li>DataModel</li> <li>DAL</li> </ol> <p>Now, i want to create a asp.mvc UI within the same above solution, for the same application using MVC pattern. When i searched about mvc solution architecture, mostly i found, the model, view and controllers are created in the same project. But, since i already have the model as DAL, and BLL which developed for my winforms application, how can i design the solution architecure so that i can make use of my present BLL, DataModel and DAL layers.</p> <p>Or, is it better to do the mvc projects as a separate solution? In that case, i have to maintain my BLL and DAL separately na.</p> <p>Please advise in this regard. Thanks Jim</p>
0debug
static void svq3_add_idct_c(uint8_t *dst, int16_t *block, int stride, int qp, int dc) { const int qmul = svq3_dequant_coeff[qp]; int i; if (dc) { dc = 13 * 13 * (dc == 1 ? 1538U* block[0] : qmul * (block[0] >> 3) / 2); block[0] = 0; } for (i = 0; i < 4; i++) { const int z0 = 13 * (block[0 + 4 * i] + block[2 + 4 * i]); const int z1 = 13 * (block[0 + 4 * i] - block[2 + 4 * i]); const int z2 = 7 * block[1 + 4 * i] - 17 * block[3 + 4 * i]; const int z3 = 17 * block[1 + 4 * i] + 7 * block[3 + 4 * i]; block[0 + 4 * i] = z0 + z3; block[1 + 4 * i] = z1 + z2; block[2 + 4 * i] = z1 - z2; block[3 + 4 * i] = z0 - z3; } for (i = 0; i < 4; i++) { const unsigned z0 = 13 * (block[i + 4 * 0] + block[i + 4 * 2]); const unsigned z1 = 13 * (block[i + 4 * 0] - block[i + 4 * 2]); const unsigned z2 = 7 * block[i + 4 * 1] - 17 * block[i + 4 * 3]; const unsigned z3 = 17 * block[i + 4 * 1] + 7 * block[i + 4 * 3]; const int rr = (dc + 0x80000); dst[i + stride * 0] = av_clip_uint8(dst[i + stride * 0] + ((int)((z0 + z3) * qmul + rr) >> 20)); dst[i + stride * 1] = av_clip_uint8(dst[i + stride * 1] + ((int)((z1 + z2) * qmul + rr) >> 20)); dst[i + stride * 2] = av_clip_uint8(dst[i + stride * 2] + ((int)((z1 - z2) * qmul + rr) >> 20)); dst[i + stride * 3] = av_clip_uint8(dst[i + stride * 3] + ((int)((z0 - z3) * qmul + rr) >> 20)); } memset(block, 0, 16 * sizeof(int16_t)); }
1threat
A weird output ? : I am new to the C.Sc course and we are taught C program. I was trying some of the basic stuff. Currently I am learning User-Defined-Function. The following code is the one I was trying with. I know it is pretty simple but I am not able to understand why it is producing such weird output. #include <stdio.h> int add(int a); //function declaration int main (void) { int b,sum; printf("\nEnter a number: "); scanf("%d", &b); sum = add(b); //function calling printf("\nSum: %d\n\n", sum); } int add(int a) //function definition { int result; for(int i = 0; i < a; i++) { result = result + i; return result; } } The output for 1 is 32743 The output for 2 is 32594 The output for 3 is 32704 The weird thing is output change each time for the same number. It's just weird considering my experience in C.Sc. till date. Kindly explain what the program is doing. **This is the right place to post problems like this. Right ?**
0debug
can i make android app using only html and css : <p>Please tell whether I can make an app using HTML and CSS only and <strong>NO</strong> javascript . I am not aware of any programming languages but I have an idea of making an android application. So I want to make it however and please also suggest for if I could make for ios application. if yes then what are the features I could use in that app. like my app notifies you like alarm-clock so is that possible??</p>
0debug
I am trying to do basic addition in c++ but large numbers are showing : <p>I am tryimg to do basic addition in c++ but a large number shows instead of the number thats suposed to show.</p> <pre><code>#include &lt;iostream&gt; using namespace std; int main() { int x; int y; int sub = x + y; cout&lt;&lt;"Enter First number:"&lt;&lt;endl; cin&gt;&gt;x; cout&lt;&lt;"Enter second number:"&lt;&lt;endl; cin&gt;&gt;y; cout &lt;&lt; "The sum is: "&lt;&lt; sub &lt;&lt; endl; return 0; } </code></pre> <p>When I run this it shows the sum as "6996596".</p>
0debug
Angular 6 - WebSocket is closed before the connection is established : <p>Everytime I start my application I get this. I don't use SSL and I am connecting to localhost:4200.</p> <p>WebSocket is closed before the connection is established</p> <p>What would cause this?</p> <p><a href="https://i.stack.imgur.com/xt2Fv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xt2Fv.png" alt="enter image description here"></a></p>
0debug
static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; enum AVAudioServiceType *ast; int ac3info, acmod, lfeon, bsmod; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, sizeof(*ast)); if (!ast) return AVERROR(ENOMEM); ac3info = avio_rb24(pb); bsmod = (ac3info >> 14) & 0x7; acmod = (ac3info >> 11) & 0x7; lfeon = (ac3info >> 10) & 0x1; st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon; st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod]; if (lfeon) st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; *ast = bsmod; if (st->codec->channels > 1 && bsmod == 0x7) *ast = AV_AUDIO_SERVICE_TYPE_KARAOKE; st->codec->audio_service_type = *ast; return 0; }
1threat
static av_cold int hap_init(AVCodecContext *avctx) { HapContext *ctx = avctx->priv_data; int ratio; int corrected_chunk_count; int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Invalid video size %dx%d.\n", avctx->width, avctx->height); return ret; } if (avctx->width % 4 || avctx->height % 4) { av_log(avctx, AV_LOG_ERROR, "Video size %dx%d is not multiple of 4.\n", avctx->width, avctx->height); return AVERROR_INVALIDDATA; } ff_texturedspenc_init(&ctx->dxtc); switch (ctx->opt_tex_fmt) { case HAP_FMT_RGBDXT1: ratio = 8; avctx->codec_tag = MKTAG('H', 'a', 'p', '1'); avctx->bits_per_coded_sample = 24; ctx->tex_fun = ctx->dxtc.dxt1_block; break; case HAP_FMT_RGBADXT5: ratio = 4; avctx->codec_tag = MKTAG('H', 'a', 'p', '5'); avctx->bits_per_coded_sample = 32; ctx->tex_fun = ctx->dxtc.dxt5_block; break; case HAP_FMT_YCOCGDXT5: ratio = 4; avctx->codec_tag = MKTAG('H', 'a', 'p', 'Y'); avctx->bits_per_coded_sample = 24; ctx->tex_fun = ctx->dxtc.dxt5ys_block; break; default: av_log(avctx, AV_LOG_ERROR, "Invalid format %02X\n", ctx->opt_tex_fmt); return AVERROR_INVALIDDATA; } ctx->tex_size = FFALIGN(avctx->width, TEXTURE_BLOCK_W) * FFALIGN(avctx->height, TEXTURE_BLOCK_H) * 4 / ratio; corrected_chunk_count = av_clip(ctx->opt_chunk_count, 1, HAP_MAX_CHUNKS); while ((ctx->tex_size / (64 / ratio)) % corrected_chunk_count != 0) { corrected_chunk_count--; } if (corrected_chunk_count != ctx->opt_chunk_count) { av_log(avctx, AV_LOG_INFO, "%d chunks requested but %d used.\n", ctx->opt_chunk_count, corrected_chunk_count); } ret = ff_hap_set_chunk_count(ctx, corrected_chunk_count, 1); if (ret != 0) return ret; ctx->max_snappy = snappy_max_compressed_length(ctx->tex_size / corrected_chunk_count); ctx->tex_buf = av_malloc(ctx->tex_size); if (!ctx->tex_buf) return AVERROR(ENOMEM); return 0; }
1threat