problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
Reusing code from Hartl Rails Tutorial : <p>I've almost completed Michael Hartl's Rails Tutorial. Absolutely loved it, and loving what I've learnt about Rails.</p>
<p>It occurred to me, that I could reuse most of what we've done for the other app ideas that I have. We have great user registration, authentication, security and testing. It would be 'straightforward' to modify what I have here for other purposes.</p>
<p>I just want to ask if this is a standard practice when building new apps (reusing what you already have), and if there any gotchas or things I've not considered in looking to do so?</p>
<p>Loving getting back into coding, and can't wait to get my first idea out into the wild!</p>
| 0debug
|
static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration)
{
int i;
MP3DecContext *mp3 = s->priv_data;
int fill_index = mp3->usetoc == 1 && duration > 0;
if (!filesize &&
!(filesize = avio_size(s->pb))) {
av_log(s, AV_LOG_WARNING, "Cannot determine file size, skipping TOC table.\n");
fill_index = 0;
}
for (i = 0; i < XING_TOC_COUNT; i++) {
uint8_t b = avio_r8(s->pb);
if (fill_index)
av_add_index_entry(s->streams[0],
av_rescale(b, filesize, 256),
av_rescale(i, duration, XING_TOC_COUNT),
0, 0, AVINDEX_KEYFRAME);
}
if (fill_index)
mp3->xing_toc = 1;
}
| 1threat
|
Abort evaluating Haskell expression if memory limit reached : <p>I'm using QuickCheck to test automatically-generated properties (similar to <a href="https://hackage.haskell.org/package/quickspec" rel="noreferrer">QuickSpec</a>) but one common problem I'm running into is exhausting the memory, either due to naive recursive generators or very large function outputs (e.g. one failure was caused by an exponential function for Peano numerals, which generated huge nested structures).</p>
<p>I'm wondering if there's a way to abandon evaluation if a (resident) memory limit is reached. It seems <a href="https://stackoverflow.com/questions/20752083/haskell-time-limit-on-evaluation">we can do this for timeouts</a>, but memory seems to be trickier. This way, if we use too much memory, that test can be discarded (as if a <code>==></code> precondition had failed).</p>
<p>I can see how to measure the whole program's memory usage, by looking at the source of the <code>weigh</code> package. This would be workable, but it would be much nicer (and robust) to measure it for one particular expression (perhaps by getting the memory used by one thread, or something?).</p>
<p>For my purposes it would be enough to fully-normalise the expression, since I don't need to worry about recursive structures (I can apply this to the test results, which are effectively booleans).</p>
| 0debug
|
static void ac97_write(void *opaque, target_phys_addr_t addr, uint64_t value,
unsigned size)
{
MilkymistAC97State *s = opaque;
trace_milkymist_ac97_memory_write(addr, value);
addr >>= 2;
switch (addr) {
case R_AC97_CTRL:
if (value & AC97_CTRL_RQEN) {
if (value & AC97_CTRL_WRITE) {
trace_milkymist_ac97_pulse_irq_crrequest();
qemu_irq_pulse(s->crrequest_irq);
} else {
trace_milkymist_ac97_pulse_irq_crreply();
qemu_irq_pulse(s->crreply_irq);
}
}
s->regs[addr] = value & ~AC97_CTRL_RQEN;
break;
case R_D_CTRL:
case R_U_CTRL:
s->regs[addr] = value;
update_voices(s);
break;
case R_AC97_ADDR:
case R_AC97_DATAOUT:
case R_AC97_DATAIN:
case R_D_ADDR:
case R_D_REMAINING:
case R_U_ADDR:
case R_U_REMAINING:
s->regs[addr] = value;
break;
default:
error_report("milkymist_ac97: write access to unknown register 0x"
TARGET_FMT_plx, addr);
break;
}
}
| 1threat
|
c++ fstream when see string in file : <p>I made a code but it doesn't work.Can you help? In code, I wanted to take a line and if code see <strong>//n</strong>, end line.</p>
<p>Here is my example.<br>
File:</p>
<pre><code>I love C++! //n
</code></pre>
<p>My Code:</p>
<pre><code>ifstream file("file.txt");
char text[250];
while(file >> text){
cout << text << " ";
if(text == "//n"){
cout << endl;
}
}
</code></pre>
<p>Thanks for your help.</p>
| 0debug
|
How to pass multiple arguments to Static Void Main in C# : <p>I am trying to pass two arguments like :</p>
<pre><code>static void Main(string[] args,string NewReportID)
</code></pre>
<p>But I am getting error stating "Main has the wrong signature to be entry point". Is there a better way to do this?</p>
| 0debug
|
Random class always returning the same number between two classes : <p>I have a program that rolls two die. The die are objects created from the Dice class. The Dice class contains a method that returns a random number between 1 and the number of sides that the dice contains. Like so:</p>
<pre><code>class Dice
{
//field
private int sides;
private Random rand = new Random();
//Constructor omitted for brevity
//public method to roll the dice.
public int rollDie()
{
return rand.Next(sides) + 1;
}
}
</code></pre>
<p>This works just fine for one dice. However, when I create two die and run both of their rollDie methods at the same time, I always receive the same number between the two die objects. For example:</p>
<pre><code>Dice dice1 = new Dice(6); //created two die with 6 sides each.
Dice dice2 = new Dice(6);
dice1.rollDie(); //problem functions
dice2.rollDie();
</code></pre>
<p>those two functions will always return the same number, i.e. (1,1), (2,2), etc... never parting from this pattern. </p>
<p>From my research, I have concluded that the random object is creating a random number from the system's time and because the two methods are performed at nearly the same exact moment, they are returning a random number from the same seed. This is obviously a problem because it is far from reality. </p>
<p>The only solution I have tried so far, and the only one I can think of, was to define my own seed for each Dice object to be used in my Random object, but that seems to return the same number each time the rollDie method is called between each time the program is run (i.e. it will return (2, 5), (1, 3) every time the program is run with a seed of 1 and 2, respectively).</p>
<p>The question I have is if there is any way to prevent the two objects from returning the same number as the other?</p>
| 0debug
|
Trying to show the size taken up by a specific directory, I'm my case, the HOME directory : <p>I've tried </p>
<pre><code>df -H $HOME
</code></pre>
<p>But I just get</p>
<pre><code>Filesystem Size Used Avail Use% Mounted on
/dev/mmcblk0p2 31G 7.9G 21G 28% /
</code></pre>
<p>This is not correct as the total used size of my home directory is only 800MB</p>
| 0debug
|
Disable warnings in jupyter notebook : <p>I'm getting this warning in jupyter notebook.</p>
<pre><code>/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:10: DeprecationWarning: object of type <class 'float'> cannot be safely interpreted as an integer.
# Remove the CWD from sys.path while we load stuff.
/anaconda3/lib/python3.6/site-packages/ipykernel_launcher.py:11: DeprecationWarning: object of type <class 'float'> cannot be safely interpreted as an integer.
# This is added back by InteractiveShellApp.init_path()
</code></pre>
<p>It's annoying because it shows up in every run I do:</p>
<p><a href="https://i.stack.imgur.com/2Gkfg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2Gkfg.png" alt="enter image description here"></a></p>
<p>How do I fix or disable it?</p>
| 0debug
|
take last row first item from two-dimensional java :
I am trying to take take first item of the last row which in this case would be 5, but i cant find how to get this.
int[][] arr = { { 2, 4, 5, 1 }, { 4, 8, 7, 1 }, { 5, 9, 2, 20 } };`
this is what ive tried but this gives me the last item of the row.
`String[] lastNum = arr[arr.length - 1];
System.out.println(lastNum[lastNum.length-1]);`
| 0debug
|
accesing vectors going out of bounds : #include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{ vector <int> a,b;
int i,n,m,k;
bool cond=true;
cin>>n;
for(i=0;i<n;i++)
{
cin>>m;
a.push_back(m);
}
for(i=1;i<n-1;i++)
{
if(a.at(i)==a.at(i+1))
a.erase(a.begin()+i);
}
n=a.size();
for(i=0;i<n;i++)
cout<<a[i];
}
return 0;
}
i want to delete all the repetions of consecutive numbers why is the program throwing me an error of out of bounds????
is there any logical error.or could u give me some better logic
| 0debug
|
static void test_yield(void)
{
Coroutine *coroutine;
bool done = false;
int i = -1;
coroutine = qemu_coroutine_create(yield_5_times);
while (!done) {
qemu_coroutine_enter(coroutine, &done);
i++;
}
g_assert_cmpint(i, ==, 5);
}
| 1threat
|
Firepad with Angular5 : I would like to use firepad within my angular5 application.
I don't see any example of firepad with angular5.
I am not sure how to bind .ts to html.
Sample example with .html and .ts file would be a great help.
Thanks
Pari
| 0debug
|
I can't connect to mysql? : <p><a href="https://i.stack.imgur.com/GrzcU.png" rel="nofollow noreferrer">here is my code please help me to solve this prob.i think error is inside the function. compiler show error on line 9. thanks in advance </a></p>
<pre><code><?php
class db_connector{
var $db_dsn="mysql:host=localhost;dbname=erp5_temp2";
var $db_username = "root";
var $db_password = "";
var $dbh ="";
public db_connector(){
$dbh = new PDO($this->$db_dsn,$this->$db_username,$this->$db_password);
$dbh->setAttribute(PDO::ATTR_EMULATE_PREPARES,TRUE);
}
public get_db_handler(){
return $dbh;
}
}
</code></pre>
<p>?></p>
| 0debug
|
R: data.table count !NA per row : <p>I am trying to count the number of columns that do not contain NA for each row, and place that value into a new column for that row.</p>
<p>Example data:</p>
<pre><code>library(data.table)
a = c(1,2,3,4,NA)
b = c(6,NA,8,9,10)
c = c(11,12,NA,14,15)
d = data.table(a,b,c)
> d
a b c
1: 1 6 11
2: 2 NA 12
3: 3 8 NA
4: 4 9 14
5: NA 10 15
</code></pre>
<p>My desired output would include a new column <code>num_obs</code> which contains the number of non-NA entries per row:</p>
<pre><code> a b c num_obs
1: 1 6 11 3
2: 2 NA 12 2
3: 3 8 NA 2
4: 4 9 14 3
5: NA 10 15 2
</code></pre>
<p>I've been reading for hours now and so far the best I've come up with is looping over rows, which I know is never advisable in R or data.table. I'm sure there is a better way to do this, please enlighten me.</p>
<p>My crappy way:</p>
<pre><code>len = (1:NROW(d))
for (n in len) {
d[n, num_obs := length(which(!is.na(d[n])))]
}
</code></pre>
| 0debug
|
int apic_init(CPUState *env)
{
APICState *s;
if (last_apic_idx >= MAX_APICS)
return -1;
s = qemu_mallocz(sizeof(APICState));
env->apic_state = s;
s->idx = last_apic_idx++;
s->id = env->cpuid_apic_id;
s->cpu_env = env;
apic_reset(s);
msix_supported = 1;
if (apic_io_memory == 0) {
apic_io_memory = cpu_register_io_memory(apic_mem_read,
apic_mem_write, NULL);
cpu_register_physical_memory(MSI_ADDR_BASE, MSI_ADDR_SIZE,
apic_io_memory);
}
s->timer = qemu_new_timer(vm_clock, apic_timer, s);
vmstate_register(s->idx, &vmstate_apic, s);
qemu_register_reset(apic_reset, s);
local_apics[s->idx] = s;
return 0;
}
| 1threat
|
void *av_realloc(void *ptr, unsigned int size)
{
#ifdef MEMALIGN_HACK
int diff;
#endif
if(size > INT_MAX)
return NULL;
#ifdef MEMALIGN_HACK
if(!ptr) return av_malloc(size);
diff= ((char*)ptr)[-1];
return realloc(ptr - diff, size + diff) + diff;
#else
return realloc(ptr, size);
#endif
}
| 1threat
|
How to version and separate Service Fabric applications? : <p>All of the service fabric <a href="https://github.com/Azure-Samples/service-fabric-dotnet-getting-started">examples</a> depict single-solution service fabric examples. This seems to go <em>counter</em> to the philosophy of microservices, where you want complete dependency isolation between your services. While you can manually follow this pattern, the more common practice is to enforce it by making each service it's own repository and solution/project.</p>
<p>How do you manage and deploy service fabric services, and enforce service contracts (ServiceInferfaces) using multiple solutions (in multiple Git repositories)?</p>
<p>E.g.</p>
<pre><code>Service Fabric Solution
App1 - Customers
- Service1 [Carts] From Other Solution
- Service2 [LocationInfo]From Other Solution
- Service3 [REST WebAPI for Admin] From Other Solution
App2 - Products
- Service4 [Status]From Other Solution
- Service5 [Firmware]From Other Solution
- Service6 [Event Stream] From Other Solution
External Solution
- Service1
External Solution
- Service2
External Solution
- Service3
External Solution
- Service4
External Solution
- Service5
External Solution
- Service6
</code></pre>
<p>1) As a developer, I want to check out and build all the current versions of apps/services. I want to fire up my Service Fabric project that manages all the manifests, and deploy it to my local dev cluster. I want to enforce the same service interfaces between solutions. I don't understand how you'd do this, because the application is external to the services. </p>
<p>2) As a DevOps team, I want to automate pulling down the apps, building them and deploying to Azure. </p>
<p>How do we "enforce" isolation via separate solutions, but make it easy to pull them together and deploy into the cluster, while also making it easy to make pipelines to deploy each cluster configured uniquely for DEV, QA, and PROD environments. </p>
<p>What is the workflow/process/project structure to enable this? Is it even possible?</p>
| 0debug
|
static void gen_neon_dup_low16(TCGv var)
{
TCGv tmp = new_tmp();
tcg_gen_ext16u_i32(var, var);
tcg_gen_shli_i32(tmp, var, 16);
tcg_gen_or_i32(var, var, tmp);
dead_tmp(tmp);
}
| 1threat
|
Node-Inspector not starting : <p>First, I was having an issue installing node-inspector, I had to revert to installing version <code>@0.7.5</code>.. That installed globally on my machine, but now when I try to run <code>node-inspector</code> I get the error below. I find it odd that I haven't been able to find much in regards to these two errors.</p>
<pre><code>module.js:487
throw err;
^
Error: Cannot find module '_debugger'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/node-inspector/lib/debugger.js:2:16)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
</code></pre>
| 0debug
|
Error getting the selected value in Javascript : I am working on this project where I need to get the selected value from the user and and do a simple if - else. However, I'm not being able to get the value of the selected option from the user.
**Please don't mark this as duplicate, I tried many resources before I came here. I want a solution not go read this documentation either.**
```javascript
function getInsulinStrength() {
let insulinSt = document.getElementById('insulinStrength'),
selectedNode = insulinSt.options[insulinSt.selectedIndex];
if (selectedNode.value ==="Humalog"){
insulinStrengthTotal = 1800;
}
else {
insulinStrengthTotal = 1500;
}
return insulinStrengthTotal;
}
```
This value needs to be put in the function below:
```javascript
function doTheMath(){
let carbIntake = getCurrentMeal();
let cbs = getCurrentBloodSugar();
let tbs = getTargetBloodSugar();
let br = getBasalRate();
let is = getInsulinStrength();
let dailyBasalRate = br * 24;
let gramsPerInsulin = 450 / dailyBasalRate;
let bolus = carbIntake / gramsPerInsulin;
if (cbs > tbs){
let correctionFactor = is / dailyBasalRate;
let correctionDose = (cbs - tbs) / correctionFactor;
bolus += correctionDose;
}
return bolus;
}
```
Everything else works minus the getInsulinStrength() function. Regardless of what the user chooses, it returns the same value.
I ADDED THE HTML CODE ~ just to make give more insight.
```html
<select id = "insulinStrength" name="insulinStrength" type="text" class="selectBtn" >
<option value="">Select Insulin Type</option>
<option value="Novolog">Novolog</option>
<option value="Humalog">Humalog</option>
<option value="Apidra">Apidra</option>
<option value="Velosulin">Velosulin</option>
</select>
```
The result is supposed to change when the user chooses Humalog. But the *results always stay the same for every single selected value*.
| 0debug
|
static void check_consistency(FFFrameQueue *fq)
{
#if ASSERT_LEVEL >= 2
uint64_t nb_samples = 0;
size_t i;
av_assert0(fq->queued == fq->total_frames_head - fq->total_frames_tail);
for (i = 0; i < fq->queued; i++)
nb_samples += bucket(fq, i)->frame->nb_samples;
av_assert0(nb_samples == fq->total_samples_head - fq->total_samples_tail);
#endif
}
| 1threat
|
Expand The App bar in Flutter to Allow Multi-Line Title? : <p>Does anyone know how I can create an app bar with a multi-line title, as per the material guidelines show here? </p>
<p><a href="https://material.io/design/components/app-bars-top.html#anatomy" rel="noreferrer">https://material.io/design/components/app-bars-top.html#anatomy</a></p>
<p><a href="https://i.stack.imgur.com/mCokC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mCokC.png" alt="Multi-line app bar"></a></p>
<p>Any ideas how to do this? It seems like it should be straightforward given that it's part of the material guidelines! Worth pointing out that the title is user defined, so I want to allow the app bar to expand from a single line to multiple lines (perhaps with a limit imposed) depending on user input.</p>
<p>Mike</p>
| 0debug
|
static void vnc_debug_gnutls_log(int level, const char* str) {
VNC_DEBUG("%d %s", level, str);
}
| 1threat
|
static int ivr_read_header(AVFormatContext *s)
{
unsigned tag, type, len, tlen, value;
int i, j, n, count, nb_streams, ret;
uint8_t key[256], val[256];
AVIOContext *pb = s->pb;
AVStream *st;
int64_t pos, offset, temp;
pos = avio_tell(pb);
tag = avio_rl32(pb);
if (tag == MKTAG('.','R','1','M')) {
if (avio_rb16(pb) != 1)
return AVERROR_INVALIDDATA;
if (avio_r8(pb) != 1)
return AVERROR_INVALIDDATA;
len = avio_rb32(pb);
avio_skip(pb, len);
avio_skip(pb, 5);
temp = avio_rb64(pb);
while (!avio_feof(pb) && temp) {
offset = temp;
temp = avio_rb64(pb);
}
avio_skip(pb, offset - avio_tell(pb));
if (avio_r8(pb) != 1)
return AVERROR_INVALIDDATA;
len = avio_rb32(pb);
avio_skip(pb, len);
if (avio_r8(pb) != 2)
return AVERROR_INVALIDDATA;
avio_skip(pb, 16);
pos = avio_tell(pb);
tag = avio_rl32(pb);
}
if (tag != MKTAG('.','R','E','C'))
return AVERROR_INVALIDDATA;
if (avio_r8(pb) != 0)
return AVERROR_INVALIDDATA;
count = avio_rb32(pb);
for (i = 0; i < count; i++) {
if (avio_feof(pb))
return AVERROR_INVALIDDATA;
type = avio_r8(pb);
tlen = avio_rb32(pb);
avio_get_str(pb, tlen, key, sizeof(key));
len = avio_rb32(pb);
if (type == 5) {
avio_get_str(pb, len, val, sizeof(val));
av_log(s, AV_LOG_DEBUG, "%s = '%s'\n", key, val);
} else if (type == 4) {
av_log(s, AV_LOG_DEBUG, "%s = '0x", key);
for (j = 0; j < len; j++)
av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb));
av_log(s, AV_LOG_DEBUG, "'\n");
} else if (len == 4 && type == 3 && !strncmp(key, "StreamCount", tlen)) {
nb_streams = value = avio_rb32(pb);
} else if (len == 4 && type == 3) {
value = avio_rb32(pb);
av_log(s, AV_LOG_DEBUG, "%s = %d\n", key, value);
} else {
av_log(s, AV_LOG_DEBUG, "Skipping unsupported key: %s\n", key);
avio_skip(pb, len);
}
}
for (n = 0; n < nb_streams; n++) {
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
st->priv_data = ff_rm_alloc_rmstream();
if (!st->priv_data)
return AVERROR(ENOMEM);
if (avio_r8(pb) != 1)
return AVERROR_INVALIDDATA;
count = avio_rb32(pb);
for (i = 0; i < count; i++) {
if (avio_feof(pb))
return AVERROR_INVALIDDATA;
type = avio_r8(pb);
tlen = avio_rb32(pb);
avio_get_str(pb, tlen, key, sizeof(key));
len = avio_rb32(pb);
if (type == 5) {
avio_get_str(pb, len, val, sizeof(val));
av_log(s, AV_LOG_DEBUG, "%s = '%s'\n", key, val);
} else if (type == 4 && !strncmp(key, "OpaqueData", tlen)) {
ret = ffio_ensure_seekback(pb, 4);
if (ret < 0)
return ret;
if (avio_rb32(pb) == MKBETAG('M', 'L', 'T', 'I')) {
ret = rm_read_multi(s, pb, st, NULL);
} else {
avio_seek(pb, -4, SEEK_CUR);
ret = ff_rm_read_mdpr_codecdata(s, pb, st, st->priv_data, len, NULL);
}
if (ret < 0)
return ret;
} else if (type == 4) {
int j;
av_log(s, AV_LOG_DEBUG, "%s = '0x", key);
for (j = 0; j < len; j++)
av_log(s, AV_LOG_DEBUG, "%X", avio_r8(pb));
av_log(s, AV_LOG_DEBUG, "'\n");
} else if (len == 4 && type == 3 && !strncmp(key, "Duration", tlen)) {
st->duration = avio_rb32(pb);
} else if (len == 4 && type == 3) {
value = avio_rb32(pb);
av_log(s, AV_LOG_DEBUG, "%s = %d\n", key, value);
} else {
av_log(s, AV_LOG_DEBUG, "Skipping unsupported key: %s\n", key);
avio_skip(pb, len);
}
}
}
if (avio_r8(pb) != 6)
return AVERROR_INVALIDDATA;
avio_skip(pb, 12);
avio_skip(pb, avio_rb64(pb) + pos - avio_tell(s->pb));
if (avio_r8(pb) != 8)
return AVERROR_INVALIDDATA;
avio_skip(pb, 8);
return 0;
}
| 1threat
|
Given a int suppose 5, whose binary representation is 101, we need to flip the bit which will be 010, which will be 2 : <p>I am converting the given int to binary represention which is string, and then traversing the string and changing each char/bit in string and then converting back to required int.</p>
<p>Myquestion is, is there a mathematical or better way to do this?</p>
| 0debug
|
void FUNCC(ff_h264_idct_dc_add)(uint8_t *_dst, DCTELEM *block, int stride){
int i, j;
int dc = (((dctcoef*)block)[0] + 32) >> 6;
INIT_CLIP
pixel *dst = (pixel*)_dst;
stride /= sizeof(pixel);
for( j = 0; j < 4; j++ )
{
for( i = 0; i < 4; i++ )
dst[i] = CLIP( dst[i] + dc );
dst += stride;
}
}
| 1threat
|
Visual Studio Help - The "RunCommand" property is not defined : <p>I'm using Microsoft Visual Studio Community 2017. I have created a project with multiple classes to be compiled. The primary class I want the application to run first has <code>public static void Main(string[] args)</code> in it already. In the library, I've set properties to the following:</p>
<ul>
<li>Target Framework: .NET standard 2.0</li>
<li>Output type: Console Application</li>
<li>Startup object: Main.Game</li>
</ul>
<p>Still, the error persists with all the forums I have visited.
If you have encountered this problem, please guide me through so I can compile my program. Thank you :)</p>
| 0debug
|
void mips_malta_init(MachineState *machine)
{
ram_addr_t ram_size = machine->ram_size;
ram_addr_t ram_low_size;
const char *cpu_model = machine->cpu_model;
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
char *filename;
pflash_t *fl;
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *ram_high = g_new(MemoryRegion, 1);
MemoryRegion *ram_low_preio = g_new(MemoryRegion, 1);
MemoryRegion *ram_low_postio;
MemoryRegion *bios, *bios_copy = g_new(MemoryRegion, 1);
target_long bios_size = FLASH_SIZE;
const size_t smbus_eeprom_size = 8 * 256;
uint8_t *smbus_eeprom_buf = g_malloc0(smbus_eeprom_size);
int64_t kernel_entry, bootloader_run_addr;
PCIBus *pci_bus;
ISABus *isa_bus;
MIPSCPU *cpu;
CPUMIPSState *env;
qemu_irq *isa_irq;
int piix4_devfn;
I2CBus *smbus;
int i;
DriveInfo *dinfo;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
DriveInfo *fd[MAX_FD];
int fl_idx = 0;
int fl_sectors = bios_size >> 16;
int be;
DeviceState *dev = qdev_create(NULL, TYPE_MIPS_MALTA);
MaltaState *s = MIPS_MALTA(dev);
empty_slot_init(0, 0x20000000);
qdev_init_nofail(dev);
for(i = 0; i < 3; i++) {
if (!serial_hds[i]) {
char label[32];
snprintf(label, sizeof(label), "serial%d", i);
serial_hds[i] = qemu_chr_new(label, "null", NULL);
}
}
if (cpu_model == NULL) {
#ifdef TARGET_MIPS64
cpu_model = "20Kc";
#else
cpu_model = "24Kf";
#endif
}
for (i = 0; i < smp_cpus; i++) {
cpu = cpu_mips_init(cpu_model);
if (cpu == NULL) {
fprintf(stderr, "Unable to find CPU definition\n");
exit(1);
}
env = &cpu->env;
cpu_mips_irq_init_cpu(env);
cpu_mips_clock_init(env);
qemu_register_reset(main_cpu_reset, cpu);
}
cpu = MIPS_CPU(first_cpu);
env = &cpu->env;
if (ram_size > (2048u << 20)) {
fprintf(stderr,
"qemu: Too much memory for this machine: %d MB, maximum 2048 MB\n",
((unsigned int)ram_size / (1 << 20)));
exit(1);
}
memory_region_allocate_system_memory(ram_high, NULL, "mips_malta.ram",
ram_size);
memory_region_add_subregion(system_memory, 0x80000000, ram_high);
memory_region_init_alias(ram_low_preio, NULL, "mips_malta_low_preio.ram",
ram_high, 0, MIN(ram_size, (256 << 20)));
memory_region_add_subregion(system_memory, 0, ram_low_preio);
if (ram_size > (512 << 20)) {
ram_low_postio = g_new(MemoryRegion, 1);
memory_region_init_alias(ram_low_postio, NULL,
"mips_malta_low_postio.ram",
ram_high, 512 << 20,
ram_size - (512 << 20));
memory_region_add_subregion(system_memory, 512 << 20, ram_low_postio);
}
generate_eeprom_spd(&smbus_eeprom_buf[0 * 256], ram_size);
generate_eeprom_serial(&smbus_eeprom_buf[6 * 256]);
#ifdef TARGET_WORDS_BIGENDIAN
be = 1;
#else
be = 0;
#endif
malta_fpga_init(system_memory, FPGA_ADDRESS, env->irq[4], serial_hds[2]);
dinfo = drive_get(IF_PFLASH, 0, fl_idx);
#ifdef DEBUG_BOARD_INIT
if (dinfo) {
printf("Register parallel flash %d size " TARGET_FMT_lx " at "
"addr %08llx '%s' %x\n",
fl_idx, bios_size, FLASH_ADDRESS,
blk_name(dinfo->bdrv), fl_sectors);
}
#endif
fl = pflash_cfi01_register(FLASH_ADDRESS, NULL, "mips_malta.bios",
BIOS_SIZE,
dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
65536, fl_sectors,
4, 0x0000, 0x0000, 0x0000, 0x0000, be);
bios = pflash_cfi01_get_memory(fl);
fl_idx++;
if (kernel_filename) {
ram_low_size = MIN(ram_size, 256 << 20);
if (kvm_enabled()) {
ram_low_size -= 0x100000;
bootloader_run_addr = 0x40000000 + ram_low_size;
} else {
bootloader_run_addr = 0xbfc00000;
}
loaderparams.ram_size = ram_size;
loaderparams.ram_low_size = ram_low_size;
loaderparams.kernel_filename = kernel_filename;
loaderparams.kernel_cmdline = kernel_cmdline;
loaderparams.initrd_filename = initrd_filename;
kernel_entry = load_kernel();
write_bootloader(memory_region_get_ram_ptr(bios),
bootloader_run_addr, kernel_entry);
if (kvm_enabled()) {
write_bootloader(memory_region_get_ram_ptr(ram_low_preio) +
ram_low_size,
bootloader_run_addr, kernel_entry);
}
} else {
if (kvm_enabled()) {
error_report("KVM enabled but no -kernel argument was specified. "
"Booting from flash is not supported with KVM.");
exit(1);
}
if (!dinfo) {
if (bios_name == NULL) {
bios_name = BIOS_FILENAME;
}
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (filename) {
bios_size = load_image_targphys(filename, FLASH_ADDRESS,
BIOS_SIZE);
g_free(filename);
} else {
bios_size = -1;
}
if ((bios_size < 0 || bios_size > BIOS_SIZE) &&
!kernel_filename && !qtest_enabled()) {
error_report("Could not load MIPS bios '%s', and no "
"-kernel argument was specified", bios_name);
exit(1);
}
}
#ifndef TARGET_WORDS_BIGENDIAN
{
uint32_t *end, *addr = rom_ptr(FLASH_ADDRESS);
if (!addr) {
addr = memory_region_get_ram_ptr(bios);
}
end = (void *)addr + MIN(bios_size, 0x3e0000);
while (addr < end) {
bswap32s(addr);
addr++;
}
}
#endif
}
memory_region_init_ram(bios_copy, NULL, "bios.1fc", BIOS_SIZE,
&error_fatal);
if (!rom_copy(memory_region_get_ram_ptr(bios_copy),
FLASH_ADDRESS, BIOS_SIZE)) {
memcpy(memory_region_get_ram_ptr(bios_copy),
memory_region_get_ram_ptr(bios), BIOS_SIZE);
}
memory_region_set_readonly(bios_copy, true);
memory_region_add_subregion(system_memory, RESET_ADDRESS, bios_copy);
stl_p(memory_region_get_ram_ptr(bios_copy) + 0x10, 0x00000420);
cpu_mips_irq_init_cpu(env);
cpu_mips_clock_init(env);
isa_irq = qemu_irq_proxy(&s->i8259, 16);
pci_bus = gt64120_register(isa_irq);
ide_drive_get(hd, ARRAY_SIZE(hd));
piix4_devfn = piix4_init(pci_bus, &isa_bus, 80);
s->i8259 = i8259_init(isa_bus, env->irq[2]);
isa_bus_irqs(isa_bus, s->i8259);
pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1);
pci_create_simple(pci_bus, piix4_devfn + 2, "piix4-usb-uhci");
smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100,
isa_get_irq(NULL, 9), NULL, 0, NULL);
smbus_eeprom_init(smbus, 8, smbus_eeprom_buf, smbus_eeprom_size);
g_free(smbus_eeprom_buf);
pit = pit_init(isa_bus, 0x40, 0, NULL);
DMA_init(isa_bus, 0);
isa_create_simple(isa_bus, "i8042");
rtc_init(isa_bus, 2000, NULL);
serial_hds_isa_init(isa_bus, 2);
parallel_hds_isa_init(isa_bus, 1);
for(i = 0; i < MAX_FD; i++) {
fd[i] = drive_get(IF_FLOPPY, 0, i);
}
fdctrl_init_isa(isa_bus, fd);
network_init(pci_bus);
pci_vga_init(pci_bus);
}
| 1threat
|
How to make a custom Django api : <p>I made a simple Django website which supports user authentication(login/Logoff) and Registration I want to make a custom API which does this using REST how would i do this </p>
| 0debug
|
static void test_bh_delete_from_cb(void)
{
BHTestData data1 = { .n = 0, .max = 1 };
data1.bh = aio_bh_new(ctx, bh_delete_cb, &data1);
qemu_bh_schedule(data1.bh);
g_assert_cmpint(data1.n, ==, 0);
wait_for_aio();
g_assert_cmpint(data1.n, ==, data1.max);
g_assert(data1.bh == NULL);
g_assert(!aio_poll(ctx, false));
}
| 1threat
|
what's wrong with deleteAll method for single linked list? I want to delete all nodes in the list. Can't figure out what's wrong with this :
public void deleteAll() {
if(head==null) {
System.out.println("list already empty");
}
else {
Node temp=head; Node del;
while(temp.next!=null) {
del=temp.next;
temp=null;
temp=del;
}
System.out.println("all nodes deleted");
}
}
this is the method to delete all nodes in linked list without taking parameters.
| 0debug
|
static int spapr_phb_init(SysBusDevice *s)
{
sPAPRPHBState *sphb = SPAPR_PCI_HOST_BRIDGE(s);
PCIHostState *phb = PCI_HOST_BRIDGE(s);
char *namebuf;
int i;
PCIBus *bus;
sphb->dtbusname = g_strdup_printf("pci@%" PRIx64, sphb->buid);
namebuf = alloca(strlen(sphb->dtbusname) + 32);
sprintf(namebuf, "%s.mmio", sphb->dtbusname);
memory_region_init(&sphb->memspace, namebuf, INT64_MAX);
sprintf(namebuf, "%s.mmio-alias", sphb->dtbusname);
memory_region_init_alias(&sphb->memwindow, namebuf, &sphb->memspace,
SPAPR_PCI_MEM_WIN_BUS_OFFSET, sphb->mem_win_size);
memory_region_add_subregion(get_system_memory(), sphb->mem_win_addr,
&sphb->memwindow);
sprintf(namebuf, "%s.io", sphb->dtbusname);
memory_region_init(&sphb->iospace, namebuf, SPAPR_PCI_IO_WIN_SIZE);
memory_region_add_subregion(get_system_io(), 0, &sphb->iospace);
sprintf(namebuf, "%s.io-alias", sphb->dtbusname);
memory_region_init_io(&sphb->iowindow, &spapr_io_ops, sphb,
namebuf, SPAPR_PCI_IO_WIN_SIZE);
memory_region_add_subregion(get_system_memory(), sphb->io_win_addr,
&sphb->iowindow);
if (msi_supported) {
sprintf(namebuf, "%s.msi", sphb->dtbusname);
memory_region_init_io(&sphb->msiwindow, &spapr_msi_ops, sphb,
namebuf, SPAPR_MSIX_MAX_DEVS * 0x10000);
memory_region_add_subregion(get_system_memory(), sphb->msi_win_addr,
&sphb->msiwindow);
}
bus = pci_register_bus(DEVICE(s),
sphb->busname ? sphb->busname : sphb->dtbusname,
pci_spapr_set_irq, pci_spapr_map_irq, sphb,
&sphb->memspace, &sphb->iospace,
PCI_DEVFN(0, 0), PCI_NUM_PINS);
phb->bus = bus;
sphb->dma_liobn = SPAPR_PCI_BASE_LIOBN | (pci_find_domain(bus) << 16);
sphb->dma_window_start = 0;
sphb->dma_window_size = 0x40000000;
sphb->dma = spapr_tce_new_dma_context(sphb->dma_liobn, sphb->dma_window_size);
pci_setup_iommu(bus, spapr_pci_dma_context_fn, sphb);
QLIST_INSERT_HEAD(&spapr->phbs, sphb, list);
for (i = 0; i < PCI_NUM_PINS; i++) {
uint32_t irq;
irq = spapr_allocate_lsi(0);
if (!irq) {
return -1;
}
sphb->lsi_table[i].irq = irq;
}
return 0;
}
| 1threat
|
Whats the purpose of "this" wen create object in memory? - android : someone can hellp me with this?
i didnt undrerstand two things.
one, is that thing:
RelativeLayout.LayoutParams center_ob_l = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
what is the meaning of WARP.CONTENT and why shoukd i do this?
second thing, is the "this":
Button log_b = new Button(this);
why should i send "this" in those brackets?
and why at all i would want to create by myself the buttons and things instead of just go to the visual device and throw the things i want to the screen?
| 0debug
|
Is it possible to run React project without npm start? : <p>I'm in a big trouble. Working in a part time in a company they're looking for a <b>new web technology to build "web-component"</b> in their website. </p>
<p>They have started to use AngularJS (first version) and I told them that, with the recent evolution of this framework, it's not the right period of time to deal with it.</p>
<p>That's why I began to be interested in <b>ReactJS</b>. However, they don't have a node.js server infrastructure (and that's why AngularJS suits to them, only one browser is sufficient) so <b>it's impossible to run it with something like "npm start"</b>.</p>
<p>SO ! My question is (as my post's title says...) :</p>
<p><b>Is it possible to run ReactJS without server side ?</b></p>
<p>I've tried with the following line in my header</p>
<p><code><script src="https://unpkg.com/react@15/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@15/dist/react-dom.js"></script></code></p>
<p>But it remains a blank page. </p>
<p>Maybe there is something I don't understant in the react structure and that's why I'm looking for some help/explanations from you. </p>
<p>I hope I have been clear enough ! Thank you in advance for answer.</p>
| 0debug
|
static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
int completion)
{
int dir;
size_t len = 0;
#ifdef DEBUG_ISOCH
const char *str = NULL;
#endif
int pid;
int ret;
int i;
USBDevice *dev;
struct ohci_iso_td iso_td;
uint32_t addr;
uint16_t starting_frame;
int16_t relative_frame_number;
int frame_count;
uint32_t start_offset, next_offset, end_offset = 0;
uint32_t start_addr, end_addr;
addr = ed->head & OHCI_DPTR_MASK;
if (!ohci_read_iso_td(ohci, addr, &iso_td)) {
printf("usb-ohci: ISO_TD read error at %x\n", addr);
return 0;
}
starting_frame = OHCI_BM(iso_td.flags, TD_SF);
frame_count = OHCI_BM(iso_td.flags, TD_FC);
relative_frame_number = USUB(ohci->frame_number, starting_frame);
#ifdef DEBUG_ISOCH
printf("--- ISO_TD ED head 0x%.8x tailp 0x%.8x\n"
"0x%.8x 0x%.8x 0x%.8x 0x%.8x\n"
"0x%.8x 0x%.8x 0x%.8x 0x%.8x\n"
"0x%.8x 0x%.8x 0x%.8x 0x%.8x\n"
"frame_number 0x%.8x starting_frame 0x%.8x\n"
"frame_count 0x%.8x relative %d\n"
"di 0x%.8x cc 0x%.8x\n",
ed->head & OHCI_DPTR_MASK, ed->tail & OHCI_DPTR_MASK,
iso_td.flags, iso_td.bp, iso_td.next, iso_td.be,
iso_td.offset[0], iso_td.offset[1], iso_td.offset[2], iso_td.offset[3],
iso_td.offset[4], iso_td.offset[5], iso_td.offset[6], iso_td.offset[7],
ohci->frame_number, starting_frame,
frame_count, relative_frame_number,
OHCI_BM(iso_td.flags, TD_DI), OHCI_BM(iso_td.flags, TD_CC));
#endif
if (relative_frame_number < 0) {
DPRINTF("usb-ohci: ISO_TD R=%d < 0\n", relative_frame_number);
return 1;
} else if (relative_frame_number > frame_count) {
DPRINTF("usb-ohci: ISO_TD R=%d > FC=%d\n", relative_frame_number,
frame_count);
OHCI_SET_BM(iso_td.flags, TD_CC, OHCI_CC_DATAOVERRUN);
ed->head &= ~OHCI_DPTR_MASK;
ed->head |= (iso_td.next & OHCI_DPTR_MASK);
iso_td.next = ohci->done;
ohci->done = addr;
i = OHCI_BM(iso_td.flags, TD_DI);
if (i < ohci->done_count)
ohci->done_count = i;
ohci_put_iso_td(ohci, addr, &iso_td);
return 0;
}
dir = OHCI_BM(ed->flags, ED_D);
switch (dir) {
case OHCI_TD_DIR_IN:
#ifdef DEBUG_ISOCH
str = "in";
#endif
pid = USB_TOKEN_IN;
break;
case OHCI_TD_DIR_OUT:
#ifdef DEBUG_ISOCH
str = "out";
#endif
pid = USB_TOKEN_OUT;
break;
case OHCI_TD_DIR_SETUP:
#ifdef DEBUG_ISOCH
str = "setup";
#endif
pid = USB_TOKEN_SETUP;
break;
default:
printf("usb-ohci: Bad direction %d\n", dir);
return 1;
}
if (!iso_td.bp || !iso_td.be) {
printf("usb-ohci: ISO_TD bp 0x%.8x be 0x%.8x\n", iso_td.bp, iso_td.be);
return 1;
}
start_offset = iso_td.offset[relative_frame_number];
next_offset = iso_td.offset[relative_frame_number + 1];
if (!(OHCI_BM(start_offset, TD_PSW_CC) & 0xe) ||
((relative_frame_number < frame_count) &&
!(OHCI_BM(next_offset, TD_PSW_CC) & 0xe))) {
printf("usb-ohci: ISO_TD cc != not accessed 0x%.8x 0x%.8x\n",
start_offset, next_offset);
return 1;
}
if ((relative_frame_number < frame_count) && (start_offset > next_offset)) {
printf("usb-ohci: ISO_TD start_offset=0x%.8x > next_offset=0x%.8x\n",
start_offset, next_offset);
return 1;
}
if ((start_offset & 0x1000) == 0) {
start_addr = (iso_td.bp & OHCI_PAGE_MASK) |
(start_offset & OHCI_OFFSET_MASK);
} else {
start_addr = (iso_td.be & OHCI_PAGE_MASK) |
(start_offset & OHCI_OFFSET_MASK);
}
if (relative_frame_number < frame_count) {
end_offset = next_offset - 1;
if ((end_offset & 0x1000) == 0) {
end_addr = (iso_td.bp & OHCI_PAGE_MASK) |
(end_offset & OHCI_OFFSET_MASK);
} else {
end_addr = (iso_td.be & OHCI_PAGE_MASK) |
(end_offset & OHCI_OFFSET_MASK);
}
} else {
end_addr = iso_td.be;
}
if ((start_addr & OHCI_PAGE_MASK) != (end_addr & OHCI_PAGE_MASK)) {
len = (end_addr & OHCI_OFFSET_MASK) + 0x1001
- (start_addr & OHCI_OFFSET_MASK);
} else {
len = end_addr - start_addr + 1;
}
if (len && dir != OHCI_TD_DIR_IN) {
ohci_copy_iso_td(ohci, start_addr, end_addr, ohci->usb_buf, len, 0);
}
if (completion) {
ret = ohci->usb_packet.len;
} else {
ret = USB_RET_NODEV;
for (i = 0; i < ohci->num_ports; i++) {
dev = ohci->rhport[i].port.dev;
if ((ohci->rhport[i].ctrl & OHCI_PORT_PES) == 0)
continue;
ohci->usb_packet.pid = pid;
ohci->usb_packet.devaddr = OHCI_BM(ed->flags, ED_FA);
ohci->usb_packet.devep = OHCI_BM(ed->flags, ED_EN);
ohci->usb_packet.data = ohci->usb_buf;
ohci->usb_packet.len = len;
ret = usb_handle_packet(dev, &ohci->usb_packet);
if (ret != USB_RET_NODEV)
break;
}
if (ret == USB_RET_ASYNC) {
return 1;
}
}
#ifdef DEBUG_ISOCH
printf("so 0x%.8x eo 0x%.8x\nsa 0x%.8x ea 0x%.8x\ndir %s len %zu ret %d\n",
start_offset, end_offset, start_addr, end_addr, str, len, ret);
#endif
if (dir == OHCI_TD_DIR_IN && ret >= 0 && ret <= len) {
ohci_copy_iso_td(ohci, start_addr, end_addr, ohci->usb_buf, ret, 1);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC,
OHCI_CC_NOERROR);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE, ret);
} else if (dir == OHCI_TD_DIR_OUT && ret == len) {
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC,
OHCI_CC_NOERROR);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE, 0);
} else {
if (ret > (ssize_t) len) {
printf("usb-ohci: DataOverrun %d > %zu\n", ret, len);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC,
OHCI_CC_DATAOVERRUN);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE,
len);
} else if (ret >= 0) {
printf("usb-ohci: DataUnderrun %d\n", ret);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC,
OHCI_CC_DATAUNDERRUN);
} else {
switch (ret) {
case USB_RET_NODEV:
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC,
OHCI_CC_DEVICENOTRESPONDING);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE,
0);
break;
case USB_RET_NAK:
case USB_RET_STALL:
printf("usb-ohci: got NAK/STALL %d\n", ret);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC,
OHCI_CC_STALL);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_SIZE,
0);
break;
default:
printf("usb-ohci: Bad device response %d\n", ret);
OHCI_SET_BM(iso_td.offset[relative_frame_number], TD_PSW_CC,
OHCI_CC_UNDEXPETEDPID);
break;
}
}
}
if (relative_frame_number == frame_count) {
OHCI_SET_BM(iso_td.flags, TD_CC, OHCI_CC_NOERROR);
ed->head &= ~OHCI_DPTR_MASK;
ed->head |= (iso_td.next & OHCI_DPTR_MASK);
iso_td.next = ohci->done;
ohci->done = addr;
i = OHCI_BM(iso_td.flags, TD_DI);
if (i < ohci->done_count)
ohci->done_count = i;
}
ohci_put_iso_td(ohci, addr, &iso_td);
return 1;
}
| 1threat
|
Xcode 11 XCUITest Failed to get matching snapshots: Error getting main window kAXErrorServerNotFound : <p>After building my app in Xcode 11 and running my suite of XCUITests I am getting many random failures with the following. </p>
<p>Failed to get matching snapshots: Error getting main window kAXErrorServerNotFound</p>
<p>No matter how long I increase timeouts the issues pop up intermittently. It seems to be having issues Snapshotting the UI hierarchy. Our tests pass consistently in Xcode 10.</p>
<p>I have reinstalled Xcode. Deleted all simulators. Cleared derived data. Modified timeouts. Upgraded from Xcode 11.1 to Xcode 11.2.1. </p>
<p>Thanks!</p>
<p> </p>
| 0debug
|
static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, int16_t bS[4], int bsi, int qp ) {
int i;
int index_a = qp + h->slice_alpha_c0_offset;
int alpha = (alpha_table+52)[index_a];
int beta = (beta_table+52)[qp + h->slice_beta_offset];
for( i = 0; i < 8; i++, pix += stride) {
const int bS_index = (i >> 1) * bsi;
if( bS[bS_index] == 0 ) {
continue;
}
if( bS[bS_index] < 4 ) {
const int tc0 = (tc0_table+52)[index_a][bS[bS_index]];
const int p0 = pix[-1];
const int p1 = pix[-2];
const int p2 = pix[-3];
const int q0 = pix[0];
const int q1 = pix[1];
const int q2 = pix[2];
if( FFABS( p0 - q0 ) < alpha &&
FFABS( p1 - p0 ) < beta &&
FFABS( q1 - q0 ) < beta ) {
int tc = tc0;
int i_delta;
if( FFABS( p2 - p0 ) < beta ) {
if(tc0)
pix[-2] = p1 + av_clip( ( p2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( p1 << 1 ) ) >> 1, -tc0, tc0 );
tc++;
}
if( FFABS( q2 - q0 ) < beta ) {
if(tc0)
pix[1] = q1 + av_clip( ( q2 + ( ( p0 + q0 + 1 ) >> 1 ) - ( q1 << 1 ) ) >> 1, -tc0, tc0 );
tc++;
}
i_delta = av_clip( (((q0 - p0 ) << 2) + (p1 - q1) + 4) >> 3, -tc, tc );
pix[-1] = av_clip_uint8( p0 + i_delta );
pix[0] = av_clip_uint8( q0 - i_delta );
tprintf(h->s.avctx, "filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d, tc:%d\n# bS:%d -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, tc, bS[bS_index], pix[-3], p1, p0, q0, q1, pix[2], p1, pix[-1], pix[0], q1);
}
}else{
const int p0 = pix[-1];
const int p1 = pix[-2];
const int p2 = pix[-3];
const int q0 = pix[0];
const int q1 = pix[1];
const int q2 = pix[2];
if( FFABS( p0 - q0 ) < alpha &&
FFABS( p1 - p0 ) < beta &&
FFABS( q1 - q0 ) < beta ) {
if(FFABS( p0 - q0 ) < (( alpha >> 2 ) + 2 )){
if( FFABS( p2 - p0 ) < beta)
{
const int p3 = pix[-4];
pix[-1] = ( p2 + 2*p1 + 2*p0 + 2*q0 + q1 + 4 ) >> 3;
pix[-2] = ( p2 + p1 + p0 + q0 + 2 ) >> 2;
pix[-3] = ( 2*p3 + 3*p2 + p1 + p0 + q0 + 4 ) >> 3;
} else {
pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
}
if( FFABS( q2 - q0 ) < beta)
{
const int q3 = pix[3];
pix[0] = ( p1 + 2*p0 + 2*q0 + 2*q1 + q2 + 4 ) >> 3;
pix[1] = ( p0 + q0 + q1 + q2 + 2 ) >> 2;
pix[2] = ( 2*q3 + 3*q2 + q1 + q0 + p0 + 4 ) >> 3;
} else {
pix[0] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
}
}else{
pix[-1] = ( 2*p1 + p0 + q1 + 2 ) >> 2;
pix[ 0] = ( 2*q1 + q0 + p1 + 2 ) >> 2;
}
tprintf(h->s.avctx, "filter_mb_mbaff_edgev i:%d, qp:%d, indexA:%d, alpha:%d, beta:%d\n# bS:4 -> [%02x, %02x, %02x, %02x, %02x, %02x] =>[%02x, %02x, %02x, %02x, %02x, %02x]\n", i, qp[qp_index], index_a, alpha, beta, p2, p1, p0, q0, q1, q2, pix[-3], pix[-2], pix[-1], pix[0], pix[1], pix[2]);
}
}
}
}
| 1threat
|
Replace spaces within a substring : Thanks in advance.
I want to replace the spaces in a particular string with some other char like '_' or '~' or maybe just remove the spaces but only for the substring between certain charecters like '<>' or '" "'. eg.
config snmp trapreceiver create <community name> <trap receiver IP>
should become :
config snmp trapreceiver create <community_name> <trap_receiver_IP>
Any help will be appreciated.
| 0debug
|
HTML/JAVASCRIPT Animation like on storj.io : <p>I found this site <a href="https://storj.io/" rel="nofollow">Storj.io</a>. I really like the design of the site and was looking at the header. There is a background-image and then on top of this there are those points that are moving. How can such a animation be achieved? Is this done with html5 and how or is JavaScript used?</p>
| 0debug
|
Copy docker image from one AWS ECR repo to another : <p>We want to copy a docker image from non-prod to prod ECR account. Is it possible without pulling, retaging and pushing it again.</p>
| 0debug
|
void ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
{
if (av_strstart(p, "pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {
ByteIOContext pb;
RTSPState *rt = s->priv_data;
int len = strlen(p) * 6 / 8;
char *buf = av_mallocz(len);
av_base64_decode(buf, p, len);
if (rtp_asf_fix_header(buf, len) < 0)
av_log(s, AV_LOG_ERROR,
"Failed to fix invalid RTSP-MS/ASF min_pktsize\n");
init_packetizer(&pb, buf, len);
if (rt->asf_ctx) {
av_close_input_stream(rt->asf_ctx);
rt->asf_ctx = NULL;
}
av_open_input_stream(&rt->asf_ctx, &pb, "", &asf_demuxer, NULL);
rt->asf_pb_pos = url_ftell(&pb);
av_free(buf);
rt->asf_ctx->pb = NULL;
}
}
| 1threat
|
static int bmp_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
BMPContext *s = avctx->priv_data;
AVFrame *picture = data;
AVFrame *p = &s->picture;
unsigned int fsize, hsize;
int width, height;
unsigned int depth;
BiCompression comp;
unsigned int ihsize;
int i, j, n, linesize;
uint32_t rgb[3];
uint8_t *ptr;
int dsize;
uint8_t *buf0 = buf;
if(buf_size < 14){
av_log(avctx, AV_LOG_ERROR, "buf size too small (%d)\n", buf_size);
return -1;
}
if(bytestream_get_byte(&buf) != 'B' ||
bytestream_get_byte(&buf) != 'M') {
av_log(avctx, AV_LOG_ERROR, "bad magic number\n");
return -1;
}
fsize = bytestream_get_le32(&buf);
if(buf_size < fsize){
av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n",
buf_size, fsize);
return -1;
}
buf += 2;
buf += 2;
hsize = bytestream_get_le32(&buf);
if(fsize <= hsize){
av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n",
fsize, hsize);
return -1;
}
ihsize = bytestream_get_le32(&buf);
if(ihsize + 14 > hsize){
av_log(avctx, AV_LOG_ERROR, "invalid header size %d\n", hsize);
return -1;
}
width = bytestream_get_le32(&buf);
height = bytestream_get_le32(&buf);
if(bytestream_get_le16(&buf) != 1){
av_log(avctx, AV_LOG_ERROR, "invalid BMP header\n");
return -1;
}
depth = bytestream_get_le16(&buf);
if(ihsize > 16)
comp = bytestream_get_le32(&buf);
else
comp = BMP_RGB;
if(comp != BMP_RGB && comp != BMP_BITFIELDS){
av_log(avctx, AV_LOG_ERROR, "BMP coding %d not supported\n", comp);
return -1;
}
if(comp == BMP_BITFIELDS){
buf += 20;
rgb[0] = bytestream_get_le32(&buf);
rgb[1] = bytestream_get_le32(&buf);
rgb[2] = bytestream_get_le32(&buf);
}
avctx->codec_id = CODEC_ID_BMP;
avctx->width = width;
avctx->height = height > 0? height: -height;
avctx->pix_fmt = PIX_FMT_NONE;
switch(depth){
case 32:
if(comp == BMP_BITFIELDS){
rgb[0] = (rgb[0] >> 15) & 3;
rgb[1] = (rgb[1] >> 15) & 3;
rgb[2] = (rgb[2] >> 15) & 3;
if(rgb[0] + rgb[1] + rgb[2] != 3 ||
rgb[0] == rgb[1] || rgb[0] == rgb[2] || rgb[1] == rgb[2]){
break;
}
} else {
rgb[0] = 2;
rgb[1] = 1;
rgb[2] = 0;
}
avctx->pix_fmt = PIX_FMT_BGR24;
break;
case 24:
avctx->pix_fmt = PIX_FMT_BGR24;
break;
case 16:
if(comp == BMP_RGB)
avctx->pix_fmt = PIX_FMT_RGB555;
break;
default:
av_log(avctx, AV_LOG_ERROR, "depth %d not supported\n", depth);
return -1;
}
if(avctx->pix_fmt == PIX_FMT_NONE){
av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n");
return -1;
}
if(p->data[0])
avctx->release_buffer(avctx, p);
p->reference = 0;
if(avctx->get_buffer(avctx, p) < 0){
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
p->pict_type = FF_I_TYPE;
p->key_frame = 1;
buf = buf0 + hsize;
dsize = buf_size - hsize;
n = (avctx->width * (depth / 8) + 3) & ~3;
if(n * avctx->height > dsize){
av_log(avctx, AV_LOG_ERROR, "not enough data (%d < %d)\n",
dsize, n * avctx->height);
return -1;
}
if(height > 0){
ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
linesize = -p->linesize[0];
} else {
ptr = p->data[0];
linesize = p->linesize[0];
}
switch(depth){
case 24:
for(i = 0; i < avctx->height; i++){
memcpy(ptr, buf, n);
buf += n;
ptr += linesize;
}
break;
case 16:
for(i = 0; i < avctx->height; i++){
uint16_t *src = (uint16_t *) buf;
uint16_t *dst = (uint16_t *) ptr;
for(j = 0; j < avctx->width; j++)
*dst++ = le2me_16(*src++);
buf += n;
ptr += linesize;
}
break;
case 32:
for(i = 0; i < avctx->height; i++){
uint8_t *src = buf;
uint8_t *dst = ptr;
for(j = 0; j < avctx->width; j++){
dst[0] = src[rgb[2]];
dst[1] = src[rgb[1]];
dst[2] = src[rgb[0]];
dst += 3;
src += 4;
}
buf += n;
ptr += linesize;
}
break;
default:
av_log(avctx, AV_LOG_ERROR, "BMP decoder is broken\n");
return -1;
}
*picture = s->picture;
*data_size = sizeof(AVPicture);
return buf_size;
}
| 1threat
|
Store Array Javascript to PHP with session : <p>I want to store array from index.html to file.php with $_SESSION but I'm getting stuck (I don't know how to store and access it, since im new in php).</p>
<p>Here my codes in <strong>index.html</strong>:</p>
<pre><code><?php
session_start();
$_SESSION["myArray"] = $array;
?>
$(function generateArray (parameter) {
var array = ["hello","world"];
});
</code></pre>
<p>Here my codes in file.php:</p>
<pre><code><?php
session_start();
//print_r($_SESSION["myArray"]) --> how can I do that?
?>
</code></pre>
<p>Can somebody help me? :')</p>
| 0debug
|
static inline void downmix_3f_2r_to_dolby(float *samples)
{
int i;
for (i = 0; i < 256; i++) {
samples[i] += (samples[i + 256] - samples[i + 768]);
samples[i + 256] = (samples[i + 512] + samples[i + 1024]);
samples[i + 512] = samples[i + 768] = samples[i + 1024] = 0;
}
}
| 1threat
|
static inline void asv2_encode_block(ASV1Context *a, int16_t block[64])
{
int i;
int count = 0;
for (count = 63; count > 3; count--) {
const int index = ff_asv_scantab[count];
if ((block[index] * a->q_intra_matrix[index] + (1 << 15)) >> 16)
break;
}
count >>= 2;
asv2_put_bits(&a->pb, 4, count);
asv2_put_bits(&a->pb, 8, (block[0] + 32) >> 6);
block[0] = 0;
for (i = 0; i <= count; i++) {
const int index = ff_asv_scantab[4 * i];
int ccp = 0;
if ((block[index + 0] = (block[index + 0] *
a->q_intra_matrix[index + 0] + (1 << 15)) >> 16))
ccp |= 8;
if ((block[index + 8] = (block[index + 8] *
a->q_intra_matrix[index + 8] + (1 << 15)) >> 16))
ccp |= 4;
if ((block[index + 1] = (block[index + 1] *
a->q_intra_matrix[index + 1] + (1 << 15)) >> 16))
ccp |= 2;
if ((block[index + 9] = (block[index + 9] *
a->q_intra_matrix[index + 9] + (1 << 15)) >> 16))
ccp |= 1;
av_assert2(i || ccp < 8);
if (i)
put_bits(&a->pb, ff_asv_ac_ccp_tab[ccp][1], ff_asv_ac_ccp_tab[ccp][0]);
else
put_bits(&a->pb, ff_asv_dc_ccp_tab[ccp][1], ff_asv_dc_ccp_tab[ccp][0]);
if (ccp) {
if (ccp & 8)
asv2_put_level(&a->pb, block[index + 0]);
if (ccp & 4)
asv2_put_level(&a->pb, block[index + 8]);
if (ccp & 2)
asv2_put_level(&a->pb, block[index + 1]);
if (ccp & 1)
asv2_put_level(&a->pb, block[index + 9]);
}
}
}
| 1threat
|
why does this onclicklistener not work in android studio? : i created this click listener in a android project, it is taken from a tutorial.It worked there but does not seem to work when I tried it in my new app.
ImageView animals = (ImageView) findViewById(R.id.anim);
animals.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent animalsIntent = new Intent(MainActivity.this, animals.class);
// Start the new activity
startActivity(animalsIntent);
}
});
the app crashes when i do this
| 0debug
|
Socket.io acknowledgement in Nest.js : <p>I'm trying to enable usage of socket.io acknowledgement callbacks in Nest.js WebSocketGateways.</p>
<p>I'd like to be able to emit this:</p>
<pre><code>socket.emit('event', 'some data', function (response) { //do something });
</code></pre>
<p>And use the message handler like this:</p>
<pre><code>@SubscribeMessage('event')
onStart(client, data, ack) {
//Do stuff
ack('stuff completed');
}
</code></pre>
<p>According to <a href="https://github.com/nestjs/nest/issues/249" rel="noreferrer">this</a> issue there is no support for it in the library so you'd have to build your own websocket adapter. I tried it but am not sure how to do it exactly. I guess I need to do something special in the <code>bindMessageHandlers</code> function but my attempts have been in vain.
This is the <code>bindMessageHandlers</code> implementation in the default socket.io adapter bundled in the framework:</p>
<pre><code>public bindMessageHandlers(
client,
handlers: MessageMappingProperties[],
process: (data: any) => Observable<any>,
) {
handlers.forEach(({ message, callback }) =>
Observable.fromEvent(client, message)
.switchMap(data => process(callback(data)))
.filter(result => !!result && result.event)
.subscribe(({ event, data }) => client.emit(event, data)),
);
}
</code></pre>
<p>Does anyone have any pointers on how I would go about implementing this?<br>
Thanks in advance!</p>
| 0debug
|
int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4],
enum AVPixelFormat pix_fmt, uint8_t rgba_color[4],
int *is_packed_rgba, uint8_t rgba_map_ptr[4])
{
uint8_t rgba_map[4] = {0};
int i;
const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(pix_fmt);
int hsub = pix_desc->log2_chroma_w;
*is_packed_rgba = ff_fill_rgba_map(rgba_map, pix_fmt) >= 0;
if (*is_packed_rgba) {
pixel_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
for (i = 0; i < 4; i++)
dst_color[rgba_map[i]] = rgba_color[i];
line[0] = av_malloc_array(w, pixel_step[0]);
for (i = 0; i < w; i++)
memcpy(line[0] + i * pixel_step[0], dst_color, pixel_step[0]);
if (rgba_map_ptr)
memcpy(rgba_map_ptr, rgba_map, sizeof(rgba_map[0]) * 4);
} else {
int plane;
dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
dst_color[3] = rgba_color[3];
for (plane = 0; plane < 4; plane++) {
int line_size;
int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
pixel_step[plane] = 1;
line_size = FF_CEIL_RSHIFT(w, hsub1) * pixel_step[plane];
line[plane] = av_malloc(line_size);
if (!line[plane]) {
while(plane && line[plane-1])
av_freep(&line[--plane]);
}
memset(line[plane], dst_color[plane], line_size);
}
}
return 0;
}
| 1threat
|
denied: requested access to the resource is denied : docker : <p>I am following <a href="https://docs.docker.com/engine/getstarted/step_four/" rel="noreferrer">this link</a> to create my first docker Image and it went successfully and now I am trying to push this Image into my docker repository from this <a href="https://docs.docker.com/engine/getstarted/step_six/" rel="noreferrer">link</a>. But whenever I am trying to push this Image into repository , I got this type of error. </p>
<pre><code>denied: requested access to the resource is denied
</code></pre>
<p><a href="https://i.stack.imgur.com/GCu19.png" rel="noreferrer"><img src="https://i.stack.imgur.com/GCu19.png" alt="enter image description here"></a></p>
<p>Could anyone give me some hint towards this problem ? Any help would appreciated.</p>
<p>Note: I have successfully login into docker </p>
| 0debug
|
How to auto generate E1, E2, E3, E4 in rows in Excel? : <p>I need Excel to generate the rows like below. How do I do it via a formula?</p>
<pre><code>E1
E2
E3
E4
E5
..
..
</code></pre>
| 0debug
|
static void allwinner_ahci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->vmsd = &vmstate_allwinner_ahci;
}
| 1threat
|
static const AVOption *av_set_number(void *obj, const char *name, double num, int den, int64_t intnum){
const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
void *dst;
if(!o || o->offset<=0)
return NULL;
if(o->max*den < num*intnum || o->min*den > num*intnum) {
av_log(NULL, AV_LOG_ERROR, "Value %lf for parameter '%s' out of range\n", num, name);
return NULL;
}
dst= ((uint8_t*)obj) + o->offset;
switch(o->type){
case FF_OPT_TYPE_FLAGS:
case FF_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break;
case FF_OPT_TYPE_INT64: *(int64_t *)dst= llrint(num/den)*intnum; break;
case FF_OPT_TYPE_FLOAT: *(float *)dst= num*intnum/den; break;
case FF_OPT_TYPE_DOUBLE:*(double *)dst= num*intnum/den; break;
case FF_OPT_TYPE_RATIONAL:
if((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den};
else *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24);
break;
default:
return NULL;
}
return o;
}
| 1threat
|
static uint32_t pcie_mmcfg_data_read(PCIBus *s, uint32_t addr, int len)
{
PCIDevice *pci_dev = pcie_dev_find_by_mmcfg_addr(s, addr);
if (!pci_dev) {
return ~0x0;
}
return pci_host_config_read_common(pci_dev, PCIE_MMCFG_CONFOFFSET(addr),
pci_config_size(pci_dev), len);
}
| 1threat
|
This error only getting in Android 10, work fine in other versions. If anyone knows please tell me the solution..Urget : Here is the Error:
android.database.sqlite.SQLiteException: near "GROUP": syntax error (code 1 SQLITE_ERROR): , while compiling: SELECT _id, bucket_display_name, bucket_id, _id, orientation FROM images WHERE ((is_pending=0) AND (is_trashed=0) AND (volume_name IN ( 'external_primary' ))) AND ((1) GROUP BY 1,(2)) ORDER BY date_modified DESC
| 0debug
|
Different width for each columns in jspdf autotable? : <p>My table has 13 columns. How can I get different width for each column? Can I give each column width like this? </p>
<p><strong>styles: {overflow: 'linebreak' ,columnWidth: [100,80,80,70,80,80,70,70,70,70,60,80,100]},</strong> </p>
<p>My table Syntax:</p>
<pre><code>> var res = doc.autoTableHtmlToJson(document.getElementById(tableID));
> doc.autoTable(res.columns, res.data, { styles: {overflow: 'linebreak'
> ,columnWidth: [100,80,80,70,80,80,70,70,70,70,60,80,100]}, startY:
> 60, bodyStyles: {valign: 'top'}, });
</code></pre>
| 0debug
|
static void get_seg(SegmentCache *lhs, const struct kvm_segment *rhs)
{
lhs->selector = rhs->selector;
lhs->base = rhs->base;
lhs->limit = rhs->limit;
lhs->flags = (rhs->type << DESC_TYPE_SHIFT) |
(rhs->present * DESC_P_MASK) |
(rhs->dpl << DESC_DPL_SHIFT) |
(rhs->db << DESC_B_SHIFT) |
(rhs->s * DESC_S_MASK) |
(rhs->l << DESC_L_SHIFT) |
(rhs->g * DESC_G_MASK) |
(rhs->avl * DESC_AVL_MASK);
}
| 1threat
|
Unix Shell inverts in a file pairs of neighboting digits : **How can I invert in a file all pairs of neighbouring ditis ? ex:a3972b->a9327b**
I tried to use : awk
| 0debug
|
Firestore select where is not null : <p>I'm using firebase to manage my project and I cannot get to create a query with a where clause where some value is not null. </p>
<p>Example: I have a collection of employees. Each have a list of equipments as an object where the key is the equipment id and the value a color. </p>
<pre><code>user = {
firstName: 'blabla',
lastName: 'bloblo',
equipments: {
123: 'blue',
124: 'red'
}
}
</code></pre>
<p>I would like to get all the employees who has a certain equipment in the equipments. Lets say 123. </p>
<p>It comes to Select * from Employees where equipments.123 is not null. I've tried:</p>
<pre><code>firestore.collection('employees').where(`equipments.${equipmentId}`, '!=', null)
</code></pre>
<p>but it's not working.</p>
<p>I can't seems to make it work. Can you help me.</p>
| 0debug
|
Two dimmensional array feeding : need to do an arr[n,n] which will do a result as [0,0] = 0 [0,1] = 1 [0,2] = 3 [0,3] = 6 [1,1] = 0 [1,2] = 2 [1,3] = 5 [2,2] = 0 [2,3] = 3 [3,3] = 0
It is night right now and I feel so flustrated(read sleepy) as I can't solve the problem. Trying to feed that arr with two for cycles, that's I think is good way to go. Anyway, can't figure out how to set conditions to generate it as I want it.
Any hint is welcome, trying to programme solution for optional task in school.
Pasting code which I ended, totaly mishmash. I guess when I wake up in the morning I will try to do it once again all. Thanks for any hint/advice.
I tried to feed an array with two fors, where I tried to sum values. So many errors occur when I start typing code.
```int[,] array_prava = new int[n,
for (int i = 0; i < n; i++) // array_prava
{
for (int j = 0; j < n; j++)
{
if (j == i || j == 0)
{
array_prava[i, j] = Math.Abs(j - i);
}
else if (i >= 1)
{
array_prava[i, j] = Math.Abs(j + 1 - i) + array_prava[i, j - 1];
}
else if (i > j) {
array_prava[i, j] = 0;
}else
{
array_prava[i, j] = Math.Abs(j - i) + array_prava[i, j - 1];
}
any hint is welcome
| 0debug
|
jQuery-UI - "Cannot read property 'step' of undefined" : <p>We've recently upgraded jQuery from version 2.2.4 to 3.1.1 and are now seeing some interesting errors. I installed the <code>jquery-migrate</code> plugin which helped me through a few errors, but not all. Below is the error I'm seeing in my developer console in Chrome and I can't seem to pin point where this error is occurring. </p>
<pre><code>jquery-ui-1.12.1.js:1951 Uncaught TypeError: Cannot read property 'step' of undefined
at String.<anonymous> (jquery-ui-1.12.1.js:1951)
at each (jquery-3.1.1.slim.js:368)
at Function.color.hook (jquery-ui-1.12.1.js:1913)
at jquery-ui-1.12.1.js:1963
at jquery-ui-1.12.1.js:2005
at jquery-ui-1.12.1.js:14
at jquery-ui-1.12.1.js:16
</code></pre>
<p>I've debugged in Chrome and it breaks inside of a function called <code>jQuery.fx.step[ hook ]</code>. When I hover over <code>jQuery.fx</code>, it's shown as undefined. See below</p>
<pre><code>jQuery.fx.step[ hook ] = function( fx ) {
if ( !fx.colorInit ) {
fx.start = color( fx.elem, hook );
fx.end = color( fx.end );
fx.colorInit = true;
}
</code></pre>
<p>I've uninstalled <code>jquery-ui</code>, but all that did was break Angular. Would love if someone could shed some light on the matter.</p>
<p>packages.config =</p>
<pre><code> <package id="Angular.Material" version="1.1.4" targetFramework="net462" />
<package id="Angular.UI.Bootstrap" version="2.5.0" targetFramework="net462" />
<package id="angular-file-upload" version="12.2.13" targetFramework="net462" />
<package id="AngularJS.Animate" version="1.6.5" targetFramework="net462" />
<package id="AngularJS.Aria" version="1.6.5" targetFramework="net462" />
<package id="AngularJS.Core" version="1.6.5" targetFramework="net462" />
<package id="AngularJS.Messages" version="1.6.5" targetFramework="net462" />
<package id="AngularJS.Resource" version="1.6.5" targetFramework="net462" />
<package id="AngularJS.Route" version="1.6.5" targetFramework="net462" />
<package id="AngularJS.Sanitize" version="1.6.5" targetFramework="net462" />
<package id="Antlr" version="3.5.0.2" targetFramework="net462" />
<package id="Bootbox.JS" version="4.4.0" targetFramework="net462" />
<package id="bootstrap" version="3.3.7" targetFramework="net462" />
<package id="CommonServiceLocator" version="1.3" targetFramework="net462" />
<package id="EntityFramework" version="6.1.3" targetFramework="net462" />
<package id="font-awesome" version="4.7.0" targetFramework="net462" />
<package id="HubSpot.Tether" version="1.1.1" targetFramework="net462" />
<package id="jQuery" version="3.1.1" targetFramework="net462" />
<package id="jQuery.UI.Combined" version="1.12.1" targetFramework="net462" />
<package id="lodash" version="4.17.4" targetFramework="net462" />
</code></pre>
| 0debug
|
Insert image into Google Sheets cell using Google Sheets API : <p>In google apps Script you can insert an image into Google Spreadsheets using the <code>insertImage</code> function (<a href="https://developers.google.com/apps-script/reference/spreadsheet/sheet#insertimageblob-column-row" rel="noreferrer">https://developers.google.com/apps-script/reference/spreadsheet/sheet#insertimageblob-column-row</a>).</p>
<p>But I'm not using appscript. I'm using the Google Sheets API (<a href="https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets" rel="noreferrer">https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets</a>) and I can't seem to find a way to do this. Is there any possible implementation?</p>
| 0debug
|
RGB_FUNCTIONS(rgba32)
#undef RGB_IN
#undef RGB_OUT
#undef BPP
static void rgb24_to_rgb565(AVPicture *dst, AVPicture *src,
int width, int height)
{
const unsigned char *p;
unsigned char *q;
int r, g, b, dst_wrap, src_wrap;
int x, y;
p = src->data[0];
src_wrap = src->linesize[0] - 3 * width;
q = dst->data[0];
dst_wrap = dst->linesize[0] - 2 * width;
for(y=0;y<height;y++) {
for(x=0;x<width;x++) {
r = p[0];
g = p[1];
b = p[2];
((unsigned short *)q)[0] =
((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
q += 2;
p += 3;
}
p += src_wrap;
q += dst_wrap;
}
}
| 1threat
|
static void omap_l4_io_writew(void *opaque, target_phys_addr_t addr,
uint32_t value)
{
unsigned int i = (addr - OMAP2_L4_BASE) >> TARGET_PAGE_BITS;
return omap_l4_io_writew_fn[i](omap_l4_io_opaque[i], addr, value);
}
| 1threat
|
static void sch_handle_start_func(SubchDev *sch, ORB *orb)
{
PMCW *p = &sch->curr_status.pmcw;
SCSW *s = &sch->curr_status.scsw;
int path;
int ret;
path = 0x80;
if (!(s->ctrl & SCSW_ACTL_SUSP)) {
assert(orb != NULL);
p->intparm = orb->intparm;
if (!(orb->lpm & path)) {
s->flags |= SCSW_FLAGS_MASK_CC;
s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
s->ctrl |= (SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND);
return;
}
sch->ccw_fmt_1 = !!(orb->ctrl0 & ORB_CTRL0_MASK_FMT);
sch->ccw_no_data_cnt = 0;
} else {
s->ctrl &= ~(SCSW_ACTL_SUSP | SCSW_ACTL_RESUME_PEND);
}
sch->last_cmd_valid = false;
do {
ret = css_interpret_ccw(sch, sch->channel_prog);
switch (ret) {
case -EAGAIN:
break;
case 0:
s->ctrl &= ~SCSW_ACTL_START_PEND;
s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |
SCSW_STCTL_STATUS_PEND;
s->dstat = SCSW_DSTAT_CHANNEL_END | SCSW_DSTAT_DEVICE_END;
s->cpa = sch->channel_prog + 8;
break;
case -ENOSYS:
s->ctrl &= ~SCSW_ACTL_START_PEND;
s->dstat = SCSW_DSTAT_UNIT_CHECK;
sch->sense_data[0] = 0x80;
s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |
SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
s->cpa = sch->channel_prog + 8;
break;
case -EFAULT:
s->ctrl &= ~SCSW_ACTL_START_PEND;
s->cstat = SCSW_CSTAT_DATA_CHECK;
s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |
SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
s->cpa = sch->channel_prog + 8;
break;
case -EBUSY:
s->flags &= ~SCSW_FLAGS_MASK_CC;
s->flags |= (1 << 8);
s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
s->ctrl |= SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
break;
case -EINPROGRESS:
s->ctrl &= ~SCSW_ACTL_START_PEND;
s->ctrl |= SCSW_ACTL_SUSP;
break;
default:
s->ctrl &= ~SCSW_ACTL_START_PEND;
s->cstat = SCSW_CSTAT_PROG_CHECK;
s->ctrl &= ~SCSW_CTRL_MASK_STCTL;
s->ctrl |= SCSW_STCTL_PRIMARY | SCSW_STCTL_SECONDARY |
SCSW_STCTL_ALERT | SCSW_STCTL_STATUS_PEND;
s->cpa = sch->channel_prog + 8;
break;
}
} while (ret == -EAGAIN);
}
| 1threat
|
Limiting number of clicks on a button : <p>I have two buttons on my webpage(Accept And Reject). I want to restrict the number of clicks on the accept button. I want the number of times Accept button can be clicked to be 20 times over a period of 24 hours. Once 24 hours finish, the user can click the button again for 20 times. I am using a MySQL database and PHP. </p>
| 0debug
|
static gboolean qio_channel_yield_enter(QIOChannel *ioc,
GIOCondition condition,
gpointer opaque)
{
QIOChannelYieldData *data = opaque;
qemu_coroutine_enter(data->co, NULL);
return FALSE;
}
| 1threat
|
MySQLi DELETE FROM and DROP querys returning false : <p>I am creating a delete account system for my site. Once clicking the button and confirming, it <em>should</em> Delete the entry from the table 'email' matching the users username, and then delete the table with the name as the users username. After all this, it then redirects you back to the login page. </p>
<p>The issue is that when you try to delete the account, it redirects you to the login page as it should, but does not delete the tables. After testing, it is clear that the querys return false, hinting that there is something wrong with my syntax, although when putting it straight into PHPMyAdmin it works.</p>
<p>Your help would be appreciated!</p>
<p><strong><em>I DO NOT WANT REPLY'S COMPLAINING ABOUT THE SECURITY OF MY SYSTEM. IT IS NOT PUBLIC AND I DON'T INTEND TO MAKE IT PUBLIC</em></strong></p>
<p>Here's some code:</p>
<p><strong>PHP script that listens for the button click and contains the querys:</strong></p>
<pre><code>if(isset($_POST['wannadltaccount'])){
include 'Connect.php';
$userUsername = $_COOKIE['userName'];
mysqli_query($conn, 'DELETE FROM email WHERE `user` = "$userUsername"');
mysqli_query($conn, 'DROP TABLE `$userUsername`');
echo "<script type='text/javascript'>window.location.href = 'LoginReg.php';</script>";
}
</code></pre>
| 0debug
|
static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size)
{
int cb_size = 1 << log2_cb_size;
HEVCLocalContext *lc = &s->HEVClc;
int log2_min_cb_size = s->sps->log2_min_cb_size;
int length = cb_size >> log2_min_cb_size;
int min_cb_width = s->sps->min_cb_width;
int x_cb = x0 >> log2_min_cb_size;
int y_cb = y0 >> log2_min_cb_size;
int x, y;
lc->cu.x = x0;
lc->cu.y = y0;
lc->cu.rqt_root_cbf = 1;
lc->cu.pred_mode = MODE_INTRA;
lc->cu.part_mode = PART_2Nx2N;
lc->cu.intra_split_flag = 0;
lc->cu.pcm_flag = 0;
SAMPLE_CTB(s->skip_flag, x_cb, y_cb) = 0;
for (x = 0; x < 4; x++)
lc->pu.intra_pred_mode[x] = 1;
if (s->pps->transquant_bypass_enable_flag) {
lc->cu.cu_transquant_bypass_flag = ff_hevc_cu_transquant_bypass_flag_decode(s);
if (lc->cu.cu_transquant_bypass_flag)
set_deblocking_bypass(s, x0, y0, log2_cb_size);
} else
lc->cu.cu_transquant_bypass_flag = 0;
if (s->sh.slice_type != I_SLICE) {
uint8_t skip_flag = ff_hevc_skip_flag_decode(s, x0, y0, x_cb, y_cb);
lc->cu.pred_mode = MODE_SKIP;
x = y_cb * min_cb_width + x_cb;
for (y = 0; y < length; y++) {
memset(&s->skip_flag[x], skip_flag, length);
x += min_cb_width;
}
lc->cu.pred_mode = skip_flag ? MODE_SKIP : MODE_INTER;
}
if (SAMPLE_CTB(s->skip_flag, x_cb, y_cb)) {
hls_prediction_unit(s, x0, y0, cb_size, cb_size, log2_cb_size, 0);
intra_prediction_unit_default_value(s, x0, y0, log2_cb_size);
if (!s->sh.disable_deblocking_filter_flag)
ff_hevc_deblocking_boundary_strengths(s, x0, y0, log2_cb_size,
lc->slice_or_tiles_up_boundary,
lc->slice_or_tiles_left_boundary);
} else {
if (s->sh.slice_type != I_SLICE)
lc->cu.pred_mode = ff_hevc_pred_mode_decode(s);
if (lc->cu.pred_mode != MODE_INTRA ||
log2_cb_size == s->sps->log2_min_cb_size) {
lc->cu.part_mode = ff_hevc_part_mode_decode(s, log2_cb_size);
lc->cu.intra_split_flag = lc->cu.part_mode == PART_NxN &&
lc->cu.pred_mode == MODE_INTRA;
}
if (lc->cu.pred_mode == MODE_INTRA) {
if (lc->cu.part_mode == PART_2Nx2N && s->sps->pcm_enabled_flag &&
log2_cb_size >= s->sps->pcm.log2_min_pcm_cb_size &&
log2_cb_size <= s->sps->pcm.log2_max_pcm_cb_size) {
lc->cu.pcm_flag = ff_hevc_pcm_flag_decode(s);
}
if (lc->cu.pcm_flag) {
int ret;
intra_prediction_unit_default_value(s, x0, y0, log2_cb_size);
ret = hls_pcm_sample(s, x0, y0, log2_cb_size);
if (s->sps->pcm.loop_filter_disable_flag)
set_deblocking_bypass(s, x0, y0, log2_cb_size);
if (ret < 0)
return ret;
} else {
intra_prediction_unit(s, x0, y0, log2_cb_size);
}
} else {
intra_prediction_unit_default_value(s, x0, y0, log2_cb_size);
switch (lc->cu.part_mode) {
case PART_2Nx2N:
hls_prediction_unit(s, x0, y0, cb_size, cb_size, log2_cb_size, 0);
break;
case PART_2NxN:
hls_prediction_unit(s, x0, y0, cb_size, cb_size / 2, log2_cb_size, 0);
hls_prediction_unit(s, x0, y0 + cb_size / 2, cb_size, cb_size / 2, log2_cb_size, 1);
break;
case PART_Nx2N:
hls_prediction_unit(s, x0, y0, cb_size / 2, cb_size, log2_cb_size, 0);
hls_prediction_unit(s, x0 + cb_size / 2, y0, cb_size / 2, cb_size, log2_cb_size, 1);
break;
case PART_2NxnU:
hls_prediction_unit(s, x0, y0, cb_size, cb_size / 4, log2_cb_size, 0);
hls_prediction_unit(s, x0, y0 + cb_size / 4, cb_size, cb_size * 3 / 4, log2_cb_size, 1);
break;
case PART_2NxnD:
hls_prediction_unit(s, x0, y0, cb_size, cb_size * 3 / 4, log2_cb_size, 0);
hls_prediction_unit(s, x0, y0 + cb_size * 3 / 4, cb_size, cb_size / 4, log2_cb_size, 1);
break;
case PART_nLx2N:
hls_prediction_unit(s, x0, y0, cb_size / 4, cb_size, log2_cb_size, 0);
hls_prediction_unit(s, x0 + cb_size / 4, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 1);
break;
case PART_nRx2N:
hls_prediction_unit(s, x0, y0, cb_size * 3 / 4, cb_size, log2_cb_size, 0);
hls_prediction_unit(s, x0 + cb_size * 3 / 4, y0, cb_size / 4, cb_size, log2_cb_size, 1);
break;
case PART_NxN:
hls_prediction_unit(s, x0, y0, cb_size / 2, cb_size / 2, log2_cb_size, 0);
hls_prediction_unit(s, x0 + cb_size / 2, y0, cb_size / 2, cb_size / 2, log2_cb_size, 1);
hls_prediction_unit(s, x0, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 2);
hls_prediction_unit(s, x0 + cb_size / 2, y0 + cb_size / 2, cb_size / 2, cb_size / 2, log2_cb_size, 3);
break;
}
}
if (!lc->cu.pcm_flag) {
if (lc->cu.pred_mode != MODE_INTRA &&
!(lc->cu.part_mode == PART_2Nx2N && lc->pu.merge_flag)) {
lc->cu.rqt_root_cbf = ff_hevc_no_residual_syntax_flag_decode(s);
}
if (lc->cu.rqt_root_cbf) {
lc->cu.max_trafo_depth = lc->cu.pred_mode == MODE_INTRA ?
s->sps->max_transform_hierarchy_depth_intra + lc->cu.intra_split_flag :
s->sps->max_transform_hierarchy_depth_inter;
hls_transform_tree(s, x0, y0, x0, y0, x0, y0, log2_cb_size,
log2_cb_size, 0, 0);
} else {
if (!s->sh.disable_deblocking_filter_flag)
ff_hevc_deblocking_boundary_strengths(s, x0, y0, log2_cb_size,
lc->slice_or_tiles_up_boundary,
lc->slice_or_tiles_left_boundary);
}
}
}
if (s->pps->cu_qp_delta_enabled_flag && lc->tu.is_cu_qp_delta_coded == 0)
ff_hevc_set_qPy(s, x0, y0, x0, y0, log2_cb_size);
x = y_cb * min_cb_width + x_cb;
for (y = 0; y < length; y++) {
memset(&s->qp_y_tab[x], lc->qp_y, length);
x += min_cb_width;
}
set_ct_depth(s, x0, y0, log2_cb_size, lc->ct.depth);
return 0;
}
| 1threat
|
int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
struct image_info * info)
{
struct elfhdr elf_ex;
struct elfhdr interp_elf_ex;
struct exec interp_ex;
int interpreter_fd = -1;
abi_ulong load_addr, load_bias;
int load_addr_set = 0;
unsigned int interpreter_type = INTERPRETER_NONE;
unsigned char ibcs2_interpreter;
int i;
abi_ulong mapped_addr;
struct elf_phdr * elf_ppnt;
struct elf_phdr *elf_phdata;
abi_ulong elf_bss, k, elf_brk;
int retval;
char * elf_interpreter;
abi_ulong elf_entry, interp_load_addr = 0;
int status;
abi_ulong start_code, end_code, start_data, end_data;
abi_ulong reloc_func_desc = 0;
abi_ulong elf_stack;
char passed_fileno[6];
ibcs2_interpreter = 0;
status = 0;
load_addr = 0;
load_bias = 0;
elf_ex = *((struct elfhdr *) bprm->buf);
#ifdef BSWAP_NEEDED
bswap_ehdr(&elf_ex);
#endif
if ((elf_ex.e_type != ET_EXEC && elf_ex.e_type != ET_DYN) ||
(! elf_check_arch(elf_ex.e_machine))) {
return -ENOEXEC;
}
bprm->p = copy_elf_strings(1, &bprm->filename, bprm->page, bprm->p);
bprm->p = copy_elf_strings(bprm->envc,bprm->envp,bprm->page,bprm->p);
bprm->p = copy_elf_strings(bprm->argc,bprm->argv,bprm->page,bprm->p);
if (!bprm->p) {
retval = -E2BIG;
}
elf_phdata = (struct elf_phdr *)malloc(elf_ex.e_phentsize*elf_ex.e_phnum);
if (elf_phdata == NULL) {
return -ENOMEM;
}
retval = lseek(bprm->fd, elf_ex.e_phoff, SEEK_SET);
if(retval > 0) {
retval = read(bprm->fd, (char *) elf_phdata,
elf_ex.e_phentsize * elf_ex.e_phnum);
}
if (retval < 0) {
perror("load_elf_binary");
exit(-1);
free (elf_phdata);
return -errno;
}
#ifdef BSWAP_NEEDED
elf_ppnt = elf_phdata;
for (i=0; i<elf_ex.e_phnum; i++, elf_ppnt++) {
bswap_phdr(elf_ppnt);
}
#endif
elf_ppnt = elf_phdata;
elf_bss = 0;
elf_brk = 0;
elf_stack = ~((abi_ulong)0UL);
elf_interpreter = NULL;
start_code = ~((abi_ulong)0UL);
end_code = 0;
start_data = 0;
end_data = 0;
for(i=0;i < elf_ex.e_phnum; i++) {
if (elf_ppnt->p_type == PT_INTERP) {
if ( elf_interpreter != NULL )
{
free (elf_phdata);
free(elf_interpreter);
close(bprm->fd);
return -EINVAL;
}
elf_interpreter = (char *)malloc(elf_ppnt->p_filesz);
if (elf_interpreter == NULL) {
free (elf_phdata);
close(bprm->fd);
return -ENOMEM;
}
retval = lseek(bprm->fd, elf_ppnt->p_offset, SEEK_SET);
if(retval >= 0) {
retval = read(bprm->fd, elf_interpreter, elf_ppnt->p_filesz);
}
if(retval < 0) {
perror("load_elf_binary2");
exit(-1);
}
if (strcmp(elf_interpreter,"/usr/lib/libc.so.1") == 0 ||
strcmp(elf_interpreter,"/usr/lib/ld.so.1") == 0) {
ibcs2_interpreter = 1;
}
#if 0
printf("Using ELF interpreter %s\n", elf_interpreter);
#endif
if (retval >= 0) {
retval = open(path(elf_interpreter), O_RDONLY);
if(retval >= 0) {
interpreter_fd = retval;
}
else {
perror(elf_interpreter);
exit(-1);
}
}
if (retval >= 0) {
retval = lseek(interpreter_fd, 0, SEEK_SET);
if(retval >= 0) {
retval = read(interpreter_fd,bprm->buf,128);
}
}
if (retval >= 0) {
interp_ex = *((struct exec *) bprm->buf);
interp_elf_ex=*((struct elfhdr *) bprm->buf);
}
if (retval < 0) {
perror("load_elf_binary3");
exit(-1);
free (elf_phdata);
free(elf_interpreter);
close(bprm->fd);
return retval;
}
}
elf_ppnt++;
}
if (elf_interpreter){
interpreter_type = INTERPRETER_ELF | INTERPRETER_AOUT;
if ((N_MAGIC(interp_ex) != OMAGIC) && (N_MAGIC(interp_ex) != ZMAGIC) &&
(N_MAGIC(interp_ex) != QMAGIC)) {
interpreter_type = INTERPRETER_ELF;
}
if (interp_elf_ex.e_ident[0] != 0x7f ||
strncmp((char *)&interp_elf_ex.e_ident[1], "ELF",3) != 0) {
interpreter_type &= ~INTERPRETER_ELF;
}
if (!interpreter_type) {
free(elf_interpreter);
free(elf_phdata);
close(bprm->fd);
return -ELIBBAD;
}
}
{
char * passed_p;
if (interpreter_type == INTERPRETER_AOUT) {
snprintf(passed_fileno, sizeof(passed_fileno), "%d", bprm->fd);
passed_p = passed_fileno;
if (elf_interpreter) {
bprm->p = copy_elf_strings(1,&passed_p,bprm->page,bprm->p);
bprm->argc++;
}
}
if (!bprm->p) {
if (elf_interpreter) {
free(elf_interpreter);
}
free (elf_phdata);
close(bprm->fd);
return -E2BIG;
}
}
info->end_data = 0;
info->end_code = 0;
info->start_mmap = (abi_ulong)ELF_START_MMAP;
info->mmap = 0;
elf_entry = (abi_ulong) elf_ex.e_entry;
info->rss = 0;
bprm->p = setup_arg_pages(bprm->p, bprm, info);
info->start_stack = bprm->p;
for(i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) {
int elf_prot = 0;
int elf_flags = 0;
abi_ulong error;
if (elf_ppnt->p_type != PT_LOAD)
continue;
if (elf_ppnt->p_flags & PF_R) elf_prot |= PROT_READ;
if (elf_ppnt->p_flags & PF_W) elf_prot |= PROT_WRITE;
if (elf_ppnt->p_flags & PF_X) elf_prot |= PROT_EXEC;
elf_flags = MAP_PRIVATE | MAP_DENYWRITE;
if (elf_ex.e_type == ET_EXEC || load_addr_set) {
elf_flags |= MAP_FIXED;
} else if (elf_ex.e_type == ET_DYN) {
error = target_mmap(0, ET_DYN_MAP_SIZE,
PROT_NONE, MAP_PRIVATE | MAP_ANON,
-1, 0);
if (error == -1) {
perror("mmap");
exit(-1);
}
load_bias = TARGET_ELF_PAGESTART(error - elf_ppnt->p_vaddr);
}
error = target_mmap(TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr),
(elf_ppnt->p_filesz +
TARGET_ELF_PAGEOFFSET(elf_ppnt->p_vaddr)),
elf_prot,
(MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE),
bprm->fd,
(elf_ppnt->p_offset -
TARGET_ELF_PAGEOFFSET(elf_ppnt->p_vaddr)));
if (error == -1) {
perror("mmap");
exit(-1);
}
#ifdef LOW_ELF_STACK
if (TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr) < elf_stack)
elf_stack = TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr);
#endif
if (!load_addr_set) {
load_addr_set = 1;
load_addr = elf_ppnt->p_vaddr - elf_ppnt->p_offset;
if (elf_ex.e_type == ET_DYN) {
load_bias += error -
TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr);
load_addr += load_bias;
reloc_func_desc = load_bias;
}
}
k = elf_ppnt->p_vaddr;
if (k < start_code)
start_code = k;
if (start_data < k)
start_data = k;
k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz;
if (k > elf_bss)
elf_bss = k;
if ((elf_ppnt->p_flags & PF_X) && end_code < k)
end_code = k;
if (end_data < k)
end_data = k;
k = elf_ppnt->p_vaddr + elf_ppnt->p_memsz;
if (k > elf_brk) elf_brk = k;
}
elf_entry += load_bias;
elf_bss += load_bias;
elf_brk += load_bias;
start_code += load_bias;
end_code += load_bias;
start_data += load_bias;
end_data += load_bias;
if (elf_interpreter) {
if (interpreter_type & 1) {
elf_entry = load_aout_interp(&interp_ex, interpreter_fd);
}
else if (interpreter_type & 2) {
elf_entry = load_elf_interp(&interp_elf_ex, interpreter_fd,
&interp_load_addr);
}
reloc_func_desc = interp_load_addr;
close(interpreter_fd);
free(elf_interpreter);
if (elf_entry == ~((abi_ulong)0UL)) {
printf("Unable to load interpreter\n");
free(elf_phdata);
exit(-1);
return 0;
}
}
free(elf_phdata);
if (loglevel)
load_symbols(&elf_ex, bprm->fd);
if (interpreter_type != INTERPRETER_AOUT) close(bprm->fd);
info->personality = (ibcs2_interpreter ? PER_SVR4 : PER_LINUX);
#ifdef LOW_ELF_STACK
info->start_stack = bprm->p = elf_stack - 4;
#endif
bprm->p = create_elf_tables(bprm->p,
bprm->argc,
bprm->envc,
&elf_ex,
load_addr, load_bias,
interp_load_addr,
(interpreter_type == INTERPRETER_AOUT ? 0 : 1),
info);
info->load_addr = reloc_func_desc;
info->start_brk = info->brk = elf_brk;
info->end_code = end_code;
info->start_code = start_code;
info->start_data = start_data;
info->end_data = end_data;
info->start_stack = bprm->p;
set_brk(elf_bss, elf_brk);
padzero(elf_bss, elf_brk);
#if 0
printf("(start_brk) %x\n" , info->start_brk);
printf("(end_code) %x\n" , info->end_code);
printf("(start_code) %x\n" , info->start_code);
printf("(end_data) %x\n" , info->end_data);
printf("(start_stack) %x\n" , info->start_stack);
printf("(brk) %x\n" , info->brk);
#endif
if ( info->personality == PER_SVR4 )
{
mapped_addr = target_mmap(0, qemu_host_page_size, PROT_READ | PROT_EXEC,
MAP_FIXED | MAP_PRIVATE, -1, 0);
}
info->entry = elf_entry;
return 0;
}
| 1threat
|
How to run podman from inside a container? : <p>I want to run <a href="https://podman.io" rel="noreferrer">podman</a> as a container to run CI/CD pipelines. However, I keep getting this error from the podman container:</p>
<pre class="lang-sh prettyprint-override"><code>$ podman info
ERRO[0000] 'overlay' is not supported over overlayfs
Error: could not get runtime: 'overlay' is not supported over overlayfs: backing file system is unsupported for this graph driver
</code></pre>
<p>I am using the <a href="https://github.com/jenkinsci/kubernetes-plugin" rel="noreferrer">Jenkins Kubernetes plugin</a> to write CI/CD pipelines that run as containers within a Kubernetes cluster. I've been successful at writing pipelines that use a Docker-in-Docker container to run <code>docker build</code> and <code>docker push</code> commands.</p>
<p>However, running a Docker client and a Docker Daemon inside a container makes the CI/CD environment very bloated, hard to configure, and just not ideal to work with. So I figured I could use <a href="https://podman.io" rel="noreferrer">podman</a> to build Docker images from Dockerfiles without using a fat Docker daemon.</p>
<p>The problem is that <strong>podman</strong> is so new that I have not seen anyone attempt this before, nor I am enough of a podman expert to properly execute this.</p>
<p>So, using the <a href="https://github.com/containers/libpod/blob/master/install.md#ubuntu" rel="noreferrer">podman installation instructions for Ubuntu</a> I created the following Dockerfile:</p>
<pre><code>FROM ubuntu:16.04
RUN apt-get update -qq \
&& apt-get install -qq -y software-properties-common uidmap \
&& add-apt-repository -y ppa:projectatomic/ppa \
&& apt-get update -qq \
&& apt-get -qq -y install podman
# To keep it running
CMD tail -f /dev/null
</code></pre>
<p>So I built the image and ran it as follows:</p>
<pre class="lang-sh prettyprint-override"><code># Build
docker build -t podman:ubuntu-16.04 .
# Run
docker run --name podman -d podman:ubuntu-16.04
</code></pre>
<p>Then when running this command on the running container, I get an error:</p>
<pre class="lang-sh prettyprint-override"><code>$ docker exec -ti podman bash -c "podman info"
ERRO[0000] 'overlay' is not supported over overlayfs
Error: could not get runtime: 'overlay' is not supported over overlayfs: backing file system is unsupported for this graph driver
</code></pre>
<p>I install podman on an Ubuntu 16.04 machine I had and ran the same <code>podman info</code> command I got the expected results:</p>
<pre class="lang-sh prettyprint-override"><code>host:
BuildahVersion: 1.8-dev
Conmon:
package: 'conmon: /usr/libexec/crio/conmon'
path: /usr/libexec/crio/conmon
version: 'conmon version , commit: '
Distribution:
distribution: ubuntu
version: "16.04"
MemFree: 2275770368
MemTotal: 4142137344
OCIRuntime:
package: 'cri-o-runc: /usr/lib/cri-o-runc/sbin/runc'
path: /usr/lib/cri-o-runc/sbin/runc
version: 'runc version spec: 1.0.1-dev'
SwapFree: 2146758656
SwapTotal: 2146758656
arch: amd64
cpus: 2
hostname: jumpbox-4b3620b3
kernel: 4.4.0-141-generic
os: linux
rootless: false
uptime: 222h 46m 33.48s (Approximately 9.25 days)
insecure registries:
registries: []
registries:
registries:
- docker.io
store:
ConfigFile: /etc/containers/storage.conf
ContainerStore:
number: 0
GraphDriverName: overlay
GraphOptions: null
GraphRoot: /var/lib/containers/storage
GraphStatus:
Backing Filesystem: extfs
Native Overlay Diff: "true"
Supports d_type: "true"
Using metacopy: "false"
ImageStore:
number: 15
RunRoot: /var/run/containers/storage
VolumePath: /var/lib/containers/storage/volumes
</code></pre>
<p>Does anyone know how I can fix this error and get podman working from a container?</p>
| 0debug
|
Update Column in SQLlite : I am learning android now....I am trying to use sqllite in my application. I am inserting data in table without hassle with below code
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
public void addQuote(String qu_text, int qu_author, int qu_web_id, String qu_time, int qu_like, int qu_share) {
open();
ContentValues v = new ContentValues();
v.put(QU_TEXT, qu_text);
v.put(QU_AUTHOR, qu_author);
v.put(QU_FAVORITE, "0");
v.put(QU_WEB_ID, qu_web_id);
v.put(QU_TIME, qu_time);
v.put(QU_LIKE, qu_like);
v.put(QU_SHARE, qu_share);
database.insert(TABLE_QUOTES, null, v);
}
<!-- end snippet -->
Now I want make another function which can update two column in table called qu_like and qu_share. anyone can please suggest me how can I update only two column instead of full table ?
Thanks
| 0debug
|
I am new to apache spark and trying to understand structured streaming : I am new to apache spark and trying to understand structured streaming with apache kafka in scala but nothing worked in my favour till now basically i want to send json from kafka and display it in tabular format using structured streaming actually i am looking for complete code from parsing to writing to spark any suggestions would be of much help .
| 0debug
|
Image processing i.e. matching similar images in java : <p>Is there a way where i can match some sort of screenshots with earlier stored images in my system.
Consider 2 images i want to compare A and B.
A is full screenshot of monitor whereas B corresponds to a particular window say a small image.
My problem is to find whether A contains B or not?</p>
| 0debug
|
Replace bars by line break in javascript : <p>I want replace '/' by a line break in javascript.</p>
<p>I have this string:</p>
<pre><code>L-V:DE 08:30 A 14:30 Y DE 16:30 A 20:00/S:DE 09:30 A 13:00/Festivos:SIN SERVICIO
</code></pre>
<p>I want to turn it into:</p>
<pre><code>L-V:DE 08:30 A 14:30 Y DE 16:30 A 20:00
S:DE 09:30 A 13:00
Festivos:SIN SERVICIO
</code></pre>
| 0debug
|
Javascrip Confusion :
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
body{
margin:0;
padding:0;
line-height: 1.5em;
background: #782609 url(images/body_bg.jpg) repeat-x;
font-size: 11px;
font-family: Arial, Helvetica, sans-serif;
}
a:link, a:visited { color: #621c03; text-decoration: none; font-weight: bold;}
a:active, a:hover { color: #621c03; text-decoration: none; font-weight: bold; }
h1 {
font-size: 22px;
color: white;
font-weight: bold;
height: 27px;
padding-top: 40px;
padding-left: 70px;
}
h2 {
font-size: 13px;
font-weight: bold;
color: #fff;
height: 22px;
padding-top: 3px;
padding-left: 5px;
background: url(images/h2.jpg) no-repeat;
}
#maincontainer{
width: 1000px;
margin: 0 auto;
float: left;
}
#topsection{
background: url(images/header.jpg) no-repeat;
height: 283px;
}
#title{
margin: 0;
padding-top: 150px;
padding-left: 50px;
color: #FFFFFF;
font-size: 24px;
font-weight: bold;
}
#slogan {
margin-top: 10px;
padding-left: 50px;
font-size: 12px;
font-weight: bold;
color: #ff9a59;
}
#left_column {
float: left;
width: 229px;
}
#menu_top {
float: left;
height: 33px;
width: 229px;
background: url(images/menu_top.jpg) no-repeat;
}
#right_column {
float: right;
width: 651px;
padding-right: 20px;
height: auto
}
#destination {
float: left;
padding: 10px 10px 0px 40px;
width: 280px;
border-right: dotted 1px #782609;
}
#search {
float: right;
padding: 0px 30px 0px 0px;
width: 262px;
background: url(images/form-bg.jpg) repeat-y;
}
.search_top {
background: url(images/=search.jpg) no-repeat;
width: 262px;
height: 76px;
}
.search_mid {
margin: 0px;
padding-left: 10px;
padding-top: 0px;
}
.search_bot {
background: url(images/search_bot.jpg) no-repeat;
height: 11px;
}
#contact {
width: 200px;
height: 96px;
background: url(images/contact.jpg) no-repeat;
color: #fff;
padding-left: 29px;
padding-top: 15px;
}
#bot {
float: left;
height: 22px;
width: 877px;
}
#footer{
float: left;
width: 100%;
padding-top: 16px;
height: 31px;
color: #fff;
text-align: center;
background: url(images/footer_bg.jpg) repeat-x;
}
#footer a {
color: #fff;
font-weight: bold;
}
.menu {
margin-top: 40px;
width: 210px;
}
.menu li{
list-style: none;
height: 30px;
display: block;
background: url(images/menu_bg.jpg) no-repeat;
font-weight: bold;
font-size: 12px;
padding-left: 30px;
padding-top: 7px;
}
.menu a {
color: #fff;
text-decoration: none;
}
.menu a:hover {
color: #f08661;
}
.innertube{
margin: 40px;
margin-top: 0;
margin-bottom: 10px;
text-align: justify;
border-bottom: dotted 1px #782609;
}
.post_date { color: #177212; }
<!-- language: lang-html -->
<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Travel Company Red - Free Website Template</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script>
var BOO= 1;
var COIN = 1;
var MAP = 1;
var WATCH = 1;
var HARM = 1;
var GUITAR = 1;
var incrementCount = function(){
clicks++;
}
</script>
<div id="maincontainer">
<div id="topsection">
<div id="title">Welcome to Australia</div>
</div>
<div id="left_column">
<div id="menu_top"></div>
<div class="menu">
<ul>
<li><a href="aus.html">Home</a></li>
<li><a href="tourism.html">Tourism</a></li>
<li><a href="educationandindustry.html">Education and Industry</a></li>
<li><a href="culture.html">Culture</a></li>
<li><a href="gallery.html">Gallery</a></li>
<li><a href="giftshop.html">Gift Shop</a></li>
</ul></div>
<div id="contact">
<strong>QUICK CONTACT<br /></strong>
Tel: 001-100-1000<br />
Fax: 002-200-2000<br />
Email: info[at]company.com</div>
</div>
<br>
<br>
<div id="right_column">
<table>
<tr>
<td><img src="images/BOOMRANG.jpg" width="151" height="148"></td>
<td class="echo"><input type="text" form="esp" id="push" value="" size="2" /></td>
<td><img src="images/coin.jpg" width="140" height="139"></td>
<td class="echo"><input type="text" form="esp" id="q2" value="" size="2" /></td>
<td><img src="images/FLAG.jpg" width="175" height="152"></td>
<td class="echo"><input type="text" form="esp" id="q3" value="" size="2" /></td>
</tr>
<tr>
<td>
<h3>Price: 10$</h3><input type="button" value="Add to Cart" onClick ="incrementCount();" q1.value="1"'/>
</td><td></td>
<td>
<h3>Price: 10$</h3><input type="button" value="Add to Cart" onclick='COIN = 1; q2.value="1"'/>
</td><td></td>
<td>
<h3>Price: 10$</h3><input type="button" value="Add to Cart" onclick='MAP = 1; q3.value="1"'/>
</td><td></td>
</tr>
<tr>
<td><img src="images/watch.jpg" width="139" height="150"></td>
<td class="echo"><input type="text" form="esp" id="q4" value="" size="2" /></td>
<td><img src="images/harmoniam.jpg" width="147" height="131"></td>
<td class="echo"><input type="text" form="esp" id="q5" value="" size="2" /></td>
<td><img src="images/guitar.jpg" width="189" height="139"></td>
<td class="echo"><input type="text" form="esp" id="q6" value="" size="2" /></td>
</tr>
<tr>
<td>
<h3>Price: 10$</h3><input type="button" value="Add to Cart" onclick='WATCH = 1; q4.value="1"'/>
</td><td></td>
<td>
<h3>Price: 30$</h3><input type="button" value="Add to Cart" onclick='HARM = 1; q5.value="1"'/>
</td><td></td>
<td>
<h3>Price: 20$</h3><input type="button" value="Add to Cart" onclick='GUITAR = 1; q6.value="1"'/>
</td><td></td>
</tr>
</table>
<p> </p>
<h2> TOTAL ITEMS: </h2>
<h2> TOTAL VALUE: </h2>
</div>
</div>
<div id="bot"></div>
</div>
<div id="footer">Copyright © Australia Expo</div>
</body>
</html>
<!-- end snippet -->
I am developing a webpage and I need help adding plus one to the value on click.
and
I also need help adding the price of all the items that is collected in a section in the "number of items selected" and I want to add the total price of all the items in the "Total amount section".
Any sort of help with be much appreciated.
| 0debug
|
golang: How do you connect to multiple MySQL databases in Go? : <p>operating 3 or more database at the same time,
Read/Write Splitting,
have connection pool.</p>
| 0debug
|
static void dbdma_cmdptr_save(DBDMA_channel *ch)
{
DBDMA_DPRINTF("dbdma_cmdptr_save 0x%08x\n",
be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]));
DBDMA_DPRINTF("xfer_status 0x%08x res_count 0x%04x\n",
le16_to_cpu(ch->current.xfer_status),
le16_to_cpu(ch->current.res_count));
cpu_physical_memory_write(be32_to_cpu(ch->regs[DBDMA_CMDPTR_LO]),
(uint8_t*)&ch->current, sizeof(dbdma_cmd));
}
| 1threat
|
EventListener is not work : <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>I need Help</title>
<style media="screen">
.try {
padding: 3em;
background: #B51C35;
text-align: center;}
.try a {
display: inline-block;
padding: 0 .5em;
font-size: 2em;
font-weight: 900;
color: #FFFCED;
text-decoration: none;
border: 5px solid #FFFCED;}
</style>
</head>
<body>
<div class="">
<h3 style="text-align:center;">The event in the console was worked but remove Attribute is not work!! <br />I just need the advice or if you can told me why is not working? </h3>
</div>
<div class="try movemaus">
<a href="#">Book Now!</a>
</div><!-- .cta -->
<script>
const NEWSTYLE = document.querySelector(".movemaus");
NEWSTYLE.addEventListener('mouseleave', function(){NEWSTYLE.removeAttribute(".try");}, false);
NEWSTYLE.addEventListener('mouseleave', function(){console.log("The Function is work in the Console");}, false);
</script>
</body>
</html></code></pre>
</div>
</div>
</p>
<p>Dear All,
The event in the console was worked but remove Attribute is not work!!
I just need the advice or if you can told me why is not working?
Thanks in Advance,
Mustafa </p>
| 0debug
|
How to highlight different part of human anatomy when tapping on : <p>So, I have searched enough, got one or two ways but failed to get an exact solution to my problem. I have an image of a body like this:</p>
<p><a href="https://i.stack.imgur.com/t7oYg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/t7oYg.png" alt="enter image description here"></a></p>
<p>Now when tapping on different body parts, those bodyparts will be highlighted like below image: </p>
<p><a href="https://i.stack.imgur.com/tB3rr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tB3rr.png" alt="enter image description here"></a></p>
<p>This is a back body portion image for reference.</p>
<p>Now I have small images like: </p>
<p><a href="https://i.stack.imgur.com/h6c1W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h6c1W.png" alt="enter image description here"></a></p>
<p>To highlight the body parts. Can anyone please suggest me a way how I can achieve this. Just guide me with a way that will be enough. Thanks in advance.</p>
| 0debug
|
How can i run the code with my own smaller dataset? : <p>I want to run <a href="https://github.com/TropComplique/shufflenet-v2-tensorflow" rel="nofollow noreferrer">https://github.com/TropComplique/shufflenet-v2-tensorflow</a>
with my own smaller dataset. how can I do it?!!!!</p>
| 0debug
|
static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
{
VirtIODevice *vdev = VIRTIO_DEVICE(n);
NetClientState *nc = qemu_get_queue(n->nic);
int queues = n->multiqueue ? n->max_queues : 1;
if (!get_vhost_net(nc->peer)) {
return;
}
if ((virtio_net_started(n, status) && !nc->peer->link_down) ==
!!n->vhost_started) {
return;
}
if (!n->vhost_started) {
int r, i;
if (!vhost_net_query(get_vhost_net(nc->peer), vdev)) {
return;
}
for (i = 0; i < queues; i++) {
NetClientState *qnc = qemu_get_subqueue(n->nic, i);
qemu_net_queue_purge(qnc->peer->incoming_queue, qnc);
qemu_net_queue_purge(qnc->incoming_queue, qnc->peer);
}
n->vhost_started = 1;
r = vhost_net_start(vdev, n->nic->ncs, queues);
if (r < 0) {
error_report("unable to start vhost net: %d: "
"falling back on userspace virtio", -r);
n->vhost_started = 0;
}
} else {
vhost_net_stop(vdev, n->nic->ncs, queues);
n->vhost_started = 0;
}
}
| 1threat
|
static void test_visitor_in_union_flat(TestInputVisitorData *data,
const void *unused)
{
Visitor *v;
UserDefFlatUnion *tmp;
UserDefUnionBase *base;
v = visitor_input_test_init(data,
"{ 'enum1': 'value1', "
"'integer': 41, "
"'string': 'str', "
"'boolean': true }");
visit_type_UserDefFlatUnion(v, NULL, &tmp, &error_abort);
g_assert_cmpint(tmp->enum1, ==, ENUM_ONE_VALUE1);
g_assert_cmpstr(tmp->string, ==, "str");
g_assert_cmpint(tmp->integer, ==, 41);
g_assert_cmpint(tmp->u.value1->boolean, ==, true);
base = qapi_UserDefFlatUnion_base(tmp);
g_assert(&base->enum1 == &tmp->enum1);
qapi_free_UserDefFlatUnion(tmp);
}
| 1threat
|
Calling onStart() after onCreate() with some delay android : Can we add delay in calling onStart() method of splash activity from onCreate()?
I want to call onStart() after 5 seconds. So that I can give enough time to app to create the realm database file on first run of app. So that i can log the on start of Splash screen in realm database.
Or is there any other way of achieving this?
| 0debug
|
static void gen_rot_rm_T1(DisasContext *s, int ot, int op1, int is_right)
{
target_ulong mask = (ot == OT_QUAD ? 0x3f : 0x1f);
TCGv_i32 t0, t1;
if (op1 == OR_TMP0) {
gen_op_ld_T0_A0(ot + s->mem_index);
} else {
gen_op_mov_TN_reg(ot, 0, op1);
}
tcg_gen_andi_tl(cpu_T[1], cpu_T[1], mask);
switch (ot) {
case OT_BYTE:
tcg_gen_ext8u_tl(cpu_T[0], cpu_T[0]);
tcg_gen_muli_tl(cpu_T[0], cpu_T[0], 0x01010101);
goto do_long;
case OT_WORD:
tcg_gen_deposit_tl(cpu_T[0], cpu_T[0], cpu_T[0], 16, 16);
goto do_long;
do_long:
#ifdef TARGET_X86_64
case OT_LONG:
tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T[0]);
tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_T[1]);
if (is_right) {
tcg_gen_rotr_i32(cpu_tmp2_i32, cpu_tmp2_i32, cpu_tmp3_i32);
} else {
tcg_gen_rotl_i32(cpu_tmp2_i32, cpu_tmp2_i32, cpu_tmp3_i32);
}
tcg_gen_extu_i32_tl(cpu_T[0], cpu_tmp2_i32);
break;
#endif
default:
if (is_right) {
tcg_gen_rotr_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
} else {
tcg_gen_rotl_tl(cpu_T[0], cpu_T[0], cpu_T[1]);
}
break;
}
if (op1 == OR_TMP0) {
gen_op_st_T0_A0(ot + s->mem_index);
} else {
gen_op_mov_reg_T0(ot, op1);
}
gen_compute_eflags(s);
if (is_right) {
tcg_gen_shri_tl(cpu_cc_src2, cpu_T[0], mask - 1);
tcg_gen_shri_tl(cpu_cc_dst, cpu_T[0], mask);
} else {
tcg_gen_shri_tl(cpu_cc_src2, cpu_T[0], mask);
tcg_gen_andi_tl(cpu_cc_dst, cpu_T[0], 1);
}
tcg_gen_andi_tl(cpu_cc_src2, cpu_cc_src2, 1);
tcg_gen_xor_tl(cpu_cc_src2, cpu_cc_src2, cpu_cc_dst);
t0 = tcg_const_i32(0);
t1 = tcg_temp_new_i32();
tcg_gen_trunc_tl_i32(t1, cpu_T[1]);
tcg_gen_movi_i32(cpu_tmp2_i32, CC_OP_ADCOX);
tcg_gen_movi_i32(cpu_tmp3_i32, CC_OP_EFLAGS);
tcg_gen_movcond_i32(TCG_COND_NE, cpu_cc_op, t1, t0,
cpu_tmp2_i32, cpu_tmp3_i32);
tcg_temp_free_i32(t0);
tcg_temp_free_i32(t1);
set_cc_op(s, CC_OP_DYNAMIC);
}
| 1threat
|
What logic determines the insert order of Entity Framework 6 : <p>So, I have a DBContext, and I am doing the following operations:</p>
<pre><code>dbContext.SomeTables1.Add(object1)
dbContext.SomeTables2.AddRange(objectArray2)
dbContext.SomeTables3.AddRange(objectArray3)
dbContext.SaveChanges();
</code></pre>
<p>The EF doesn't insert the db records in this order, it inserts them in a random order. To insert them in the same order, I have to do a <code>dbContext.SaveChanges()</code> after each addition. This is not an efficient solution and in my case, it is taking 10 seconds to do all my inserts, while the random order with one save takes around 3 seconds.</p>
<p>N.B. I need the right order to solve a deadlock issue.</p>
<p>My questions are:</p>
<blockquote>
<ul>
<li>Is this issue resolved in EF7?</li>
<li>I can profile EF and determine the random order, however, is there a guarantee that it will be consistently with the same random order or
does it change between requests? (I can adopt my other code if the
answer to this question is positive).</li>
<li>Is there a better way of maintaining the order than <code>dbContext.SaveChanges()</code> on every addition?</li>
</ul>
</blockquote>
| 0debug
|
Python inheritance - how to call grandparent method? : <p>Consider the following piece of code:</p>
<pre><code>class A:
def foo(self):
return "A"
class B(A):
def foo(self):
return "B"
class C(B):
def foo(self):
tmp = ... # call A's foo and store the result to tmp
return "C"+tmp
</code></pre>
<p>What shall be written instead of <code>...</code> so that the grandparent method <code>foo</code> in class <code>A</code> is called? I tried <code>super().foo()</code>, but it just calls parent method <code>foo</code> in class <code>B</code>. </p>
<p>I am using Python 3.</p>
| 0debug
|
Java 8 Stream API in Android N : <p>According to <a href="http://android-developers.blogspot.de/2016/03/first-preview-of-android-n-developer.html">Google's introduction</a>, starting with Android N, the Android API is supposed to support Java streams.</p>
<p>However, using the Android N preview SDK, I am unable to use any of the Stream APIs in my project (which is configured with Android N as minimum, target and build SDK version).</p>
<p>The <code>java.util.stream</code> package seems to be missing, as are the <code>stream()</code> methods of all collection implementations I've tried.</p>
<p>Are the necessary classes not yet included in the current preview release of the SDK?</p>
| 0debug
|
build_ssdt(GArray *table_data, GArray *linker,
AcpiCpuInfo *cpu, AcpiPmInfo *pm, AcpiMiscInfo *misc,
PcPciInfo *pci, PcGuestInfo *guest_info)
{
MachineState *machine = MACHINE(qdev_get_machine());
uint32_t nr_mem = machine->ram_slots;
unsigned acpi_cpus = guest_info->apic_id_limit;
Aml *ssdt, *sb_scope, *scope, *pkg, *dev, *method, *crs, *field, *ifctx;
PCIBus *bus = NULL;
GPtrArray *io_ranges = g_ptr_array_new_with_free_func(crs_range_free);
GPtrArray *mem_ranges = g_ptr_array_new_with_free_func(crs_range_free);
CrsRangeEntry *entry;
int root_bus_limit = 0xFF;
int i;
ssdt = init_aml_allocator();
QEMU_BUILD_BUG_ON(ACPI_CPU_HOTPLUG_ID_LIMIT > 256);
g_assert(acpi_cpus <= ACPI_CPU_HOTPLUG_ID_LIMIT);
acpi_data_push(ssdt->buf, sizeof(AcpiTableHeader));
bus = find_i440fx();
if (bus) {
QLIST_FOREACH(bus, &bus->child, sibling) {
uint8_t bus_num = pci_bus_num(bus);
uint8_t numa_node = pci_bus_numa_node(bus);
if (!pci_bus_is_root(bus)) {
continue;
}
if (bus_num < root_bus_limit) {
root_bus_limit = bus_num - 1;
}
scope = aml_scope("\\_SB");
dev = aml_device("PC%.02X", bus_num);
aml_append(dev, aml_name_decl("_UID", aml_int(bus_num)));
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A03")));
aml_append(dev, aml_name_decl("_BBN", aml_int(bus_num)));
if (numa_node != NUMA_NODE_UNASSIGNED) {
aml_append(dev, aml_name_decl("_PXM", aml_int(numa_node)));
}
aml_append(dev, build_prt());
crs = build_crs(PCI_HOST_BRIDGE(BUS(bus)->parent),
io_ranges, mem_ranges);
aml_append(dev, aml_name_decl("_CRS", crs));
aml_append(scope, dev);
aml_append(ssdt, scope);
}
}
scope = aml_scope("\\_SB.PCI0");
crs = aml_resource_template();
aml_append(crs,
aml_word_bus_number(AML_MIN_FIXED, AML_MAX_FIXED, AML_POS_DECODE,
0x0000, 0x0, root_bus_limit,
0x0000, root_bus_limit + 1));
aml_append(crs, aml_io(AML_DECODE16, 0x0CF8, 0x0CF8, 0x01, 0x08));
aml_append(crs,
aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED,
AML_POS_DECODE, AML_ENTIRE_RANGE,
0x0000, 0x0000, 0x0CF7, 0x0000, 0x0CF8));
crs_replace_with_free_ranges(io_ranges, 0x0D00, 0xFFFF);
for (i = 0; i < io_ranges->len; i++) {
entry = g_ptr_array_index(io_ranges, i);
aml_append(crs,
aml_word_io(AML_MIN_FIXED, AML_MAX_FIXED,
AML_POS_DECODE, AML_ENTIRE_RANGE,
0x0000, entry->base, entry->limit,
0x0000, entry->limit - entry->base + 1));
}
aml_append(crs,
aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,
AML_CACHEABLE, AML_READ_WRITE,
0, 0x000A0000, 0x000BFFFF, 0, 0x00020000));
crs_replace_with_free_ranges(mem_ranges, pci->w32.begin, pci->w32.end - 1);
for (i = 0; i < mem_ranges->len; i++) {
entry = g_ptr_array_index(mem_ranges, i);
aml_append(crs,
aml_dword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,
AML_NON_CACHEABLE, AML_READ_WRITE,
0, entry->base, entry->limit,
0, entry->limit - entry->base + 1));
}
if (pci->w64.begin) {
aml_append(crs,
aml_qword_memory(AML_POS_DECODE, AML_MIN_FIXED, AML_MAX_FIXED,
AML_CACHEABLE, AML_READ_WRITE,
0, pci->w64.begin, pci->w64.end - 1, 0,
pci->w64.end - pci->w64.begin));
}
aml_append(scope, aml_name_decl("_CRS", crs));
dev = aml_device("GPE0");
aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06")));
aml_append(dev, aml_name_decl("_UID", aml_string("GPE0 resources")));
aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
crs = aml_resource_template();
aml_append(crs,
aml_io(AML_DECODE16, pm->gpe0_blk, pm->gpe0_blk, 1, pm->gpe0_blk_len)
);
aml_append(dev, aml_name_decl("_CRS", crs));
aml_append(scope, dev);
g_ptr_array_free(io_ranges, true);
g_ptr_array_free(mem_ranges, true);
if (pm->pcihp_io_len) {
dev = aml_device("PHPR");
aml_append(dev, aml_name_decl("_HID", aml_string("PNP0A06")));
aml_append(dev,
aml_name_decl("_UID", aml_string("PCI Hotplug resources")));
aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
crs = aml_resource_template();
aml_append(crs,
aml_io(AML_DECODE16, pm->pcihp_io_base, pm->pcihp_io_base, 1,
pm->pcihp_io_len)
);
aml_append(dev, aml_name_decl("_CRS", crs));
aml_append(scope, dev);
}
aml_append(ssdt, scope);
scope = aml_scope("\\");
if (!pm->s3_disabled) {
pkg = aml_package(4);
aml_append(pkg, aml_int(1));
aml_append(pkg, aml_int(1));
aml_append(pkg, aml_int(0));
aml_append(pkg, aml_int(0));
aml_append(scope, aml_name_decl("_S3", pkg));
}
if (!pm->s4_disabled) {
pkg = aml_package(4);
aml_append(pkg, aml_int(pm->s4_val));
aml_append(pkg, aml_int(pm->s4_val));
aml_append(pkg, aml_int(0));
aml_append(pkg, aml_int(0));
aml_append(scope, aml_name_decl("_S4", pkg));
}
pkg = aml_package(4);
aml_append(pkg, aml_int(0));
aml_append(pkg, aml_int(0));
aml_append(pkg, aml_int(0));
aml_append(pkg, aml_int(0));
aml_append(scope, aml_name_decl("_S5", pkg));
aml_append(ssdt, scope);
if (misc->applesmc_io_base) {
scope = aml_scope("\\_SB.PCI0.ISA");
dev = aml_device("SMC");
aml_append(dev, aml_name_decl("_HID", aml_eisaid("APP0001")));
aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
crs = aml_resource_template();
aml_append(crs,
aml_io(AML_DECODE16, misc->applesmc_io_base, misc->applesmc_io_base,
0x01, APPLESMC_MAX_DATA_LENGTH)
);
aml_append(crs, aml_irq_no_flags(6));
aml_append(dev, aml_name_decl("_CRS", crs));
aml_append(scope, dev);
aml_append(ssdt, scope);
}
if (misc->pvpanic_port) {
scope = aml_scope("\\_SB.PCI0.ISA");
dev = aml_device("PEVT");
aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0001")));
crs = aml_resource_template();
aml_append(crs,
aml_io(AML_DECODE16, misc->pvpanic_port, misc->pvpanic_port, 1, 1)
);
aml_append(dev, aml_name_decl("_CRS", crs));
aml_append(dev, aml_operation_region("PEOR", AML_SYSTEM_IO,
misc->pvpanic_port, 1));
field = aml_field("PEOR", AML_BYTE_ACC, AML_PRESERVE);
aml_append(field, aml_named_field("PEPT", 8));
aml_append(dev, field);
aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
method = aml_method("RDPT", 0);
aml_append(method, aml_store(aml_name("PEPT"), aml_local(0)));
aml_append(method, aml_return(aml_local(0)));
aml_append(dev, method);
method = aml_method("WRPT", 1);
aml_append(method, aml_store(aml_arg(0), aml_name("PEPT")));
aml_append(dev, method);
aml_append(scope, dev);
aml_append(ssdt, scope);
}
sb_scope = aml_scope("\\_SB");
{
dev = aml_device("PCI0." stringify(CPU_HOTPLUG_RESOURCE_DEVICE));
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0A06")));
aml_append(dev,
aml_name_decl("_UID", aml_string("CPU Hotplug resources"))
);
aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
crs = aml_resource_template();
aml_append(crs,
aml_io(AML_DECODE16, pm->cpu_hp_io_base, pm->cpu_hp_io_base, 1,
pm->cpu_hp_io_len)
);
aml_append(dev, aml_name_decl("_CRS", crs));
aml_append(sb_scope, dev);
aml_append(sb_scope, aml_operation_region(
"PRST", AML_SYSTEM_IO, pm->cpu_hp_io_base, pm->cpu_hp_io_len));
field = aml_field("PRST", AML_BYTE_ACC, AML_PRESERVE);
aml_append(field, aml_named_field("PRS", 256));
aml_append(sb_scope, field);
for (i = 0; i < acpi_cpus; i++) {
dev = aml_processor(i, 0, 0, "CP%.02X", i);
method = aml_method("_MAT", 0);
aml_append(method, aml_return(aml_call1("CPMA", aml_int(i))));
aml_append(dev, method);
method = aml_method("_STA", 0);
aml_append(method, aml_return(aml_call1("CPST", aml_int(i))));
aml_append(dev, method);
method = aml_method("_EJ0", 1);
aml_append(method,
aml_return(aml_call2("CPEJ", aml_int(i), aml_arg(0)))
);
aml_append(dev, method);
aml_append(sb_scope, dev);
}
method = aml_method("NTFY", 2);
for (i = 0; i < acpi_cpus; i++) {
ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
aml_append(ifctx,
aml_notify(aml_name("CP%.02X", i), aml_arg(1))
);
aml_append(method, ifctx);
}
aml_append(sb_scope, method);
pkg = acpi_cpus <= 255 ? aml_package(acpi_cpus) :
aml_varpackage(acpi_cpus);
for (i = 0; i < acpi_cpus; i++) {
uint8_t b = test_bit(i, cpu->found_cpus) ? 0x01 : 0x00;
aml_append(pkg, aml_int(b));
}
aml_append(sb_scope, aml_name_decl("CPON", pkg));
assert(nr_mem <= ACPI_MAX_RAM_SLOTS);
scope = aml_scope("\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE));
aml_append(scope,
aml_name_decl(stringify(MEMORY_SLOTS_NUMBER), aml_int(nr_mem))
);
crs = aml_resource_template();
aml_append(crs,
aml_io(AML_DECODE16, pm->mem_hp_io_base, pm->mem_hp_io_base, 0,
pm->mem_hp_io_len)
);
aml_append(scope, aml_name_decl("_CRS", crs));
aml_append(scope, aml_operation_region(
stringify(MEMORY_HOTPLUG_IO_REGION), AML_SYSTEM_IO,
pm->mem_hp_io_base, pm->mem_hp_io_len)
);
field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
AML_PRESERVE);
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_ADDR_LOW), 32));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_ADDR_HIGH), 32));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_SIZE_LOW), 32));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_SIZE_HIGH), 32));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_PROXIMITY), 32));
aml_append(scope, field);
field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_BYTE_ACC,
AML_WRITE_AS_ZEROS);
aml_append(field, aml_reserved_field(160 ));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_ENABLED), 1));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_INSERT_EVENT), 1));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_REMOVE_EVENT), 1));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_EJECT), 1));
aml_append(scope, field);
field = aml_field(stringify(MEMORY_HOTPLUG_IO_REGION), AML_DWORD_ACC,
AML_PRESERVE);
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_SLECTOR), 32));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_OST_EVENT), 32));
aml_append(field,
aml_named_field(stringify(MEMORY_SLOT_OST_STATUS), 32));
aml_append(scope, field);
aml_append(sb_scope, scope);
for (i = 0; i < nr_mem; i++) {
#define BASEPATH "\\_SB.PCI0." stringify(MEMORY_HOTPLUG_DEVICE) "."
const char *s;
dev = aml_device("MP%02X", i);
aml_append(dev, aml_name_decl("_UID", aml_string("0x%02X", i)));
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C80")));
method = aml_method("_CRS", 0);
s = BASEPATH stringify(MEMORY_SLOT_CRS_METHOD);
aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
aml_append(dev, method);
method = aml_method("_STA", 0);
s = BASEPATH stringify(MEMORY_SLOT_STATUS_METHOD);
aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
aml_append(dev, method);
method = aml_method("_PXM", 0);
s = BASEPATH stringify(MEMORY_SLOT_PROXIMITY_METHOD);
aml_append(method, aml_return(aml_call1(s, aml_name("_UID"))));
aml_append(dev, method);
method = aml_method("_OST", 3);
s = BASEPATH stringify(MEMORY_SLOT_OST_METHOD);
aml_append(method, aml_return(aml_call4(
s, aml_name("_UID"), aml_arg(0), aml_arg(1), aml_arg(2)
)));
aml_append(dev, method);
method = aml_method("_EJ0", 1);
s = BASEPATH stringify(MEMORY_SLOT_EJECT_METHOD);
aml_append(method, aml_return(aml_call2(
s, aml_name("_UID"), aml_arg(0))));
aml_append(dev, method);
aml_append(sb_scope, dev);
}
method = aml_method(stringify(MEMORY_SLOT_NOTIFY_METHOD), 2);
for (i = 0; i < nr_mem; i++) {
ifctx = aml_if(aml_equal(aml_arg(0), aml_int(i)));
aml_append(ifctx,
aml_notify(aml_name("MP%.02X", i), aml_arg(1))
);
aml_append(method, ifctx);
}
aml_append(sb_scope, method);
{
Object *pci_host;
PCIBus *bus = NULL;
pci_host = acpi_get_i386_pci_host();
if (pci_host) {
bus = PCI_HOST_BRIDGE(pci_host)->bus;
}
if (bus) {
Aml *scope = aml_scope("PCI0");
build_append_pci_bus_devices(scope, bus, pm->pcihp_bridge_en);
if (misc->tpm_version != TPM_VERSION_UNSPEC) {
dev = aml_device("ISA.TPM");
aml_append(dev, aml_name_decl("_HID", aml_eisaid("PNP0C31")));
aml_append(dev, aml_name_decl("_STA", aml_int(0xF)));
crs = aml_resource_template();
aml_append(crs, aml_memory32_fixed(TPM_TIS_ADDR_BASE,
TPM_TIS_ADDR_SIZE, AML_READ_WRITE));
aml_append(crs, aml_irq_no_flags(TPM_TIS_IRQ));
aml_append(dev, aml_name_decl("_CRS", crs));
aml_append(scope, dev);
}
aml_append(sb_scope, scope);
}
}
aml_append(ssdt, sb_scope);
}
g_array_append_vals(table_data, ssdt->buf->data, ssdt->buf->len);
build_header(linker, table_data,
(void *)(table_data->data + table_data->len - ssdt->buf->len),
"SSDT", ssdt->buf->len, 1);
free_aml_allocator();
}
| 1threat
|
CaptureVoiceOut *AUD_add_capture (
AudioState *s,
audsettings_t *as,
struct audio_capture_ops *ops,
void *cb_opaque
)
{
CaptureVoiceOut *cap;
struct capture_callback *cb;
if (!s) {
s = &glob_audio_state;
}
if (audio_validate_settings (as)) {
dolog ("Invalid settings were passed when trying to add capture\n");
audio_print_settings (as);
goto err0;
}
cb = audio_calloc (AUDIO_FUNC, 1, sizeof (*cb));
if (!cb) {
dolog ("Could not allocate capture callback information, size %zu\n",
sizeof (*cb));
goto err0;
}
cb->ops = *ops;
cb->opaque = cb_opaque;
cap = audio_pcm_capture_find_specific (s, as);
if (cap) {
LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
return cap;
}
else {
HWVoiceOut *hw;
CaptureVoiceOut *cap;
cap = audio_calloc (AUDIO_FUNC, 1, sizeof (*cap));
if (!cap) {
dolog ("Could not allocate capture voice, size %zu\n",
sizeof (*cap));
goto err1;
}
hw = &cap->hw;
LIST_INIT (&hw->sw_head);
LIST_INIT (&cap->cb_head);
hw->samples = 4096 * 4;
hw->mix_buf = audio_calloc (AUDIO_FUNC, hw->samples,
sizeof (st_sample_t));
if (!hw->mix_buf) {
dolog ("Could not allocate capture mix buffer (%d samples)\n",
hw->samples);
goto err2;
}
audio_pcm_init_info (&hw->info, as);
cap->buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift);
if (!cap->buf) {
dolog ("Could not allocate capture buffer "
"(%d samples, each %d bytes)\n",
hw->samples, 1 << hw->info.shift);
goto err3;
}
hw->clip = mixeng_clip
[hw->info.nchannels == 2]
[hw->info.sign]
[hw->info.swap_endianness]
[audio_bits_to_index (hw->info.bits)];
LIST_INSERT_HEAD (&s->cap_head, cap, entries);
LIST_INSERT_HEAD (&cap->cb_head, cb, entries);
hw = NULL;
while ((hw = audio_pcm_hw_find_any_out (s, hw))) {
audio_attach_capture (s, hw);
}
return cap;
err3:
qemu_free (cap->hw.mix_buf);
err2:
qemu_free (cap);
err1:
qemu_free (cb);
err0:
return NULL;
}
}
| 1threat
|
alert('Hello ' + user_input);
| 1threat
|
How to get response body with request.send() in dart : <p>I'm doing an api request uploading an image with</p>
<pre><code>var request = new http.MultipartRequest("POST", uri);
var response = await request.send()
</code></pre>
<p>in dart using flutter. I can then check the response code with for instance </p>
<pre><code>if (response.statusCode == 200) {
print('ok');
}
</code></pre>
<p>with other calls I can also get the response body with</p>
<pre><code>var result = response.body;
</code></pre>
<p>however when using request.send() I can't seem to find out how to get the response body result.</p>
<p>Any help or input is very much appreciated, thanks!</p>
| 0debug
|
static int decode_sequence_header(AVCodecContext *avctx, GetBitContext *gb)
{
VC9Context *v = avctx->priv_data;
v->profile = get_bits(gb, 2);
av_log(avctx, AV_LOG_DEBUG, "Profile: %i\n", v->profile);
#if HAS_ADVANCED_PROFILE
if (v->profile > PROFILE_MAIN)
{
v->level = get_bits(gb, 3);
v->chromaformat = get_bits(gb, 2);
if (v->chromaformat != 1)
{
av_log(avctx, AV_LOG_ERROR,
"Only 4:2:0 chroma format supported\n");
return -1;
}
}
else
#endif
{
v->res_sm = get_bits(gb, 2);
if (v->res_sm)
{
av_log(avctx, AV_LOG_ERROR,
"Reserved RES_SM=%i is forbidden\n", v->res_sm);
}
}
v->frmrtq_postproc = get_bits(gb, 3);
v->bitrtq_postproc = get_bits(gb, 5);
v->loopfilter = get_bits(gb, 1);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->res_x8 = get_bits(gb, 1);
if (v->res_x8)
{
av_log(avctx, AV_LOG_ERROR,
"1 for reserved RES_X8 is forbidden\n");
return -1;
}
v->multires = get_bits(gb, 1);
v->res_fasttx = get_bits(gb, 1);
if (!v->res_fasttx)
{
av_log(avctx, AV_LOG_ERROR,
"0 for reserved RES_FASTTX is forbidden\n");
}
}
v->fastuvmc = get_bits(gb, 1);
if (!v->profile && !v->fastuvmc)
{
av_log(avctx, AV_LOG_ERROR,
"FASTUVMC unavailable in Simple Profile\n");
return -1;
}
v->extended_mv = get_bits(gb, 1);
if (!v->profile && v->extended_mv)
{
av_log(avctx, AV_LOG_ERROR,
"Extended MVs unavailable in Simple Profile\n");
return -1;
}
v->dquant = get_bits(gb, 2);
v->vstransform = get_bits(gb, 1);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->res_transtab = get_bits(gb, 1);
if (v->res_transtab)
{
av_log(avctx, AV_LOG_ERROR,
"1 for reserved RES_TRANSTAB is forbidden\n");
return -1;
}
}
v->overlap = get_bits(gb, 1);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->syncmarker = get_bits(gb, 1);
v->rangered = get_bits(gb, 1);
}
avctx->max_b_frames = get_bits(gb, 3);
v->quantizer_mode = get_bits(gb, 2);
#if HAS_ADVANCED_PROFILE
if (v->profile <= PROFILE_MAIN)
#endif
{
v->finterpflag = get_bits(gb, 1);
v->res_rtm_flag = get_bits(gb, 1);
if (!v->res_rtm_flag)
{
av_log(avctx, AV_LOG_ERROR,
"0 for reserved RES_RTM_FLAG is forbidden\n");
}
#if TRACE
av_log(avctx, AV_LOG_INFO,
"Profile %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n"
"LoopFilter=%i, MultiRes=%i, FastUVMV=%i, Extended MV=%i\n"
"Rangered=%i, VSTransform=%i, Overlap=%i, SyncMarker=%i\n"
"DQuant=%i, Quantizer mode=%i, Max B frames=%i\n",
v->profile, v->frmrtq_postproc, v->bitrtq_postproc,
v->loopfilter, v->multires, v->fastuvmc, v->extended_mv,
v->rangered, v->vstransform, v->overlap, v->syncmarker,
v->dquant, v->quantizer_mode, avctx->max_b_frames
);
#endif
}
#if HAS_ADVANCED_PROFILE
else decode_advanced_sequence_header(avctx, gb);
#endif
}
| 1threat
|
JCO IDOC Server for multiple destinations : <p>I'm developing a IDOC server which can connect to multiple destinations on same SAP system(gateway host will be same) and receive IDocs. I'm not sure that I need multiple JCoServer instance running or single JCoServer with multiple destinations.</p>
<p>If latter is the case, why would there is a parameter to specify the destination name using <code>jco.server.repository_destination</code> property when providing the server data?</p>
| 0debug
|
static void dnxhd_decode_dct_block_10(const DNXHDContext *ctx,
RowContext *row, int n)
{
dnxhd_decode_dct_block(ctx, row, n, 6, 8, 4);
}
| 1threat
|
static av_always_inline void mpeg_motion_lowres(MpegEncContext *s,
uint8_t *dest_y,
uint8_t *dest_cb,
uint8_t *dest_cr,
int field_based,
int bottom_field,
int field_select,
uint8_t **ref_picture,
h264_chroma_mc_func *pix_op,
int motion_x, int motion_y,
int h, int mb_y)
{
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int mx, my, src_x, src_y, uvsrc_x, uvsrc_y, uvlinesize, linesize, sx, sy,
uvsx, uvsy;
const int lowres = s->avctx->lowres;
const int op_index = FFMIN(lowres-1+s->chroma_x_shift, 2);
const int block_s = 8>>lowres;
const int s_mask = (2 << lowres) - 1;
const int h_edge_pos = s->h_edge_pos >> lowres;
const int v_edge_pos = s->v_edge_pos >> lowres;
linesize = s->current_picture.f.linesize[0] << field_based;
uvlinesize = s->current_picture.f.linesize[1] << field_based;
if (s->quarter_sample) {
motion_x /= 2;
motion_y /= 2;
}
if(field_based){
motion_y += (bottom_field - field_select)*((1 << lowres)-1);
}
sx = motion_x & s_mask;
sy = motion_y & s_mask;
src_x = s->mb_x * 2 * block_s + (motion_x >> lowres + 1);
src_y = (mb_y * 2 * block_s >> field_based) + (motion_y >> lowres + 1);
if (s->out_format == FMT_H263) {
uvsx = ((motion_x >> 1) & s_mask) | (sx & 1);
uvsy = ((motion_y >> 1) & s_mask) | (sy & 1);
uvsrc_x = src_x >> 1;
uvsrc_y = src_y >> 1;
} else if (s->out_format == FMT_H261) {
mx = motion_x / 4;
my = motion_y / 4;
uvsx = (2 * mx) & s_mask;
uvsy = (2 * my) & s_mask;
uvsrc_x = s->mb_x * block_s + (mx >> lowres);
uvsrc_y = mb_y * block_s + (my >> lowres);
} else {
if(s->chroma_y_shift){
mx = motion_x / 2;
my = motion_y / 2;
uvsx = mx & s_mask;
uvsy = my & s_mask;
uvsrc_x = s->mb_x * block_s + (mx >> lowres + 1);
uvsrc_y = (mb_y * block_s >> field_based) + (my >> lowres + 1);
} else {
if(s->chroma_x_shift){
mx = motion_x / 2;
uvsx = mx & s_mask;
uvsy = motion_y & s_mask;
uvsrc_y = src_y;
uvsrc_x = s->mb_x*block_s + (mx >> (lowres+1));
} else {
uvsx = motion_x & s_mask;
uvsy = motion_y & s_mask;
uvsrc_x = src_x;
uvsrc_y = src_y;
}
}
}
ptr_y = ref_picture[0] + src_y * linesize + src_x;
ptr_cb = ref_picture[1] + uvsrc_y * uvlinesize + uvsrc_x;
ptr_cr = ref_picture[2] + uvsrc_y * uvlinesize + uvsrc_x;
if ((unsigned) src_x > FFMAX( h_edge_pos - (!!sx) - 2 * block_s, 0) || uvsrc_y<0 ||
(unsigned) src_y > FFMAX((v_edge_pos >> field_based) - (!!sy) - h, 0)) {
s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y,
linesize >> field_based, 17, 17 + field_based,
src_x, src_y << field_based, h_edge_pos,
v_edge_pos);
ptr_y = s->edge_emu_buffer;
if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
uint8_t *uvbuf = s->edge_emu_buffer + 18 * s->linesize;
s->vdsp.emulated_edge_mc(uvbuf , ptr_cb, uvlinesize >> field_based, 9,
9 + field_based,
uvsrc_x, uvsrc_y << field_based,
h_edge_pos >> 1, v_edge_pos >> 1);
s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, uvlinesize >> field_based, 9,
9 + field_based,
uvsrc_x, uvsrc_y << field_based,
h_edge_pos >> 1, v_edge_pos >> 1);
ptr_cb = uvbuf;
ptr_cr = uvbuf + 16;
}
}
if (bottom_field) {
dest_y += s->linesize;
dest_cb += s->uvlinesize;
dest_cr += s->uvlinesize;
}
if (field_select) {
ptr_y += s->linesize;
ptr_cb += s->uvlinesize;
ptr_cr += s->uvlinesize;
}
sx = (sx << 2) >> lowres;
sy = (sy << 2) >> lowres;
pix_op[lowres - 1](dest_y, ptr_y, linesize, h, sx, sy);
if (!CONFIG_GRAY || !(s->flags & CODEC_FLAG_GRAY)) {
int hc = s->chroma_y_shift ? (h+1-bottom_field)>>1 : h;
uvsx = (uvsx << 2) >> lowres;
uvsy = (uvsy << 2) >> lowres;
if (hc) {
pix_op[op_index](dest_cb, ptr_cb, uvlinesize, hc, uvsx, uvsy);
pix_op[op_index](dest_cr, ptr_cr, uvlinesize, hc, uvsx, uvsy);
}
}
}
| 1threat
|
Using name of php variable in function : <p>This may seem like a very dumb question, but I don't know if it's possible. I'm trying to write a function as follows:</p>
<pre><code>function checkDuplicates($input) {
$result = pg_query('SELECT username FROM accounts WHERE LOWER(username)=\''.strtolower(pg_escape_string($input)).'\'') or exit(pg_last_error());
}
</code></pre>
<p>and I want to replace "username" with the name of the variable being passed in. For example, if I called <code>checkDuplicates($email)</code>, I want essentially the following function to be called:</p>
<pre><code>function checkDuplicates($email) {
$result = pg_query('SELECT email FROM accounts WHERE LOWER(email)=\''.strtolower(pg_escape_string($email)).'\'') or exit(pg_last_error());
}
</code></pre>
<p>Is there any way to do this?</p>
| 0debug
|
How do I get a double c pointer in rust? : How do I make the equivalent code in Rust?
I'm trying to learn Rust, then I started to porting C code to Rust, but I'm confused about how things work in Rust.
typedef struct Room {
int xPos;
int yPos;
} Room;
void main (){
Room **rooms;
rooms = malloc(sizeof(Room)*8);
}
| 0debug
|
Does anyone know why my code is not filtering is still printing everything in the columns rather than what it should be filtering by? : This is my first post on here, so please excuse any errors in my posting.
Here is an image of my code. I am trying to filter and print this data, but when the script runs it prints all of the column headers which is what I don't want. Any tips?
Thanks so much.
[1]: https://i.stack.imgur.com/KyOcq.png
| 0debug
|
Code Working Perfectly In Java CRASHES In Android Studio : I am new to android programming and am trying to the program to run but the problem is that the app builds and runs successfully but crashes whenever I press the GO button. My professor gave me this to accomplish as something to get started with android programming as he thought it would be challenging task that will be motivational and interesting. I looked everywhere for the solution but could not find it. My professor himself is unable to debug the code and hence.
The code is as given below :
**CODE 1**
package com.example.thispc.myapplication;
import android.annotation.SuppressLint;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.EditText;
import java.util.Scanner;
import edu.princeton.cs.algs4.EdgeWeightedDigraph;
import edu.princeton.cs.algs4.DirectedEdge;
import edu.princeton.cs.algs4.BellmanFordSP;
public class Arbitrage extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_arbitrage);
Button Check_Arbitrage = findViewById(R.id.Check_Arbitrage);
Check_Arbitrage.setOnClickListener(new View.OnClickListener() {
@SuppressLint("SetTextI18n")
@Override
public void onClick(View view) {
EditText inputcurrencynumber;
EditText inputdata;
TextView outputarbitrage;
inputcurrencynumber = findViewById(R.id.GetNoCurrencies);
inputdata = findViewById(R.id.currency_table_input);
outputarbitrage = findViewById(R.id.result);
inputcurrencynumber = findViewById(R.id.GetNoCurrencies);
int V;
V = Integer.parseInt(inputcurrencynumber.getText().toString());
outputarbitrage = findViewById(R.id.result);
double rate,stake;
inputdata = findViewById(R.id.currency_table_input);
EdgeWeightedDigraph G = new EdgeWeightedDigraph(V);
outputarbitrage.setText("Hello World");
String [] name = new String[V];
// The error occures here when i try to take an input
for (int v = 0; v < V ; v++)
{`enter code here`
name[v] = inputdata.getText().toString();
for (int w = 0; w < V ; w++)
{
rate = Double.parseDouble(inputdata.getText().toString());
DirectedEdge e = new DirectedEdge(v, w, -Math.log(rate));
G.addEdge(e);
}
}
BellmanFordSP spt = new BellmanFordSP(G,0);
if (spt.hasNegativeCycle())
{
stake = 1000;
for (DirectedEdge e : spt.negativeCycle())
{
//outputarbitrage.setText((Double.toString(stake) + name[e.from()]) + " " + (Double.toString(stake) + name[e.to()]) + "\n");
outputarbitrage.setText("%10.5f %s " + stake + name[e.from()]);
stake = stake * Math.exp(-e.weight());
outputarbitrage.setText("= %10.5f %s\n" + stake + name[e.to()]);
}
}
else
{
outputarbitrage.setText("No Arbitrage Opportunity Found");
}
}
});
}
}
Thanks
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.