problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
Configuring AppSettings with ASP.Net Core on Azure Web App for Containers: Whither Colons? : <p>Consider this <code>appsettings.json</code>:</p>
<pre><code>{
"Parent": {
"ChildOne": "C1 from secrets.json",
"ChildTwo": "C2 from secrets.json"
}
}
</code></pre>
<p>According to Microsoft (<a href="https://blogs.msdn.microsoft.com/waws/2018/06/12/asp-net-core-settings-for-azure-app-service/" rel="noreferrer">https://blogs.msdn.microsoft.com/waws/2018/06/12/asp-net-core-settings-for-azure-app-service/</a>), if an app using this config was deployed to an AppService in Azure, the config could be overwritten by creating Application settings in Azure in the style <code>Parent:ChildOne</code> / <code>Parent:ChildTwo</code>. To be clear: using colons to target a specific piece of config.</p>
<p>This works just fine with a standard AppService:</p>
<p><a href="https://i.stack.imgur.com/5oJV3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5oJV3.png" alt="Colons are fine on an Azure App Service"></a></p>
<p>However, if you're using Web App for Containers / i.e. a Docker image deployed to an Azure App Service on Linux (<a href="https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-intro" rel="noreferrer">https://docs.microsoft.com/en-us/azure/app-service/containers/app-service-linux-intro</a>) you <strong>cannot</strong> use colons:</p>
<p><a href="https://i.stack.imgur.com/Vto0Q.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Vto0Q.png" alt="Colons are not fine on Azure App Service for Linux"></a></p>
<p>Why?</p>
<p>When you hover over the error you see this message: <code>This field can only contain letters, numbers (0-9), periods ("."), and underscores ("_")</code>. Using <code>.</code> does not work alas. </p>
<p>How do you configure say <code>Parent:ChildOne</code> in Azure? <code>Parent.ChildOne</code> does not work. Can anyone advise? I can't find any docs on this....</p>
| 0debug
|
def sort_tuple(tup):
lst = len(tup)
for i in range(0, lst):
for j in range(0, lst-i-1):
if (tup[j][-1] > tup[j + 1][-1]):
temp = tup[j]
tup[j]= tup[j + 1]
tup[j + 1]= temp
return tup
| 0debug
|
Typescript in vue - Property 'validate' does not exist on type 'Vue | Element | Vue[] | Element[]'. : <p>I created <code>v-form</code> like this</p>
<pre><code><v-form ref="form" v-model="valid" lazy-validation>
...
<v-btn
:disabled="!valid"
@click="submit"
>
submit
</v-btn>
</v-form>
</code></pre>
<p>script:</p>
<pre><code>if (this.$refs.form.validate()) // Error is in here
</code></pre>
<p>If i just <code>console.log(this.$ref.form)</code> the validate() function is available. But why this error is coming while building?</p>
| 0debug
|
Is it possible to write a multi-database query with PHPMyAdmin? : <p>I need to create a query which connects to different databases with different users. Every database has its own user.</p>
<p>Can I achieve this with PHPMyAdmin?</p>
| 0debug
|
import math
def sum_series(number):
total = 0
total = math.pow((number * (number + 1)) /2, 2)
return total
| 0debug
|
Json parsing in Ansible : <p>I have to parse the output of the following command:</p>
<pre><code>mongo <dbname> --eval "db.isMaster()"
</code></pre>
<p>which gives output as follows:</p>
<pre><code> {
"hosts" : [
"xxx:<port>",
"xxx:<port>",
"xxx:<port>"
],
"setName" : "xxx",
"setVersion" : xxx,
"ismaster" : true,
"secondary" : false,
"primary" : "xxx",
"me" : "xxx",
"electionId" : ObjectId("xxxx"),
"maxBsonObjectSize" : xxx,
"maxMessageSizeBytes" : xxxx,
"maxWriteBatchSize" : xxx,
"localTime" : ISODate("xxx"),
"maxWireVersion" : 4,
"minWireVersion" : 0,
"ok" : 1
}
</code></pre>
<p>I need to parse the above output to check the value of "ismaster" is true. Please let me know how i can do this in ansible.</p>
<p>At the moment i am simply checking that the text "ismaster" : true is shown in the output using the following code:</p>
<pre><code> tasks:
- name: Check if the mongo node is primary
shell: mongo <dbname> --eval "db.isMaster()"
register: output_text
- name: Run command on master
shell: <command to execute>
when: "'\"ismaster\\\" : true,' in output_text.stdout"
</code></pre>
<p>However it would be nice to use Ansible's json processing to check the same. Please advise.</p>
| 0debug
|
uint8_t sd_read_data(SDState *sd)
{
uint8_t ret;
int io_len;
if (!sd->blk || !blk_is_inserted(sd->blk) || !sd->enable)
return 0x00;
if (sd->state != sd_sendingdata_state) {
qemu_log_mask(LOG_GUEST_ERROR,
"sd_read_data: not in Sending-Data state\n");
return 0x00;
}
if (sd->card_status & (ADDRESS_ERROR | WP_VIOLATION))
return 0x00;
io_len = (sd->ocr & (1 << 30)) ? 512 : sd->blk_len;
switch (sd->current_cmd) {
case 6:
ret = sd->data[sd->data_offset ++];
if (sd->data_offset >= 64)
sd->state = sd_transfer_state;
break;
case 9:
case 10:
ret = sd->data[sd->data_offset ++];
if (sd->data_offset >= 16)
sd->state = sd_transfer_state;
break;
case 11:
if (sd->data_offset == 0)
BLK_READ_BLOCK(sd->data_start, io_len);
ret = sd->data[sd->data_offset ++];
if (sd->data_offset >= io_len) {
sd->data_start += io_len;
sd->data_offset = 0;
if (sd->data_start + io_len > sd->size) {
sd->card_status |= ADDRESS_ERROR;
break;
}
}
break;
case 13:
ret = sd->sd_status[sd->data_offset ++];
if (sd->data_offset >= sizeof(sd->sd_status))
sd->state = sd_transfer_state;
break;
case 17:
if (sd->data_offset == 0)
BLK_READ_BLOCK(sd->data_start, io_len);
ret = sd->data[sd->data_offset ++];
if (sd->data_offset >= io_len)
sd->state = sd_transfer_state;
break;
case 18:
if (sd->data_offset == 0)
BLK_READ_BLOCK(sd->data_start, io_len);
ret = sd->data[sd->data_offset ++];
if (sd->data_offset >= io_len) {
sd->data_start += io_len;
sd->data_offset = 0;
if (sd->multi_blk_cnt != 0) {
if (--sd->multi_blk_cnt == 0) {
sd->state = sd_transfer_state;
break;
}
}
if (sd->data_start + io_len > sd->size) {
sd->card_status |= ADDRESS_ERROR;
break;
}
}
break;
case 22:
ret = sd->data[sd->data_offset ++];
if (sd->data_offset >= 4)
sd->state = sd_transfer_state;
break;
case 30:
ret = sd->data[sd->data_offset ++];
if (sd->data_offset >= 4)
sd->state = sd_transfer_state;
break;
case 51:
ret = sd->scr[sd->data_offset ++];
if (sd->data_offset >= sizeof(sd->scr))
sd->state = sd_transfer_state;
break;
case 56:
if (sd->data_offset == 0)
APP_READ_BLOCK(sd->data_start, sd->blk_len);
ret = sd->data[sd->data_offset ++];
if (sd->data_offset >= sd->blk_len)
sd->state = sd_transfer_state;
break;
default:
qemu_log_mask(LOG_GUEST_ERROR, "sd_read_data: unknown command\n");
return 0x00;
}
return ret;
}
| 1threat
|
How to map json object to array list in Javascript : <p>Hi I have json object data from ajax as below.</p>
<pre><code>var history= [
{ date: '12/1/2011', open: 3, high: 5,low: 2, close:4 },
{ date: '12/2/2011', open: 4, high: 6,low: 3, close:5 },
{ date: '12/3/2011', open: 3, high: 5,low: 2, close:3 }
];
</code></pre>
<p>I would like to map only stock data to array list as below.</p>
<pre><code>[
[3,5,2,4],
[4,6,3,5],
[3,5,2,3]
]
</code></pre>
<p>Prefer use the map method (data.map(function(a)). Any advise or guidance would be greatly appreciated, Thanks</p>
| 0debug
|
static void qmp_cleanup(void *datap)
{
QmpSerializeData *d = datap;
visit_free(qmp_output_get_visitor(d->qov));
visit_free(d->qiv);
g_free(d);
}
| 1threat
|
static void vnc_dpy_update(DisplayChangeListener *dcl,
int x, int y, int w, int h)
{
VncDisplay *vd = container_of(dcl, VncDisplay, dcl);
struct VncSurface *s = &vd->guest;
int width = surface_width(vd->ds);
int height = surface_height(vd->ds);
w += (x % VNC_DIRTY_PIXELS_PER_BIT);
x -= (x % VNC_DIRTY_PIXELS_PER_BIT);
x = MIN(x, width);
y = MIN(y, height);
w = MIN(x + w, width) - x;
h = MIN(y + h, height);
for (; y < h; y++) {
bitmap_set(s->dirty[y], x / VNC_DIRTY_PIXELS_PER_BIT,
DIV_ROUND_UP(w, VNC_DIRTY_PIXELS_PER_BIT));
}
}
| 1threat
|
S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
{
S390PCIBusDevice *pbdev;
int i;
int j = 0;
S390pciState *s = S390_PCI_HOST_BRIDGE(
object_resolve_path(TYPE_S390_PCI_HOST_BRIDGE, NULL));
if (!s) {
return NULL;
}
for (i = 0; i < PCI_SLOT_MAX; i++) {
pbdev = &s->pbdev[i];
if (pbdev->fh == 0) {
continue;
}
if (j == idx) {
return pbdev;
}
j++;
}
return NULL;
}
| 1threat
|
how do I decode md5 passwordencode data in spring : <p>I am new in java and spring .I used Md5PasswordEncoder for password encoding.how can i decode it.</p>
<p>My encoding code is </p>
<pre><code> Md5PasswordEncoder md5PasswordEncoder = new Md5PasswordEncoder();
String monthlycost = md5PasswordEncoder.encodePassword(
empDetails.getMonthlyCost(), null);
String monthlyGrossSalary = md5PasswordEncoder.encodePassword(
empDetails.getMonthlyGrossSalary(), null);
</code></pre>
<p>please help me for decoding it</p>
| 0debug
|
static int ac3_probe(AVProbeData *p)
{
int max_frames, first_frames, frames;
uint8_t *buf, *buf2, *end;
AC3HeaderInfo hdr;
if(p->buf_size < 7)
return 0;
max_frames = 0;
buf = p->buf;
end = buf + FFMIN(4096, p->buf_size - 7);
for(; buf < end; buf++) {
buf2 = buf;
for(frames = 0; buf2 < end; frames++) {
if(ff_ac3_parse_header(buf2, &hdr) < 0)
break;
buf2 += hdr.frame_size;
}
max_frames = FFMAX(max_frames, frames);
if(buf == p->buf)
first_frames = frames;
}
if (first_frames>=3) return AVPROBE_SCORE_MAX * 3 / 4;
else if(max_frames>=3) return AVPROBE_SCORE_MAX / 2;
else if(max_frames>=1) return 1;
else return 0;
}
| 1threat
|
static void vapic_map_rom_writable(VAPICROMState *s)
{
hwaddr rom_paddr = s->rom_state_paddr & ROM_BLOCK_MASK;
MemoryRegionSection section;
MemoryRegion *as;
size_t rom_size;
uint8_t *ram;
as = sysbus_address_space(&s->busdev);
if (s->rom_mapped_writable) {
memory_region_del_subregion(as, &s->rom);
memory_region_destroy(&s->rom);
}
section = memory_region_find(as, 0, 1);
ram = memory_region_get_ram_ptr(section.mr);
rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
s->rom_size = rom_size;
rom_size += rom_paddr & ~TARGET_PAGE_MASK;
rom_paddr &= TARGET_PAGE_MASK;
rom_size = TARGET_PAGE_ALIGN(rom_size);
memory_region_init_alias(&s->rom, OBJECT(s), "kvmvapic-rom", section.mr,
rom_paddr, rom_size);
memory_region_add_subregion_overlap(as, rom_paddr, &s->rom, 1000);
s->rom_mapped_writable = true;
memory_region_unref(section.mr);
}
| 1threat
|
static inline int check_physical(CPUPPCState *env, mmu_ctx_t *ctx,
target_ulong eaddr, int rw)
{
int in_plb, ret;
ctx->raddr = eaddr;
ctx->prot = PAGE_READ | PAGE_EXEC;
ret = 0;
switch (env->mmu_model) {
case POWERPC_MMU_32B:
case POWERPC_MMU_601:
case POWERPC_MMU_SOFT_6xx:
case POWERPC_MMU_SOFT_74xx:
case POWERPC_MMU_SOFT_4xx:
case POWERPC_MMU_REAL:
case POWERPC_MMU_BOOKE:
ctx->prot |= PAGE_WRITE;
break;
#if defined(TARGET_PPC64)
case POWERPC_MMU_64B:
case POWERPC_MMU_2_06:
case POWERPC_MMU_2_06d:
ctx->raddr &= 0x0FFFFFFFFFFFFFFFULL;
ctx->prot |= PAGE_WRITE;
break;
#endif
case POWERPC_MMU_SOFT_4xx_Z:
if (unlikely(msr_pe != 0)) {
in_plb =
(env->pb[0] < env->pb[1] &&
eaddr >= env->pb[0] && eaddr < env->pb[1]) ||
(env->pb[2] < env->pb[3] &&
eaddr >= env->pb[2] && eaddr < env->pb[3]) ? 1 : 0;
if (in_plb ^ msr_px) {
if (rw == 1) {
ret = -2;
}
} else {
ctx->prot |= PAGE_WRITE;
}
}
break;
case POWERPC_MMU_MPC8xx:
cpu_abort(env, "MPC8xx MMU model is not implemented\n");
break;
case POWERPC_MMU_BOOKE206:
cpu_abort(env, "BookE 2.06 MMU doesn't have physical real mode\n");
break;
default:
cpu_abort(env, "Unknown or invalid MMU model\n");
return -1;
}
return ret;
}
| 1threat
|
How can I view Threads window in Visual studio? : <p>In visual studio, it should be in Debug> Windows> Threads.
But mine doesn't have it!</p>
<p><a href="https://i.stack.imgur.com/YyLU6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YyLU6.png" alt="enter image description here"></a></p>
| 0debug
|
Java Generics casts strangely : <p>I am using java 8.</p>
<p>I recently came across this:</p>
<pre><code>public class Test {
public static void main(String[] args) {
String ss = "" + (Test.<Integer>abc(2));
System.out.println(Test.<Integer>abc(2));
}
public static <T> T abc(T a) {
String s = "adsa";
return (T) s;
}
}
</code></pre>
<p>This does not throw a java.lang.ClassCastException. Why is that?</p>
<p>I always thought <code>+</code> and <code>System.out.println</code> calls <code>toString</code>. But when I try to do that it throws an Exception as expected.</p>
<pre><code>String sss = (Test.<Integer>abc(2)).toString();
</code></pre>
| 0debug
|
static int lut2_config_output(AVFilterLink *outlink)
{
AVFilterContext *ctx = outlink->src;
LUT2Context *s = ctx->priv;
AVFilterLink *srcx = ctx->inputs[0];
AVFilterLink *srcy = ctx->inputs[1];
FFFrameSyncIn *in;
int ret;
if (srcx->format != srcy->format) {
av_log(ctx, AV_LOG_ERROR, "inputs must be of same pixel format\n");
return AVERROR(EINVAL);
}
if (srcx->w != srcy->w ||
srcx->h != srcy->h ||
srcx->sample_aspect_ratio.num != srcy->sample_aspect_ratio.num ||
srcx->sample_aspect_ratio.den != srcy->sample_aspect_ratio.den) {
av_log(ctx, AV_LOG_ERROR, "First input link %s parameters "
"(size %dx%d, SAR %d:%d) do not match the corresponding "
"second input link %s parameters (%dx%d, SAR %d:%d)\n",
ctx->input_pads[0].name, srcx->w, srcx->h,
srcx->sample_aspect_ratio.num,
srcx->sample_aspect_ratio.den,
ctx->input_pads[1].name,
srcy->w, srcy->h,
srcy->sample_aspect_ratio.num,
srcy->sample_aspect_ratio.den);
return AVERROR(EINVAL);
}
outlink->w = srcx->w;
outlink->h = srcx->h;
outlink->time_base = srcx->time_base;
outlink->sample_aspect_ratio = srcx->sample_aspect_ratio;
outlink->frame_rate = srcx->frame_rate;
if ((ret = ff_framesync2_init(&s->fs, ctx, 2)) < 0)
return ret;
in = s->fs.in;
in[0].time_base = srcx->time_base;
in[1].time_base = srcy->time_base;
in[0].sync = 1;
in[0].before = EXT_STOP;
in[0].after = EXT_INFINITY;
in[1].sync = 1;
in[1].before = EXT_STOP;
in[1].after = EXT_INFINITY;
s->fs.opaque = s;
s->fs.on_event = process_frame;
if ((ret = config_output(outlink)) < 0)
return ret;
return ff_framesync2_configure(&s->fs);
}
| 1threat
|
Pass a URL as a get parameter in php : <pre><code> http://example.com/geturl.php?url=http://example.org/index.php?parafile=1698%3A1562%3A0%3A0&para_action=print_ticket&parafile=dance://here.kodas/print&token=3ec2b0d3e6e0ca152bc024cc3f30f16c
</code></pre>
<p>So i want each of this parameters in a different varaible in the geturl.php file. I am using the regular get url </p>
| 0debug
|
TypeError: db.collection is not a function : <p>I am trying to post data to database that I have created on mLab and I am getting this error but I don't know whats going wrong.I also have read previously asked question on this topic but I am not able to solve my error as I am new to this. So here I am posting the code which I am trying to implement and It is taken from this tutorial <a href="https://medium.freecodecamp.com/building-a-simple-node-js-api-in-under-30-minutes-a07ea9e390d2" rel="noreferrer">https://medium.freecodecamp.com/building-a-simple-node-js-api-in-under-30-minutes-a07ea9e390d2</a>. </p>
<p>server.js</p>
<pre><code>const express = require('express');
const MongoClient = require('mongodb').MongoClient;
const bodyParser = require('body-parser');
const db = require('./config/db');
const app = express();
const port = 8000;
app.use(bodyParser.urlencoded({extened:true}));
MongoClient.connect(db.url,(err,database) =>{
if (err) return console.log(err)
require('./app/routes')(app,{});
app.listen(port,() => {
console.log("We are live on"+port);
});
})
</code></pre>
<p>db.js </p>
<pre><code>module.exports = {
url : "mongodb://JayTanna:Jay12345@ds147510.mlab.com:47510/testing"
};
</code></pre>
<p>index.js </p>
<pre><code>const noteroutes = require('./note_routes');
module.exports = function(app,db)
{
noteroutes(app,db);
};
</code></pre>
<p>note_routes.js</p>
<pre><code>module.exports = function(app, db) {
app.post('/notes', (req, res) => {
const note = { text: req.body.body, title: req.body.title };
db.collection('notes').insert(note, (err, result) => {
if (err) {
res.send({ 'error': 'An error has occurred' });
} else {
res.send(result.ops[0]);
}
});
});
};
</code></pre>
| 0debug
|
Error print function python "INVALID: Syntax" : <p>Hello I have an error with the code below. I am trying to print "Bus num: "busnum. busnum is data taken from a excel sheet. Can someone explain to me why this invalid syntax as well as ways to improve to that part of the code?</p>
<pre><code> for busnum,change in busses_in_year[location]:
print('Bus #: 'busnum)
</code></pre>
| 0debug
|
Difference between "from x.y import z" and "import x.y.z as z" : <p>In situations where you want to import a nested module into your namespace, I've always written it like this:</p>
<pre class="lang-py prettyprint-override"><code>from concurrent import futures
</code></pre>
<p>However, I recently realized that this can be expressed using the "as" syntax as well. See the following:</p>
<pre class="lang-py prettyprint-override"><code>import concurrent.futures as futures
</code></pre>
<p>Which has the subjective advantage of looking more similar to other imports:</p>
<pre class="lang-py prettyprint-override"><code>import sys
import os
import concurrent.futures as futures
</code></pre>
<p>... with the disadvantage of added verbosity.</p>
<p>Is there a functional difference between the two, or is one officially preferred in a PEP or otherwise?</p>
| 0debug
|
Rotation of an array . Need suggestions with the code : THIS IS A C++ CODE AND I FEEL ITS CORRECT ,YET IT DOESN'T WORK.I WILL EXPLAIN A BIT FOR UNDERSTANDING , //int t IS FOR NO OF TRIES. //int n IS for size of array. //int k is for no of rotation. INPUT 1 2 3 4 5 and if k=2 then OUTPUT 4 5 1 2 3. // PLEASE ADVICE ON THE SAME.
enter code here
#include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
int n;
int k;
int s=0;
int a[1000];
int b[1000];
for(int i=0;i<t;i++)
{
cin>>n;
cin>>k;
for(int j=0;j<n;j++)
{
cin>>a[j];
cout<<" ";
}
for(int y=0;y<n;y++)
{
b[y+k]=a[y];
if(y+k>=n)
{
b[s]=a[y];
s++;
}
cout<<b[y]<<" ";
}
}
return 0;
}
| 0debug
|
find object in in array of objects : <p>Hi want to search in this array of objects. This Objects can have childrean with array of objects. These is really difficult to find a logic to find a object. I tried it with.</p>
<pre><code> let obj = DATA.children.find(o => o.size === 4461)
</code></pre>
<p>This looks only in the first layer. I want to look in the whole object.
Have somebody an idea? Maybe there is an easy solution?
Example Object:</p>
<pre><code>let DATA = {
"name": "flare",
"children": [{
"name": "analytics",
"children": [{
"name": "cluster",
"children": [{
"name": "AgglomerativeCluster",
"size": 3938
}, {
"name": "CommunityStructure",
"size": 3812
}, {
"name": "HierarchicalCluster",
"size": 6714
}, {
"name": "MergeEdge",
"size": 743
}]
}, {
"name": "graph",
"children": [{
"name": "BetweennessCentrality",
"size": 3534
}, {
"name": "LinkDistance",
"size": 5731
}, {
"name": "MaxFlowMinCut",
"size": 7840
}, {
"name": "ShortestPaths",
"size": 5914
}, {
"name": "SpanningTree",
"size": 3416
}]
}, {
"name": "optimization",
"children": [{
"name": "AspectRatioBanker",
"size": 7074
}]
}]
}, {
"name": "animate",
"children": [{
"name": "Easing",
"size": 17010
}, {
"name": "FunctionSequence",
"size": 5842
}, {
"name": "interpolate",
"children": [{
"name": "ArrayInterpolator",
"size": 1983
}, {
"name": "ColorInterpolator",
"size": 2047
}, {
"name": "DateInterpolator",
"size": 1375
}, {
"name": "Interpolator",
"size": 8746
}, {
"name": "MatrixInterpolator",
"size": 2202
}, {
"name": "NumberInterpolator",
"size": 1382
}, {
"name": "ObjectInterpolator",
"size": 1629
}, {
"name": "PointInterpolator",
"size": 1675
}, {
"name": "RectangleInterpolator",
"size": 2042
}]
}, {
"name": "ISchedulable",
"size": 1041
}, {
"name": "Parallel",
"size": 5176
}, {
"name": "Pause",
"size": 449
}, {
"name": "Scheduler",
"size": 5593
}, {
"name": "Sequence",
"size": 5534
}, {
"name": "Transition",
"size": 9201
}, {
"name": "Transitioner",
"size": 19975
}, {
"name": "TransitionEvent",
"size": 1116
}, {
"name": "Tween",
"size": 6006
}]
}, {
"name": "data",
"children": [{
"name": "converters",
"children": [{
"name": "Converters",
"size": 721
}, {
"name": "DelimitedTextConverter",
"size": 4294
}, {
"name": "GraphMLConverter",
"size": 9800
}, {
"name": "IDataConverter",
"size": 1314
}, {
"name": "JSONConverter",
"size": 2220
}]
}, {
"name": "DataField",
"size": 1759
}, {
"name": "DataSchema",
"size": 2165
}, {
"name": "DataSet",
"size": 586
}, {
"name": "DataSource",
"size": 3331
}, {
"name": "DataTable",
"size": 772
}, {
"name": "DataUtil",
"size": 3322
}]
}, {
"name": "display",
"children": [{
"name": "DirtySprite",
"size": 8833
}, {
"name": "LineSprite",
"size": 1732
}, {
"name": "RectSprite",
"size": 3623
}, {
"name": "TextSprite",
"size": 10066
}]
}, {
"name": "flex",
"children": [{
"name": "FlareVis",
"size": 4116
}]
}, {
"name": "physics",
"children": [{
"name": "DragForce",
"size": 1082
}, {
"name": "GravityForce",
"size": 1336
}, {
"name": "IForce",
"size": 319
}, {
"name": "NBodyForce",
"size": 10498
}, {
"name": "Particle",
"size": 2822
}, {
"name": "Simulation",
"size": 9983
}, {
"name": "Spring",
"size": 2213
}, {
"name": "SpringForce",
"size": 1681
}]
}, {
"name": "query",
"children": [{
"name": "AggregateExpression",
"size": 1616
}, {
"name": "And",
"size": 1027
}, {
"name": "Arithmetic",
"size": 3891
}, {
"name": "Average",
"size": 891
}, {
"name": "BinaryExpression",
"size": 2893
}, {
"name": "Comparison",
"size": 5103
}, {
"name": "CompositeExpression",
"size": 3677
}, {
"name": "Count",
"size": 781
}, {
"name": "DateUtil",
"size": 4141
}, {
"name": "Distinct",
"size": 933
}, {
"name": "Expression",
"size": 5130
}, {
"name": "ExpressionIterator",
"size": 3617
}, {
"name": "Fn",
"size": 3240
}, {
"name": "If",
"size": 2732
}, {
"name": "IsA",
"size": 2039
}, {
"name": "Literal",
"size": 1214
}, {
"name": "Match",
"size": 3748
}, {
"name": "Maximum",
"size": 843
}, {
"name": "methods",
"children": [{
"name": "add",
"size": 593
}, {
"name": "and",
"size": 330
}, {
"name": "average",
"size": 287
}, {
"name": "count",
"size": 277
}, {
"name": "distinct",
"size": 292
}, {
"name": "div",
"size": 595
}, {
"name": "eq",
"size": 594
}, {
"name": "fn",
"size": 460
}, {
"name": "gt",
"size": 603
}, {
"name": "gte",
"size": 625
}, {
"name": "iff",
"size": 748
}, {
"name": "isa",
"size": 461
}, {
"name": "lt",
"size": 597
}, {
"name": "lte",
"size": 619
}, {
"name": "max",
"size": 283
}, {
"name": "min",
"size": 283
}, {
"name": "mod",
"size": 591
}, {
"name": "mul",
"size": 603
}, {
"name": "neq",
"size": 599
}, {
"name": "not",
"size": 386
}, {
"name": "or",
"size": 323
}, {
"name": "orderby",
"size": 307
}, {
"name": "range",
"size": 772
}, {
"name": "select",
"size": 296
}, {
"name": "stddev",
"size": 363
}, {
"name": "sub",
"size": 600
}, {
"name": "sum",
"size": 280
}, {
"name": "update",
"size": 307
}, {
"name": "variance",
"size": 335
}, {
"name": "where",
"size": 299
}, {
"name": "xor",
"size": 354
}, {
"name": "_",
"size": 264
}]
}, {
"name": "Minimum",
"size": 843
}, {
"name": "Not",
"size": 1554
}, {
"name": "Or",
"size": 970
}, {
"name": "Query",
"size": 13896
}, {
"name": "Range",
"size": 1594
}, {
"name": "StringUtil",
"size": 4130
}, {
"name": "Sum",
"size": 791
}, {
"name": "Variable",
"size": 1124
}, {
"name": "Variance",
"size": 1876
}, {
"name": "Xor",
"size": 1101
}]
}, {
"name": "scale",
"children": [{
"name": "IScaleMap",
"size": 2105
}, {
"name": "LinearScale",
"size": 1316
}, {
"name": "LogScale",
"size": 3151
}, {
"name": "OrdinalScale",
"size": 3770
}, {
"name": "QuantileScale",
"size": 2435
}, {
"name": "QuantitativeScale",
"size": 4839
}, {
"name": "dataScale",
"size": 1756
}, {
"name": "Scale",
"size": 4268
}, {
"name": "ScaleType",
"size": 1821
}, {
"name": "TimeScale",
"size": 5833
}]
}, {
"name": "util",
"children": [{
"name": "Arrays",
"size": 8258
}, {
"name": "Colors",
"size": 10001
}, {
"name": "Dates",
"size": 8217
}, {
"name": "Displays",
"size": 12555
}, {
"name": "Filter",
"size": 2324
}, {
"name": "Geometry",
"size": 10993
}, {
"name": "heap",
"children": [{
"name": "FibonacciHeap",
"size": 9354
}, {
"name": "HeapNode",
"size": 1233
}]
}, {
"name": "IEvaluable",
"size": 335
}, {
"name": "IPredicate",
"size": 383
}, {
"name": "IValueProxy",
"size": 874
}, {
"name": "math",
"children": [{
"name": "DenseMatrix",
"size": 3165
}, {
"name": "IMatrix",
"size": 2815
}, {
"name": "SparseMatrix",
"size": 3366
}]
}, {
"name": "Maths",
"size": 17705
}, {
"name": "Orientation",
"size": 1486
}, {
"name": "palette",
"children": [{
"name": "ColorPalette",
"size": 6367
}, {
"name": "Palette",
"size": 1229
}, {
"name": "ShapePalette",
"size": 2059
}, {
"name": "SizePalette",
"size": 2291
}]
}, {
"name": "Property",
"size": 5559
}, {
"name": "Shapes",
"size": 19118
}, {
"name": "Sort",
"size": 6887
}, {
"name": "Stats",
"size": 6557
}, {
"name": "Strings",
"size": 22026
}]
}, {
"name": "vis",
"children": [{
"name": "axis",
"children": [{
"name": "Axes",
"size": 1302
}, {
"name": "Axis",
"size": 24593
}, {
"name": "AxisGridLine",
"size": 652
}, {
"name": "AxisLabel",
"size": 636
}, {
"name": "CartesianAxes",
"size": 6703
}]
}, {
"name": "controls",
"children": [{
"name": "AnchorControl",
"size": 2138
}, {
"name": "ClickControl",
"size": 3824
}, {
"name": "Control",
"size": 1353
}, {
"name": "ControlList",
"size": 4665
}, {
"name": "DragControl",
"size": 2649
}, {
"name": "ExpandControl",
"size": 2832
}, {
"name": "HoverControl",
"size": 4896
}, {
"name": "IControl",
"size": 763
}, {
"name": "PanZoomControl",
"size": 5222
}, {
"name": "SelectionControl",
"size": 7862
}, {
"name": "TooltipControl",
"size": 8435
}]
}, {
"name": "data",
"children": [{
"name": "Data",
"size": 20544
}, {
"name": "DataList",
"size": 19788
}, {
"name": "DataSprite",
"size": 10349
}, {
"name": "EdgeSprite",
"size": 3301
}, {
"name": "NodeSprite",
"size": 19382
}, {
"name": "render",
"children": [{
"name": "ArrowType",
"size": 698
}, {
"name": "EdgeRenderer",
"size": 5569
}, {
"name": "IRenderer",
"size": 353
}, {
"name": "ShapeRenderer",
"size": 2247
}]
}, {
"name": "ScaleBinding",
"size": 11275
}, {
"name": "Tree",
"size": 7147
}, {
"name": "TreeBuilder",
"size": 9930
}]
}, {
"name": "events",
"children": [{
"name": "DataEvent",
"size": 2313
}, {
"name": "SelectionEvent",
"size": 1880
}, {
"name": "TooltipEvent",
"size": 1701
}, {
"name": "VisualizationEvent",
"size": 1117
}]
}, {
"name": "legend",
"children": [{
"name": "Legend",
"size": 20859
}, {
"name": "LegendItem",
"size": 4614
}, {
"name": "LegendRange",
"size": 10530
}]
}, {
"name": "operator",
"children": [{
"name": "distortion",
"children": [{
"name": "BifocalDistortion",
"size": 4461
}, {
"name": "Distortion",
"size": 6314
}, {
"name": "FisheyeDistortion",
"size": 3444
}]
}, {
"name": "encoder",
"children": [{
"name": "ColorEncoder",
"size": 3179
}, {
"name": "Encoder",
"size": 4060
}, {
"name": "PropertyEncoder",
"size": 4138
}, {
"name": "ShapeEncoder",
"size": 1690
}, {
"name": "SizeEncoder",
"size": 1830
}]
}, {
"name": "filter",
"children": [{
"name": "FisheyeTreeFilter",
"size": 5219
}, {
"name": "GraphDistanceFilter",
"size": 3165
}, {
"name": "VisibilityFilter",
"size": 3509
}]
}, {
"name": "IOperator",
"size": 1286
}, {
"name": "label",
"children": [{
"name": "Labeler",
"size": 9956
}, {
"name": "RadialLabeler",
"size": 3899
}, {
"name": "StackedAreaLabeler",
"size": 3202
}]
}, {
"name": "layout",
"children": [{
"name": "AxisLayout",
"size": 6725
}, {
"name": "BundledEdgeRouter",
"size": 3727
}, {
"name": "CircleLayout",
"size": 9317
}, {
"name": "CirclePackingLayout",
"size": 12003
}, {
"name": "DendrogramLayout",
"size": 4853
}, {
"name": "ForceDirectedLayout",
"size": 8411
}, {
"name": "IcicleTreeLayout",
"size": 4864
}, {
"name": "IndentedTreeLayout",
"size": 3174
}, {
"name": "Layout",
"size": 7881
}, {
"name": "NodeLinkTreeLayout",
"size": 12870
}, {
"name": "PieLayout",
"size": 2728
}, {
"name": "RadialTreeLayout",
"size": 12348
}, {
"name": "RandomLayout",
"size": 870
}, {
"name": "StackedAreaLayout",
"size": 9121
}, {
"name": "TreeMapLayout",
"size": 9191
}]
}, {
"name": "Operator",
"size": 2490
}, {
"name": "OperatorList",
"size": 5248
}, {
"name": "OperatorSequence",
"size": 4190
}, {
"name": "OperatorSwitch",
"size": 2581
}, {
"name": "SortOperator",
"size": 2023
}]
}, {
"name": "Visualization",
"size": 16540
}]
}]
}
</code></pre>
| 0debug
|
int rx_produce(World *world, uint32_t pport,
const struct iovec *iov, int iovcnt, uint8_t copy_to_cpu)
{
Rocker *r = world_rocker(world);
PCIDevice *dev = (PCIDevice *)r;
DescRing *ring = rocker_get_rx_ring_by_pport(r, pport);
DescInfo *info = desc_ring_fetch_desc(ring);
char *data;
size_t data_size = iov_size(iov, iovcnt);
char *buf;
uint16_t rx_flags = 0;
uint16_t rx_csum = 0;
size_t tlv_size;
RockerTlv *tlvs[ROCKER_TLV_RX_MAX + 1];
hwaddr frag_addr;
uint16_t frag_max_len;
int pos;
int err;
if (!info) {
return -ROCKER_ENOBUFS;
}
buf = desc_get_buf(info, false);
if (!buf) {
err = -ROCKER_ENXIO;
goto out;
}
rocker_tlv_parse(tlvs, ROCKER_TLV_RX_MAX, buf, desc_tlv_size(info));
if (!tlvs[ROCKER_TLV_RX_FRAG_ADDR] ||
!tlvs[ROCKER_TLV_RX_FRAG_MAX_LEN]) {
err = -ROCKER_EINVAL;
goto out;
}
frag_addr = rocker_tlv_get_le64(tlvs[ROCKER_TLV_RX_FRAG_ADDR]);
frag_max_len = rocker_tlv_get_le16(tlvs[ROCKER_TLV_RX_FRAG_MAX_LEN]);
if (data_size > frag_max_len) {
err = -ROCKER_EMSGSIZE;
goto out;
}
if (copy_to_cpu) {
rx_flags |= ROCKER_RX_FLAGS_FWD_OFFLOAD;
}
tlv_size = rocker_tlv_total_size(sizeof(uint16_t)) +
rocker_tlv_total_size(sizeof(uint16_t)) +
rocker_tlv_total_size(sizeof(uint64_t)) +
rocker_tlv_total_size(sizeof(uint16_t)) +
rocker_tlv_total_size(sizeof(uint16_t));
if (tlv_size > desc_buf_size(info)) {
err = -ROCKER_EMSGSIZE;
goto out;
}
data = g_malloc(data_size);
if (!data) {
err = -ROCKER_ENOMEM;
goto out;
}
iov_to_buf(iov, iovcnt, 0, data, data_size);
pci_dma_write(dev, frag_addr, data, data_size);
g_free(data);
pos = 0;
rocker_tlv_put_le16(buf, &pos, ROCKER_TLV_RX_FLAGS, rx_flags);
rocker_tlv_put_le16(buf, &pos, ROCKER_TLV_RX_CSUM, rx_csum);
rocker_tlv_put_le64(buf, &pos, ROCKER_TLV_RX_FRAG_ADDR, frag_addr);
rocker_tlv_put_le16(buf, &pos, ROCKER_TLV_RX_FRAG_MAX_LEN, frag_max_len);
rocker_tlv_put_le16(buf, &pos, ROCKER_TLV_RX_FRAG_LEN, data_size);
err = desc_set_buf(info, tlv_size);
out:
if (desc_ring_post_desc(ring, err)) {
rocker_msix_irq(r, ROCKER_MSIX_VEC_RX(pport - 1));
}
return err;
}
| 1threat
|
How to delete a gcloud Dataflow job? : <p>The Dataflow jobs are cluttered all over my dashboard, and I'd like to delete the failed jobs from my project. But in the dashboard, I don't see any option to delete the Dataflow job. I'm looking for something like below at least,</p>
<pre><code>$ gcloud beta dataflow jobs delete JOB_ID
</code></pre>
<p>To delete all jobs,</p>
<pre><code>$ gcloud beta dataflow jobs delete
</code></pre>
<p>Can someone please help me with this?</p>
| 0debug
|
qsort - What goes on behind the scenes? : <p>Using this simple sample, there are 6 numbers currently ordered 5,4,3,2,1,0 and will be sorted as : 0,1,2,3,4,5</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
int values[] = {5,4,3,2,1,0};
int sizeOfArray = sizeof(values)/sizeof(int);
int cmpfunc (const void * a, const void * b)
{
printf("Comparing %d and %d \n",*(int*)a, *(int*)b);
return ( *(int*)a - *(int*)b );
}
int main () {
int n;
printf("Size of Array : %d\n", sizeOfArray);
printf("Before sorting the list is: \n");
for( n = 0 ; n < sizeOfArray; n++ ) {
printf("%d ", values[n]);
}
printf("\n");
qsort(values, sizeOfArray, sizeof(int), cmpfunc);
printf("\nAfter sorting the list is: \n");
for( n = 0 ; n < sizeOfArray; n++ ) {
printf("%d ", values[n]);
}
return(0);
}
</code></pre>
<p>Added to the cmpfunc function is a printf command to show the numbers being compared as each function is called. </p>
<pre><code>Size of Array : 6
Before sorting the list is:
5 4 3 2 1 0
Comparing 4 and 3
Comparing 5 and 3
Comparing 5 and 4
Comparing 1 and 0
Comparing 2 and 0
Comparing 2 and 1
Comparing 3 and 0
Comparing 3 and 1
Comparing 3 and 2
After sorting the list is:
0 1 2 3 4 5
</code></pre>
<p>Notice the application only calls the cmpfunc 9 times.
I would have expected this function to be called numerous times more.
Also notice that 5 or 4 is never compared to 2 or to 1. </p>
<p>Is anyone able to explain what is going on behind the scenes which causes this routine to be so efficient?</p>
| 0debug
|
static void deblocking_filter_CTB(HEVCContext *s, int x0, int y0)
{
uint8_t *src;
int x, y, x_end, y_end, chroma;
int c_tc[2], beta[2], tc[2];
uint8_t no_p[2] = { 0 };
uint8_t no_q[2] = { 0 };
int log2_ctb_size = s->sps->log2_ctb_size;
int ctb_size = 1 << log2_ctb_size;
int ctb = (x0 >> log2_ctb_size) +
(y0 >> log2_ctb_size) * s->sps->ctb_width;
int cur_tc_offset = s->deblock[ctb].tc_offset;
int cur_beta_offset = s->deblock[ctb].beta_offset;
int tc_offset, left_tc_offset, beta_offset, left_beta_offset;
int pcmf = (s->sps->pcm_enabled_flag &&
s->sps->pcm.loop_filter_disable_flag) ||
s->pps->transquant_bypass_enable_flag;
if (x0) {
left_tc_offset = s->deblock[ctb - 1].tc_offset;
left_beta_offset = s->deblock[ctb - 1].beta_offset;
}
x_end = x0 + ctb_size;
if (x_end > s->sps->width)
x_end = s->sps->width;
y_end = y0 + ctb_size;
if (y_end > s->sps->height)
y_end = s->sps->height;
tc_offset = cur_tc_offset;
beta_offset = cur_beta_offset;
for (y = y0; y < y_end; y += 8) {
for (x = x0 ? x0 : 8; x < x_end; x += 8) {
const int bs0 = s->vertical_bs[(x >> 3) + (y >> 2) * s->bs_width];
const int bs1 = s->vertical_bs[(x >> 3) + ((y + 4) >> 2) * s->bs_width];
if (bs0 || bs1) {
const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
const int qp1 = (get_qPy(s, x - 1, y + 4) + get_qPy(s, x, y + 4) + 1) >> 1;
beta[0] = betatable[av_clip(qp0 + beta_offset, 0, MAX_QP)];
beta[1] = betatable[av_clip(qp1 + beta_offset, 0, MAX_QP)];
tc[0] = bs0 ? TC_CALC(qp0, bs0) : 0;
tc[1] = bs1 ? TC_CALC(qp1, bs1) : 0;
src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->sps->pixel_shift)];
if (pcmf) {
no_p[0] = get_pcm(s, x - 1, y);
no_p[1] = get_pcm(s, x - 1, y + 4);
no_q[0] = get_pcm(s, x, y);
no_q[1] = get_pcm(s, x, y + 4);
s->hevcdsp.hevc_v_loop_filter_luma_c(src,
s->frame->linesize[LUMA],
beta, tc, no_p, no_q);
} else
s->hevcdsp.hevc_v_loop_filter_luma(src,
s->frame->linesize[LUMA],
beta, tc, no_p, no_q);
}
}
}
for (chroma = 1; chroma <= 2; chroma++) {
for (y = y0; y < y_end; y += 16) {
for (x = x0 ? x0 : 16; x < x_end; x += 16) {
const int bs0 = s->vertical_bs[(x >> 3) + (y >> 2) * s->bs_width];
const int bs1 = s->vertical_bs[(x >> 3) + ((y + 8) >> 2) * s->bs_width];
if ((bs0 == 2) || (bs1 == 2)) {
const int qp0 = (get_qPy(s, x - 1, y) + get_qPy(s, x, y) + 1) >> 1;
const int qp1 = (get_qPy(s, x - 1, y + 8) + get_qPy(s, x, y + 8) + 1) >> 1;
c_tc[0] = (bs0 == 2) ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
c_tc[1] = (bs1 == 2) ? chroma_tc(s, qp1, chroma, tc_offset) : 0;
src = &s->frame->data[chroma][y / 2 * s->frame->linesize[chroma] + ((x / 2) << s->sps->pixel_shift)];
if (pcmf) {
no_p[0] = get_pcm(s, x - 1, y);
no_p[1] = get_pcm(s, x - 1, y + 8);
no_q[0] = get_pcm(s, x, y);
no_q[1] = get_pcm(s, x, y + 8);
s->hevcdsp.hevc_v_loop_filter_chroma_c(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
} else
s->hevcdsp.hevc_v_loop_filter_chroma(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
}
}
}
}
if (x_end != s->sps->width)
x_end -= 8;
for (y = y0 ? y0 : 8; y < y_end; y += 8) {
for (x = x0 ? x0 - 8 : 0; x < x_end; x += 8) {
const int bs0 = s->horizontal_bs[(x + y * s->bs_width) >> 2];
const int bs1 = s->horizontal_bs[(x + 4 + y * s->bs_width) >> 2];
if (bs0 || bs1) {
const int qp0 = (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1;
const int qp1 = (get_qPy(s, x + 4, y - 1) + get_qPy(s, x + 4, y) + 1) >> 1;
tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
beta_offset = x >= x0 ? cur_beta_offset : left_beta_offset;
beta[0] = betatable[av_clip(qp0 + beta_offset, 0, MAX_QP)];
beta[1] = betatable[av_clip(qp1 + beta_offset, 0, MAX_QP)];
tc[0] = bs0 ? TC_CALC(qp0, bs0) : 0;
tc[1] = bs1 ? TC_CALC(qp1, bs1) : 0;
src = &s->frame->data[LUMA][y * s->frame->linesize[LUMA] + (x << s->sps->pixel_shift)];
if (pcmf) {
no_p[0] = get_pcm(s, x, y - 1);
no_p[1] = get_pcm(s, x + 4, y - 1);
no_q[0] = get_pcm(s, x, y);
no_q[1] = get_pcm(s, x + 4, y);
s->hevcdsp.hevc_h_loop_filter_luma_c(src,
s->frame->linesize[LUMA],
beta, tc, no_p, no_q);
} else
s->hevcdsp.hevc_h_loop_filter_luma(src,
s->frame->linesize[LUMA],
beta, tc, no_p, no_q);
}
}
}
for (chroma = 1; chroma <= 2; chroma++) {
for (y = y0 ? y0 : 16; y < y_end; y += 16) {
for (x = x0 - 8; x < x_end; x += 16) {
int bs0, bs1;
if (x < 0) {
bs0 = 0;
bs1 = s->horizontal_bs[(x + 8 + y * s->bs_width) >> 2];
} else if (x >= x_end - 8) {
bs0 = s->horizontal_bs[(x + y * s->bs_width) >> 2];
bs1 = 0;
} else {
bs0 = s->horizontal_bs[(x + y * s->bs_width) >> 2];
bs1 = s->horizontal_bs[(x + 8 + y * s->bs_width) >> 2];
}
if ((bs0 == 2) || (bs1 == 2)) {
const int qp0 = bs0 == 2 ? (get_qPy(s, x, y - 1) + get_qPy(s, x, y) + 1) >> 1 : 0;
const int qp1 = bs1 == 2 ? (get_qPy(s, x + 8, y - 1) + get_qPy(s, x + 8, y) + 1) >> 1 : 0;
tc_offset = x >= x0 ? cur_tc_offset : left_tc_offset;
c_tc[0] = bs0 == 2 ? chroma_tc(s, qp0, chroma, tc_offset) : 0;
c_tc[1] = bs1 == 2 ? chroma_tc(s, qp1, chroma, cur_tc_offset) : 0;
src = &s->frame->data[chroma][y / 2 * s->frame->linesize[chroma] + ((x / 2) << s->sps->pixel_shift)];
if (pcmf) {
no_p[0] = get_pcm(s, x, y - 1);
no_p[1] = get_pcm(s, x + 8, y - 1);
no_q[0] = get_pcm(s, x, y);
no_q[1] = get_pcm(s, x + 8, y);
s->hevcdsp.hevc_h_loop_filter_chroma_c(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
} else
s->hevcdsp.hevc_h_loop_filter_chroma(src,
s->frame->linesize[chroma],
c_tc, no_p, no_q);
}
}
}
}
}
| 1threat
|
Angular 2 ngModelChange select option, grab a specific property : <p>I have a dropdown select form in angular 2. </p>
<p>Currently: When I select an option the <code>option name</code> gets passed into my <code>onChange</code> function as <code>$event</code> </p>
<p>Wanted: When I select an option I would like to pass <code>workout.id</code> into my <code>onChange</code> function. </p>
<p>How can I achieve that?</p>
<pre><code><select class="form-control" [ngModel]="selectedWorkout" (ngModelChange)="onChange($event)">
<option *ngFor="#workout of workouts">{{workout.name}}</option>
</select>
</code></pre>
<p><code>Controller</code></p>
<pre><code>onChange(value){
alert(JSON.stringify(value));
}
</code></pre>
| 0debug
|
javascript collapse doesnt work : <p>Hello Stackoverflow community,
i got this code for faq collapse but it doesnt work</p>
<p>HTML</p>
<pre><code> <a href="#" class="togglefaq"><i class="icon-plus"></i> How do you tell an introverted computer scientist from an extroverted computer scientist?</a>
<div class="faqanswer">
<p>An extroverted computer scientist looks at <em>your</em> shoes when he talks to you.
</p>
</div>
<br>
<a href="#" class="togglefaq"><i class="icon-plus"></i> How many programmers does it take to change a light bulb?</a>
<div class="faqanswer">
<p>None, that's a hardware problem.
</p>
</div>
<br>
<a href="#" class="togglefaq"><i class="icon-plus"></i> What's the object-oriented way to become wealthy?</a>
<div class="faqanswer">
<p>Inheritance.
</p>
</div>
<br>
<a href="#" class="togglefaq"><i class="icon-plus"></i> Why do programmers like UNIX?</a>
<div class="faqanswer">
<p>unzip, strip, touch, finger, grep, mount, fsck, more, yes, fsck, fsck, fsck, umount, sleep
</p>
</div>
</code></pre>
<p>CSS</p>
<pre><code>/* FAQ COLLAPSE/EXPAND STYLES */
* {
box-sizing: border-box;
}
body{
background-color:black;
}
.faqanswer {
display: none;
width: 590px;
padding: 12px 20px 0 30px;
background-color:white;
}
.faqanswer p {
font-size: 13px;
line-height: 17px;
padding-bottom: 20px;
color:#2b2d39;
}
a.active {
font-weight: bold;
}
.togglefaq {
text-decoration: none;
color: #2b2d39;
font-size: 13px;
padding: 10px 30px;
line-height: 20px;
display: block;
width: 590px;
margin-bottom: -1px;
background-color:white;
}
.icon-plus {
color: #1c1e2b;
margin-right: 20px;
font-size: 20px;
float:right;
}
.icon-remove {
color: #1c1e2b;
font-size: 20px;
float:right;
}
p {
margin: 0;
}
</code></pre>
<p>javascript</p>
<pre><code><script>
//faq toggle stuff
$('.togglefaq').click(function(e) {
e.preventDefault();
var notthis = $('.active').not(this);
notthis.find('.icon-remove ').addClass('icon-plus').removeClass('icon-remove ');
notthis.toggleClass('active').next('.faqanswer').slideToggle(300);
$(this).toggleClass('active').next().slideToggle("fast");
$(this).children('i').toggleClass('icon-plus icon-remove ');
});
</script>
</code></pre>
<p>on the codepen it works
<a href="https://codepen.io/mrs_snow/pen/vEvzaL" rel="nofollow noreferrer">https://codepen.io/mrs_snow/pen/vEvzaL</a></p>
<p>but when i add it to my website it doesn't</p>
| 0debug
|
MSBuild and Webpack : <p>I am developing an Angular2 application in VS2015 and have a webpack bundling and minification environment set up for the same.</p>
<p>This is my webpack.conf.js</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>switch (process.env.NODE_ENV) {
case 'prod':
case 'production':
module.exports = require('./config/webpack.prod');
break;
case 'test':
case 'testing':
//module.exports = require('./config/webpack.test');
break;
case 'dev':
case 'development':
default:
module.exports = require('./config/webpack.dev');
}</code></pre>
</div>
</div>
</p>
<p>I have also installed a webpack task runner which invokes this with the following commands</p>
<pre><code>cmd /c SET NODE_ENV=development&& webpack -d --color
</code></pre>
<p>and</p>
<pre><code>cmd /c SET NODE_ENV=production&& webpack -p --color
</code></pre>
<p>The setup seems to work fine. However, I want to integrate this with my TFS builds CI. The webpack command should fire after the project is built and report a build failure incase the webpack build fails. I have tried to incorporate the following code in my .csproj file</p>
<pre><code><Target Name="AfterBuild">
<Exec Condition="$(Configuration) == 'Debug'" Command="cmd /c SET NODE_ENV=production&& webpack -p --color">
</Exec>
</Target>
</code></pre>
<p>It failed with an error 9009</p>
<p>After that I tried, starting the command up from the node_modules folder where webpack was installed</p>
<pre><code><Target Name="AfterBuild">
<Exec Condition="$(Configuration) == 'Debug'" Command="./node_modules/.bin cmd /c SET NODE_ENV=production&& webpack -p --color">
</Exec>
</Target>
</code></pre>
<p>still in vain. Even if I get this to work, I am not sure if it would cause the VS build to fail if it encounters an error in webpack. </p>
<p>How do I go ahead with this?</p>
| 0debug
|
Hi im newbie, want to ask how to change this to BUY or SELL from database in Android : this is my code :
@Override
public void onBindViewHolder(ViewHolder holder, int position){
Glide.with(context)
.load("http://192.168.60.37/signalss/image/" + list_data.get(position).get("Icon"))
.crossFade()
.placeholder(R.mipmap.ic_launcher)
.into(holder.imgsignals);
holder.txtsignals1.setText(list_data.get(position).get("SignalsId"));
holder.txtsignals2.setText(list_data.get(position).get("PairName"));
holder.txtsignals3.setText(list_data.get(position).get("SignalsPosition"));
holder.txtsignals4.setText(list_data.get(position).get("AreaOpenPrice1"));
holder.txtsignals5.setText(list_data.get(position).get("AreaOpenPrice2"));
holder.txtsignals6.setText(list_data.get(position).get("StopLoss"));
holder.txtsignals7.setText(list_data.get(position).get("TargetProfit1"));
holder.txtsignals8.setText(list_data.get(position).get("TargetProfit3"));
holder.txtsignals9.setText(list_data.get(position).get("AddDate"));
}
want to change this one to BUY or SELL [Mydb][1] [myandroid][2]
i think use ifelse, but i dunno how to use. please help, thankyou verymuch
[1]: https://i.stack.imgur.com/VS264.png
[2]: https://i.stack.imgur.com/QTvQU.png
| 0debug
|
Can anyone tell me what an I doing wrong in this code and how can I solve it? : HTML
<div class="container1">
<div id="container-table"></div>
<div id="container-tablec"></div>
<div id="container-tableq"></div>
<div id="container-table"></div>
<div id="container-table"></div>
</div>
JavaScript
<script>
$('document').ready(function(){
refreshData();
})
function refreshData() {
$('#container-table').load("data.php", function(){
setTimeout(refreshData, 10000);
});
}
</script>
<script>
$('document').ready(function(){
refreshData();
})
function refreshData() {
$('#container-tablec').load("datacex.php", function(){
setTimeout(refreshData, 10000);
});
}
</script>
<script>
$('document').ready(function(){
refreshData();
})
function refreshData() {
$('#container-tableq').load("dataquad.php", function(){
setTimeout(refreshData, 10000);
});
}
</script>
I'm trying to integrate theses three APIs in my HTML website. But the problem that I'm facing is that every time subsequent <script> cancels out the previous one and only the last one runs.
| 0debug
|
how to write test cases during online interview : <p>Hi I'm kind of newbie of coding interview. And I always use unit test in real life(create in IDE). I heard there'll be a online interview, and writing code in collabedit. And I heard after write algrithm, please write several test cases to test your answer. Could someone tell me how to write test cases? It's my first time doing interview like this and I use C#. Thank you</p>
| 0debug
|
Unexpectedly found nil while unwrapping an Optional value in Swift application : <p>I’m building an app with Swift.
I have this code in my class:</p>
<pre><code>var url : Url? = Url()
</code></pre>
<p>on ViewDidLoad() method I have this:</p>
<pre><code>override func viewDidLoad() {
super.viewDidLoad()
//recuper ip di arduino
url = UrlCoreDataController.shared.loadUrl()!
self.setUpLuci()
// self.tabella.dataSource = self
// self.tabella.delegate = self
}
</code></pre>
<p>the loadUrl() method can return nil value.</p>
<p>So if the method return nil value I have this error:</p>
<pre><code>2018-03-06 12:29:47.150240+0100 ArduinoHomeKit_bis[2318:1060982] [error] error: CoreData: error: Failed to call designated initializer on NSManagedObject class 'Url'
CoreData: error: CoreData: error: Failed to call designated initializer on NSManagedObject class ‘Url'
</code></pre>
<p>How can I change my code ?</p>
| 0debug
|
How to use JQUERY to select a radio button : <p>I intend to write a piece of code to select one option in a radio button. I used the following code which is saw being used to select a dropdown. I modified it and used it but its not working. Could you please point out my error?</p>
<pre><code>$("div.classradio radio").val("Male");
</code></pre>
<p>this is the code I used but it doesn't work.</p>
| 0debug
|
static void switch_tss(CPUX86State *env, int tss_selector,
uint32_t e1, uint32_t e2, int source,
uint32_t next_eip)
{
int tss_limit, tss_limit_max, type, old_tss_limit_max, old_type, v1, v2, i;
target_ulong tss_base;
uint32_t new_regs[8], new_segs[6];
uint32_t new_eflags, new_eip, new_cr3, new_ldt, new_trap;
uint32_t old_eflags, eflags_mask;
SegmentCache *dt;
int index;
target_ulong ptr;
type = (e2 >> DESC_TYPE_SHIFT) & 0xf;
LOG_PCALL("switch_tss: sel=0x%04x type=%d src=%d\n", tss_selector, type,
source);
if (type == 5) {
if (!(e2 & DESC_P_MASK)) {
raise_exception_err(env, EXCP0B_NOSEG, tss_selector & 0xfffc);
}
tss_selector = e1 >> 16;
if (tss_selector & 4) {
raise_exception_err(env, EXCP0A_TSS, tss_selector & 0xfffc);
}
if (load_segment(env, &e1, &e2, tss_selector) != 0) {
raise_exception_err(env, EXCP0D_GPF, tss_selector & 0xfffc);
}
if (e2 & DESC_S_MASK) {
raise_exception_err(env, EXCP0D_GPF, tss_selector & 0xfffc);
}
type = (e2 >> DESC_TYPE_SHIFT) & 0xf;
if ((type & 7) != 1) {
raise_exception_err(env, EXCP0D_GPF, tss_selector & 0xfffc);
}
}
if (!(e2 & DESC_P_MASK)) {
raise_exception_err(env, EXCP0B_NOSEG, tss_selector & 0xfffc);
}
if (type & 8) {
tss_limit_max = 103;
} else {
tss_limit_max = 43;
}
tss_limit = get_seg_limit(e1, e2);
tss_base = get_seg_base(e1, e2);
if ((tss_selector & 4) != 0 ||
tss_limit < tss_limit_max) {
raise_exception_err(env, EXCP0A_TSS, tss_selector & 0xfffc);
}
old_type = (env->tr.flags >> DESC_TYPE_SHIFT) & 0xf;
if (old_type & 8) {
old_tss_limit_max = 103;
} else {
old_tss_limit_max = 43;
}
if (type & 8) {
new_cr3 = cpu_ldl_kernel(env, tss_base + 0x1c);
new_eip = cpu_ldl_kernel(env, tss_base + 0x20);
new_eflags = cpu_ldl_kernel(env, tss_base + 0x24);
for (i = 0; i < 8; i++) {
new_regs[i] = cpu_ldl_kernel(env, tss_base + (0x28 + i * 4));
}
for (i = 0; i < 6; i++) {
new_segs[i] = cpu_lduw_kernel(env, tss_base + (0x48 + i * 4));
}
new_ldt = cpu_lduw_kernel(env, tss_base + 0x60);
new_trap = cpu_ldl_kernel(env, tss_base + 0x64);
} else {
new_cr3 = 0;
new_eip = cpu_lduw_kernel(env, tss_base + 0x0e);
new_eflags = cpu_lduw_kernel(env, tss_base + 0x10);
for (i = 0; i < 8; i++) {
new_regs[i] = cpu_lduw_kernel(env, tss_base + (0x12 + i * 2)) |
0xffff0000;
}
for (i = 0; i < 4; i++) {
new_segs[i] = cpu_lduw_kernel(env, tss_base + (0x22 + i * 4));
}
new_ldt = cpu_lduw_kernel(env, tss_base + 0x2a);
new_segs[R_FS] = 0;
new_segs[R_GS] = 0;
new_trap = 0;
}
(void)new_trap;
v1 = cpu_ldub_kernel(env, env->tr.base);
v2 = cpu_ldub_kernel(env, env->tr.base + old_tss_limit_max);
cpu_stb_kernel(env, env->tr.base, v1);
cpu_stb_kernel(env, env->tr.base + old_tss_limit_max, v2);
if (source == SWITCH_TSS_JMP || source == SWITCH_TSS_IRET) {
target_ulong ptr;
uint32_t e2;
ptr = env->gdt.base + (env->tr.selector & ~7);
e2 = cpu_ldl_kernel(env, ptr + 4);
e2 &= ~DESC_TSS_BUSY_MASK;
cpu_stl_kernel(env, ptr + 4, e2);
}
old_eflags = cpu_compute_eflags(env);
if (source == SWITCH_TSS_IRET) {
old_eflags &= ~NT_MASK;
}
if (type & 8) {
cpu_stl_kernel(env, env->tr.base + 0x20, next_eip);
cpu_stl_kernel(env, env->tr.base + 0x24, old_eflags);
cpu_stl_kernel(env, env->tr.base + (0x28 + 0 * 4), env->regs[R_EAX]);
cpu_stl_kernel(env, env->tr.base + (0x28 + 1 * 4), env->regs[R_ECX]);
cpu_stl_kernel(env, env->tr.base + (0x28 + 2 * 4), env->regs[R_EDX]);
cpu_stl_kernel(env, env->tr.base + (0x28 + 3 * 4), env->regs[R_EBX]);
cpu_stl_kernel(env, env->tr.base + (0x28 + 4 * 4), env->regs[R_ESP]);
cpu_stl_kernel(env, env->tr.base + (0x28 + 5 * 4), env->regs[R_EBP]);
cpu_stl_kernel(env, env->tr.base + (0x28 + 6 * 4), env->regs[R_ESI]);
cpu_stl_kernel(env, env->tr.base + (0x28 + 7 * 4), env->regs[R_EDI]);
for (i = 0; i < 6; i++) {
cpu_stw_kernel(env, env->tr.base + (0x48 + i * 4),
env->segs[i].selector);
}
} else {
cpu_stw_kernel(env, env->tr.base + 0x0e, next_eip);
cpu_stw_kernel(env, env->tr.base + 0x10, old_eflags);
cpu_stw_kernel(env, env->tr.base + (0x12 + 0 * 2), env->regs[R_EAX]);
cpu_stw_kernel(env, env->tr.base + (0x12 + 1 * 2), env->regs[R_ECX]);
cpu_stw_kernel(env, env->tr.base + (0x12 + 2 * 2), env->regs[R_EDX]);
cpu_stw_kernel(env, env->tr.base + (0x12 + 3 * 2), env->regs[R_EBX]);
cpu_stw_kernel(env, env->tr.base + (0x12 + 4 * 2), env->regs[R_ESP]);
cpu_stw_kernel(env, env->tr.base + (0x12 + 5 * 2), env->regs[R_EBP]);
cpu_stw_kernel(env, env->tr.base + (0x12 + 6 * 2), env->regs[R_ESI]);
cpu_stw_kernel(env, env->tr.base + (0x12 + 7 * 2), env->regs[R_EDI]);
for (i = 0; i < 4; i++) {
cpu_stw_kernel(env, env->tr.base + (0x22 + i * 4),
env->segs[i].selector);
}
}
if (source == SWITCH_TSS_CALL) {
cpu_stw_kernel(env, tss_base, env->tr.selector);
new_eflags |= NT_MASK;
}
if (source == SWITCH_TSS_JMP || source == SWITCH_TSS_CALL) {
target_ulong ptr;
uint32_t e2;
ptr = env->gdt.base + (tss_selector & ~7);
e2 = cpu_ldl_kernel(env, ptr + 4);
e2 |= DESC_TSS_BUSY_MASK;
cpu_stl_kernel(env, ptr + 4, e2);
}
env->cr[0] |= CR0_TS_MASK;
env->hflags |= HF_TS_MASK;
env->tr.selector = tss_selector;
env->tr.base = tss_base;
env->tr.limit = tss_limit;
env->tr.flags = e2 & ~DESC_TSS_BUSY_MASK;
if ((type & 8) && (env->cr[0] & CR0_PG_MASK)) {
cpu_x86_update_cr3(env, new_cr3);
}
env->eip = new_eip;
eflags_mask = TF_MASK | AC_MASK | ID_MASK |
IF_MASK | IOPL_MASK | VM_MASK | RF_MASK | NT_MASK;
if (!(type & 8)) {
eflags_mask &= 0xffff;
}
cpu_load_eflags(env, new_eflags, eflags_mask);
env->regs[R_EAX] = new_regs[0];
env->regs[R_ECX] = new_regs[1];
env->regs[R_EDX] = new_regs[2];
env->regs[R_EBX] = new_regs[3];
env->regs[R_ESP] = new_regs[4];
env->regs[R_EBP] = new_regs[5];
env->regs[R_ESI] = new_regs[6];
env->regs[R_EDI] = new_regs[7];
if (new_eflags & VM_MASK) {
for (i = 0; i < 6; i++) {
load_seg_vm(env, i, new_segs[i]);
}
cpu_x86_set_cpl(env, 3);
} else {
cpu_x86_set_cpl(env, new_segs[R_CS] & 3);
for (i = 0; i < 6; i++) {
cpu_x86_load_seg_cache(env, i, new_segs[i], 0, 0, 0);
}
}
env->ldt.selector = new_ldt & ~4;
env->ldt.base = 0;
env->ldt.limit = 0;
env->ldt.flags = 0;
if (new_ldt & 4) {
raise_exception_err(env, EXCP0A_TSS, new_ldt & 0xfffc);
}
if ((new_ldt & 0xfffc) != 0) {
dt = &env->gdt;
index = new_ldt & ~7;
if ((index + 7) > dt->limit) {
raise_exception_err(env, EXCP0A_TSS, new_ldt & 0xfffc);
}
ptr = dt->base + index;
e1 = cpu_ldl_kernel(env, ptr);
e2 = cpu_ldl_kernel(env, ptr + 4);
if ((e2 & DESC_S_MASK) || ((e2 >> DESC_TYPE_SHIFT) & 0xf) != 2) {
raise_exception_err(env, EXCP0A_TSS, new_ldt & 0xfffc);
}
if (!(e2 & DESC_P_MASK)) {
raise_exception_err(env, EXCP0A_TSS, new_ldt & 0xfffc);
}
load_seg_cache_raw_dt(&env->ldt, e1, e2);
}
if (!(new_eflags & VM_MASK)) {
tss_load_seg(env, R_CS, new_segs[R_CS]);
tss_load_seg(env, R_SS, new_segs[R_SS]);
tss_load_seg(env, R_ES, new_segs[R_ES]);
tss_load_seg(env, R_DS, new_segs[R_DS]);
tss_load_seg(env, R_FS, new_segs[R_FS]);
tss_load_seg(env, R_GS, new_segs[R_GS]);
}
if (new_eip > env->segs[R_CS].limit) {
raise_exception_err(env, EXCP0D_GPF, 0);
}
#ifndef CONFIG_USER_ONLY
if (env->dr[7] & DR7_LOCAL_BP_MASK) {
for (i = 0; i < DR7_MAX_BP; i++) {
if (hw_local_breakpoint_enabled(env->dr[7], i) &&
!hw_global_breakpoint_enabled(env->dr[7], i)) {
hw_breakpoint_remove(env, i);
}
}
env->dr[7] &= ~DR7_LOCAL_BP_MASK;
}
#endif
}
| 1threat
|
static void apic_reset_common(DeviceState *d)
{
APICCommonState *s = DO_UPCAST(APICCommonState, busdev.qdev, d);
APICCommonClass *info = APIC_COMMON_GET_CLASS(s);
bool bsp;
bsp = cpu_is_bsp(s->cpu_env);
s->apicbase = 0xfee00000 |
(bsp ? MSR_IA32_APICBASE_BSP : 0) | MSR_IA32_APICBASE_ENABLE;
s->vapic_paddr = 0;
info->vapic_base_update(s);
apic_init_reset(d);
if (bsp) {
s->lvt[APIC_LVT_LINT0] = 0x700;
}
}
| 1threat
|
How to add autofocus to AVCaptureSession? SWIFT : <p>I'm using AVFoundation to recognize text and perform OCR. How do I add autofocus? I don't want to have the yellow square thing when user taps the screen, I just want it to automatically focus on the object, a credit card for example.</p>
<p>Here is my session code.</p>
<pre><code>func setupSession() {
session = AVCaptureSession()
session.sessionPreset = AVCaptureSessionPresetHigh
let camera = AVCaptureDevice
.defaultDeviceWithMediaType(AVMediaTypeVideo)
do { input = try AVCaptureDeviceInput(device: camera) } catch { return }
output = AVCaptureStillImageOutput()
output.outputSettings = [ AVVideoCodecKey: AVVideoCodecJPEG ]
guard session.canAddInput(input)
&& session.canAddOutput(output) else { return }
session.addInput(input)
session.addOutput(output)
previewLayer = AVCaptureVideoPreviewLayer(session: session)
previewLayer!.videoGravity = AVLayerVideoGravityResizeAspect
previewLayer!.connection?.videoOrientation = .Portrait
view.layer.addSublayer(previewLayer!)
session.startRunning()
}
</code></pre>
| 0debug
|
Jqery error in .js file : I've just complete my JavaScript and jQuery basics and i got an error while writing the jquery in .js file 1.'$' is uses before was defined
2. Missing 'used strict' statement
what to do
| 0debug
|
C++ Initialising fields directly vs initialisation list in default constructor : <p>I'd like to know if there is a difference between this code:</p>
<pre><code>class Foo{
private:
int a = 0;
public:
Foo(){}
}
</code></pre>
<p>And:</p>
<pre><code>class Foo{
private:
int a;
public:
Foo(): a(0) {}
}
</code></pre>
<p>And, if so, which should be preferred?
I know it's preferable to use an initialiser list than assigning in the constructor body, but what about initialiser list vs directly initialising in field declaration (for primitive types, at least, as is the case here)?</p>
<p>Also, what of the case below:</p>
<pre><code>class Foo{
private:
int a = 0;
public:
Foo(){}
Foo(int i): a(i) {}
}
</code></pre>
<p>When the non-default constructor is called: is "a" initialised twice, first to 0 then to "i", or directly to "i"?</p>
| 0debug
|
Vue Watch not triggering : <p>Trying to use vue watch methods but it doesn't seem to trigger for some objects even with <code>deep:true</code>.</p>
<p>In my component, I recieve an array as a prop that are the fields to create
the following forms.
I can build the forms and dynamicly bind them to an object called <code>crudModelCreate</code> and everything works fine (i see in vue dev tools and even submiting the form works according to plan)</p>
<p>But I have a problem trying to watch the changes in that dynamic object.</p>
<pre><code> <md-input v-for="(field, rowIndex) in fields" :key="field.id" v-model="crudModelCreate[field.name]" maxlength="250"></md-input>
...
data() {
return {
state: 1, // This gets changed somewhere in the middle and changes fine
crudModelCreate: {},
}
},
...
watch: {
'state': {
handler: function(val, oldVal) {
this.$emit("changedState", this.state);
// this works fine
},
},
'crudModelCreate': {
handler: function(val, oldVal) {
console.log("beep1")
this.$emit("updatedCreate", this.crudModelCreate);
// This doesn't work
},
deep: true,
immediate: true
},
}
</code></pre>
| 0debug
|
int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def)
{
env->msr_mask = def->msr_mask;
env->mmu_model = def->mmu_model;
env->excp_model = def->excp_model;
env->bus_model = def->bus_model;
env->insns_flags = def->insns_flags;
env->insns_flags2 = def->insns_flags2;
env->flags = def->flags;
env->bfd_mach = def->bfd_mach;
env->check_pow = def->check_pow;
if (kvm_enabled()) {
if (kvmppc_fixup_cpu(env) != 0) {
fprintf(stderr, "Unable to virtualize selected CPU with KVM\n");
exit(1);
} else {
if (ppc_fixup_cpu(env) != 0) {
fprintf(stderr, "Unable to emulate selected CPU with TCG\n");
exit(1);
if (create_ppc_opcodes(env, def) < 0)
return -1;
init_ppc_proc(env, def);
if (def->insns_flags & PPC_FLOAT) {
gdb_register_coprocessor(env, gdb_get_float_reg, gdb_set_float_reg,
33, "power-fpu.xml", 0);
if (def->insns_flags & PPC_ALTIVEC) {
gdb_register_coprocessor(env, gdb_get_avr_reg, gdb_set_avr_reg,
34, "power-altivec.xml", 0);
if (def->insns_flags & PPC_SPE) {
gdb_register_coprocessor(env, gdb_get_spe_reg, gdb_set_spe_reg,
34, "power-spe.xml", 0);
#if defined(PPC_DUMP_CPU)
{
const char *mmu_model, *excp_model, *bus_model;
switch (env->mmu_model) {
case POWERPC_MMU_32B:
mmu_model = "PowerPC 32";
break;
case POWERPC_MMU_SOFT_6xx:
mmu_model = "PowerPC 6xx/7xx with software driven TLBs";
break;
case POWERPC_MMU_SOFT_74xx:
mmu_model = "PowerPC 74xx with software driven TLBs";
break;
case POWERPC_MMU_SOFT_4xx:
mmu_model = "PowerPC 4xx with software driven TLBs";
break;
case POWERPC_MMU_SOFT_4xx_Z:
mmu_model = "PowerPC 4xx with software driven TLBs "
"and zones protections";
break;
case POWERPC_MMU_REAL:
mmu_model = "PowerPC real mode only";
break;
case POWERPC_MMU_MPC8xx:
mmu_model = "PowerPC MPC8xx";
break;
case POWERPC_MMU_BOOKE:
mmu_model = "PowerPC BookE";
break;
case POWERPC_MMU_BOOKE206:
mmu_model = "PowerPC BookE 2.06";
break;
case POWERPC_MMU_601:
mmu_model = "PowerPC 601";
break;
#if defined (TARGET_PPC64)
case POWERPC_MMU_64B:
mmu_model = "PowerPC 64";
break;
case POWERPC_MMU_620:
mmu_model = "PowerPC 620";
break;
#endif
default:
mmu_model = "Unknown or invalid";
break;
switch (env->excp_model) {
case POWERPC_EXCP_STD:
excp_model = "PowerPC";
break;
case POWERPC_EXCP_40x:
excp_model = "PowerPC 40x";
break;
case POWERPC_EXCP_601:
excp_model = "PowerPC 601";
break;
case POWERPC_EXCP_602:
excp_model = "PowerPC 602";
break;
case POWERPC_EXCP_603:
excp_model = "PowerPC 603";
break;
case POWERPC_EXCP_603E:
excp_model = "PowerPC 603e";
break;
case POWERPC_EXCP_604:
excp_model = "PowerPC 604";
break;
case POWERPC_EXCP_7x0:
excp_model = "PowerPC 740/750";
break;
case POWERPC_EXCP_7x5:
excp_model = "PowerPC 745/755";
break;
case POWERPC_EXCP_74xx:
excp_model = "PowerPC 74xx";
break;
case POWERPC_EXCP_BOOKE:
excp_model = "PowerPC BookE";
break;
#if defined (TARGET_PPC64)
case POWERPC_EXCP_970:
excp_model = "PowerPC 970";
break;
#endif
default:
excp_model = "Unknown or invalid";
break;
switch (env->bus_model) {
case PPC_FLAGS_INPUT_6xx:
bus_model = "PowerPC 6xx";
break;
case PPC_FLAGS_INPUT_BookE:
bus_model = "PowerPC BookE";
break;
case PPC_FLAGS_INPUT_405:
bus_model = "PowerPC 405";
break;
case PPC_FLAGS_INPUT_401:
bus_model = "PowerPC 401/403";
break;
case PPC_FLAGS_INPUT_RCPU:
bus_model = "RCPU / MPC8xx";
break;
#if defined (TARGET_PPC64)
case PPC_FLAGS_INPUT_970:
bus_model = "PowerPC 970";
break;
#endif
default:
bus_model = "Unknown or invalid";
break;
printf("PowerPC %-12s : PVR %08x MSR %016" PRIx64 "\n"
" MMU model : %s\n",
def->name, def->pvr, def->msr_mask, mmu_model);
#if !defined(CONFIG_USER_ONLY)
if (env->tlb != NULL) {
printf(" %d %s TLB in %d ways\n",
env->nb_tlb, env->id_tlbs ? "splitted" : "merged",
env->nb_ways);
#endif
printf(" Exceptions model : %s\n"
" Bus model : %s\n",
excp_model, bus_model);
printf(" MSR features :\n");
if (env->flags & POWERPC_FLAG_SPE)
printf(" signal processing engine enable"
"\n");
else if (env->flags & POWERPC_FLAG_VRE)
printf(" vector processor enable\n");
if (env->flags & POWERPC_FLAG_TGPR)
printf(" temporary GPRs\n");
else if (env->flags & POWERPC_FLAG_CE)
printf(" critical input enable\n");
if (env->flags & POWERPC_FLAG_SE)
printf(" single-step trace mode\n");
else if (env->flags & POWERPC_FLAG_DWE)
printf(" debug wait enable\n");
else if (env->flags & POWERPC_FLAG_UBLE)
printf(" user BTB lock enable\n");
if (env->flags & POWERPC_FLAG_BE)
printf(" branch-step trace mode\n");
else if (env->flags & POWERPC_FLAG_DE)
printf(" debug interrupt enable\n");
if (env->flags & POWERPC_FLAG_PX)
printf(" inclusive protection\n");
else if (env->flags & POWERPC_FLAG_PMM)
printf(" performance monitor mark\n");
if (env->flags == POWERPC_FLAG_NONE)
printf(" none\n");
printf(" Time-base/decrementer clock source: %s\n",
env->flags & POWERPC_FLAG_RTC_CLK ? "RTC clock" : "bus clock");
dump_ppc_insns(env);
dump_ppc_sprs(env);
fflush(stdout);
#endif
return 0;
| 1threat
|
Remove object from Realm Result based on primary key : How can i remove single object from Realm Result based on primary key of objects stored in Realm. Tell me anybody.
| 0debug
|
void qemu_put_be64(QEMUFile *f, uint64_t v)
{
qemu_put_be32(f, v >> 32);
qemu_put_be32(f, v);
}
| 1threat
|
useRef "refers to a value, but is being used as a type here." : <p>I'm trying to figure out how to tell react which element is being used as ref i.e. in my case</p>
<pre><code>const circleRef = useRef<AnimatedCircle>(undefined);
</code></pre>
<p><code>AnimatedCircle</code> is an SVG component from a third party library, and defining it this way causes error</p>
<p><a href="https://i.stack.imgur.com/KjlOp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KjlOp.png" alt="enter image description here"></a></p>
<p>Is there some universal way to define which element is ref?</p>
| 0debug
|
static ExitStatus gen_bcond(DisasContext *ctx, TCGCond cond, int ra,
int32_t disp, int mask)
{
TCGv cmp_tmp;
if (mask) {
cmp_tmp = tcg_temp_new();
tcg_gen_andi_i64(cmp_tmp, load_gpr(ctx, ra), 1);
} else {
cmp_tmp = load_gpr(ctx, ra);
}
return gen_bcond_internal(ctx, cond, cmp_tmp, disp);
}
| 1threat
|
app doesn't save date to calender swift : I am trying to specific date to calendar but doesn't wok
this is my code
I am trying to specific date to calendar but doesn't wok
this is my code
@IBAction func addToCalenderButton(sender: AnyObject) {
let eventStore = EKEventStore()
self.event?.Start
let dateString = "Thu, 24 Oct 2015 07:45"
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "EEE, dd MMM yyy hh:mm"
let date:NSDate = dateFormatter.dateFromString(dateString)!
dateFormatter.dateFormat = "EEE, dd MMM yyy hh:mm"
if (EKEventStore.authorizationStatusForEntityType(.Event) != EKAuthorizationStatus.Authorized) {
eventStore.requestAccessToEntityType(.Event, completion: {
granted, error in
self.createEvent(eventStore, title: (self.event?.title)!, startDate: date)
})
} else {
createEvent(eventStore, title: (self.event?.title)!, startDate: date)
}
}
func createEvent(eventStore: EKEventStore, title: String, startDate: NSDate) {
let event = EKEvent(eventStore: eventStore)
event.title = title
event.startDate = startDate
event.calendar = eventStore.defaultCalendarForNewEvents
do {
try eventStore.saveEvent(event, span: .ThisEvent)
savedEventId = event.eventIdentifier
Constant.displayAlert(self, title: "", Message: "The event has been added")
} catch {
print("Bad things happened")
}
}
| 0debug
|
translate typescript to javascript : <p>I need this code is in <strong>Javascript</strong></p>
<p>I am not specialized in language typescript.</p>
<p>this is code for play music and record audio in mobile with nativescript</p>
<p>do not think <strong>GitHub</strong> quickly give answer</p>
<p><a href="https://github.com/bradmartin/nativescript-audio/issues/56" rel="nofollow noreferrer">in github issues</a></p>
<pre><code>import { TNSPlayer } from 'nativescript-audio';
export class YourClass {
private _player: TNSPlayer;
constructor() {
this._player = new TNSPlayer();
this._player.initFromFile({
audioFile: '~/audio/song.mp3', // ~ = app directory
loop: false,
completeCallback: this._trackComplete.bind(this),
errorCallback: this._trackError.bind(this)
}).then(() => {
this._player.getAudioTrackDuration().then((duration) => {
// iOS: duration is in seconds
// Android: duration is in milliseconds
console.log(`song duration:`, duration);
});
});
}
public togglePlay() {
if (this._player.isAudioPlaying()) {
this._player.pause();
} else {
this._player.play();
}
}
private _trackComplete(args: any) {
console.log('reference back to player:', args.player);
// iOS only: flag indicating if completed succesfully
console.log('whether song play completed successfully:', args.flag);
}
private _trackError(args: any) {
console.log('reference back to player:', args.player);
console.log('the error:', args.error);
// Android only: extra detail on error
console.log('extra info on the error:', args.extra);
}
}
</code></pre>
| 0debug
|
static int migration_put_buffer(void *opaque, const uint8_t *buf,
int64_t pos, int size)
{
MigrationState *s = opaque;
int ret;
DPRINTF("putting %d bytes at %" PRId64 "\n", size, pos);
if (size <= 0) {
return size;
}
qemu_put_buffer(s->migration_file, buf, size);
ret = qemu_file_get_error(s->migration_file);
if (ret) {
return ret;
}
s->bytes_xfer += size;
return size;
}
| 1threat
|
Angular2 with two frontend admin and site : <p>I am developing an app using angular-cli. The app has two frontend - site and admin. Both have different assets. </p>
<p><strong>Load only Admin assets when Admin is open.</strong>
<strong>Load only Site assets when Site is open.</strong>
How i can do it?
Currently i am having this structure.</p>
<p><a href="https://i.stack.imgur.com/sWNGa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sWNGa.png" alt="enter image description here"></a></p>
| 0debug
|
int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header)
{
int sample_rate, frame_size, mpeg25, padding;
int sample_rate_index, bitrate_index;
if (header & (1<<20)) {
s->lsf = (header & (1<<19)) ? 0 : 1;
mpeg25 = 0;
} else {
s->lsf = 1;
mpeg25 = 1;
}
s->layer = 4 - ((header >> 17) & 3);
sample_rate_index = (header >> 10) & 3;
sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
sample_rate_index += 3 * (s->lsf + mpeg25);
s->sample_rate_index = sample_rate_index;
s->error_protection = ((header >> 16) & 1) ^ 1;
s->sample_rate = sample_rate;
bitrate_index = (header >> 12) & 0xf;
padding = (header >> 9) & 1;
s->mode = (header >> 6) & 3;
s->mode_ext = (header >> 4) & 3;
if (s->mode == MPA_MONO)
s->nb_channels = 1;
else
s->nb_channels = 2;
if (bitrate_index != 0) {
frame_size = avpriv_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index];
s->bit_rate = frame_size * 1000;
switch(s->layer) {
case 1:
frame_size = (frame_size * 12000) / sample_rate;
frame_size = (frame_size + padding) * 4;
break;
case 2:
frame_size = (frame_size * 144000) / sample_rate;
frame_size += padding;
break;
default:
case 3:
frame_size = (frame_size * 144000) / (sample_rate << s->lsf);
frame_size += padding;
break;
}
s->frame_size = frame_size;
} else {
return 1;
}
#if defined(DEBUG)
av_dlog(NULL, "layer%d, %d Hz, %d kbits/s, ",
s->layer, s->sample_rate, s->bit_rate);
if (s->nb_channels == 2) {
if (s->layer == 3) {
if (s->mode_ext & MODE_EXT_MS_STEREO)
av_dlog(NULL, "ms-");
if (s->mode_ext & MODE_EXT_I_STEREO)
av_dlog(NULL, "i-");
}
av_dlog(NULL, "stereo");
} else {
av_dlog(NULL, "mono");
}
av_dlog(NULL, "\n");
#endif
return 0;
}
| 1threat
|
focus follows mouse (NO autoraise) in Mac Sierra : <p>I'm aware of the other threads on this topic but they are autoraised-based and/or all the answers point to software that's no longer being developed. I'm just looking for this simple feature: focus follows mouse WITHOUT autoraise for Mac.
Zooom2 was able to perform this, but they are no longer developing their software.
I'm not using the terminal and need to copy/paste and read between multiple programs with multiple windows, someone please tell you've found a solution to this? </p>
| 0debug
|
GMT_TO_EPOCH_TIME_CONVERTION : my server is using GMT time zone but my application is working on IST so i am converting GMT to IST while saving to database.
but when i am converting this saved IST into epoch time then its adding 5 hours 30 minutes into saved IST time.
Is there any idea ?? am i doing anything wrong ??
| 0debug
|
TPMInfo *tpm_backend_query_tpm(TPMBackend *s)
{
TPMInfo *info = g_new0(TPMInfo, 1);
TPMBackendClass *k = TPM_BACKEND_GET_CLASS(s);
TPMIfClass *tic = TPM_IF_GET_CLASS(s->tpmif);
info->id = g_strdup(s->id);
info->model = tic->model;
if (k->get_tpm_options) {
info->options = k->get_tpm_options(s);
}
return info;
}
| 1threat
|
Vuex $store properties not reactive when using computed property : <p>I have a Vuex store, which I'm injecting into my instance:</p>
<pre><code>import store from '../store';
const mainNav = new Vue({
el: '#main-nav',
store,
components: { NavComponent }
});
</code></pre>
<p>And I'm creating a computed property from that store in the component:</p>
<pre><code>computed: {
isWide() {
return this.$store.state.nav.type === 'wide';
}
}
</code></pre>
<p>This does create the <code>this.isWide</code> property for the template on component initialization, but when the store value is updated, the component doesn't register this - the old value is still on the template.</p>
<p>What am I doing wrong here?</p>
| 0debug
|
static void __attribute__((constructor)) init_cpuid_cache(void)
{
int max = __get_cpuid_max(0, NULL);
int a, b, c, d;
unsigned cache = 0;
if (max >= 1) {
__cpuid(1, a, b, c, d);
if (d & bit_SSE2) {
cache |= CACHE_SSE2;
}
#ifdef CONFIG_AVX2_OPT
if (c & bit_SSE4_1) {
cache |= CACHE_SSE4;
}
if ((c & bit_OSXSAVE) && (c & bit_AVX)) {
__asm("xgetbv" : "=a"(a), "=d"(d) : "c"(0));
if ((a & 6) == 6) {
cache |= CACHE_AVX1;
if (max >= 7) {
__cpuid_count(7, 0, a, b, c, d);
if (b & bit_AVX2) {
cache |= CACHE_AVX2;
}
}
}
}
#endif
}
cpuid_cache = cache;
}
| 1threat
|
static int do_info(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
const mon_cmd_t *cmd;
const char *item = qdict_get_try_str(qdict, "item");
if (!item) {
goto help;
}
for (cmd = info_cmds; cmd->name != NULL; cmd++) {
if (compare_cmd(item, cmd->name))
break;
}
if (cmd->name == NULL) {
goto help;
}
if (monitor_handler_is_async(cmd)) {
user_async_info_handler(mon, cmd);
*ret_data = qobject_from_jsonf("{ '__mon_async': 'return' }");
} else if (monitor_handler_ported(cmd)) {
QObject *info_data = NULL;
cmd->mhandler.info_new(mon, &info_data);
if (info_data) {
cmd->user_print(mon, info_data);
qobject_decref(info_data);
}
} else {
cmd->mhandler.info(mon);
}
return 0;
help:
help_cmd(mon, "info");
return 0;
}
| 1threat
|
Transposing csv file in python using jupyter : ****Disclaimer, I am a beginner in coding so please go easy , thanks in advance*****
How do you transpose the data before saving the data to a csv file using python in jupyter?
Here is my code>>
import csv
Col1 = "Product Name"
Col2 = "Product Image Is Thumbnail - 1"
Col3 = "Product Code/SKU"
Col4 = "Product Description"
Col5 = "Price"
Col6 = "Cost Price"
Col7 = "Product Image File - 1"
Col8 = "Product Image File - 2"
mydictionary={Col1:[], Col2:[], Col3:[], Col4 :[], Col5:[], Col6:[], Col7:[], Col8:[]}
csvFile = csv.reader(open("wedding.csv"))
for row in csvFile:
mydictionary[Col1].append(row[2])
mydictionary[Col2].append(row[6])
mydictionary[Col3].append(row[4])
mydictionary[Col4].append(row[11])
mydictionary[Col5].append(row[7])
mydictionary[Col6].append(row[8])
mydictionary[Col7].append(row[9])
mydictionary[Col8].append(row[10])
print (mydictionary)
with open('test.csv', 'w') as csv_file1:
writer = csv.writer(csv_file1, delimiter=' ',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
for key, value in mydictionary.items():
writer.writerow([key, value])``
| 0debug
|
style not working for innerhtml in Angular 2 Typescript : <p>I am passing html as innerHtml to my view. The below is my view</p>
<pre><code><div [innerHTML]="someHtmlCode"></div>
</code></pre>
<p>if I pass the below code, it is working fine.</p>
<pre><code>this.someHtmlCode = "<div><b>This is my HTML.</b></div>"
</code></pre>
<p>if I pass the below code which contain color, it is not working.</p>
<pre><code> this.someHtmlCode = '<div style="background-color: blue;"><b>This is my HTML.</b></div>';
</code></pre>
| 0debug
|
static int block_save_complete(QEMUFile *f, void *opaque)
{
int ret;
DPRINTF("Enter save live complete submitted %d transferred %d\n",
block_mig_state.submitted, block_mig_state.transferred);
ret = flush_blks(f);
if (ret) {
blk_mig_cleanup();
return ret;
}
blk_mig_reset_dirty_cursor();
assert(block_mig_state.submitted == 0);
do {
ret = blk_mig_save_dirty_block(f, 0);
} while (ret == 0);
blk_mig_cleanup();
if (ret) {
return ret;
}
qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);
DPRINTF("Block migration completed\n");
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
return 0;
}
| 1threat
|
c# datetimepicker did not work with sql parameters and work with directly like sql injection : string sqlconf = ConfigurationManager.ConnectionStrings["sqlconstr"].ConnectionString;
string pathconf = ConfigurationManager.AppSettings["expath"].ToString();
string sql = "select userid,logdate from Devicelogs_1_2015 where convert(varchar(10),LogDate,103) between '@fdate' and '@tdate';";
StreamWriter sw = new StreamWriter(pathconf);
SqlConnection sqlcon = new SqlConnection(sqlconf);
SqlCommand sqlcom = new SqlCommand(sql, sqlcon);
sqlcom.Parameters.Add("@fdate", SqlDbType.VarChar).Value = dateTimePicker1.Value.ToString("dd/MM/yyyy");
sqlcom.Parameters.Add("@tdate", SqlDbType.VarChar).Value = dateTimePicker2.Value.ToString("dd/MM/yyyy");
sqlcon.Open();
using (sqlcon)
{
using (SqlDataReader sqldr = sqlcom.ExecuteReader())
{
while (sqldr.Read())
{
string userid1 = sqldr.GetString(0);
DateTime logdate1 = sqldr.GetDateTime(1);
sw.WriteLine("{0},{1}", userid1, logdate1.ToString("yyyy-MM-dd HH:mm:ss"));
}
sw.Close();
sqldr.Close();
}
sqlcon.Close();
MessageBox.Show("File Exported Successfully");
Close();
}
}
| 0debug
|
alert('Hello ' + user_input);
| 1threat
|
No operator "==" matches these operands (Snake game) : #include <vector>
#include <limits>
#include <algorithm>
#include <SFML/Graphics.hpp>
#include <iostream>
sf::RectangleShape snake;
//increases size of the snake
sf::RectangleShape addsnake(){
sf::RectangleShape addsnake1;
addsnake1.setSize(sf::Vector2f(20, 25));
addsnake1.setFillColor(sf::Color::Red);
addsnake1.setPosition(100, 100);
sf::RectangleShape addsnake2;
addsnake2.setSize(sf::Vector2f(20, 30));
addsnake2.setFillColor(sf::Color::Red);
addsnake2.setPosition(100, 100);
sf::RectangleShape addsnake3;
addsnake3.setFillColor(sf::Color::Red);
addsnake3.setSize(sf::Vector2f(20, 35));
addsnake3.setPosition(100, 100);
sf::RectangleShape addsnake4;
addsnake4.setSize(sf::Vector2f(20, 40));
addsnake4.setFillColor(sf::Color::Red);
addsnake4.setPosition(100, 100);
sf::RectangleShape addsnakey[4] = { addsnake1, addsnake2, addsnake3, addsnake4 };
if (snake == snake) //problem here (No operator "==" matches these operands)
return addsnakey[0];
else if (snake == addsnakey[0])
return addsnakey[1];
else if (snake == addsnakey[1])
return addsnakey[2];
else if (snake == addsnakey[2])
return addsnakey[3];
else if (snake == addsnakey[3])
return addsnakey[4];
}
//checks if snake ate the fruit
bool intersects(const sf::RectangleShape & r1, const sf::RectangleShape & r2){
sf::FloatRect snake = r1.getGlobalBounds();
sf::FloatRect spawnedFruit = r2.getGlobalBounds();
return snake.intersects(spawnedFruit);
}
sf::RectangleShape generateFruit() {
sf::RectangleShape fruit;
fruit.setFillColor(sf::Color::Yellow);
int fruitx = rand() % 400;
int fruity = rand() % 400;
fruit.setPosition(fruitx, fruity);
fruit.setSize(sf::Vector2f(5, 5));
return fruit;
}
int main()
{
srand(time(NULL));
int width = 400;
int height = 400;
sf::VideoMode videomode(width, height);
sf::RenderWindow window(videomode, "Snake");
snake.setFillColor(sf::Color::Red);
snake.setSize(sf::Vector2f(20, 20));
snake.setPosition(100, 100);
sf::Clock clock;
sf::Time t1 = sf::seconds(20);
sf::RectangleShape spawnedFruit;
while (window.isOpen()) {
window.clear();
window.draw(snake);
sf::Time elapsed1 = clock.getElapsedTime();
if (elapsed1 >= t1) {
spawnedFruit = generateFruit();
clock.restart();
}
window.draw(spawnedFruit);
window.display();
sf::Event event;
while (window.pollEvent(event))
{
if ((event.type == sf::Event::Closed) ||
((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Escape)))
window.close();
}
//motion
if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
snake.move(0, -0.1);
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
snake.move(0, 0.1);
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
snake.move(-0.1, 0);
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
snake.move(0.1, 0);
if (intersects(snake, spawnedFruit))
snake = addsnake();
}
}
The error:-
No operator "==" matches these operands.Operand types are sf::RectangleShape == sf::RectangleShape. Why is that? Could you please help me fix it? I've done my research but didn't find anything relevant to my problem here. Thank you!
| 0debug
|
static void xilinx_spips_realize(DeviceState *dev, Error **errp)
{
XilinxSPIPS *s = XILINX_SPIPS(dev);
SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
XilinxSPIPSClass *xsc = XILINX_SPIPS_GET_CLASS(s);
int i;
DB_PRINT_L(0, "realized spips\n");
s->spi = g_new(SSIBus *, s->num_busses);
for (i = 0; i < s->num_busses; ++i) {
char bus_name[16];
snprintf(bus_name, 16, "spi%d", i);
s->spi[i] = ssi_create_bus(dev, bus_name);
}
s->cs_lines = g_new0(qemu_irq, s->num_cs * s->num_busses);
ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[0]);
ssi_auto_connect_slaves(DEVICE(s), s->cs_lines, s->spi[1]);
sysbus_init_irq(sbd, &s->irq);
for (i = 0; i < s->num_cs * s->num_busses; ++i) {
sysbus_init_irq(sbd, &s->cs_lines[i]);
}
memory_region_init_io(&s->iomem, OBJECT(s), xsc->reg_ops, s,
"spi", XLNX_SPIPS_R_MAX * 4);
sysbus_init_mmio(sbd, &s->iomem);
s->irqline = -1;
fifo8_create(&s->rx_fifo, xsc->rx_fifo_size);
fifo8_create(&s->tx_fifo, xsc->tx_fifo_size);
}
| 1threat
|
Restrict slack-slash command access : <p>I have automated the deployments in Jenkins from slack by <code>slash commands</code>.</p>
<p>I need give <code>permission for slash commands</code> or restrict the slash command access only to particular users (i.e) some members in the channel can deploy the dev environment by using <code>/deploy_dev</code> but they should not able to deploy to staging and production environments.</p>
| 0debug
|
def empty_dit(list1):
empty_dit=all(not d for d in list1)
return empty_dit
| 0debug
|
how to use contains with substring : i have an `ArryList` which have (name+"\n"+phoneNumber) so I wanna see if the name is containing with the list ? I used this code
`HashSet<String> set = new HashSet<String>(ContactsList);
if (set.contains(name))
{}
else
{
ContactsList.add(name+"\n"+phoneNumber+"\n");
}`
but how to use substring in contains so I get just the name from it to contain it with the name that I wanna add It to the list
and thanks
| 0debug
|
PHP code date is not working well : <p>For some strange reason, my php code is displaying a wrong value.
I am trying to display the day of the week.</p>
<p>When using the following code <code><?php echo date('w');?></code> it is displaying 0, which is right for Sunday.</p>
<p>But when using the following code, it is dispalying 5 (Friday) for some reason.</p>
<p>What am I missing?</p>
<pre><code><?php $weekday = date('w'); ?>
<?php if ($weekday >= 1 && $weekday <= 4) : ?>
<li class="usp-list-checkout first">
<a class="usp-link" href="/url">It's day 1 - 4</a>
</li>
<?php elseif ($weekday = 5) : ?>
<li class="usp-list-checkout first">
<a class="usp-link" href="/url">It's day 5</a>
</li>
<?php else : ?>
<li class="usp-list-checkout first">
<a class="usp-link" href="/url">It's day 6 or 7</a>
</li>
<?php endif; ?>
</code></pre>
| 0debug
|
Special Singleton : class A{
}
class B extends A{
}
class C extends B{
}
A a1 = new A(); //Should work fine
A a2 = new A(); // Should throw an error if one instance is already created
B b1 = new B(); // Should work fine despite A instance is there or not
B b2 = new B(); // Should throw an error
C c1 = new C(); // Should work fine despite B instance is there or not
C c2 = new C(); // Should throw an error
| 0debug
|
How to create a boolean function that returns true if 's' is immediately followed by the letter 't' in a string : <p>I've just started to learn how to write code using Java and am trying to make a boolean function that takes a string and returns true is a character 's' in a string is always followed(somewhere) by the character 't', and false otherwise. So for example, "stay" should return true; "tta" should return false; "cc" should return true because 's' does not appear at all therefore any 's' IS preceded by an 't', there just are no 't's.How would I go about this? </p>
| 0debug
|
Changes made to copy of an object reflect in the original object : <p>In the below snippet, I made changes to the 'current' object, which is a copy of 'head' object. However, changes get reflected to the global head object.</p>
<pre><code>class Node
{
public Node next; //pointer
public Object data; //data
public Node(Object d)
{
data = d;
}
}
public class CustomLinkedList
{
private Node head = new Node(null); //head of linked list
public void Add(Object data)
{
Node newNode = new Node(data);
Node current = head;
while (current.next != null)
{
current = current.next;
}
current.next = newNode;
}
}
</code></pre>
| 0debug
|
static int virtio_ccw_device_init(VirtioCcwDevice *dev, VirtIODevice *vdev)
{
unsigned int cssid = 0;
unsigned int ssid = 0;
unsigned int schid;
unsigned int devno;
bool have_devno = false;
bool found = false;
SubchDev *sch;
int ret;
int num;
DeviceState *parent = DEVICE(dev);
sch = g_malloc0(sizeof(SubchDev));
sch->driver_data = dev;
dev->sch = sch;
dev->indicators = NULL;
sch->channel_prog = 0x0;
sch->last_cmd_valid = false;
sch->thinint_active = false;
if (dev->bus_id) {
num = sscanf(dev->bus_id, "%x.%x.%04x", &cssid, &ssid, &devno);
if (num == 3) {
if ((cssid > MAX_CSSID) || (ssid > MAX_SSID)) {
ret = -EINVAL;
error_report("Invalid cssid or ssid: cssid %x, ssid %x",
cssid, ssid);
goto out_err;
}
if (cssid != VIRTUAL_CSSID) {
ret = -EINVAL;
error_report("cssid %x not valid for virtio devices", cssid);
goto out_err;
}
if (css_devno_used(cssid, ssid, devno)) {
ret = -EEXIST;
error_report("Device %x.%x.%04x already exists", cssid, ssid,
devno);
goto out_err;
}
sch->cssid = cssid;
sch->ssid = ssid;
sch->devno = devno;
have_devno = true;
} else {
ret = -EINVAL;
error_report("Malformed devno parameter '%s'", dev->bus_id);
goto out_err;
}
}
if (have_devno) {
for (schid = 0; schid <= MAX_SCHID; schid++) {
if (!css_find_subch(1, cssid, ssid, schid)) {
sch->schid = schid;
css_subch_assign(cssid, ssid, schid, devno, sch);
found = true;
break;
}
}
if (!found) {
ret = -ENODEV;
error_report("No free subchannel found for %x.%x.%04x", cssid, ssid,
devno);
goto out_err;
}
trace_virtio_ccw_new_device(cssid, ssid, schid, devno,
"user-configured");
} else {
cssid = VIRTUAL_CSSID;
for (ssid = 0; ssid <= MAX_SSID; ssid++) {
for (schid = 0; schid <= MAX_SCHID; schid++) {
if (!css_find_subch(1, cssid, ssid, schid)) {
sch->cssid = cssid;
sch->ssid = ssid;
sch->schid = schid;
devno = schid;
while (css_devno_used(cssid, ssid, devno)) {
if (devno == MAX_SCHID) {
devno = 0;
} else if (devno == schid - 1) {
ret = -ENODEV;
error_report("No free devno found");
goto out_err;
} else {
devno++;
}
}
sch->devno = devno;
css_subch_assign(cssid, ssid, schid, devno, sch);
found = true;
break;
}
}
if (found) {
break;
}
}
if (!found) {
ret = -ENODEV;
error_report("Virtual channel subsystem is full!");
goto out_err;
}
trace_virtio_ccw_new_device(cssid, ssid, schid, devno,
"auto-configured");
}
css_sch_build_virtual_schib(sch, 0, VIRTIO_CCW_CHPID_TYPE);
sch->ccw_cb = virtio_ccw_cb;
memset(&sch->id, 0, sizeof(SenseId));
sch->id.reserved = 0xff;
sch->id.cu_type = VIRTIO_CCW_CU_TYPE;
sch->id.cu_model = vdev->device_id;
dev->host_features[0] = virtio_bus_get_vdev_features(&dev->bus,
dev->host_features[0]);
dev->host_features[0] |= 0x1 << VIRTIO_F_NOTIFY_ON_EMPTY;
dev->host_features[0] |= 0x1 << VIRTIO_F_BAD_FEATURE;
css_generate_sch_crws(sch->cssid, sch->ssid, sch->schid,
parent->hotplugged, 1);
return 0;
out_err:
dev->sch = NULL;
g_free(sch);
return ret;
}
| 1threat
|
React-Native Lowest Android API level : <p>I am doing some research on react-native and android. Does anyone know the lowest api level react-native supports for android? I've searched all over their docs page and couldn't find it. </p>
| 0debug
|
#1136 - Column count doesn't match value count at row 1. Could someone please explain why this is not working? : INSERT into Customer
(CustomerID, Forename, Surname, DOB, Address, Email)
VALUES ('1', 'Steven’, ‘Halls’, ‘08/02/1992’, ‘%d-%m-%y’, ‘12 Lesnes Abbey SE7 8TX’, ‘stevenH@gmail.com');
COULD SOME EXPLAIN WHY THIS IS NOT WORKING
| 0debug
|
DeviceState *aux_create_slave(AUXBus *bus, const char *type, uint32_t addr)
{
DeviceState *dev;
dev = DEVICE(object_new(type));
assert(dev);
qdev_set_parent_bus(dev, &bus->qbus);
qdev_init_nofail(dev);
aux_bus_map_device(AUX_BUS(qdev_get_parent_bus(dev)), AUX_SLAVE(dev), addr);
return dev;
}
| 1threat
|
Match anything between special characters in c# : <p>I have a string like this
[test]][test][test]</p>
<p>I would like with a regex to obtain a collection of elements where each element will be a value between the brackets [] :</p>
<p>test<br>
test<br>
test<br></p>
<p>With this code:</p>
<pre><code>var pattern = @"\[(.*?)\]";
var results = Regex.Matches("[test]][test][test]", pattern);
</code></pre>
<p>I managed to get the values but they include the brackets [] :</p>
<p>[test]<br>
[test]<br>
[test]<br></p>
| 0debug
|
Install Atom for Python on Windows 10 - Solved : So I just encountered this issue and wanted to share my experience in how to solve the problem.
A lot of posts are about setting the paths etc. which will sometimes not work for everybody.
If this does not work guys uninstall Python and Atom. While reinstalling Python make sure you click on "Add Python to Path" so you will not have any problems with setting the paths at all!
[Problem solved][1]
[1]: http://i.stack.imgur.com/CCXQG.jpg
| 0debug
|
static int multiwrite_req_compare(const void *a, const void *b)
{
const BlockRequest *req1 = a, *req2 = b;
if (req1->sector > req2->sector) {
return 1;
} else if (req1->sector < req2->sector) {
return -1;
} else {
return 0;
}
}
| 1threat
|
static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev);
int buflen = 0;
if (req->cmd.buf[1] & 0x2) {
BADF("optional INQUIRY command support request not implemented\n");
return -1;
}
if (req->cmd.buf[1] & 0x1) {
uint8_t page_code = req->cmd.buf[2];
if (req->cmd.xfer < 4) {
BADF("Error: Inquiry (EVPD[%02X]) buffer size %zd is "
"less than 4\n", page_code, req->cmd.xfer);
return -1;
}
if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
outbuf[buflen++] = 5;
} else {
outbuf[buflen++] = 0;
}
outbuf[buflen++] = page_code ;
outbuf[buflen++] = 0x00;
switch (page_code) {
case 0x00:
DPRINTF("Inquiry EVPD[Supported pages] "
"buffer size %zd\n", req->cmd.xfer);
outbuf[buflen++] = 4;
outbuf[buflen++] = 0x00;
outbuf[buflen++] = 0x80;
outbuf[buflen++] = 0x83;
outbuf[buflen++] = 0xb0;
break;
case 0x80:
{
const char *serial = req->dev->conf.dinfo->serial ?
req->dev->conf.dinfo->serial : "0";
int l = strlen(serial);
if (l > req->cmd.xfer)
l = req->cmd.xfer;
if (l > 20)
l = 20;
DPRINTF("Inquiry EVPD[Serial number] "
"buffer size %zd\n", req->cmd.xfer);
outbuf[buflen++] = l;
memcpy(outbuf+buflen, serial, l);
buflen += l;
break;
}
case 0x83:
{
int max_len = 255 - 8;
int id_len = strlen(bdrv_get_device_name(s->bs));
if (id_len > max_len)
id_len = max_len;
DPRINTF("Inquiry EVPD[Device identification] "
"buffer size %zd\n", req->cmd.xfer);
outbuf[buflen++] = 3 + id_len;
outbuf[buflen++] = 0x2;
outbuf[buflen++] = 0;
outbuf[buflen++] = 0;
outbuf[buflen++] = id_len;
memcpy(outbuf+buflen, bdrv_get_device_name(s->bs), id_len);
buflen += id_len;
break;
}
case 0xb0:
{
unsigned int min_io_size = s->qdev.conf.min_io_size >> 9;
unsigned int opt_io_size = s->qdev.conf.opt_io_size >> 9;
outbuf[3] = buflen = 0x3c;
memset(outbuf + 4, 0, buflen - 4);
outbuf[6] = (min_io_size >> 8) & 0xff;
outbuf[7] = min_io_size & 0xff;
outbuf[12] = (opt_io_size >> 24) & 0xff;
outbuf[13] = (opt_io_size >> 16) & 0xff;
outbuf[14] = (opt_io_size >> 8) & 0xff;
outbuf[15] = opt_io_size & 0xff;
break;
}
default:
BADF("Error: unsupported Inquiry (EVPD[%02X]) "
"buffer size %zd\n", page_code, req->cmd.xfer);
return -1;
}
return buflen;
}
if (req->cmd.buf[2] != 0) {
BADF("Error: Inquiry (STANDARD) page or code "
"is non-zero [%02X]\n", req->cmd.buf[2]);
return -1;
}
if (req->cmd.xfer < 5) {
BADF("Error: Inquiry (STANDARD) buffer size %zd "
"is less than 5\n", req->cmd.xfer);
return -1;
}
buflen = req->cmd.xfer;
if (buflen > SCSI_MAX_INQUIRY_LEN)
buflen = SCSI_MAX_INQUIRY_LEN;
memset(outbuf, 0, buflen);
if (req->lun || req->cmd.buf[1] >> 5) {
outbuf[0] = 0x7f;
return buflen;
}
if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
outbuf[0] = 5;
outbuf[1] = 0x80;
memcpy(&outbuf[16], "QEMU CD-ROM ", 16);
} else {
outbuf[0] = 0;
memcpy(&outbuf[16], "QEMU HARDDISK ", 16);
}
memcpy(&outbuf[8], "QEMU ", 8);
memcpy(&outbuf[32], s->version ? s->version : QEMU_VERSION, 4);
outbuf[2] = 5;
outbuf[3] = 2;
if (buflen > 36) {
outbuf[4] = buflen - 5;
} else {
outbuf[4] = 36 - 5;
}
outbuf[7] = 0x10 | (req->bus->tcq ? 0x02 : 0);
return buflen;
}
| 1threat
|
Generate random value at interval of 5 Sec in JavaScript : <p>Can anyone tell me how to generate random value between <code>0 and 100</code> in an interval of <code>5 seconds</code>.</p>
| 0debug
|
connection.query('SELECT * FROM users WHERE username = ' + input_string)
| 1threat
|
I need command line for Linux An Mac OS : So I know a command lines that I need For windows:
cd src
java -cp . mazesolver.SolverCode
Now I need what those lines will be in:
**Mac OS and Linux**
| 0debug
|
sql queury for below condition : Employee_id Status
111 Approved
111 Approved
111 Pending
222 Approved
222 Approved
in my table which is like above only 222 should get as approved give solution
| 0debug
|
static void ide_init2(IDEState *ide_state,
BlockDriverState *hd0, BlockDriverState *hd1,
qemu_irq irq)
{
IDEState *s;
static int drive_serial = 1;
int i, cylinders, heads, secs;
uint64_t nb_sectors;
for(i = 0; i < 2; i++) {
s = ide_state + i;
s->io_buffer = qemu_memalign(512, IDE_DMA_BUF_SECTORS*512 + 4);
if (i == 0)
s->bs = hd0;
else
s->bs = hd1;
if (s->bs) {
bdrv_get_geometry(s->bs, &nb_sectors);
bdrv_guess_geometry(s->bs, &cylinders, &heads, &secs);
s->cylinders = cylinders;
s->heads = heads;
s->sectors = secs;
s->nb_sectors = nb_sectors;
if (bdrv_get_type_hint(s->bs) == BDRV_TYPE_CDROM) {
s->is_cdrom = 1;
bdrv_set_change_cb(s->bs, cdrom_change_cb, s);
}
}
s->drive_serial = drive_serial++;
strncpy(s->drive_serial_str, drive_get_serial(s->bs),
sizeof(s->drive_serial_str));
if (strlen(s->drive_serial_str) == 0)
snprintf(s->drive_serial_str, sizeof(s->drive_serial_str),
"QM%05d", s->drive_serial);
s->irq = irq;
s->sector_write_timer = qemu_new_timer(vm_clock,
ide_sector_write_timer_cb, s);
ide_reset(s);
}
}
| 1threat
|
SQL - Multiple Counts that are grouped, from multiple tables, with a join thrown in. : Hoping for some help on this topic. I've found related things but nothing that encompassed my whole problem.
I have two tables that hold image paths. The counts of approved images should equal the count of published images but I have evidence that they do not. One table has to have a join to group by the same criteria as the other table. I only want to return rows where the two counts don't match up. I've included the two queries I have that would return the data individually. Even if I tried to use Excel as a crutch, the amount of rows this query would return is in the millions.
Query 1
select product_id, count(*)
from published p
join published_set ps on ps.id = p.media_set_id
group by ps.product_id
Query 2
select product_id, count(*)
from media
where status in 'APPROVED'
group by pro_sku
I did use Excel to pull one category of products that I suspected was the worst and got 8,000 mismatches out of 12,000 products. I want to compare this to other areas of the website, which I believe have little to no mismatches. My suspicion is a system is inserting data into the table incorrectly in a specific category.
| 0debug
|
Avoid overflow with softplus function in python : <p>I am trying to implement the following softplus function:</p>
<pre><code>log(1 + exp(x))
</code></pre>
<p>I've tried it with math/numpy and float64 as data type, but whenever <code>x</code> gets too large (e.g. <code>x = 1000</code>) the result is <code>inf</code>.</p>
<p>Can you assist me on how to successfully handle this function with large numbers?</p>
| 0debug
|
Stuck at "A merge operation in progress" : <h3>Steps</h3>
<ul>
<li>In Visual Studio</li>
<li>Pulled from remote repo</li>
<li>1 merge conflict.</li>
<li>Merged manually, clicked 'Accept merge'</li>
</ul>
<h3>Result</h3>
<ul>
<li>Message: "A merge operation is in progress in the ... repository. Commit your changes to complete the merge operation."</li>
<li>However, there is nothing to commit: There are 0 pending changes, no actions apart from Abort seem to be possible.</li>
</ul>
<p>Screenshot: <a href="https://pbs.twimg.com/media/DBOeRIiXsAEbnLP.jpg" rel="noreferrer">https://pbs.twimg.com/media/DBOeRIiXsAEbnLP.jpg</a></p>
<h3>Context</h3>
<ul>
<li>remote git repo is hosted in Visual Studio Team Services</li>
<li>Visual Studio 2017 with all updates</li>
</ul>
| 0debug
|
Vertically concatenating multiple data frames within a loop in R : <p>I have 40 data frames (same size) let's say station_1, station_2,....,station_40</p>
<p>In each loop there will be different stations that need to be vertically concatenated. For example, in a particular loop, i want to concatenate [station_2, station_3, station_11, station_30, station_40]. How can i code the R to do that without explicitly specifying the names of those station?</p>
| 0debug
|
static inline int lock_hpte(void *hpte, target_ulong bits)
{
uint64_t pteh;
pteh = ldq_p(hpte);
if (pteh & bits) {
return 0;
}
stq_p(hpte, pteh | HPTE_V_HVLOCK);
return 1;
}
| 1threat
|
How to implement slider menu in react Native : <p>I'm new to react.
I need to develop slider menu in React-native.
I follow below link but that is not I want
<a href="http://www.reactnative.com/a-slide-menu-inspired-from-android-for-react-native/">http://www.reactnative.com/a-slide-menu-inspired-from-android-for-react-native/</a></p>
<p>Actually I need image which I attached here.</p>
<p><a href="https://i.stack.imgur.com/qrMZ7.png"><img src="https://i.stack.imgur.com/qrMZ7.png" alt="enter image description here"></a></p>
<p>Please help me..</p>
| 0debug
|
Angular2 "No provider for t!" and Uncaught (in promise): Error: DI Error : <p>I've build a app in Angular 2, and have encountered a issue.
I have used angular CLI to create my application, I have created my components and services using Angular CLI and I use "<strong>ng serve</strong>" to run the application locally and everything works fine. In order to create a build for PROD I'm using the command "<strong>ng build --Prod --base-href ./ --aot</strong>", it creates a DIST folder and hosting the folder in IIS opens the application fine. When I check in the code to TFS there is a event which automatically creates DIST folder using jenkins and pushes the build to my server. Now if I browse the application for server it throws the following errors "<strong>No provider for t!</strong>" and Error: DI Error. I don't know what I'm doing wrong here. <br/></p>
<p>Below are the screenshots of the error</p>
<p><a href="https://i.stack.imgur.com/4goYO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4goYO.png" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/QDVsl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QDVsl.png" alt="enter image description here"></a></p>
<p><br/>
Any help is much appreciated.<br/></p>
| 0debug
|
Parsing an arrayList in android : I am new to android. How do I parse this array list {apptName=Ken O'Reily, apptClientId=1056, apptOption1=Option1: Sun 11/26/2017 01:30 PM} (sent from another activity)? Thanks
| 0debug
|
Can someone explain me partial in ruby on rails : I am trying to figure out how partials works in rails.
Here is code :
<%= render "layouts/appended_pages", pages: {partial: "items",
collection: @results,
locals: {user_flag: false}} %>
I understand that this render will render _appended_pages but what will do part with pages: ? Can someone explain me how it works
| 0debug
|
Allow only numbers and special character(-) to be typed in a textbox : <p>I need to Allow only numbers and special character minus "-" to be typed in a textbox, plz help me i already have a number restriction, but wanna minus sign too.</p>
<p>thanks in advance</p>
<pre><code><script>
function isNumber(evt) {
evt = (evt) ? evt : window.event;
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode > 31 && (charCode < 48 || charCode > 57)) {
return false;
}
return true;
}
</script>
<input type="text" class="textfield" value="" id="extra7" name="extra7" onkeypress="return isNumber(event)" />
</code></pre>
| 0debug
|
How can I check the content of a list with step 3 by 3? : I need to write a function that given a list of integers `L` and integer `n`, it returns `True` if the list contains a consecutive sequence of ones of length `n`, and `False` otherwhise.
Let's say my list is : `L = [1,2,3,4,1,1,1,2,3,4]` and `n` = 3.
The function should return `True` because there are 3 ones at the 5th position.
I tried with:
def consecutive (L,n):
for i in range(len(L)):
if [1]*n in L:
return True
return False
L = [1,2,3,4,1,1,1,2,3,4]
n = 3
consecutive (L,n)
But this is not working of course, because `[1]*3` generate `[1,1,1]` and there are not sublist inside `L`.
Is there any way using list comprehension? Something like:
L = [1,2,3,4,1,1,1,2,3,4]
result = all(x==(1,1,1) for x in range(0,len(L)+1,3))
result
Again, I know is not working because each element `x` can't be equal to `(1,1,1)`. I wrote it down just to give an idea of what was in my mind.
| 0debug
|
T SQL syntax for creating table : I Need to make a table of student marks list.
in one column the data need to be sum of the columns in the same row
ex roll_no Maths1 maths2 physics total
12 48 50 60 158
how can i create a table for the above solution in sql
| 0debug
|
visual Studio/Basics SumNumber program code : Public Class frmSumNumbers
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim sum As Integer
Dim count As Integer
Dim num1 As Integer
Dim num2 As Integer
For x = num1 To num2
sum = num1 + num2
count = count + 1
Next x
lblAnswer.Text = count
lblAnswer1.Text = sum
End Sub
End Class
If I do this I get the first number split into two labels. I need it to show from the numbers in between the starting number and ending. E.G 10(starting) 11+12+13+14+15+16+17+18+19+20 20(being the ending number) What should I do?My grade is dropping.
| 0debug
|
Global Exception Handling in Xamarin Cross platform : <p>Can you please let me know how to handle the global exception(without App crash) in Xamarin Cross platform project.</p>
| 0debug
|
static inline void gen_intermediate_code_internal(UniCore32CPU *cpu,
TranslationBlock *tb, bool search_pc)
{
CPUState *cs = CPU(cpu);
CPUUniCore32State *env = &cpu->env;
DisasContext dc1, *dc = &dc1;
CPUBreakpoint *bp;
uint16_t *gen_opc_end;
int j, lj;
target_ulong pc_start;
uint32_t next_page_start;
int num_insns;
int max_insns;
num_temps = 0;
pc_start = tb->pc;
dc->tb = tb;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
dc->is_jmp = DISAS_NEXT;
dc->pc = pc_start;
dc->singlestep_enabled = cs->singlestep_enabled;
dc->condjmp = 0;
cpu_F0s = tcg_temp_new_i32();
cpu_F1s = tcg_temp_new_i32();
cpu_F0d = tcg_temp_new_i64();
cpu_F1d = tcg_temp_new_i64();
next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
lj = -1;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
#ifndef CONFIG_USER_ONLY
if ((env->uncached_asr & ASR_M) == ASR_MODE_USER) {
dc->user = 1;
} else {
dc->user = 0;
}
#endif
gen_tb_start();
do {
if (unlikely(!QTAILQ_EMPTY(&cs->breakpoints))) {
QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
if (bp->pc == dc->pc) {
gen_set_pc_im(dc->pc);
gen_exception(EXCP_DEBUG);
dc->is_jmp = DISAS_JUMP;
dc->pc += 2;
goto done_generating;
}
}
}
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j) {
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
}
tcg_ctx.gen_opc_pc[lj] = dc->pc;
tcg_ctx.gen_opc_instr_start[lj] = 1;
tcg_ctx.gen_opc_icount[lj] = num_insns;
}
if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) {
gen_io_start();
}
disas_uc32_insn(env, dc);
if (num_temps) {
fprintf(stderr, "Internal resource leak before %08x\n", dc->pc);
num_temps = 0;
}
if (dc->condjmp && !dc->is_jmp) {
gen_set_label(dc->condlabel);
dc->condjmp = 0;
}
num_insns++;
} while (!dc->is_jmp && tcg_ctx.gen_opc_ptr < gen_opc_end &&
!cs->singlestep_enabled &&
!singlestep &&
dc->pc < next_page_start &&
num_insns < max_insns);
if (tb->cflags & CF_LAST_IO) {
if (dc->condjmp) {
cpu_abort(cs, "IO on conditional branch instruction");
}
gen_io_end();
}
if (unlikely(cs->singlestep_enabled)) {
if (dc->condjmp) {
if (dc->is_jmp == DISAS_SYSCALL) {
gen_exception(UC32_EXCP_PRIV);
} else {
gen_exception(EXCP_DEBUG);
}
gen_set_label(dc->condlabel);
}
if (dc->condjmp || !dc->is_jmp) {
gen_set_pc_im(dc->pc);
dc->condjmp = 0;
}
if (dc->is_jmp == DISAS_SYSCALL && !dc->condjmp) {
gen_exception(UC32_EXCP_PRIV);
} else {
gen_exception(EXCP_DEBUG);
}
} else {
switch (dc->is_jmp) {
case DISAS_NEXT:
gen_goto_tb(dc, 1, dc->pc);
break;
default:
case DISAS_JUMP:
case DISAS_UPDATE:
tcg_gen_exit_tb(0);
break;
case DISAS_TB_JUMP:
break;
case DISAS_SYSCALL:
gen_exception(UC32_EXCP_PRIV);
break;
}
if (dc->condjmp) {
gen_set_label(dc->condlabel);
gen_goto_tb(dc, 1, dc->pc);
dc->condjmp = 0;
}
}
done_generating:
gen_tb_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
#ifdef DEBUG_DISAS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
qemu_log("----------------\n");
qemu_log("IN: %s\n", lookup_symbol(pc_start));
log_target_disas(env, pc_start, dc->pc - pc_start, 0);
qemu_log("\n");
}
#endif
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j) {
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
} else {
tb->size = dc->pc - pc_start;
tb->icount = num_insns;
}
}
| 1threat
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.