problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Is it possible to bind data without refersh page using knockout.js? : I have tried to rebind data with knockout.js and ajax but it wont be fix. | 0debug |
static void pl181_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
DeviceClass *k = DEVICE_CLASS(klass);
sdc->init = pl181_init;
k->vmsd = &vmstate_pl181;
k->reset = pl181_reset;
k->no_user = 1;
}
| 1threat |
Testing Flutter code that uses a plugin and platform channel : <p>I have a flutter plugin which uses the platform channel to do some native work.</p>
<p>How do I properly write tests for my application that requires this plugin?</p>
<p>Unit tests only are good for pure dart functions. I don't believe Widget testing will be able to test things that use the platform channel to native. So that leaves integration testing.</p>
<p>From what I understand is that integration testing will start your main application and you can control it around your app and test things.</p>
<p>For my case, I want to test just the code that uses the plugin (that uses the platform channel for native stuff).</p>
<p>Also what is important is the values that come back from the platform channel, so it is important to call the native side using a real platform channel and not a mock one.</p>
<p>Is that possible? Can I tell the integration tester to open a dummy version of my application, kind of like an integrated widget tester?</p>
| 0debug |
visual studio project out of date do you want to rebuild? : <p>am new to visual studio and whenever i try to build and run my code on Vs2017 a dailog box appears displaying the message " your project is out of date do you want to rebuild?"
after click rebuild its displays an error message even though there are no errors</p>
| 0debug |
static int ioreq_map(struct ioreq *ioreq)
{
int gnt = ioreq->blkdev->xendev.gnttabdev;
int i;
if (ioreq->v.niov == 0) {
return 0;
}
if (batch_maps) {
ioreq->pages = xc_gnttab_map_grant_refs
(gnt, ioreq->v.niov, ioreq->domids, ioreq->refs, ioreq->prot);
if (ioreq->pages == NULL) {
xen_be_printf(&ioreq->blkdev->xendev, 0,
"can't map %d grant refs (%s, %d maps)\n",
ioreq->v.niov, strerror(errno), ioreq->blkdev->cnt_map);
return -1;
}
for (i = 0; i < ioreq->v.niov; i++) {
ioreq->v.iov[i].iov_base = ioreq->pages + i * XC_PAGE_SIZE +
(uintptr_t)ioreq->v.iov[i].iov_base;
}
ioreq->blkdev->cnt_map += ioreq->v.niov;
} else {
for (i = 0; i < ioreq->v.niov; i++) {
ioreq->page[i] = xc_gnttab_map_grant_ref
(gnt, ioreq->domids[i], ioreq->refs[i], ioreq->prot);
if (ioreq->page[i] == NULL) {
xen_be_printf(&ioreq->blkdev->xendev, 0,
"can't map grant ref %d (%s, %d maps)\n",
ioreq->refs[i], strerror(errno), ioreq->blkdev->cnt_map);
ioreq_unmap(ioreq);
return -1;
}
ioreq->v.iov[i].iov_base = ioreq->page[i] + (uintptr_t)ioreq->v.iov[i].iov_base;
ioreq->blkdev->cnt_map++;
}
}
return 0;
}
| 1threat |
static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
unsigned int width, unsigned int height,
int lumStride, int chromStride, int dstStride)
{
RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 2);
}
| 1threat |
static void quantize_and_encode_band_cost_UQUAD_mips(struct AACEncContext *s,
PutBitContext *pb, const float *in, float *out,
const float *scaled, int size, int scale_idx,
int cb, const float lambda, const float uplim,
int *bits, const float ROUNDING)
{
const float Q34 = ff_aac_pow34sf_tab[POW_SF2_ZERO - scale_idx + SCALE_ONE_POS - SCALE_DIV_512];
const float IQ = ff_aac_pow2sf_tab [POW_SF2_ZERO + scale_idx - SCALE_ONE_POS + SCALE_DIV_512];
int i;
int qc1, qc2, qc3, qc4;
uint8_t *p_bits = (uint8_t *)ff_aac_spectral_bits[cb-1];
uint16_t *p_codes = (uint16_t *)ff_aac_spectral_codes[cb-1];
float *p_vec = (float *)ff_aac_codebook_vectors[cb-1];
abs_pow34_v(s->scoefs, in, size);
scaled = s->scoefs;
for (i = 0; i < size; i += 4) {
int curidx, sign, count;
int *in_int = (int *)&in[i];
uint8_t v_bits;
unsigned int v_codes;
int t0, t1, t2, t3, t4;
const float *vec;
qc1 = scaled[i ] * Q34 + ROUND_STANDARD;
qc2 = scaled[i+1] * Q34 + ROUND_STANDARD;
qc3 = scaled[i+2] * Q34 + ROUND_STANDARD;
qc4 = scaled[i+3] * Q34 + ROUND_STANDARD;
__asm__ volatile (
".set push \n\t"
".set noreorder \n\t"
"ori %[t4], $zero, 2 \n\t"
"ori %[sign], $zero, 0 \n\t"
"slt %[t0], %[t4], %[qc1] \n\t"
"slt %[t1], %[t4], %[qc2] \n\t"
"slt %[t2], %[t4], %[qc3] \n\t"
"slt %[t3], %[t4], %[qc4] \n\t"
"movn %[qc1], %[t4], %[t0] \n\t"
"movn %[qc2], %[t4], %[t1] \n\t"
"movn %[qc3], %[t4], %[t2] \n\t"
"movn %[qc4], %[t4], %[t3] \n\t"
"lw %[t0], 0(%[in_int]) \n\t"
"lw %[t1], 4(%[in_int]) \n\t"
"lw %[t2], 8(%[in_int]) \n\t"
"lw %[t3], 12(%[in_int]) \n\t"
"slt %[t0], %[t0], $zero \n\t"
"movn %[sign], %[t0], %[qc1] \n\t"
"slt %[t1], %[t1], $zero \n\t"
"slt %[t2], %[t2], $zero \n\t"
"slt %[t3], %[t3], $zero \n\t"
"sll %[t0], %[sign], 1 \n\t"
"or %[t0], %[t0], %[t1] \n\t"
"movn %[sign], %[t0], %[qc2] \n\t"
"slt %[t4], $zero, %[qc1] \n\t"
"slt %[t1], $zero, %[qc2] \n\t"
"slt %[count], $zero, %[qc3] \n\t"
"sll %[t0], %[sign], 1 \n\t"
"or %[t0], %[t0], %[t2] \n\t"
"movn %[sign], %[t0], %[qc3] \n\t"
"slt %[t2], $zero, %[qc4] \n\t"
"addu %[count], %[count], %[t4] \n\t"
"addu %[count], %[count], %[t1] \n\t"
"sll %[t0], %[sign], 1 \n\t"
"or %[t0], %[t0], %[t3] \n\t"
"movn %[sign], %[t0], %[qc4] \n\t"
"addu %[count], %[count], %[t2] \n\t"
".set pop \n\t"
: [qc1]"+r"(qc1), [qc2]"+r"(qc2),
[qc3]"+r"(qc3), [qc4]"+r"(qc4),
[sign]"=&r"(sign), [count]"=&r"(count),
[t0]"=&r"(t0), [t1]"=&r"(t1), [t2]"=&r"(t2), [t3]"=&r"(t3),
[t4]"=&r"(t4)
: [in_int]"r"(in_int)
: "memory"
);
curidx = qc1;
curidx *= 3;
curidx += qc2;
curidx *= 3;
curidx += qc3;
curidx *= 3;
curidx += qc4;
v_codes = (p_codes[curidx] << count) | (sign & ((1 << count) - 1));
v_bits = p_bits[curidx] + count;
put_bits(pb, v_bits, v_codes);
if (out) {
vec = &p_vec[curidx*4];
out[i+0] = copysignf(vec[0] * IQ, in[i+0]);
out[i+1] = copysignf(vec[1] * IQ, in[i+1]);
out[i+2] = copysignf(vec[2] * IQ, in[i+2]);
out[i+3] = copysignf(vec[3] * IQ, in[i+3]);
}
}
}
| 1threat |
Reversing a Sentence without reversing Characters in JavaScript and Java : how do i reverse a sentence like "Hello World" to "World Hello" Not dlroW oleo
Been search for an example on this forum the whole day | 0debug |
double av_get_double(void *obj, const char *name, const AVOption **o_out)
{
int64_t intnum=1;
double num=1;
int den=1;
av_get_number(obj, name, o_out, &num, &den, &intnum);
return num*intnum/den;
}
| 1threat |
Why do I get "base table or view not found" when trying to use sprintf? : <pre><code>$sql = sprintf(
'insert into $s ($s) values ($s)',
$table,
implode(', ', array_keys($parameters)),
':' . implode(', :', array_keys($parameters))
);
try {
$statement = $this->pdo->prepare($sql);
$statement->execute($parameters);
} catch (Exception $e) {
die($e->getMessage());
}
</code></pre>
<p>OTHER FILE:</p>
<pre><code>$query->test('todos', [
'description' => $_POST['name'] . ' ' . $_POST['lastName'],
'completed' => isset($_POST['finished'])
]);
</code></pre>
<p>It's weird cause if I do it manually instead it works perfectly</p>
<pre><code> $sql = "insert into $table (description, completed) values (:description, :completed)";
</code></pre>
<p>But when I use sprintf and implode it gives me an error saying "base table or view not found" Any ideas why?</p>
| 0debug |
static int sub2video_prepare(InputStream *ist)
{
AVFormatContext *avf = input_files[ist->file_index]->ctx;
int i, w, h;
w = ist->dec_ctx->width;
h = ist->dec_ctx->height;
if (!(w && h)) {
for (i = 0; i < avf->nb_streams; i++) {
if (avf->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
w = FFMAX(w, avf->streams[i]->codec->width);
h = FFMAX(h, avf->streams[i]->codec->height);
}
}
if (!(w && h)) {
w = FFMAX(w, 720);
h = FFMAX(h, 576);
}
av_log(avf, AV_LOG_INFO, "sub2video: using %dx%d canvas\n", w, h);
}
ist->sub2video.w = ist->dec_ctx->width = ist->resample_width = w;
ist->sub2video.h = ist->dec_ctx->height = ist->resample_height = h;
ist->resample_pix_fmt = ist->dec_ctx->pix_fmt = AV_PIX_FMT_RGB32;
ist->sub2video.frame = av_frame_alloc();
if (!ist->sub2video.frame)
return AVERROR(ENOMEM);
ist->sub2video.last_pts = INT64_MIN;
return 0;
}
| 1threat |
'which' command outputs nothing in Ubuntu : <p>I want to figure out path of the executable command, but <code>which</code> says nothing. Why ? So and when it's usual case for <code>which</code>to return nothing about command's path. path is hidden/inaccessible for some types of executables or ...</p>
<pre><code>which sdk
</code></pre>
<p>sdk - it's <a href="https://sdkman.io/" rel="nofollow noreferrer">SDKMAN</a></p>
| 0debug |
How to get lineno of "end-of-statement" in Python ast : <p>I am trying to work on a script that manipulates another script in Python, the script to be modified has structure like:</p>
<pre><code>class SomethingRecord(Record):
description = 'This records something'
author = 'john smith'
</code></pre>
<p>I use <code>ast</code> to locate the <code>description</code> line number, and I use some code to change the original file with new description string base on the line number. So far so good.</p>
<p>Now the only issue is <code>description</code> occasionally is a multi-line string, e.g.</p>
<pre><code> description = ('line 1'
'line 2'
'line 3')
</code></pre>
<p>or</p>
<pre><code> description = 'line 1' \
'line 2' \
'line 3'
</code></pre>
<p>and I only have the line number of the first line, not the following lines. So my one-line replacer would do</p>
<pre><code> description = 'new value'
'line 2' \
'line 3'
</code></pre>
<p>and the code is broken. I figured that if I know both the lineno of start and end/number of lines of <code>description</code> assignment I could repair my code to handle such situation. How do I get such information with Python standard library?</p>
| 0debug |
c# : How to call mehods with same name but in different classes? : I am writing C# script in Unity
```
public class something1 : MonoBehaviour
{
public void Dosomething(){
}
}
public class something2 : MonoBehaviour
{
public void Dosomething(){
}
}
public class callingDoSometing
{
public void callALLDosomething(){
someting1 s1 = new something1();
someting2 s2 = new something2();
someting1 s3 = new something3();
someting1 s4 = new something4();
.
.
.
s1.Dosomething();
s2.Dosomething();
s3.Dosomething();
s4.Dosomething();
.
.
.
}
}
```
I need to call methods with same names from different classes.
Actually I need something like multiple inheritance in other OOP languages and I don't want to create additional languages. | 0debug |
Span doesn't work : How i can change code? nodeValue is a string type and it's also write <span> in replace word!
walk(document.body);
function walk(node)
{
var child, next;
switch ( node.nodeType )
{
case 1:
case 9:
case 11:
child = node.firstChild;
while ( child )
{
next = child.nextSibling;
walk(child);
child = next;
}
break;
case 3:
handleText(node);
break;
}
}
function handleText(textNode)
{
var v = textNode.nodeValue;
v = v.replace(/ddd/gi, '<span class="red">N</span>');
v = v.replace(/fff/gi, '<span class="yellow">N</span>');
v = v.replace(/ccc/gi, '<span class="green">N</span>');
textNode.nodeValue = v;
}
| 0debug |
Stopping .bat files dinamically using java : I need to write a Java app in which I have several .bat files which run in continuous loops. I have 4 of them, and only one of them can run at one time. I need to stop the other 3.
Something like
if condition
-stop the other 3 .bat files ( well normally one of them would run but not knowing which, I try to stop all 3);
-start the .bat file which satisfies the condition.
-when other condition of a different .bat file is satisfied, the other 3 (again, one actually) would be stopped + this .bat file starts running (continuous loop)
I am struggling to get to how to stop these .bat files from my java code..is there anything that I can use in command line to stop one particular .bat file from running, identifying it by name or something? Because running commands from cmd using Java is something that I know how to do. | 0debug |
static int decode_b_picture_primary_header(VC9Context *v)
{
GetBitContext *gb = &v->s.gb;
int pqindex;
if (v->profile == PROFILE_SIMPLE)
{
av_log(v->s.avctx, AV_LOG_ERROR, "Found a B frame while in Simple Profile!\n");
return FRAME_SKIPED;
}
v->bfraction = vc9_bfraction_lut[get_vlc2(gb, vc9_bfraction_vlc.table,
VC9_BFRACTION_VLC_BITS, 2)];
if (v->bfraction < -1)
{
av_log(v->s.avctx, AV_LOG_ERROR, "Invalid BFRaction\n");
return FRAME_SKIPED;
}
else if (!v->bfraction)
{
v->s.pict_type = BI_TYPE;
v->buffer_fullness = get_bits(gb, 7);
}
pqindex = get_bits(gb, 5);
if (v->quantizer_mode == QUANT_FRAME_IMPLICIT)
v->pq = pquant_table[0][pqindex];
else
{
v->pq = pquant_table[v->quantizer_mode-1][pqindex];
}
if (pqindex < 9) v->halfpq = get_bits(gb, 1);
if (v->quantizer_mode == QUANT_FRAME_EXPLICIT)
v->pquantizer = get_bits(gb, 1);
if (v->profile > PROFILE_MAIN)
{
if (v->postprocflag) v->postproc = get_bits(gb, 2);
if (v->extended_mv == 1 && v->s.pict_type != BI_TYPE)
v->mvrange = get_prefix(gb, 0, 3);
}
else
{
if (v->extended_mv == 1)
v->mvrange = get_prefix(gb, 0, 3);
}
if (v->s.pict_type != BI_TYPE)
{
v->mv_mode = get_bits(gb, 1);
if (v->pq < 13)
{
if (!v->mv_mode)
{
v->mv_mode = get_bits(gb, 2);
if (v->mv_mode)
av_log(v->s.avctx, AV_LOG_ERROR,
"mv_mode for lowquant B frame was %i\n", v->mv_mode);
}
}
else
{
if (!v->mv_mode)
{
if (get_bits(gb, 1))
av_log(v->s.avctx, AV_LOG_ERROR,
"mv_mode for highquant B frame was %i\n", v->mv_mode);
}
v->mv_mode = 1-v->mv_mode;
}
}
return 0;
}
| 1threat |
discord.js message not defined (nodejs How to fix this issue what i have) : Before i ask this question i checked into simlar overflow questions and could not find an answer to my question.
So this is what i want to do.
I get live data from a telnet connection, i get the data live in the console window.
In a line in my code i added read.match("MYDATA")
So if it gets my data it needs to send it into a discord message.. but i cant implement the message.channel.send in it, because i need the main variable.. how can i solve it ?
const port = "11000";
const host = "192.168.1.12";
var socket = net.createConnection(port, host);
console.log('Socket created.');
socket.on('data', function(data) , message{
// Log the response from the HTTP server.
console.log('' + data);
var read = data.toString();
if (read.match("DC,4043,100,0")) {
console.log ("Connected to "); //<--- this shows up fine in the log
message.channel.send('enabled'); //<---- can't send to channel
}
}).on('connect', function() {
// Manually write an HTTP request.
socket.write("GET / HTTP/1.0\r\n\r\n");
}).on('end', function() {
console.log('DONE');
});
| 0debug |
pass values between pages jquery php : I used this code to get value of multiple checkbox I want any one to guide me to a tutorial that can show me how to do it withour refreshing page this is my code
<form action="#" method="post">
<input type="checkbox" name="check_list[]" value="C/C++"><label>C/C++</label><br/>
<input type="checkbox" name="check_list[]" value="Java"><label>Java</label><br/>
<input type="checkbox" name="check_list[]" value="PHP"><label>PHP</label><br/>
<input type="submit" name="submit" value="Submit"/>
</form>
<?php
if(isset($_POST['submit'])){//to run PHP script on submit
if(!empty($_POST['check_list'])){
// Loop to store and display values of individual checked checkbox.
foreach($_POST['check_list'] as $selected){
echo $selected."</br>";
}
}
}
?>
| 0debug |
Layout_alignParentRight and others aren't working on my Android Studio : I'm simply trying to do the first app-making lesson on Udacity with making a birthday card app. It asks me to put "From yourName" on the birthday card to the bottom right. I tried using android:layout_alignParentRight and android:layout_alignParentBottom and nothing has changed.
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Happy Birthday friendName!"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:text="From yourName!"
android:layout_alignParentEnd="true" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/androidparty" />
</android.support.constraint.ConstraintLayout> | 0debug |
issue with positional arguments in pthon : I am having a problem with following block of python.
class Person:
def __init__(self, firstName, lastName, idNumber):
self.firstName = firstName
self.lastName = lastName
self.idNumber = idNumber
def printPerson(self):
print("Name:", self.lastName + ",", self.firstName)
print("ID:", self.idNumber)
class Student(Person):
def _init_(self,firstName,lastName,idNum,scores):
self.scores = scores
Person.__init__(self, firstName, lastName, idNum)
def calculate(self):
s = 0
for n in self.scores:
s = s + n
avg = int(s/len(self.scores))
if avg >= 90 and avg <= 100:
return 'O'
if avg >= 80 and avg <= 90:
return 'E'
if avg >= 70 and avg <= 80:
return 'A'
if avg >= 55 and avg <= 70:
return 'P'
if avg >= 40 and avg <= 55:
return 'D'
if avg < 40:
return 'T'
line = input().split()
firstName = line[0]
lastName = line[1]
idNum = line[2]
numScores = int(input()) # not needed for Python
scores = list( map(int, input().split()) )
s = Student(firstName, lastName, idNum, scores)
s.printPerson()
print("Grade:", s.calculate())
I am getting following error
Traceback (most recent call last):
File "solution.py", line 43, in <module>
s = Student(firstName, lastName, idNum, scores)
TypeError: __init__() takes 4 positional arguments but 5 were given
can anybody help me with this. I think I gave correct number of arguments while initializing the s object of Students class. | 0debug |
Angular testing async pipe does not trigger the observable : <p>I want to test a component that uses the async pipe. This is my code:</p>
<pre><code>@Component({
selector: 'test',
template: `
<div>{{ number | async }}</div>
`
})
class AsyncComponent {
number = Observable.interval(1000).take(3)
}
fdescribe('Async Compnent', () => {
let component : AsyncComponent;
let fixture : ComponentFixture<AsyncComponent>;
beforeEach(
async(() => {
TestBed.configureTestingModule({
declarations: [ AsyncComponent ]
}).compileComponents();
})
);
beforeEach(() => {
fixture = TestBed.createComponent(AsyncComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should emit values', fakeAsync(() => {
tick(1000);
fixture.detectChanges();
expect(fixture.debugElement.query(By.css('div')).nativeElement.innerHTML).toBe('0');
});
</code></pre>
<p>But the test failed. It's seems Angular does not execute to Observable from some reason. What I am missing? </p>
<p>When I'm trying to log the observable with the <code>do</code> operator, I don't see any output in the browser console. </p>
| 0debug |
PostgreSQL, trigrams and similarity : <p>Just testing PostgreSQL 9.6.2 on my Mac and playing with Ngrams.
Assuming there is a GIN trigram index on winery field.</p>
<p>The limit for similarity (I know this is deprecated):</p>
<pre><code>SELECT set_limit(0.5);
</code></pre>
<p>I'm building a trigram search on 2,3M row table.</p>
<p>My select code:</p>
<pre><code>SELECT winery, similarity(winery, 'chateau chevla blanc') AS similarity
FROM usr_wines
WHERE status=1 AND winery % 'chateau chevla blanc'
ORDER BY similarity DESC;
</code></pre>
<p>My results (329 ms on my mac):</p>
<pre><code>Chateau ChevL Blanc 0,85
Chateau Blanc 0,736842
Chateau Blanc 0,736842
Chateau Blanc 0,736842
Chateau Blanc 0,736842
Chateau Blanc, 0,736842
Chateau Blanc 0,736842
Chateau Cheval Blanc 0,727273
Chateau Cheval Blanc 0,727273
Chateau Cheval Blanc 0,727273
Chateau Cheval Blanc (7) 0,666667
Chateau Cheval Blanc Cbo 0,64
Chateau Du Cheval Blanc 0,64
Chateau Du Cheval Blanc 0,64
</code></pre>
<p>Well, I don't understand how can "Chateau blanc" have a similarity > to "Chateau Cheval Blanc" in this case ? I understand that the 2 words are the exact same "chateau" and "blanc", but there is no other word "cheval".</p>
<p>Also why "Chateau ChevL Blanc" is first ? A letter "a" is missing !</p>
<p>Well, my goal is to match all possible duplicates when I give a winery name, even if it's mispelled. What did I miss ?</p>
| 0debug |
How to make this manual and automatic? : <p>I have this code, and it basically changes the text and image on the user's screen. I would like to do this manually with the click event. but I can't, can anyone help me? please</p>
<pre><code>let i = 0;
let img = 0;
let images = [
'...',
'...',
'...',
'...',
'...',
'...'
];
let textArrayImg = [
"Moda",
"Beleza",
"Comportamento",
"Decoração",
"Entretenimento",
"Bem-Estar"
];
let textImg = document.querySelector('.textImg');
let btnPrev = document.querySelector('.btnPrev');
let btnNext = document.querySelector('.btnNext');
function changeImg(){
document.querySelector('.slide').src = images[img];
textImg.textContent = textArrayImg[i];
if(img < textArrayImg.length - 1){
img++;
}else {
img = 0;
}
if(i < images.length - 1){
i++;
}else {
i = 0;
}
setTimeout(changeImg, 3000);
}
changeImg();
btnPrev.addEventListener('click', () => {
});
btnNext.addEventListener('click', () => {
});
</code></pre>
<p>I already tried some ways but I would like to do it this way because it makes it easier for me</p>
| 0debug |
How to open new view from collection view controller : <p>I am new to iOS and struggling in opening new view controller from collection view.</p>
<p>Can anyone help me in how to open new view controller and pass date so i can change text of lable in another view.</p>
| 0debug |
How to ignore a particular directory or file for tslint? : <p>The IDE being used is WebStorm 11.0.3, the tslint is configured and works, but, it hangs because it tries to parse large *.d.ts library files. </p>
<p>Is there a way to ignore a particular file or directory?</p>
| 0debug |
static void fdctrl_start_transfer (fdctrl_t *fdctrl, int direction)
{
fdrive_t *cur_drv;
uint8_t kh, kt, ks;
int did_seek;
fdctrl->cur_drv = fdctrl->fifo[1] & 1;
cur_drv = get_cur_drv(fdctrl);
kt = fdctrl->fifo[2];
kh = fdctrl->fifo[3];
ks = fdctrl->fifo[4];
FLOPPY_DPRINTF("Start transfer at %d %d %02x %02x (%d)\n",
fdctrl->cur_drv, kh, kt, ks,
_fd_sector(kh, kt, ks, cur_drv->last_sect));
did_seek = 0;
switch (fd_seek(cur_drv, kh, kt, ks, fdctrl->config & 0x40)) {
case 2:
fdctrl_stop_transfer(fdctrl, 0x40, 0x00, 0x00);
fdctrl->fifo[3] = kt;
fdctrl->fifo[4] = kh;
fdctrl->fifo[5] = ks;
return;
case 3:
fdctrl_stop_transfer(fdctrl, 0x40, 0x80, 0x00);
fdctrl->fifo[3] = kt;
fdctrl->fifo[4] = kh;
fdctrl->fifo[5] = ks;
return;
case 4:
fdctrl_stop_transfer(fdctrl, 0x40, 0x00, 0x00);
fdctrl->fifo[3] = kt;
fdctrl->fifo[4] = kh;
fdctrl->fifo[5] = ks;
return;
case 1:
did_seek = 1;
break;
default:
break;
}
fdctrl->data_dir = direction;
fdctrl->data_pos = 0;
FD_SET_STATE(fdctrl->data_state, FD_STATE_DATA);
if (fdctrl->fifo[0] & 0x80)
fdctrl->data_state |= FD_STATE_MULTI;
else
fdctrl->data_state &= ~FD_STATE_MULTI;
if (did_seek)
fdctrl->data_state |= FD_STATE_SEEK;
else
fdctrl->data_state &= ~FD_STATE_SEEK;
if (fdctrl->fifo[5] == 00) {
fdctrl->data_len = fdctrl->fifo[8];
} else {
int tmp;
fdctrl->data_len = 128 << fdctrl->fifo[5];
tmp = (cur_drv->last_sect - ks + 1);
if (fdctrl->fifo[0] & 0x80)
tmp += cur_drv->last_sect;
fdctrl->data_len *= tmp;
}
fdctrl->eot = fdctrl->fifo[6];
if (fdctrl->dma_en) {
int dma_mode;
dma_mode = DMA_get_channel_mode(fdctrl->dma_chann);
dma_mode = (dma_mode >> 2) & 3;
FLOPPY_DPRINTF("dma_mode=%d direction=%d (%d - %d)\n",
dma_mode, direction,
(128 << fdctrl->fifo[5]) *
(cur_drv->last_sect - ks + 1), fdctrl->data_len);
if (((direction == FD_DIR_SCANE || direction == FD_DIR_SCANL ||
direction == FD_DIR_SCANH) && dma_mode == 0) ||
(direction == FD_DIR_WRITE && dma_mode == 2) ||
(direction == FD_DIR_READ && dma_mode == 1)) {
fdctrl->state |= FD_CTRL_BUSY;
DMA_hold_DREQ(fdctrl->dma_chann);
DMA_schedule(fdctrl->dma_chann);
return;
} else {
FLOPPY_ERROR("dma_mode=%d direction=%d\n", dma_mode, direction);
}
}
FLOPPY_DPRINTF("start non-DMA transfer\n");
fdctrl_raise_irq(fdctrl, 0x00);
return;
}
| 1threat |
top: 'include' filter delimiter is missing : <p>I'm trying to filter top's output by command, but when I type <code>O</code>, then</p>
<pre><code>COMMAND?apache2
</code></pre>
<p>I get the following error:</p>
<pre><code>'include' filter delimiter is missing
</code></pre>
<p>I've looked at the top man page, but can't seem to work out what's going on.</p>
| 0debug |
Re-run the current function when the function is a variable : <p>I have a function named <code>test</code> which is inside the main func.</p>
<pre><code>//stuff
func main() {
var test = func() {
if (/*some condition from main*/) {
return test()
}
}
val := test()
}
</code></pre>
<p>When i run this it says:</p>
<blockquote>
<p>undefined: test</p>
</blockquote>
<p>and it is referencing the <code>return test()</code> inside the test func.
How can i fix this?</p>
| 0debug |
Github showing (develop) branch behind master by x commits : <p>I have been searching for the answer to this problem but have not found a solution or explanation. </p>
<p>We just switched to Github for our repo and are still trying to find the best way to use it in a team environment. Our current workflow is like this:</p>
<p>We have two branches <code>develop</code> and <code>master</code></p>
<ol>
<li><p>Developer clones <code>develop</code> branch onto their machine and creates a branch using: <code>git clone https://github.com/username/repo</code></p></li>
<li><p>Developer creates the branch for the feature they are working on using: <code>git checkout -b branchname</code></p></li>
<li><p>Developer finishes branch and pushes to Github using: <code>git pull</code> then <code>git push -u origin branchname</code></p></li>
<li><p>Developer creates pull request and the lead developer will first merge the just pushed branch into <code>develop</code> and then merges <code>develop</code> into <code>master</code></p></li>
</ol>
<p>Now the thing that concerns me and makes me wonder if we are doing something wrong is that when we look at the <code>master</code> branch in Github everything appears fine, but when we view the <code>develop</code> branch inside of Github it says <code>This branch is x commits behind master</code>. Everytime we merge a pull request the number <code>x</code> goes up. Github gives the option on the same line to "Compare" or create a "Pull Request" but when I click either of those options it shows the branches are identical.</p>
<p>I have tried to fixed this previously by merging <code>master</code> into <code>develop</code> which does make the branches both even but as soon as a pull request is merged we get the same problem again. </p>
<p>When we first switched to Github I don't ever recall seeing that <code>develop</code> was behind <code>master</code> but our workflow has not changed. I don't know if maybe I just didn't notice it before or not.</p>
<p>If I compare the commits between the branches I can see that in fact <code>develop</code> is behind <code>master</code> by <code>x</code> number of commits. The commits that are showing up are the ones where I merge <code>develop</code> into <code>master</code>. What I am wondering is if it is something to be concerned about? The branches are identical besides the number of commits. Are we not using Git/Github correctly and is that why we are getting this, or is this a normal thing?</p>
| 0debug |
static inline void gen_op_eval_fbl(TCGv dst, TCGv src,
unsigned int fcc_offset)
{
gen_mov_reg_FCC0(dst, src, fcc_offset);
gen_mov_reg_FCC1(cpu_tmp0, src, fcc_offset);
tcg_gen_xori_tl(cpu_tmp0, cpu_tmp0, 0x1);
tcg_gen_and_tl(dst, dst, cpu_tmp0);
}
| 1threat |
Segementation error when inserting more than 30 000 dataset into BST : I'm currently working on a program that should generate at least 100000 URL(www.google.com.my) and insert them into Binary Search Tree(BST) and hash tables.I got both of them quite right but when I try to insert 100000 URLs into BST I get the following `Process returned -1073741571 (0xC00000FD) execution time: 21.358 s`. And when I run debugger I get the following `Program received signal SIGSEGV, Segmentation fault.In ?? () ()`. The debugger did not show which line the error was , so where is the problem and how do i fix it ?
These are my codes :
main.cpp
#include <iostream>
#include <ctime>
#include <vector>
#include <stdint.h>
#include <cstdlib>
#include <fstream>
#include <string>
#include <conio.h>
#include <stdexcept>
#include "HashTable.cpp"
#include "BinarySearch.h"
using namespace std;
HashTable<long long> ht(0);
treeNode *root = NULL;
vector<long long> dataList;
bool error_msg = false;
static long long nextIC = 1;
long long getNextIC()
{
return ++nextIC;
}
.
.
.
.
ifstream file2(fileName);
while (getline(file2, str))
{
root = insertNode(root, countData);
countData++;
}
file2.close();
end = clock();
elapsed_secs = double(end - begin) / ( CLOCKS_PER_SEC / 1000);
BinarySearch.h
#include <iostream>
#include <stdlib.h>
#include <conio.h>
using namespace std;
struct treeNode
{
long long data;
treeNode *left;
treeNode *right;
};
treeNode *insertNode(treeNode *node,long long data)
{
if(node==NULL)
{
treeNode *temp = new treeNode();
temp -> data = data;
temp -> left = temp -> right = NULL;
return temp;
}
if(data >(node->data))
{
node->right = insertNode(node->right,data);
}
else if(data < (node->data))
{
node->left = insertNode(node->left,data);
}
/* Else there is nothing to do as the data is already in the tree. */
return node;
}
treeNode * searchNode(treeNode *node, long long data)
{
if(node==NULL)
{
/* Element is not found */
return NULL;
}
if(data > node->data)
{
/* Search in the right sub tree. */
return searchNode(node->right,data);
}
else if(data < node->data)
{
/* Search in the left sub tree. */
return searchNode(node->left,data);
}
else
{
/* Element Found */
return node;
}
}
void displayInorder(treeNode *node)
{
if(node==NULL)
{
return;
}
displayInorder(node->left);
cout<<" " << node->data<<" ";
displayInorder(node->right);
}
void displayPreorder(treeNode *node)
{
if(node==NULL)
{
return;
}
cout<<" " <<node->data<<" ";
displayPreorder(node->left);
displayPreorder(node->right);
}
void displayPostorder(treeNode *node)
{
if(node==NULL)
{
return;
}
displayPostorder(node->left);
displayPostorder(node->right);
cout<<" " <<node->data<<" ";
}
| 0debug |
static void handle_keyup(DisplayState *ds, SDL_Event *ev)
{
int mod_state;
if (!alt_grab) {
mod_state = (ev->key.keysym.mod & gui_grab_code);
} else {
mod_state = (ev->key.keysym.mod & (gui_grab_code | KMOD_LSHIFT));
}
if (!mod_state && gui_key_modifier_pressed) {
gui_key_modifier_pressed = 0;
if (gui_keysym == 0) {
if (!gui_grab) {
if (is_graphic_console() &&
SDL_GetAppState() & SDL_APPACTIVE) {
sdl_grab_start();
}
} else if (!gui_fullscreen) {
sdl_grab_end();
}
reset_keys();
return;
}
gui_keysym = 0;
}
if (is_graphic_console() && !gui_keysym) {
sdl_process_key(&ev->key);
}
}
| 1threat |
Remove element from collection during iteration with forEach : <p>Recently, I wrote this code without thinking about it very much:</p>
<pre><code>myObject.myCollection.forEach { myObject.removeItem($0) }
</code></pre>
<p>where <code>myObject.removeItem(_)</code> removes an item from <code>myObject.myCollection</code>.</p>
<p>Looking at the code now, I am puzzled as to why this even works - shouldn't I get an exception along the lines of <code>Collection was mutated while being enumerated</code>?
The same code even works when using a regular for-in loop!</p>
<p>Is this expected behaviour or am I 'lucky' that it isn't crashing?</p>
| 0debug |
can I start the code from a certain line in C++? : <p>Basically I want the code to go back and start again from a certain line after it's done something.
For example, I have a menu where you can choose an action and if everything is finished in that action I want it to display the menu again.</p>
<p>Here's some rough code to illustrate.</p>
<pre><code> int option;
cout << "1";
cout << "2";
cout << "3";
cout << "What option do you choose?";
cin >> option;
if (option = 1) {
//do something here
//if finished start again with the menu options
} else if (option = 2) {
//do something here
//if finished start again with the menu options
} else {
//do something here
//if finished start again with the menu options
}
</code></pre>
| 0debug |
Powershell, compare data table object to date time variable : I am trying to compare the current date/time to a date time located in the first row of a data table filled from an sql query.
$datatable | out-host
Shows this...
LastRunDate
————————-
3/28/2019 1:22:01 PM
I need to compare that one cell to the current date and time to see when the last time the data source was updated. I just can’t fogure out how to extract that cell and convert it to a date time variable . Any suggestions? Thanks!
Jon
| 0debug |
static void nvme_rw_cb(void *opaque, int ret)
{
NvmeRequest *req = opaque;
NvmeSQueue *sq = req->sq;
NvmeCtrl *n = sq->ctrl;
NvmeCQueue *cq = n->cq[sq->cqid];
block_acct_done(bdrv_get_stats(n->conf.bs), &req->acct);
if (!ret) {
req->status = NVME_SUCCESS;
} else {
req->status = NVME_INTERNAL_DEV_ERROR;
}
qemu_sglist_destroy(&req->qsg);
nvme_enqueue_req_completion(cq, req);
}
| 1threat |
Proxy requests to a separate backend server with vue-cli : <p>I am using <code>vue-cli</code> <code>webpack-simple</code> template to generate my projects, and I'd like to proxy requests to a separate, backend server. How can this be easily achieved? </p>
| 0debug |
How to set a default value for a Flow type? : <p>I have defined a custom Flow type</p>
<pre><code>export type MyType = {
code: number,
type: number = 1,
}
</code></pre>
<p>I want the <code>type</code> parameter to default as <code>1</code> if no value is present. However, Flow is complaining with <code>Unexpected token =</code>.</p>
<p><a href="https://i.stack.imgur.com/tUmEh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tUmEh.png" alt="Flow error"></a></p>
<p>Can this be done with Flow?</p>
<p>Currently using Flow <code>v0.32.0</code>.</p>
| 0debug |
static void aarch64_cpu_set_pc(CPUState *cs, vaddr value)
{
ARMCPU *cpu = ARM_CPU(cs);
cpu->env.pc = value;
}
| 1threat |
Disable python import sorting in VSCode : <p>I am trying to disable vscode from formatting my python imports when I save my file. I have some code that must run in between various imports so order is important, but every time I save it just shoves the imports to the top.</p>
<p>I tried putting </p>
<pre><code>"editor.codeActionsOnSave": {
"source.organizeImports": false
},
</code></pre>
<p>in my user settings but that doesn't fix it.</p>
<p>Thanks!</p>
<p>EDIT- I would like to keep formatting on save on except for the imports</p>
| 0debug |
Having trouble while solving an array problem that produces an infinite loop.Please show me the way out. Thank you : Ask the user for a number between 1 and 9. If the user does not enter a number between 1 and 9, repeatedly ask for an integer value until they do. Once they have entered a number between 1 and 9, print the array.Given the array- int array[] = { 4, 6, 7, 3, 8, 2, 1, 9, 5 };
#include<iostream>
int printArray(){
int arraySize,i;
int array[] = { 4, 6, 7, 3, 8, 2, 1, 9, 5 };
arraySize=sizeof(array)/sizeof(array[0]);
std::cout<<"The length of the array is:"<<" "<<arraySize<<"\n";
for(i=0;i<arraySize;i++){
std::cout<<array[i]<<"\n";
}
}
int main(){
tryAgain:
int x;
std::cout<< "Enter any number between 1 and 9"<<"\n";
std::cin>>x;
if(x<=9 && x>=1){
printArray();
}
else
goto tryAgain;
return 0;
}
| 0debug |
int ff_ivi_decode_blocks(GetBitContext *gb, IVIBandDesc *band, IVITile *tile)
{
int mbn, blk, num_blocks, num_coeffs, blk_size, scan_pos, run, val,
pos, is_intra, mc_type, mv_x, mv_y, col_mask;
uint8_t col_flags[8];
int32_t prev_dc, trvec[64];
uint32_t cbp, sym, lo, hi, quant, buf_offs, q;
IVIMbInfo *mb;
RVMapDesc *rvmap = band->rv_map;
void (*mc_with_delta_func)(int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
void (*mc_no_delta_func) (int16_t *buf, const int16_t *ref_buf, uint32_t pitch, int mc_type);
const uint16_t *base_tab;
const uint8_t *scale_tab;
prev_dc = 0;
blk_size = band->blk_size;
col_mask = blk_size - 1;
num_blocks = (band->mb_size != blk_size) ? 4 : 1;
num_coeffs = blk_size * blk_size;
if (blk_size == 8) {
mc_with_delta_func = ff_ivi_mc_8x8_delta;
mc_no_delta_func = ff_ivi_mc_8x8_no_delta;
} else {
mc_with_delta_func = ff_ivi_mc_4x4_delta;
mc_no_delta_func = ff_ivi_mc_4x4_no_delta;
}
for (mbn = 0, mb = tile->mbs; mbn < tile->num_MBs; mb++, mbn++) {
is_intra = !mb->type;
cbp = mb->cbp;
buf_offs = mb->buf_offs;
quant = av_clip(band->glob_quant + mb->q_delta, 0, 23);
base_tab = is_intra ? band->intra_base : band->inter_base;
scale_tab = is_intra ? band->intra_scale : band->inter_scale;
if (scale_tab)
quant = scale_tab[quant];
if (!is_intra) {
mv_x = mb->mv_x;
mv_y = mb->mv_y;
if (!band->is_halfpel) {
mc_type = 0;
} else {
mc_type = ((mv_y & 1) << 1) | (mv_x & 1);
mv_x >>= 1;
mv_y >>= 1;
}
}
for (blk = 0; blk < num_blocks; blk++) {
if (blk & 1) {
buf_offs += blk_size;
} else if (blk == 2) {
buf_offs -= blk_size;
buf_offs += blk_size * band->pitch;
}
if (cbp & 1) {
scan_pos = -1;
memset(trvec, 0, num_coeffs*sizeof(trvec[0]));
memset(col_flags, 0, sizeof(col_flags));
while (scan_pos <= num_coeffs) {
sym = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
if (sym == rvmap->eob_sym)
break;
if (sym == rvmap->esc_sym) {
run = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1) + 1;
lo = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
hi = get_vlc2(gb, band->blk_vlc.tab->table, IVI_VLC_BITS, 1);
val = IVI_TOSIGNED((hi << 6) | lo);
} else {
if (sym >= 256U) {
av_log(NULL, AV_LOG_ERROR, "Invalid sym encountered: %d.\n", sym);
return -1;
}
run = rvmap->runtab[sym];
val = rvmap->valtab[sym];
}
scan_pos += run;
if (scan_pos >= num_coeffs)
break;
pos = band->scan[scan_pos];
if (!val)
av_dlog(NULL, "Val = 0 encountered!\n");
q = (base_tab[pos] * quant) >> 9;
if (q > 1)
val = val * q + FFSIGN(val) * (((q ^ 1) - 1) >> 1);
trvec[pos] = val;
col_flags[pos & col_mask] |= !!val;
}
if (scan_pos >= num_coeffs && sym != rvmap->eob_sym)
return -1;
if (is_intra && band->is_2d_trans) {
prev_dc += trvec[0];
trvec[0] = prev_dc;
col_flags[0] |= !!prev_dc;
}
band->inv_transform(trvec, band->buf + buf_offs,
band->pitch, col_flags);
if (!is_intra)
mc_with_delta_func(band->buf + buf_offs,
band->ref_buf + buf_offs + mv_y * band->pitch + mv_x,
band->pitch, mc_type);
} else {
if (is_intra && band->dc_transform) {
band->dc_transform(&prev_dc, band->buf + buf_offs,
band->pitch, blk_size);
} else
mc_no_delta_func(band->buf + buf_offs,
band->ref_buf + buf_offs + mv_y * band->pitch + mv_x,
band->pitch, mc_type);
}
cbp >>= 1;
}
}
align_get_bits(gb);
return 0;
}
| 1threat |
static void qvirtio_9p_pci_stop(QVirtIO9P *v9p)
{
qvirtqueue_cleanup(v9p->dev->bus, v9p->vq, v9p->qs->alloc);
qvirtio_pci_device_disable(container_of(v9p->dev, QVirtioPCIDevice, vdev));
g_free(v9p->dev);
qvirtio_9p_stop(v9p);
}
| 1threat |
What would be a good approach for developing front-end for ios apps? : <p>I'm new to ios app development. I was told to do the front-end development for an app, which has already been designed by a graphic designer. My question is that what language or tool do I need to learn or use in order to build the front-end for the app. I suppose it's a different thing than web front-end development. </p>
| 0debug |
How does setting the height of elemets html and body to 100% help me in setting the height of an element to the device's screen height? : [I tumbled upon this question here][1]
[1]: http://stackoverflow.com/questions/12172177/set-div-height-equal-to-screen-size
Look at the answer,
He put the height of the body and html to 100%
which helped him solve his answer,
Can I get correct explanation for this?
why that happens? what if I don't use the overflows?
or don't put 100% height to the html or body element? | 0debug |
build_hash_table (const sparc_opcode **opcode_table,
sparc_opcode_hash **hash_table,
int num_opcodes)
{
int i;
int hash_count[HASH_SIZE];
static sparc_opcode_hash *hash_buf = NULL;
memset (hash_table, 0, HASH_SIZE * sizeof (hash_table[0]));
memset (hash_count, 0, HASH_SIZE * sizeof (hash_count[0]));
if (hash_buf != NULL)
free (hash_buf);
hash_buf = malloc (sizeof (* hash_buf) * num_opcodes);
for (i = num_opcodes - 1; i >= 0; --i)
{
int hash = HASH_INSN (opcode_table[i]->match);
sparc_opcode_hash *h = &hash_buf[i];
h->next = hash_table[hash];
h->opcode = opcode_table[i];
hash_table[hash] = h;
++hash_count[hash];
}
#if 0
{
int min_count = num_opcodes, max_count = 0;
int total;
for (i = 0; i < HASH_SIZE; ++i)
{
if (hash_count[i] < min_count)
min_count = hash_count[i];
if (hash_count[i] > max_count)
max_count = hash_count[i];
total += hash_count[i];
}
printf ("Opcode hash table stats: min %d, max %d, ave %f\n",
min_count, max_count, (double) total / HASH_SIZE);
}
#endif
}
| 1threat |
static int bdrv_inactivate_recurse(BlockDriverState *bs,
bool setting_flag)
{
BdrvChild *child, *parent;
int ret;
if (!setting_flag && bs->drv->bdrv_inactivate) {
ret = bs->drv->bdrv_inactivate(bs);
if (ret < 0) {
return ret;
}
}
if (setting_flag) {
uint64_t perm, shared_perm;
bs->open_flags |= BDRV_O_INACTIVE;
QLIST_FOREACH(parent, &bs->parents, next_parent) {
if (parent->role->inactivate) {
ret = parent->role->inactivate(parent);
if (ret < 0) {
bs->open_flags &= ~BDRV_O_INACTIVE;
return ret;
}
}
}
bdrv_get_cumulative_perm(bs, &perm, &shared_perm);
bdrv_check_perm(bs, perm, shared_perm, NULL, &error_abort);
bdrv_set_perm(bs, perm, shared_perm);
}
QLIST_FOREACH(child, &bs->children, next) {
ret = bdrv_inactivate_recurse(child->bs, setting_flag);
if (ret < 0) {
return ret;
}
}
bdrv_release_persistent_dirty_bitmaps(bs);
return 0;
}
| 1threat |
FBSDKCorekit.h, FBSDKCopying.h file note found using Cocoapods : <p>For some odd reason after adding an unrelated pod I have been receiving an error message during the build process that indicates FBSDKCorekit.h, FBSDKCopying.h and FBSDKButton.h files are not found. I have followed countless suggestions changing properties in the projects build settings based on suggestions I've found on stackoverflow; however, none seem to work. </p>
<p>I am using Cocoapods so I attempted to uninstall and reinstall it as well as the pre-release version. I cleared the pod cache as well as removed the actual pods folder and podfile.lock and the xcworkspace and re-installed the pod into the project; however, I still recieve the error.</p>
<p>I also removed the project cache and rebuilt it...</p>
<p>Any assistance would be appreciated</p>
<blockquote>
<p>Podfile</p>
</blockquote>
<pre><code># define a global platform for your project
platform :ios, '8.4'
# using Swift
use_frameworks!
#
source 'https://github.com/CocoaPods/Specs.git'
# disable bitcode in every sub-target
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
target 'MyApp' do
# other pods
pod ...
# Facebook
pod 'FBSDKCoreKit' , '4.9.0-beta2'//4.8 gives same issue
pod 'FBSDKLoginKit', '4.9.0-beta2'
pod 'FBSDKShareKit', '4.9.0-beta2'
# Uber(New pod added)
pod 'UberRides' //actually just realized it's just a wrapper for very simple calls
# ==============================================================
# Sets the inheritance mode for the tests target inheriting
# only the search paths
target 'MyAppTests' do
inherit! :search_paths
end
end
</code></pre>
| 0debug |
How to select message list from mysql table? : [This is the table][1]
[1]: https://i.stack.imgur.com/w6Jvm.png
I want to select the username from **to** and **from** col in a single col and the result should be grouped by that single col. And My user id (**admin**) should not be included in the list. | 0debug |
After mac os sierra update facing scrolling issue with Java applications like Intellij : <p>After the recent update, Mac os Sierra, to my Macbook pro, I'm facing scrolling issues with all Java applications like Intellij IDEA community edition.</p>
<p>The scrolling in the editor panes are extremely fast. The unit of
scroll increments seem to be large.</p>
<p>Intellij IDEA Version is 2016.2.3.
Java version is Java 8 Update 10.1.</p>
<p>I see the same behavior even in the "System Preference" -> "Java" -> "Advanced" tab .</p>
| 0debug |
Fit mixture of Gaussians with fixed covariance in Python : <p>I have some 2D data (GPS data) with clusters (stop locations) that I know resemble Gaussians with a characteristic standard deviation (proportional to the inherent noise of GPS samples). The figure below visualizes a sample that I expect has two such clusters. The image is 25 meters wide and 13 meters tall.</p>
<p><a href="https://i.stack.imgur.com/cECqI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cECqI.png" alt="enter image description here"></a></p>
<p>The <code>sklearn</code> module has a function <a href="http://scikit-learn.org/stable/modules/generated/sklearn.mixture.GaussianMixture.html#sklearn.mixture.GaussianMixture.fit" rel="noreferrer"><code>sklearn.mixture.GaussianMixture</code></a> which allows you to fit a mixture of Gaussians to data. The function has a parameter, <code>covariance_type</code>, that enables you to assume different things about the shape of the Gaussians. You can, for example, assume them to be uniform using the <code>'tied'</code> argument.</p>
<p>However, it does not appear directly possible to assume the covariance matrices to remain constant. From the <code>sklearn</code> source code it seems trivial to make a modification that enables this but it feels a bit excessive to make a pull request with an update that allows this (also I don't want to accidentally add bugs in <code>sklearn</code>). Is there a better way to fit a mixture to data where the covariance matrix of each Gaussian is fixed?</p>
<p>I want to assume that the SD should remain constant at around 3 meters for each component, since that is roughly the noise level of my GPS samples.</p>
| 0debug |
static int posix_aio_process_queue(void *opaque)
{
PosixAioState *s = opaque;
struct qemu_paiocb *acb, **pacb;
int ret;
int result = 0;
int async_context_id = get_async_context_id();
for(;;) {
pacb = &s->first_aio;
for(;;) {
acb = *pacb;
if (!acb)
return result;
if (acb->async_context_id != async_context_id) {
pacb = &acb->next;
continue;
}
ret = qemu_paio_error(acb);
if (ret == ECANCELED) {
*pacb = acb->next;
qemu_aio_release(acb);
result = 1;
} else if (ret != EINPROGRESS) {
if (ret == 0) {
ret = qemu_paio_return(acb);
if (ret == acb->aio_nbytes)
ret = 0;
else
ret = -EINVAL;
} else {
ret = -ret;
}
trace_paio_complete(acb, acb->common.opaque, ret);
*pacb = acb->next;
acb->common.cb(acb->common.opaque, ret);
qemu_aio_release(acb);
result = 1;
break;
} else {
pacb = &acb->next;
}
}
}
return result;
}
| 1threat |
static void gen_stswx(DisasContext *ctx)
{
TCGv t0;
TCGv_i32 t1, t2;
gen_set_access_type(ctx, ACCESS_INT);
gen_update_nip(ctx, ctx->nip - 4);
t0 = tcg_temp_new();
gen_addr_reg_index(ctx, t0);
t1 = tcg_temp_new_i32();
tcg_gen_trunc_tl_i32(t1, cpu_xer);
tcg_gen_andi_i32(t1, t1, 0x7F);
t2 = tcg_const_i32(rS(ctx->opcode));
gen_helper_stsw(cpu_env, t0, t1, t2);
tcg_temp_free(t0);
tcg_temp_free_i32(t1);
tcg_temp_free_i32(t2);
}
| 1threat |
Can getDrawable() throw a NullPointerException? : <p>I have a class extending ImageView. In it, I have a function that calls <code>getDrawable().getIntrinsicWidth();</code>. I have about 100 000 installs, and I have 10 reports of this line producing a nullpointerexception. I can't reproduce this, but would still like to fix this. For this, I need to know what throws it, but I can't test it.</p>
<p>Can I safely assume that getDrawable() can not throw a nullpointer exception, but returns null for some reason, so getIntrinsicWidth() throws the exception? </p>
<p>Also, why would it return null, unless it was set to null? I set the image only by from ShareIntents, and I filter by mimetyp "image/*". If the Uri wasn't pointing to an image, wouldn't that get sorted out during the sharing process? Or do I need to take care of that myself?</p>
| 0debug |
static void pic_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
HeathrowPICS *s = opaque;
HeathrowPIC *pic;
unsigned int n;
n = ((addr & 0xfff) - 0x10) >> 4;
PIC_DPRINTF("writel: " TARGET_FMT_plx " %u: %08x\n", addr, n, value);
if (n >= 2)
return;
pic = &s->pics[n];
switch(addr & 0xf) {
case 0x04:
pic->mask = value;
heathrow_pic_update(s);
break;
case 0x08:
value &= ~pic->level_triggered;
pic->events &= ~value;
heathrow_pic_update(s);
break;
default:
break;
}
}
| 1threat |
How to remove gap between Header navigation bar and slider revolution in wordpress website : <p>How to remove the gap between the Header navigation bar and slider revolution in WordPress website.</p>
| 0debug |
C - Char to hexa : <p>I have str:</p>
<pre><code>char *str = "lala";
</code></pre>
<p>Now, I would like convert any chars in str to hexadecimal, example:</p>
<pre><code>str = convert(str);
print str: 0x6C 0x61 0x6C 0x61
^ l ^ a ^ l ^ a
</code></pre>
<p>How I can do that ?</p>
| 0debug |
static int virtio_net_device_exit(DeviceState *qdev)
{
VirtIONet *n = VIRTIO_NET(qdev);
VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
int i;
virtio_net_set_status(vdev, 0);
unregister_savevm(qdev, "virtio-net", n);
if (n->netclient_name) {
g_free(n->netclient_name);
n->netclient_name = NULL;
}
if (n->netclient_type) {
g_free(n->netclient_type);
n->netclient_type = NULL;
}
g_free(n->mac_table.macs);
g_free(n->vlans);
for (i = 0; i < n->max_queues; i++) {
VirtIONetQueue *q = &n->vqs[i];
NetClientState *nc = qemu_get_subqueue(n->nic, i);
qemu_purge_queued_packets(nc);
if (q->tx_timer) {
timer_del(q->tx_timer);
timer_free(q->tx_timer);
} else if (q->tx_bh) {
qemu_bh_delete(q->tx_bh);
}
}
g_free(n->vqs);
qemu_del_nic(n->nic);
virtio_cleanup(vdev);
return 0;
}
| 1threat |
static void fic_draw_cursor(AVCodecContext *avctx, int cur_x, int cur_y)
{
FICContext *ctx = avctx->priv_data;
uint8_t *ptr = ctx->cursor_buf;
uint8_t *dstptr[3];
uint8_t planes[4][1024];
uint8_t chroma[3][256];
int i, j, p;
for (i = 0; i < 1024; i++) {
planes[0][i] = av_clip_uint8((( 25 * ptr[0] + 129 * ptr[1] + 66 * ptr[2]) / 255) + 16);
planes[1][i] = av_clip_uint8(((-38 * ptr[0] + 112 * ptr[1] + -74 * ptr[2]) / 255) + 128);
planes[2][i] = av_clip_uint8(((-18 * ptr[0] + 112 * ptr[1] + -94 * ptr[2]) / 255) + 128);
planes[3][i] = ptr[3];
ptr += 4;
}
for (i = 0; i < 32; i += 2)
for (j = 0; j < 32; j += 2)
for (p = 0; p < 3; p++)
chroma[p][16 * (i / 2) + j / 2] = (planes[p + 1][32 * i + j ] +
planes[p + 1][32 * i + j + 1] +
planes[p + 1][32 * (i + 1) + j ] +
planes[p + 1][32 * (i + 1) + j + 1]) / 4;
for (i = 0; i < 3; i++)
dstptr[i] = ctx->final_frame->data[i] +
(ctx->final_frame->linesize[i] * (cur_y >> !!i)) +
(cur_x >> !!i) + !!i;
for (i = 0; i < FFMIN(32, avctx->height - cur_y) - 1; i += 2) {
int lsize = FFMIN(32, avctx->width - cur_x);
int csize = lsize / 2;
fic_alpha_blend(dstptr[0],
planes[0] + i * 32, lsize, planes[3] + i * 32);
fic_alpha_blend(dstptr[0] + ctx->final_frame->linesize[0],
planes[0] + (i + 1) * 32, lsize, planes[3] + (i + 1) * 32);
fic_alpha_blend(dstptr[1],
chroma[0] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
fic_alpha_blend(dstptr[2],
chroma[1] + (i / 2) * 16, csize, chroma[2] + (i / 2) * 16);
dstptr[0] += ctx->final_frame->linesize[0] * 2;
dstptr[1] += ctx->final_frame->linesize[1];
dstptr[2] += ctx->final_frame->linesize[2];
}
}
| 1threat |
how can i check how website storing password in database in laravel? : <p>I have to create a simple php page which update user's password in database, i've to enter password in same encrypted format in which website storing it in. I don't know much about working of laravel. Password stored in database is "$2y$10$pFYa/ruRVbDbr9KJs67XLOLXg6XNo9t8hkREI/xyAR54/42HO7zXC" which is "Freelance" in actual. How can i find out how it's encrypting "Freelance" to this format so that I can also store new password in database in similar format. Thanks!</p>
| 0debug |
Why in C++ do static_cast<unsigned> of negative numbers differ if the number is constant or not : <p>What's the C++ rules that means <strong>equal</strong> is <em>false</em>?. Given:</p>
<pre><code>float f {-1.0};
bool equal = (static_cast<unsigned>(f) == static_cast<unsigned>(-1.0));
</code></pre>
<p>E.g. <a href="https://godbolt.org/z/fcmx2P" rel="noreferrer">https://godbolt.org/z/fcmx2P</a></p>
<pre><code>#include <iostream>
int main()
{
float f {-1.0};
const float cf {-1.0};
std::cout << std::hex;
std::cout << " f" << "=" << static_cast<unsigned>(f) << '\n';
std::cout << "cf" << "=" << static_cast<unsigned>(cf) << '\n';
return 0;
}
</code></pre>
<p>Produces the following output:</p>
<pre><code> f=ffffffff
cf=0
</code></pre>
| 0debug |
I'm using several condition in my code but does not checked all condition : I'm using several condition in my code but does not checked all condition , how i resolved it?
sample of my code
if (securityCodeET.getText().toString().equals("1234")&&
accountNoET.getText().toString().trim().length() != 0)
when i insert "1234" in securityCodeET it move forward and return true but i think it should give false because i didn't put any thing in accountNoET .
| 0debug |
static int advanced_decode_i_mbs(VC9Context *v)
{
int i, x, y, cbpcy, mqdiff, absmq, mquant, ac_pred, condover,
current_mb = 0, over_flags_mb = 0;
for (y=0; y<v->height_mb; y++)
{
for (x=0; x<v->width_mb; x++)
{
if (v->ac_pred_plane[i])
ac_pred = get_bits(&v->gb, 1);
if (condover == 3 && v->over_flags_plane)
over_flags_mb = get_bits(&v->gb, 1);
GET_MQUANT();
}
current_mb++;
}
return 0;
}
| 1threat |
vue.js - not defined on the instance but referenced during render : <p>I am loading a template that references a client side js file with my code like so:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.1/vue.js"></script>
<link rel="stylesheet" type="text/css" href="../css/app.css">
</head>
<body>
<div id="container">
<div id="map">
<script src="../js/app.js" type="text/javascript"></script>
<div id="offer-details">
<form id="offer-form" v-on:submit="makeOffer(tags, description, code)">
<input id="description"/>
<input id="tags"/>
<input id="code"/>
<input type="submit"/>
</form>
</div>
</div>
</div>
</body>
</html>
</code></pre>
<p>My browser shows that the following (details.js) loads successfully. </p>
<pre><code>var vm = new Vue({
el: "#details",
data: {
offer: {
publickey: '',
privatekey: '',
name: '',
service: '',
value: '',
currency: '',
tags: '',
description: '',
code: ''
},
methods: {
makeOffer: function makeOffer(){console.log(vm.publickey)}
}
}
})
</code></pre>
<p>However, when I submit the form I get the following error message:</p>
<pre><code>[Vue warn]: Property or method "makeOffer" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. (found in root instance)vue.js:2574:7
[Vue warn]: Handler for event "submit" is undefined.
</code></pre>
<p>It looks to me like I'm defining makeOffer in the method key as I should. Is this not the same as defining it on the instance? Why isn't it seeing makeOffer?</p>
| 0debug |
Facebook login on localhost - connection not secure : <p>I am adding a Facebook login to our React project, using Facebook Javascript SDK.
I followed this <a href="https://developers.facebook.com/docs/facebook-login/web" rel="noreferrer">tutorial</a>.</p>
<p>When I click the login button which I added to the page, following error is shown:</p>
<p><strong>Facebook has detected X isn't using a secure connection to transfer information.
Until X updates its security settings, you won't be able to use Facebook to log into it.</strong></p>
<p><a href="https://i.stack.imgur.com/p6s5G.png" rel="noreferrer"><img src="https://i.stack.imgur.com/p6s5G.png" alt="enter image description here"></a></p>
<p>My app is in development mode, which should mean (according Facebook docs) that localhost redirects are allowed, but it isn't so.</p>
<p>I have also tried adding localhost to Valid OAuth Redirect URIs in Facebook developers page, but it didn't solve the problem.</p>
<p>I have managed to solve the problem partially by using ngrok following this <a href="https://www.chrisjmendez.com/2018/04/16/using-ngrok-with-facebook-oauth-login/" rel="noreferrer">tutorial</a>, but it is very buggy (sometimes doesn't work) and impractical to work with, as I often have to restart whole server and everything.</p>
| 0debug |
def even_position(nums):
return all(nums[i]%2==i%2 for i in range(len(nums))) | 0debug |
Delphi 10. String not compiling properly (No crash, Possibly a glitch?) : Today I stumbled upon something mysterious. This line of code:
showmessage(menuMain.player[2] + ' ready!');
Generates this message (For example menuMain.player[2] = Player):
> Player
But if I put code this way (For example menuMain.player[2] = Player):
showmessage('Test: ' + menuMain.player[2]);
It will generate this message:
> Test: Player
I do honestly believe this is a compiler glitch, because I have EXACT same line in the other block of code, and it works flawlessly.
Now the tough part for me, is that me being dumb, or this is indeed a glitch?
Professional help required :P
Thanks in advance for help! :) | 0debug |
static int ftp_read(URLContext *h, unsigned char *buf, int size)
{
FTPContext *s = h->priv_data;
int read, err, retry_done = 0;
av_dlog(h, "ftp protocol read %d bytes\n", size);
retry:
if (s->state == DISCONNECTED) {
if (s->position >= s->filesize)
return 0;
if ((err = ftp_connect_data_connection(h)) < 0)
return err;
}
if (s->state == READY) {
if (s->position >= s->filesize)
return 0;
if ((err = ftp_retrieve(s)) < 0)
return err;
}
if (s->conn_data && s->state == DOWNLOADING) {
read = ffurl_read(s->conn_data, buf, size);
if (read >= 0) {
s->position += read;
if (s->position >= s->filesize) {
int64_t pos = s->position;
if (ftp_abort(h) < 0) {
s->position = pos;
return AVERROR(EIO);
}
s->position = pos;
}
}
if (read <= 0 && s->position < s->filesize && !h->is_streamed) {
int64_t pos = s->position;
av_log(h, AV_LOG_INFO, "Reconnect to FTP server.\n");
if ((err = ftp_abort(h)) < 0)
return err;
if ((err = ftp_seek(h, pos, SEEK_SET)) < 0) {
av_log(h, AV_LOG_ERROR, "Position cannot be restored.\n");
return err;
}
if (!retry_done) {
retry_done = 1;
goto retry;
}
}
return read;
}
av_log(h, AV_LOG_DEBUG, "FTP read failed\n");
return AVERROR(EIO);
}
| 1threat |
Div style according to the place of CSS : <p>I have the following HTML file:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<style>
#aDiv{
width:300px;
height:100px;
background-color:blue;
}
</style>
<!--link rel="stylesheet" href="style.css"-->
</head>
<body>
<div id="aDiv"></div>
</body>
</code></pre>
<p></p>
<p>If I launch the html in the above form, the blue rectangle is displayed.
If I saved the style in a css file (respectively <strong><em>style.css</em></strong>) the rectangle is not displayed. This behaviour is valid for all the browsers I tried (Firefox, IE, Chrome). How to solve this problem ?</p>
| 0debug |
def square_perimeter(a):
perimeter=4*a
return perimeter | 0debug |
How to make variable $ works both as object $ and function $()? : <p>jQuery's variable <strong>$</strong> for example works both as object and function.</p>
<pre><code>// You can access object properties such as
$.fn;
// or
$.isReady;
// You can also call the function $ such as follows
$();
</code></pre>
<p><strong>How to make variable $ works both as object and function?</strong></p>
<pre><code>$ = function(){} // ???
$ = {}; // ???
</code></pre>
| 0debug |
Laravel does not read env variables : <p>Did anyone has issues with <code>env</code> variables? For some reason, helper <code>env('VARIABLE')</code> returns <code>null</code> every time I use it. It happened very unexpectedly and I dont really know the reason. Restarting the apache/IDE/computer does not work.</p>
| 0debug |
Car Dealer Management Software : <p>For learning purposes Im thinking of Creating a management software for car dealers, but before I get into the designing/planning stage im gathering requirements. Would anyone be able to add something to my current req list? </p>
<p>Here is what I have so far </p>
<ol>
<li>Different logins (Admin, Mechanic, Car Cleaner)</li>
<li>Possibility to Add used and new cars to th system</li>
<li>When Car is sold move it to sold section with all the details</li>
<li>Possibility to book a viewing/test drive </li>
<li>Check current stock</li>
<li>Reports such as, best selling cars by make</li>
</ol>
<p>Thanks in advance</p>
| 0debug |
Selection does not contain a main type - Eclipse, Java : <p>I'm trying to work on a homework assignment. We're given a bunch of files, and the first step in the instructions says that I need to run one of the Java files that we're given, which acts as a testing file.</p>
<p>Here is the file,</p>
<pre><code>import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
public class ListBoundedIntSetTestSuiteRunner {
public static void main (final String[] args) {
final Result result =
JUnitCore.runClasses(ListBoundedIntSetTestSuite.class);
for (final Failure failure : result.getFailures()) {
System.out.println(failure.toString());
}
if (result.wasSuccessful()) {
System.out.println("Congratulations: all tests passed!");
}
final int runs = result.getRunCount();
final int failures = result.getFailureCount();
final int ignores = result.getIgnoreCount();
final int successes = runs - failures;
System.out.printf("Tests run: %d%n", runs);
if (ignores > 0) {
System.out.printf("Tests ignored: %d%n", ignores);
}
System.out.printf("Tests passed: %d%n", successes);
if (failures > 0) {
System.out.printf("Tests failed: %d%n", failures);
}
}
}
</code></pre>
<p>The instructions literally say that I just have to open this in Eclipse and click run and it should work. I have seen this work on a friend's computer as well. I have not changed any files or done anything at all. </p>
<p>When I try to run this file, I get the error "Selection does not contain a main type". </p>
<p>I have cleaned the workspace, uninstalled and reinstalled Eclipse, uninstalled and reinstalled Java but nothing seems to work.</p>
| 0debug |
Fortran OMP Parallel Do : as of lately i have been reading and playing around with omp parallel do's in fortran (f95). However i still haven't figured out how the parallel do would be used in a code like the one beneath,
`I=1
DO WHILE I<100
A=2*I
B=3*I
C=A+B
A(I)=C
I=I+1
END DO
`
Using simply *!**$OMP PARALLEL DO*** before the do loop and ***! $OMP END PARALLEL DO*** doesn't seem to work. I have read a couple of things about provate and shared variables however I think that each successive loop of the code above is completely independent. Any help would be appreciated greatly. | 0debug |
Touch ID Implementation : <p>Login credentials of my app will expire in a certain period of time. I'm planning to enable touch ID login for the app as well. My question is how the UI logic should be implemented to accomplish this?</p>
| 0debug |
Koin vs Kodein - Dependency Injection what you prefer? Kotlin : <p>What dependency injection for Android with Kotlin do you prefer? I have started using Kodein but i don't want to lose my time if Koin it's better.</p>
<p>I have read this presentation <a href="https://www.kotlindevelopment.com/koin-vs-kodein/" rel="noreferrer">https://www.kotlindevelopment.com/koin-vs-kodein/</a> by Makery Kotlin Development it's really nice.</p>
<p>From that presentation these are the differences:</p>
<p><strong>Kodein</strong></p>
<ul>
<li>Robust</li>
<li>Tons of feature</li>
<li>Great documentation</li>
<li>More complicated API</li>
</ul>
<p><strong>Koin</strong></p>
<ul>
<li>Smaller</li>
<li>Less feature</li>
<li>Natural API</li>
</ul>
<p><strong>Github stars</strong>
Kodein 1164 vs 1350 Koin</p>
<hr>
<p>Thanks !!</p>
| 0debug |
void rgb32tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size)
{
unsigned i;
unsigned num_pixels = src_size >> 2;
for(i=0; i<num_pixels; i++)
{
dst[3*i + 0] = src[4*i + 2];
dst[3*i + 1] = src[4*i + 1];
dst[3*i + 2] = src[4*i + 0];
}
}
| 1threat |
GooglePlay - wrong signing key for app bundle : <p>I've just now started using app bundles. I've set the two certificates in the <code>App signing</code> section of the dashboard (signing certificate and upload certificate).</p>
<p>I've built an app bundle and signed it with the upload certificate, but when I upload the bundle under <code>Android Instant Apps</code> (which is in fact the reason I switched to app bundles) it says that:</p>
<p><code>Your Android App Bundle is signed with the wrong key. Ensure that your app bundle is signed with the correct signing key and try again: xx:xx:xx:xx.....</code></p>
<p>I've manually checked the SHA-1 of the upload keystore (using keytool in the terminal) and it matches the xx:xx:xx.... it says in the error message.</p>
<p>What am I doing wrong? The app bundle IS signed with the required upload certificate, but google play doesn't seem to like it.</p>
<p>Ideas?</p>
| 0debug |
How do i parse this response so I ONLY GET THE NAME AND bot ID : I'm trying to just parse this so that I only get the name and bot_id
I used json.loads and did things like
for item in response:
print item['bot_id']
Right now I'm just most concerned with getting the bot_id
def view_bot_ids():
response = json.loads(requests.get("https://api.groupme.com/v3/bots?token=CANTSHOWTHIS")._content)
print response
THIS IS THE OUTPUT
{u'meta': {u'code': 200}, u'response': [{u'group_id': u'49818165', u'name': u'Johnny Five', u'dm_notification': False, u'group_name': u'Travis Manion Presentation', u'avatar_url': None, u'callback_url': None, u'bot_id': u'240b08e530d42f286f30a75379'}, {u'group_id': u'48672722', u'name': u'Johnny Five', u'dm_notification': False, u'group_name': u'DevOps Autodidact', u'avatar_url': None, u'callback_url': None, u'bot_id': u'64395a02a9382796f7cd7616ef'}, {u'group_id': u'48402248', u'name': u'suck ya mom', u'dm_notification': False, u'group_name': u'Free Flicks', u'avatar_url': None, u'callback_url': None, u'bot_id': u'42aacdb69615721d68c31d71c0'}, {u'group_id': u'43195303', u'name': u'The goat', u'dm_notification': False, u'group_name': u'2nd Floor Boiz', u'avatar_url': None, u'callback_url': None, u'bot_id': u'd45a95b6bbb344639104fd6a3a'}]}
All I want from this, is all the bot_ids and name
All I want it to output is the array of bot ids or array of names | 0debug |
static void tcg_out_qemu_ld (TCGContext *s, const TCGArg *args, int opc)
{
int addr_reg, data_reg, data_reg2, r0, r1, rbase, bswap;
#ifdef CONFIG_SOFTMMU
int mem_index, s_bits, r2, addr_reg2;
uint8_t *label_ptr;
#endif
data_reg = *args++;
if (opc == 3)
data_reg2 = *args++;
else
data_reg2 = 0;
addr_reg = *args++;
#ifdef CONFIG_SOFTMMU
#if TARGET_LONG_BITS == 64
addr_reg2 = *args++;
#else
addr_reg2 = 0;
#endif
mem_index = *args;
s_bits = opc & 3;
r0 = 3;
r1 = 4;
r2 = 0;
rbase = 0;
tcg_out_tlb_check (
s, r0, r1, r2, addr_reg, addr_reg2, s_bits,
offsetof (CPUArchState, tlb_table[mem_index][0].addr_read),
offsetof (CPUTLBEntry, addend) - offsetof (CPUTLBEntry, addr_read),
&label_ptr
);
#else
r0 = addr_reg;
r1 = 3;
rbase = GUEST_BASE ? TCG_GUEST_BASE_REG : 0;
#endif
#ifdef TARGET_WORDS_BIGENDIAN
bswap = 0;
#else
bswap = 1;
#endif
switch (opc) {
default:
case 0:
tcg_out32 (s, LBZX | TAB (data_reg, rbase, r0));
break;
case 0|4:
tcg_out32 (s, LBZX | TAB (data_reg, rbase, r0));
tcg_out32 (s, EXTSB | RA (data_reg) | RS (data_reg));
break;
case 1:
if (bswap)
tcg_out32 (s, LHBRX | TAB (data_reg, rbase, r0));
else
tcg_out32 (s, LHZX | TAB (data_reg, rbase, r0));
break;
case 1|4:
if (bswap) {
tcg_out32 (s, LHBRX | TAB (data_reg, rbase, r0));
tcg_out32 (s, EXTSH | RA (data_reg) | RS (data_reg));
}
else tcg_out32 (s, LHAX | TAB (data_reg, rbase, r0));
break;
case 2:
if (bswap)
tcg_out32 (s, LWBRX | TAB (data_reg, rbase, r0));
else
tcg_out32 (s, LWZX | TAB (data_reg, rbase, r0));
break;
case 3:
if (bswap) {
tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4);
tcg_out32 (s, LWBRX | TAB (data_reg, rbase, r0));
tcg_out32 (s, LWBRX | TAB (data_reg2, rbase, r1));
}
else {
#ifdef CONFIG_USE_GUEST_BASE
tcg_out32 (s, ADDI | RT (r1) | RA (r0) | 4);
tcg_out32 (s, LWZX | TAB (data_reg2, rbase, r0));
tcg_out32 (s, LWZX | TAB (data_reg, rbase, r1));
#else
if (r0 == data_reg2) {
tcg_out32 (s, LWZ | RT (0) | RA (r0));
tcg_out32 (s, LWZ | RT (data_reg) | RA (r0) | 4);
tcg_out_mov (s, TCG_TYPE_I32, data_reg2, 0);
}
else {
tcg_out32 (s, LWZ | RT (data_reg2) | RA (r0));
tcg_out32 (s, LWZ | RT (data_reg) | RA (r0) | 4);
}
#endif
}
break;
}
#ifdef CONFIG_SOFTMMU
add_qemu_ldst_label (s,
1,
opc,
data_reg,
data_reg2,
addr_reg,
addr_reg2,
mem_index,
s->code_ptr,
label_ptr);
#endif
}
| 1threat |
Laravel is too slow : <p>I just set this page in the routing file <code>web.php</code>:</p>
<pre><code>Route::get("/speedtest","SpeedController@speed_test");
</code></pre>
<p>Here is the speed test function:</p>
<pre><code>public function speed_test(){
return view("speedtest");
}
</code></pre>
<p>That returns <code>speedtest.blade.php</code> which contains just a <code>hello world</code>.</p>
<p>It takes between 2.5 s and 3.5 to load this page.</p>
<p>Other pages that use a middleware and some queries needs between 3.5 and 6.5 seconds. The database is almost empty and the queries returns just 3 or 4 items (something like <code>Files::where(user_id, Auth::user()->id)->get()</code> ).</p>
<p>So everything is slow, even empty sites. There is definitely something wrong.</p>
<p>The site is alone in a server with 4 GB RAM, SSD and 1 Gbit connection</p>
<p>Any help?</p>
| 0debug |
import math as mt
def get_Position(a,n,m):
for i in range(n):
a[i] = (a[i] // m + (a[i] % m != 0))
result,maxx = -1,-1
for i in range(n - 1,-1,-1):
if (maxx < a[i]):
maxx = a[i]
result = i
return result + 1 | 0debug |
Need help defining the getPrice method in this subclass : //I am trying to determine how I should define the getPrice method. The shirts can range from Small to XXXL and the price varies. The price is determined by the size: $22.99 for XXL or XXXL, and $19.99 for all other sizes. There are two other classes that I have complied. But the method I need help with only goes with this code. Let me know if you need more info. Help please!
public class TeeShirt
{
private int orderNumber;
private String size;
private String color;
private double price;
public void setOrderNumber(int num)
{
orderNumber = num;
}
public void setSize(String sz)
{
size = sz;
}
public void setColor(String color)
{
this.color = color;
}
public int getOrderNumber()
{
return orderNumber;
}
public String getSize()
{
return size;
}
public String getColor()
{
return color;
}
public double getPrice()
{
return price;
}
}//end | 0debug |
static void gen_exception(int excp)
{
TCGv tmp = new_tmp();
tcg_gen_movi_i32(tmp, excp);
gen_helper_exception(tmp);
dead_tmp(tmp);
}
| 1threat |
static void vfio_start_irqfd_injection(SysBusDevice *sbdev, qemu_irq irq)
{
VFIOPlatformDevice *vdev = VFIO_PLATFORM_DEVICE(sbdev);
VFIOINTp *intp;
if (!kvm_irqfds_enabled() || !kvm_resamplefds_enabled() ||
!vdev->irqfd_allowed) {
goto fail_irqfd;
}
QLIST_FOREACH(intp, &vdev->intp_list, next) {
if (intp->qemuirq == irq) {
break;
}
}
assert(intp);
if (kvm_irqchip_add_irqfd_notifier(kvm_state, intp->interrupt,
intp->unmask, irq) < 0) {
goto fail_irqfd;
}
if (vfio_set_trigger_eventfd(intp, NULL) < 0) {
goto fail_vfio;
}
if (vfio_set_resample_eventfd(intp) < 0) {
goto fail_vfio;
}
intp->kvm_accel = true;
trace_vfio_platform_start_irqfd_injection(intp->pin,
event_notifier_get_fd(intp->interrupt),
event_notifier_get_fd(intp->unmask));
return;
fail_vfio:
kvm_irqchip_remove_irqfd_notifier(kvm_state, intp->interrupt, irq);
error_report("vfio: failed to start eventfd signaling for IRQ %d: %m",
intp->pin);
abort();
fail_irqfd:
vfio_start_eventfd_injection(sbdev, irq);
return;
}
| 1threat |
int spapr_vio_send_crq(VIOsPAPRDevice *dev, uint8_t *crq)
{
int rc;
uint8_t byte;
if (!dev->crq.qsize) {
fprintf(stderr, "spapr_vio_send_creq on uninitialized queue\n");
return -1;
}
rc = spapr_vio_dma_read(dev, dev->crq.qladdr + dev->crq.qnext, &byte, 1);
if (rc) {
return rc;
}
if (byte != 0) {
return 1;
}
rc = spapr_vio_dma_write(dev, dev->crq.qladdr + dev->crq.qnext + 8,
&crq[8], 8);
if (rc) {
return rc;
}
kvmppc_eieio();
rc = spapr_vio_dma_write(dev, dev->crq.qladdr + dev->crq.qnext, crq, 8);
if (rc) {
return rc;
}
dev->crq.qnext = (dev->crq.qnext + 16) % dev->crq.qsize;
if (dev->signal_state & 1) {
qemu_irq_pulse(dev->qirq);
}
return 0;
}
| 1threat |
Sequencing of function parameter destruction : <p>According to C++14 [expr.call]/4:</p>
<blockquote>
<p>The lifetime of a parameter ends when the function in which it is defined returns.</p>
</blockquote>
<p>This seems to imply that a parameter's destructor must run before the code which called the function goes on to use the function's return value. </p>
<p>However, this code shows differently:</p>
<pre><code>#include <iostream>
struct G
{
G(int): moved(0) { std::cout << "G(int)\n"; }
G(G&&): moved(1) { std::cout << "G(G&&)\n"; }
~G() { std::cout << (moved ? "~G(G&&)\n" : "~G()\n"); }
int moved;
};
struct F
{
F(int) { std::cout << "F(int)\n"; }
~F() { std::cout << "~F()\n"; }
};
int func(G gparm)
{
std::cout << "---- In func.\n";
return 0;
}
int main()
{
F v { func(0) };
std::cout << "---- End of main.\n";
return 0;
}
</code></pre>
<p>The output for gcc and clang , with <code>-fno-elide-constructors</code>, is (with my annotations):</p>
<pre><code>G(int) // Temporary used to copy-initialize gparm
G(G&&) // gparm
---- In func.
F(int) // v
~G(G&&) // gparm
~G() // Temporary used to copy-initialize gparm
---- End of main.
~F() // v
</code></pre>
<p>So, clearly <code>v</code>'s constructor runs before <code>gparm</code>'s destructor. But in MSVC, <code>gparm</code> is destroyed before <code>v</code>'s constructor runs.</p>
<p>The same issue can be seen with copy-elision enabled, and/or with <code>func({0})</code> so that the parameter is direct-initialized. <code>v</code> is always constructed before <code>gparm</code> is destructed. I also observed the issue in a longer chain, e.g. <code>F v = f(g(h(i(j())));</code> did not destroy any of the parameters of <code>f,g,h,i</code> until after <code>v</code> was initialized.</p>
<p>This could be a problem in practice, for example if <code>~G</code> unlocks a resource and <code>F()</code> acquires the resource, it would be a deadlock. Or, if <code>~G</code> throws, then execution should jump to a catch handler without <code>v</code> having been initialized.</p>
<p>My question is: does the standard permit both of these orderings? . Is there any more specific definition of the sequencing relationship involving parameter destruction, than just that quote from expr.call/4 which does not use the standard sequencing terms?</p>
| 0debug |
CSS - Change image height, using only it's URL : Say... in html we have only:
img src="IMAGE-URL"
And you need to change image size in CSS, without adding classes or id... How to write in style sheet something like "IMAGE-URL height: 100px" ?
Is it possible? | 0debug |
Simple PHP contact form with Firebase hosting : <p>I'm trying to test out if PHP works from my Firebase hosting using the following:</p>
<p>(index.html)</p>
<pre><code><form action="welcome.php" method="post">
<input type="submit">
</form>
</code></pre>
<p>(welcome.php)</p>
<pre><code><?php
$to = "my@email.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: dummy@email.com";
mail($to,$subject,$txt,$headers);
?>
</code></pre>
<p>Every time I try this the browser keeps on attempting to open the PHP file rather than processing it. Is simple PHP enabled on the Firebase server hosting to process a simple form like this? If I can get it to work this way, I will be building the form out correctly including validation etc.</p>
<p>Thanks,</p>
| 0debug |
No UseDatabaseErrorPage() extension method in Net Core 3.0 : <p>I have created Net Core 3.0 app and following code that worked in 2.2 now is not.</p>
<pre><code>app.UseDatabaseErrorPage();
</code></pre>
<p>Looks like in 3.0 class <code>DatabaseErrorPageExtensions</code> does not exist within <code>Microsoft.AspNetCore.Builder</code> namespace. Am I missing some dependency? I have EntityFrameworkCore NuGet with Tools and Design added.</p>
<p>Adding </p>
<pre><code>using Microsoft.AspNetCore.Builder;
</code></pre>
<p>not helped.</p>
| 0debug |
connection.query('SELECT * FROM users WHERE username = ' + input_string) | 1threat |
db.execute('SELECT * FROM products WHERE product_id = ' + product_input) | 1threat |
How to refresh the page after a ServiceWorker update? : <p>I've consulted a lot of resources on Service Workers:</p>
<ul>
<li><a href="https://jakearchibald.com/2014/using-serviceworker-today/#updating-your-serviceworker" rel="noreferrer">Updating your ServiceWorker</a></li>
<li><a href="https://ponyfoo.com/articles/serviceworker-revolution" rel="noreferrer">ServiceWorker: Revolution of the Web Platform</a></li>
<li>Jake Archibald's lovely <a href="https://github.com/jakearchibald/svgomg/blob/6c21157b65dd779bbf2dd2adf9831aaf71d4bb08/src/js/sw/index.js" rel="noreferrer">SVGOMG</a>. </li>
</ul>
<p>However, I can't for the life of me figure out how to update the page after a new ServiceWorker has been installed. No matter what I do, my page is stuck on an old version, and only a hard refresh (Cmd-Shift-R) will fix it. No combination of 1) closing the tab, 2) closing Chrome, or 3) <code>location.reload(true)</code> will serve the new content.</p>
<p>I have a <a href="https://github.com/nolanlawson/serviceworker-update-demo" rel="noreferrer">super simple example app</a> mostly based on SVGOMG. On installation, I cache a bunch of resources using <code>cache.addAll()</code>, and I also do <code>skipWaiting()</code> if the current version's major version number doesn't match the active version's number (based on an IndexedDB lookup):</p>
<pre><code>self.addEventListener('install', function install(event) {
event.waitUntil((async () => {
var activeVersionPromise = localForage.getItem('active-version');
var cache = await caches.open('cache-' + version);
await cache.addAll(staticContent);
var activeVersion = await activeVersionPromise;
if (!activeVersion ||
semver.parse(activeVersion).major === semver.parse(version).major) {
if (self.skipWaiting) { // wrapping in an if while Chrome 40 is still around
self.skipWaiting();
}
}
})());
});
</code></pre>
<p>I'm using a semver-inspired system where the major version number indicates that the new ServiceWorker can't be hot-swapped for the old one. This works on the ServiceWorker side - a bump from v1.0.0 to v1.0.1 causes the worker to be immediately installed on a refresh, whereas from v1.0.0 to v2.0.0, it waits for the tab to be closed and reopened before being installed.</p>
<p>Back in the main thread, I'm manually updating the ServiceWorker after registration – otherwise the page never even gets the memo that there's a new version of the ServiceWorker available (oddly I found very few mentions of this anywhere in the ServiceWorker literature):</p>
<pre><code>navigator.serviceWorker.register('/sw-bundle.js', {
scope: './'
}).then(registration => {
if (typeof registration.update == 'function') {
registration.update();
}
});
</code></pre>
<p>However, the content that gets served to the main thread is always stuck on an old version of the page ("My version is 1.0.0"), regardless of whether I increment the version to 1.0.1 or 2.0.0.</p>
<p>I'm kind of stumped here. I was hoping to find an elegant semver-y solution to ServiceWorker versioning (hence my use of <code>require('./package.json').version</code>), but in my current implementation, the user is perpetually stuck on an old version of the page, unless they hard-refresh or manually clear out all their data. :/</p>
| 0debug |
JavaScript: What's the difference between a positive look ahead and a non-capturing group? : <p>If I get it right then a positive look ahead ( ?= ) as well a non-capturing group ( ?: ) are used for to excluse a part of the string in the final match-results. </p>
<p><strong>What is the difference between the a lookahead and a non-capturing group?</strong></p>
<p>Can anyone explain? Preferable with an easy understandable example?</p>
| 0debug |
The particularity of map() and forEach() : <p>What is the particularity (specificity) of map() vs forEach in JavaScript ?</p>
<p>They work fine identically !</p>
<pre><code> <script type="text/javascript"> "use strict";
const array1 = [12, 3, 7];
const array2 = [];
const dispEls=(el, idx, array1) =>
array2.push("exp (a[" + idx+ "] = "+el+") = "+
Math.exp(el).toFixed(2));
array2.push("===== FOREACH");
array1.forEach(dispEls);
array2.push("===== MAP");
array1.map(dispEls);
console.dir(array2)
/*[…]
0: "===== FOREACH"
1: "exp (a[0] = 12) = 162754.79"
2: "exp (a[1] = 3) = 20.09"
3: "exp (a[2] = 7) = 1096.63"
4: "===== MAP"
5: "exp (a[0] = 12) = 162754.79"
6: "exp (a[1] = 3) = 20.09"
7: "exp (a[2] = 7) = 1096.63"
length: 8 */
</script>
</code></pre>
| 0debug |
static int mpc7_decode_frame(AVCodecContext * avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
MPCContext *c = avctx->priv_data;
GetBitContext gb;
uint8_t *bits;
int i, ch;
int mb = -1;
Band *bands = c->bands;
int off;
int bits_used, bits_avail;
memset(bands, 0, sizeof(bands));
if(buf_size <= 4){
av_log(avctx, AV_LOG_ERROR, "Too small buffer passed (%i bytes)\n", buf_size);
}
bits = av_malloc(((buf_size - 1) & ~3) + FF_INPUT_BUFFER_PADDING_SIZE);
c->dsp.bswap_buf((uint32_t*)bits, (const uint32_t*)(buf + 4), (buf_size - 4) >> 2);
init_get_bits(&gb, bits, (buf_size - 4)* 8);
skip_bits_long(&gb, buf[0]);
for(i = 0; i <= c->maxbands; i++){
for(ch = 0; ch < 2; ch++){
int t = 4;
if(i) t = get_vlc2(&gb, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5;
if(t == 4) bands[i].res[ch] = get_bits(&gb, 4);
else bands[i].res[ch] = bands[i-1].res[ch] + t;
}
if(bands[i].res[0] || bands[i].res[1]){
mb = i;
if(c->MSS) bands[i].msf = get_bits1(&gb);
}
}
for(i = 0; i <= mb; i++)
for(ch = 0; ch < 2; ch++)
if(bands[i].res[ch]) bands[i].scfi[ch] = get_vlc2(&gb, scfi_vlc.table, MPC7_SCFI_BITS, 1);
for(i = 0; i <= mb; i++){
for(ch = 0; ch < 2; ch++){
if(bands[i].res[ch]){
bands[i].scf_idx[ch][2] = c->oldDSCF[ch][i];
bands[i].scf_idx[ch][0] = get_scale_idx(&gb, bands[i].scf_idx[ch][2]);
switch(bands[i].scfi[ch]){
case 0:
bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]);
bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]);
break;
case 1:
bands[i].scf_idx[ch][1] = get_scale_idx(&gb, bands[i].scf_idx[ch][0]);
bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1];
break;
case 2:
bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0];
bands[i].scf_idx[ch][2] = get_scale_idx(&gb, bands[i].scf_idx[ch][1]);
break;
case 3:
bands[i].scf_idx[ch][2] = bands[i].scf_idx[ch][1] = bands[i].scf_idx[ch][0];
break;
}
c->oldDSCF[ch][i] = bands[i].scf_idx[ch][2];
}
}
}
memset(c->Q, 0, sizeof(c->Q));
off = 0;
for(i = 0; i < BANDS; i++, off += SAMPLES_PER_BAND)
for(ch = 0; ch < 2; ch++)
idx_to_quant(c, &gb, bands[i].res[ch], c->Q[ch] + off);
ff_mpc_dequantize_and_synth(c, mb, data, 2);
av_free(bits);
bits_used = get_bits_count(&gb);
bits_avail = (buf_size - 4) * 8;
if(!buf[1] && ((bits_avail < bits_used) || (bits_used + 32 <= bits_avail))){
av_log(NULL,0, "Error decoding frame: used %i of %i bits\n", bits_used, bits_avail);
return -1;
}
if(c->frames_to_skip){
c->frames_to_skip--;
*data_size = 0;
return buf_size;
}
*data_size = (buf[1] ? c->lastframelen : MPC_FRAME_SIZE) * 4;
return buf_size;
}
| 1threat |
need to fix a bootstrap 3 layout : On bootstrap 3,I can't make the layout how I want to and I can't see why.
My HTML :
<div class="container">
<div id="row1" class="row">
<div class="col-lg-4 col-lg-push-8 col-md-4 col-md-push-8 col-sm-push-8 col-sm-4">
<div class="round"></div>
</div>
<div class="col-lg-8 col-lg-pull-4 col-md-8 col-md-pull-4 col-sm-8 col-sm-pull-4 intro-text">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor</p>
</div>
</div>
<div id="row2" class="row">
<div class="col-lg-4 col-md-4 col-sm-4">
<div class="round"></div>
</div>
<div class="col-lg-8 col-md-8 col-sm-8 intro-text">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor</p>
</div>
</div>
</div>
My CSS :
#row1 {
opacity:0.3;
background-color: red;
}
#row2 {
opacity:0.3;
background-color: yellow;
}
.intro-text {
text-align:center;
}
.round {
background:#bfd70e;
border-radius:50%;
width:160px;
height:160px;
border:2px solid #679403;
margin:0 auto;
}
@media(min-width:767px) {
.intro-text {
margin-top:60px;
}
#row2 {
margin-top:-15px;
}
}
I want to keep the same structure as the first JS fiddle but gain some space by making the row 2 over the first one. So I tried a margin-top but it break all the structure, I don't know why.
This is JS fiddle without :
#row2 {
margin-top:-15px;
}
[JS fiddle][1]
This is JS fiddle with
#row2 {
margin-top:-15px;
}
[JS fiddle][2]
How do I fix that ?
[1]: https://jsfiddle.net/7urbw4kq/
[2]: https://jsfiddle.net/584wcaa5/ | 0debug |
Should my Django site's main page be an app? : <p>I have finished reading the Django official tutorial which teaches how to create a simple polls app, which is the way they chose to teach beginners the Django basics.
My question is, now that I know how to make a simple app and want to create my own website (using Django), should the main (front) page of my website, be an app as well? If so, how do people usually call it and configure it? I mean, it should do nothing but render a html template, so why make it so complicated? If not, where do I put all the static files and how do I reference them? I am a bit confused and could use your help. Maybe I misunderstood Django's main use?</p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.