problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
static BlockAIOCB *read_quorum_children(QuorumAIOCB *acb)
{
BDRVQuorumState *s = acb->common.bs->opaque;
int i;
for (i = 0; i < s->num_children; i++) {
acb->qcrs[i].buf = qemu_blockalign(s->children[i]->bs, acb->qiov->size);
qemu_iovec_init(&acb->qcrs[i].qiov, acb->qiov->niov);
qemu_iovec_clone(&acb->qcrs[i].qiov, acb->qiov, acb->qcrs[i].buf);
}
for (i = 0; i < s->num_children; i++) {
bdrv_aio_readv(s->children[i]->bs, acb->sector_num, &acb->qcrs[i].qiov,
acb->nb_sectors, quorum_aio_cb, &acb->qcrs[i]);
}
return &acb->common;
}
| 1threat
|
Jenkins Pipeline Jenkinsfile: 'node' and 'pipeline' directives : <p>I am getting started with <a href="https://jenkins.io/doc/book/pipeline/jenkinsfile/" rel="noreferrer">Jenkins declarative Pipeline</a>. From some of the examples I have seen, I notice that the Jenkinsfile is setup with the Pipeline directive:</p>
<pre><code>pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'make'
}
}
stage('Test'){
steps {
sh 'make check'
junit 'reports/**/*.xml'
}
}
stage('Deploy') {
steps {
sh 'make publish'
}
}
}
}
</code></pre>
<p>In other examples, I notice that the Jenkinsfile is setup with a node directive:</p>
<pre><code>node {
stage 'Checkout'
checkout scm
stage 'Build'
bat 'nuget restore SolutionName.sln'
bat "\"${tool 'MSBuild'}\" SolutionName.sln /p:Configuration=Release /p:Platform=\"Any CPU\" /p:ProductVersion=1.0.0.${env.BUILD_NUMBER}"
stage 'Archive'
archive 'ProjectName/bin/Release/**'
}
</code></pre>
<p>I haven't been able to find solid documentation on exactly when / why to use each of these. Does anybody have any information on why these differ and when it is appropriate to use either of them?</p>
<p>I'm not sure but I belive the 'node' directive is used in scripted pipeline as opposed to declarative pipeline.</p>
<p>Thanks in advance for any guidance.</p>
| 0debug
|
Rails - Can't install RMagick 2.16.0. Can't find MagickWand.h : <p>I appreciate this question has been asked many times before, however I've tried all available answers to no avail. The error log is as follows:</p>
<pre><code>have_header: checking for wand/MagickWand.h... -------------------- no
"gcc -E -I/Users/mark/.rvm/rubies/ruby-2.3.3/include/ruby-2.3.0/x86_64-darwin16 -I/Users/mark/.rvm/rubies/ruby-2.3.3/include/ruby-2.3.0/ruby/backward -I/Users/mark/.rvm/rubies/ruby-2.3.3/include/ruby-2.3.0 -I. -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/Cellar/imagemagick/7.0.4-8/include/ImageMagick-7 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/usr/local/Cellar/imagemagick/7.0.4-8/include/ImageMagick-7 conftest.c -o conftest.i"
conftest.c:3:10: fatal error: 'wand/MagickWand.h' file not found
#include <wand/MagickWand.h>
^
1 error generated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: #include <wand/MagickWand.h>
/* end */
</code></pre>
<p>After running mdfind MagickWand.h I can see the path is:</p>
<pre><code>/usr/local/Cellar/imagemagick/7.0.4-8/include/ImageMagick-7/MagickWand/MagickWand.h
</code></pre>
<p>I then run:</p>
<pre><code>C_INCLUDE_PATH=/usr/local/Cellar/imagemagick/7.0.4-8/include/ImageMagick-7/MagickWand/ gem install rmagick
</code></pre>
<p>However get the same message as before. </p>
<p>Any help for how to get this solved is greatly appreciated.</p>
| 0debug
|
How to make ssl errors more verbose for MQTT client? : I have 2 servers, with a very similar installation (one on Debian 8.7, the other on Debian 8.8).
On the first server, when I try to subscribe to a MQTT topic :
mosquitto_sub -h localhost -t test -p 8883 --cafile /etc/mosquitto/certs/selfsigned.pem -d
I get this clear message which seems to come from OpenSSL (I already know the reason of the error, it is not the goal of my question) :
Client mosqsub/9647-CIEYY2T7 sending CONNECT
OpenSSL Error: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
Error: Protocol error
On the other server, for the exact same command, I get only this obscure message without the "OpenSSL" explanation :
Unable to connect (8).
So how could I make openssl more verbose ?
| 0debug
|
Updating Xcode on releasing new iOS version : A question always in my mind ,Why its important do download the news version of Xcode while any new ios version release .
Suppose I installed ios 11 in my mobile and i start developing an app with xcode8.3 version (which not support new version of ios i.e 11)
and then i have to download new version of OSX to
Should this is not revert work with Apple .
| 0debug
|
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
| 1threat
|
Why does malloc seemingly allow me to write over memory? : <p>Why does this not return a segmentation fault 11?</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
char *test;
test = (char*) (malloc(sizeof(char)*3));
test = "foo";
printf("%s\n", test);
test = "foobar";
printf("%s\n", test);
return 0;
}
</code></pre>
<p>My outcome is </p>
<pre><code>foo
foobar
</code></pre>
<p>I'm fairly new to C, but when I was compiling this using both gcc on mac and Windows Debugger on Windows 10, it doesn't crash like I expected.</p>
<p>My understanding is that by using <code>(char*) (malloc(sizeof(char)*3))</code>, I am creating a character array of length 3. Then, when I assign test to the string foobar I am writing to 6 array positions.</p>
<p>I'm left sitting here, staring at my apparently valid, runnable code scratching my head.</p>
| 0debug
|
static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey,
int w, int h, int stride, int color)
{
int x, y, fr, f;
sx = av_clip(sx, 0, w - 1);
sy = av_clip(sy, 0, h - 1);
ex = av_clip(ex, 0, w - 1);
ey = av_clip(ey, 0, h - 1);
buf[sy * stride + sx] += color;
if (FFABS(ex - sx) > FFABS(ey - sy)) {
if (sx > ex) {
FFSWAP(int, sx, ex);
FFSWAP(int, sy, ey);
}
buf += sx + sy * stride;
ex -= sx;
f = ((ey - sy) << 16) / ex;
for (x = 0; x = ex; x++) {
y = (x * f) >> 16;
fr = (x * f) & 0xFFFF;
buf[y * stride + x] += (color * (0x10000 - fr)) >> 16;
buf[(y + 1) * stride + x] += (color * fr ) >> 16;
}
} else {
if (sy > ey) {
FFSWAP(int, sx, ex);
FFSWAP(int, sy, ey);
}
buf += sx + sy * stride;
ey -= sy;
if (ey)
f = ((ex - sx) << 16) / ey;
else
f = 0;
for (y = 0; y = ey; y++) {
x = (y * f) >> 16;
fr = (y * f) & 0xFFFF;
buf[y * stride + x] += (color * (0x10000 - fr)) >> 16;
buf[y * stride + x + 1] += (color * fr ) >> 16;
}
}
}
| 1threat
|
def common_in_nested_lists(nestedlist):
result = list(set.intersection(*map(set, nestedlist)))
return result
| 0debug
|
Is there a way to bulk convert svg files using Android Asset Studio? : <p>I have a large number of svg files I want to convert to xml vector assets for Android.</p>
<p>The documented process is, for each file, File->New->Vector Asset. Then choose the svg file, click Next then Finish.</p>
<p>Is there a faster way? Maybe a bash comment to launch Asset Studio?</p>
| 0debug
|
Xcode :Use of unresolved identifier 'metadata' : I have this code, but I have a problem, because it writes me Use of unresolved identifier 'metadata', Thanks in advance! I am a beginner in Xcode, so please explain well!
I got this out of in a youtube tutorial, from zero2launch!
import UIKit
import FirebaseDatabase
import FirebaseAuth
import FirebaseStorage
class SignUpViewController: UIViewController {
@IBOutlet weak var ProfileImage: UIImageView!
@IBOutlet weak var UsernameField: UITextField!
@IBOutlet weak var PasswordField: UITextField!
@IBOutlet weak var Mailfield: UITextField!
var selectedImage: UIImage?
@IBAction func dismiss_onClick(_ sender: Any) {
dismiss(animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
ProfileImage.layer.cornerRadius = 40
ProfileImage.clipsToBounds = true
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(SignUpViewController.handleSelectProfileImageView))
ProfileImage.addGestureRecognizer(tapGesture)
ProfileImage.isUserInteractionEnabled = true
}
@objc func handleSelectProfileImageView() {
let pickerController = UIImagePickerController()
pickerController.delegate = self
present(pickerController, animated: true, completion: nil)
}
@IBAction func SignUpButton(_ sender: Any) {
Auth.auth().createUser(withEmail: Mailfield.text!, password: PasswordField.text! , completion:{(user: User?, error:Error?) in
if error != nil {
print(error!.localizedDescription)
return
}
let uid = user?.uid
let storageRef = Storage.storage().reference(forURL: "gs://gibble-2bed4.appspot.com").child("profile_image").child(uid!)
if let profileImg = self.selectedImage, let imageData = UIImageJPEGRepresentation(profileImg, 0.1){
storageRef.putData(imageData, metadata: nil, completion: { (matadata, error) in
if error != nil{
return
}
let profileImageUrl = metadata?.downloadURL()?.absoluteString
let ref = Database.database().reference()
let usersReference = ref.child("users")
let newUserReference = usersReference.child(uid!)
newUserReference.setValue(["username" : self.UsernameField.text!, "email": self.Mailfield.text!, "profileImageUrl": profileImageUrl])
})
}
})
}
}
extension SignUpViewController: UIImagePickerControllerDelegate, UINavigationControllerDelegate {
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
print("did Finish picking Media")
if let image = info["UIImagePickerControllerOriginalImage"] as? UIImage{
selectedImage = image
ProfileImage.image = image
dismiss(animated: true, completion: nil)
}
print(info)
}
}
Thanks again...
Hello, I have this code, but I have a problem, because it writes me Use of unresolved identifier 'metadata', Thanks in advance! I am a beginner in Xcode, so please explain well!
I got this out of in a youtube tutorial, from zero2launch!
Hello, I have this code, but I have a problem, because it writes me Use of unresolved identifier 'metadata', Thanks in advance! I am a beginner in Xcode, so please explain well!
I got this out of in a youtube tutorial, from zero2launch!
| 0debug
|
Are ValueTuples suitable as dictionary keys? : <p>I'm thinking this could be a convenient dictionary:</p>
<pre><code>var myDict = new Dictionary<(int, int), bool>();
</code></pre>
<p>What would the hashes look like?<br>
What would the equivalent key type (struct) look like?</p>
| 0debug
|
void stw_le_phys(target_phys_addr_t addr, uint32_t val)
{
stw_phys_internal(addr, val, DEVICE_LITTLE_ENDIAN);
}
| 1threat
|
static int add_doubles_metadata(int count,
const char *name, const char *sep,
TiffContext *s)
{
char *ap;
int i;
double *dp;
if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t))
return -1;
dp = av_malloc(count * sizeof(double));
if (!dp)
return AVERROR(ENOMEM);
for (i = 0; i < count; i++)
dp[i] = tget_double(&s->gb, s->le);
ap = doubles2str(dp, count, sep);
av_freep(&dp);
if (!ap)
return AVERROR(ENOMEM);
av_dict_set(&s->picture.metadata, name, ap, AV_DICT_DONT_STRDUP_VAL);
return 0;
}
| 1threat
|
Difference between java.home and JAVA_HOME : <p>In my java code, I have this line <code>System.getProperty("java.home")</code>. In some environments, this returns the same value as what has been set <code>JAVA_HOME</code> as environment variable.</p>
<p>But in some environments, <code>System.getProperty("java.home")</code> returns completely different value from <code>JAVA_HOME</code>.</p>
<p>So my question is what's the difference between <code>java.home</code> and <code>JAVA_HOME</code> from java perspective? </p>
<p>What i know from my research is <code>JAVA_HOME</code> is jdk installation path, <code>java.home</code> is jre installation path, but then why can't it match as jre can be part of jdk installation.</p>
| 0debug
|
Which is the best option? Use an unupdated component in React or try to implement the library in react without the component? : <p>I have found some components that are not updated with the last React version, however, those components work. But I was wondering if those components are not updated would be the best option or a good practice to try to implement the libraries in React without the npm packages?</p>
<p>Thanks. </p>
| 0debug
|
static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc,
int step)
{
int i, j;
int offset = avctx->width * step;
uint8_t *outdata = p->data[0];
for (i = 0; i < avctx->height; i++) {
int size, left, code, pix;
uint8_t *out = outdata;
int pos = 0;
size = left = bytestream2_get_be16(gbc);
if (bytestream2_get_bytes_left(gbc) < size)
while (left > 0) {
code = bytestream2_get_byte(gbc);
if (code & 0x80 ) {
pix = bytestream2_get_byte(gbc);
for (j = 0; j < 257 - code; j++) {
out[pos] = pix;
pos += step;
if (pos >= offset) {
pos -= offset;
pos++;
}
}
left -= 2;
} else {
for (j = 0; j < code + 1; j++) {
out[pos] = bytestream2_get_byte(gbc);
pos += step;
if (pos >= offset) {
pos -= offset;
pos++;
}
}
left -= 2 + code;
}
}
outdata += p->linesize[0];
}
return 0;
}
| 1threat
|
How to echo all values from array in bash : <p>I am making a bash script using dialog. My script make the difference between files in two tar.gz. Each add files are put in an array and each delete files are put in an other array.</p>
<p>All files are add in my two array and when I want echo them it's works</p>
<pre><code>echo ${tabAjout[@]}
echo ${tabSuppr[@]}
</code></pre>
<p>The output is :</p>
<pre><code>bonjour.txt.gpg test2.txt.gpg test.txt.gpg
hello.txt.gpg
</code></pre>
<p>Now I want add this in msgbox. </p>
<pre><code>function affiche_message(){
#Personnalisation de la fenêtre
$DIALOG --title "$1" \
--msgbox "$2" 20 45
}
</code></pre>
<p>Call function :</p>
<pre><code>affiche_message "Title" "Delete : ${tabSuppr[@]} \n\n Add : ${tabAjout[@]}"
</code></pre>
<p>When I run my script the msgbox contains only the first values of the array. If I change ${tabAjout[@]} by ${#tabAjout[@]} the dialog windows echo that array contains 3 values.</p>
| 0debug
|
void ff_ivi_recompose53(const IVIPlaneDesc *plane, uint8_t *dst,
const int dst_pitch, const int num_bands)
{
int x, y, indx;
int32_t p0, p1, p2, p3, tmp0, tmp1, tmp2;
int32_t b0_1, b0_2, b1_1, b1_2, b1_3, b2_1, b2_2, b2_3, b2_4, b2_5, b2_6;
int32_t b3_1, b3_2, b3_3, b3_4, b3_5, b3_6, b3_7, b3_8, b3_9;
int32_t pitch, back_pitch;
const IDWTELEM *b0_ptr, *b1_ptr, *b2_ptr, *b3_ptr;
pitch = plane->bands[0].pitch;
back_pitch = 0;
b0_ptr = plane->bands[0].buf;
b1_ptr = plane->bands[1].buf;
b2_ptr = plane->bands[2].buf;
b3_ptr = plane->bands[3].buf;
for (y = 0; y < plane->height; y += 2) {
if (num_bands > 0) {
b0_1 = b0_ptr[0];
b0_2 = b0_ptr[pitch];
}
if (num_bands > 1) {
b1_1 = b1_ptr[back_pitch];
b1_2 = b1_ptr[0];
b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch];
}
if (num_bands > 2) {
b2_2 = b2_ptr[0];
b2_3 = b2_2;
b2_5 = b2_ptr[pitch];
b2_6 = b2_5;
}
if (num_bands > 3) {
b3_2 = b3_ptr[back_pitch];
b3_3 = b3_2;
b3_5 = b3_ptr[0];
b3_6 = b3_5;
b3_8 = b3_2 - b3_5*6 + b3_ptr[pitch];
b3_9 = b3_8;
}
for (x = 0, indx = 0; x < plane->width; x+=2, indx++) {
b2_1 = b2_2;
b2_2 = b2_3;
b2_4 = b2_5;
b2_5 = b2_6; = b2[x+1,y+1]
b3_1 = b3_2;
b3_2 = b3_3; = b3[x+1,y-1]
b3_4 = b3_5;
b3_5 = b3_6; = b3[x+1,y ]
b3_7 = b3_8;
b3_8 = b3_9;
p0 = p1 = p2 = p3 = 0;
if (num_bands > 0) {
tmp0 = b0_1;
tmp2 = b0_2;
b0_1 = b0_ptr[indx+1];
b0_2 = b0_ptr[pitch+indx+1];
tmp1 = tmp0 + b0_1;
p0 = tmp0 << 4;
p1 = tmp1 << 3;
p2 = (tmp0 + tmp2) << 3;
p3 = (tmp1 + tmp2 + b0_2) << 2;
}
if (num_bands > 1) {
tmp0 = b1_2;
tmp1 = b1_1;
b1_2 = b1_ptr[indx+1];
b1_1 = b1_ptr[back_pitch+indx+1];
tmp2 = tmp1 - tmp0*6 + b1_3;
b1_3 = b1_1 - b1_2*6 + b1_ptr[pitch+indx+1];
p0 += (tmp0 + tmp1) << 3;
p1 += (tmp0 + tmp1 + b1_1 + b1_2) << 2;
p2 += tmp2 << 2;
p3 += (tmp2 + b1_3) << 1;
}
if (num_bands > 2) {
b2_3 = b2_ptr[indx+1];
b2_6 = b2_ptr[pitch+indx+1];
tmp0 = b2_1 + b2_2;
tmp1 = b2_1 - b2_2*6 + b2_3;
p0 += tmp0 << 3;
p1 += tmp1 << 2;
p2 += (tmp0 + b2_4 + b2_5) << 2;
p3 += (tmp1 + b2_4 - b2_5*6 + b2_6) << 1;
}
if (num_bands > 3) {
b3_6 = b3_ptr[indx+1];
b3_3 = b3_ptr[back_pitch+indx+1];
tmp0 = b3_1 + b3_4;
tmp1 = b3_2 + b3_5;
tmp2 = b3_3 + b3_6;
b3_9 = b3_3 - b3_6*6 + b3_ptr[pitch+indx+1];
p0 += (tmp0 + tmp1) << 2;
p1 += (tmp0 - tmp1*6 + tmp2) << 1;
p2 += (b3_7 + b3_8) << 1;
p3 += b3_7 - b3_8*6 + b3_9;
}
dst[x] = av_clip_uint8((p0 >> 6) + 128);
dst[x+1] = av_clip_uint8((p1 >> 6) + 128);
dst[dst_pitch+x] = av_clip_uint8((p2 >> 6) + 128);
dst[dst_pitch+x+1] = av_clip_uint8((p3 >> 6) + 128);
}
dst += dst_pitch << 1;
back_pitch = -pitch;
b0_ptr += pitch;
b1_ptr += pitch;
b2_ptr += pitch;
b3_ptr += pitch;
}
}
| 1threat
|
How to Properly Combine TensorFlow's Dataset API and Keras? : <p>Keras' <code>fit_generator()</code> model method expects a generator which produces tuples of the shape (input, targets), where both elements are NumPy arrays. <a href="https://keras.io/models/model/" rel="noreferrer">The documentation</a> seems to imply that if I simply wrap a <a href="https://www.tensorflow.org/programmers_guide/datasets" rel="noreferrer"><code>Dataset</code> iterator</a> in a generator, and make sure to convert the Tensors to NumPy arrays, I should be good to go. This code, however, gives me an error:</p>
<pre><code>import numpy as np
import os
import keras.backend as K
from keras.layers import Dense, Input
from keras.models import Model
import tensorflow as tf
from tensorflow.contrib.data import Dataset
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
with tf.Session() as sess:
def create_data_generator():
dat1 = np.arange(4).reshape(-1, 1)
ds1 = Dataset.from_tensor_slices(dat1).repeat()
dat2 = np.arange(5, 9).reshape(-1, 1)
ds2 = Dataset.from_tensor_slices(dat2).repeat()
ds = Dataset.zip((ds1, ds2)).batch(4)
iterator = ds.make_one_shot_iterator()
while True:
next_val = iterator.get_next()
yield sess.run(next_val)
datagen = create_data_generator()
input_vals = Input(shape=(1,))
output = Dense(1, activation='relu')(input_vals)
model = Model(inputs=input_vals, outputs=output)
model.compile('rmsprop', 'mean_squared_error')
model.fit_generator(datagen, steps_per_epoch=1, epochs=5,
verbose=2, max_queue_size=2)
</code></pre>
<p>Here's the error I get:</p>
<pre><code>Using TensorFlow backend.
Epoch 1/5
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 270, in __init__
fetch, allow_tensor=True, allow_operation=True))
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2708, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2787, in _as_graph_element_locked
raise ValueError("Tensor %s is not an element of this graph." % obj)
ValueError: Tensor Tensor("IteratorGetNext:0", shape=(?, 1), dtype=int64) is not an element of this graph.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/jsaporta/anaconda3/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/jsaporta/anaconda3/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/keras/utils/data_utils.py", line 568, in data_generator_task
generator_output = next(self._generator)
File "./datagen_test.py", line 25, in create_data_generator
yield sess.run(next_val)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1109, in _run
self._graph, fetches, feed_dict_tensor, feed_handles=feed_handles)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 413, in __init__
self._fetch_mapper = _FetchMapper.for_fetch(fetches)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 233, in for_fetch
return _ListFetchMapper(fetch)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 340, in __init__
self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 340, in <listcomp>
self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 241, in for_fetch
return _ElementFetchMapper(fetches, contraction_fn)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 277, in __init__
'Tensor. (%s)' % (fetch, str(e)))
ValueError: Fetch argument <tf.Tensor 'IteratorGetNext:0' shape=(?, 1) dtype=int64> cannot be interpreted as a Tensor. (Tensor Tensor("IteratorGetNext:0", shape=(?, 1), dtype=int64) is not an element of this graph.)
Traceback (most recent call last):
File "./datagen_test.py", line 34, in <module>
verbose=2, max_queue_size=2)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/keras/legacy/interfaces.py", line 87, in wrapper
return func(*args, **kwargs)
File "/home/jsaporta/anaconda3/lib/python3.6/site-packages/keras/engine/training.py", line 2011, in fit_generator
generator_output = next(output_generator)
StopIteration
</code></pre>
<p>Strangely enough, adding a line containing <code>next(datagen)</code> directly after where I initialize <code>datagen</code> causes the code to run just fine, with no errors.</p>
<p>Why does my original code not work? Why does it begin to work when I add that line to my code? Is there a more efficient way to use TensorFlow's Dataset API with Keras that doesn't involve converting Tensors to NumPy arrays and back again?</p>
| 0debug
|
Proper use of wait and notify methods in java threading : I am new to java multithreading. I created simple producer-consumer pattern using wait and notify but my producer is getting called only once in tbe starting.
class ProducerConsumerWorld{
public void producer() throws InterruptedException{
synchronized (this) {
while(true){
System.out.println("Producer thread started running");
wait();
System.out.println("Resumed Producing");
}
}
}
public void consumer() throws InterruptedException{
synchronized (this) {
while(true){
Thread.sleep(2000);
System.out.println("Consumer thread started running");
System.out.println("Press enter to consume all and start producing");
Scanner s = new Scanner(System.in);
s.nextLine();
notify();
Thread.sleep(2000);
System.out.println("consumed all");
}
}
}
}
I am creating separate threads for producer and consumer. Producer thread only gets called in the starting and then after it is never getting executed.
| 0debug
|
My terminal in VSCode has a tiny font after installing zsh and changing font style? : <p>If you look at the vscode terminal - its too tiny. Heres the user settings that I have modified to create this result. I have searched how to change terminal fonts at vscode but I have followed all instructions pertaining to
<code>terminal.integrated.fontSize</code> and this doesnt help at all - it only lengthens the line. Please advise - thanks in advance.</p>
<p><a href="https://i.stack.imgur.com/B1AaM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/B1AaM.png" alt="enter image description here"></a></p>
| 0debug
|
static int mov_read_wide(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
int err;
uint32_t type;
#ifdef DEBUG
print_atom("wide", atom);
debug_indent++;
#endif
if (atom.size < 8)
return 0;
if (get_be32(pb) != 0) {
url_fskip(pb, atom.size - 4);
return 0;
}
atom.type = get_le32(pb);
atom.offset += 8;
atom.size -= 8;
if (type != MKTAG('m', 'd', 'a', 't')) {
url_fskip(pb, atom.size);
return 0;
}
err = mov_read_mdat(c, pb, atom);
#ifdef DEBUG
debug_indent--;
#endif
return err;
}
| 1threat
|
Integrate report from Reporting server 2016 via iframe in SharePoint 2013 : <p>I'm trying to integrate a Report from Reporting Server2016 into our SharePoint2013.<br>
It worked fine with Reporting Server 2012 but not anymore with the new enviroment.<p>
I've alread read a bit around and found out that the Reporting Server is sending the Report with X-Frame-Options = SAMEORIGIN in the answer header.<p>
Is there the possibility to turn that off in the Reporting server?<p>
Installing a Browser Plugin that ignores the header is not an option.</p>
| 0debug
|
static int colo_packet_compare_icmp(Packet *spkt, Packet *ppkt)
{
trace_colo_compare_main("compare icmp");
if (colo_packet_compare_common(ppkt, spkt)) {
trace_colo_compare_icmp_miscompare("primary pkt size",
ppkt->size);
qemu_hexdump((char *)ppkt->data, stderr, "colo-compare",
ppkt->size);
trace_colo_compare_icmp_miscompare("Secondary pkt size",
spkt->size);
qemu_hexdump((char *)spkt->data, stderr, "colo-compare",
spkt->size);
return -1;
} else {
return 0;
}
}
| 1threat
|
How to debug type-level programs : <p>I'm trying to do some hoopy type-level programming, and it just doesn't work. I'm tearing my hair out trying to figure out why the heck GHC utterly fails to infer the type signatures I want.</p>
<p>Is there some way to make GHC <em>tell me</em> what it's doing?</p>
<p>I tried <code>-ddump-tc</code>, which just prints out the final type signatures. (Yes, they're wrong. Thanks, I already knew that.)</p>
<p>I also tried <code>-ddump-tc-trace</code>, which dumps out ~70KB of unintelligible gibberish. (In particular, I can't see any user-written identifiers mentioned <em>anywhere</em>.)</p>
<p>My code is <em>so close</em> to working, but somehow an extra type variable keeps appearing. For some reason, GHC can't see that this variable should be completely determined. Indeed, if I <em>manually</em> write the five-mile type signature, GHC happily accepts it. So I'm clearly just missing a constraint somewhere... <em>but where?!?</em> >_<</p>
| 0debug
|
static int ppc6xx_tlb_check (CPUState *env, mmu_ctx_t *ctx,
target_ulong eaddr, int rw, int access_type)
{
ppc6xx_tlb_t *tlb;
int nr, best, way;
int ret;
best = -1;
ret = -1;
for (way = 0; way < env->nb_ways; way++) {
nr = ppc6xx_tlb_getnum(env, eaddr, way,
access_type == ACCESS_CODE ? 1 : 0);
tlb = &env->tlb[nr].tlb6;
if ((eaddr & TARGET_PAGE_MASK) != tlb->EPN) {
#if defined (DEBUG_SOFTWARE_TLB)
if (loglevel != 0) {
fprintf(logfile, "TLB %d/%d %s [" ADDRX " " ADDRX
"] <> " ADDRX "\n",
nr, env->nb_tlb,
pte_is_valid(tlb->pte0) ? "valid" : "inval",
tlb->EPN, tlb->EPN + TARGET_PAGE_SIZE, eaddr);
}
#endif
continue;
}
#if defined (DEBUG_SOFTWARE_TLB)
if (loglevel != 0) {
fprintf(logfile, "TLB %d/%d %s " ADDRX " <> " ADDRX " " ADDRX
" %c %c\n",
nr, env->nb_tlb,
pte_is_valid(tlb->pte0) ? "valid" : "inval",
tlb->EPN, eaddr, tlb->pte1,
rw ? 'S' : 'L', access_type == ACCESS_CODE ? 'I' : 'D');
}
#endif
switch (pte32_check(ctx, tlb->pte0, tlb->pte1, 0, rw)) {
case -3:
return -1;
case -2:
ret = -2;
best = nr;
break;
case -1:
default:
break;
case 0:
ret = 0;
best = nr;
goto done;
}
}
if (best != -1) {
done:
#if defined (DEBUG_SOFTWARE_TLB)
if (loglevel != 0) {
fprintf(logfile, "found TLB at addr 0x%08lx prot=0x%01x ret=%d\n",
ctx->raddr & TARGET_PAGE_MASK, ctx->prot, ret);
}
#endif
pte_update_flags(ctx, &env->tlb[best].tlb6.pte1, ret, rw);
}
return ret;
}
| 1threat
|
Woocommerce shipping class displayed on product page : Could anyone advise how to display a specific Woocommerce shipping class on an individual product page? Ie. If a product has a "Pickup Only" shipping class, I'd like that to be visible just below the Add to Cart button. All other classes do not need to be displayed. Thanks.
| 0debug
|
void virtio_init_iov_from_pdu(V9fsPDU *pdu, struct iovec **piov,
unsigned int *pniov, bool is_write)
{
V9fsState *s = pdu->s;
V9fsVirtioState *v = container_of(s, V9fsVirtioState, state);
VirtQueueElement *elem = &v->elems[pdu->idx];
if (is_write) {
*piov = elem->out_sg;
*pniov = elem->out_num;
} else {
*piov = elem->in_sg;
*pniov = elem->in_num;
}
}
| 1threat
|
static void openrisc_pic_cpu_handler(void *opaque, int irq, int level)
{
OpenRISCCPU *cpu = (OpenRISCCPU *)opaque;
CPUState *cs = CPU(cpu);
int i;
uint32_t irq_bit = 1 << irq;
if (irq > 31 || irq < 0) {
return;
}
if (level) {
cpu->env.picsr |= irq_bit;
} else {
cpu->env.picsr &= ~irq_bit;
}
for (i = 0; i < 32; i++) {
if ((cpu->env.picsr && (1 << i)) && (cpu->env.picmr && (1 << i))) {
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
} else {
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
cpu->env.picsr &= ~(1 << i);
}
}
}
| 1threat
|
What does " rand()% 11" and what's the diffrence between this and "rand()% 10+1"? : <p>I know that rand() generates a random number and that % operator returns the rest of the division but what I don't understand is why do we Have to use it here why can't we just give a max number directly like 10 for example</p>
| 0debug
|
Content not displaying on Wordpress : <p>None of my content is displaying when I pull up my website. The only thing that shows is the header and footer. I did not edit the page.php file so I know this can't be it. I made some changes to the css to make the header and footer full-width and suddenly everything was gone. The content is still in my page editor but does not display in the web browser. I tried deactivating all of the plugins, but that did not seem to work. Only one page displays content. </p>
<p>My website is <a href="http://www.smaysdesigns.com" rel="nofollow noreferrer">www.smaysdesigns.com</a> </p>
| 0debug
|
void monitor_init(CharDriverState *chr, int flags)
{
static int is_first_init = 1;
Monitor *mon;
if (is_first_init) {
key_timer = qemu_new_timer(vm_clock, release_keys, NULL);
is_first_init = 0;
}
mon = qemu_mallocz(sizeof(*mon));
mon->chr = chr;
mon->flags = flags;
if (flags & MONITOR_USE_READLINE) {
mon->rs = readline_init(mon, monitor_find_completion);
monitor_read_command(mon, 0);
}
qemu_chr_add_handlers(chr, monitor_can_read, monitor_read, monitor_event,
mon);
LIST_INSERT_HEAD(&mon_list, mon, entry);
if (!cur_mon || (flags & MONITOR_IS_DEFAULT))
cur_mon = mon;
}
| 1threat
|
Node update a specific package : <p>I want to update my Browser-sync <strong>without updating all my node packages</strong>. How can I achieve this? My current version of Browser-sync does not have the Browser-sync GUI :(</p>
<pre><code>├─┬ [email protected]
│ ├── [email protected]
</code></pre>
| 0debug
|
static void parse_presentation_segment(AVCodecContext *avctx,
const uint8_t *buf, int buf_size)
{
PGSSubContext *ctx = avctx->priv_data;
int x, y;
int w = bytestream_get_be16(&buf);
int h = bytestream_get_be16(&buf);
av_dlog(avctx, "Video Dimensions %dx%d\n",
w, h);
if (av_image_check_size(w, h, 0, avctx) >= 0)
avcodec_set_dimensions(avctx, w, h);
buf++;
ctx->presentation.id_number = bytestream_get_be16(&buf);
buf += 3;
ctx->presentation.object_number = bytestream_get_byte(&buf);
if (!ctx->presentation.object_number)
return;
buf += 4;
x = bytestream_get_be16(&buf);
y = bytestream_get_be16(&buf);
av_dlog(avctx, "Subtitle Placement x=%d, y=%d\n", x, y);
if (x > avctx->width || y > avctx->height) {
av_log(avctx, AV_LOG_ERROR, "Subtitle out of video bounds. x = %d, y = %d, video width = %d, video height = %d.\n",
x, y, avctx->width, avctx->height);
x = 0; y = 0;
}
ctx->presentation.x = x;
ctx->presentation.y = y;
}
| 1threat
|
create a simple bash script 10 random numbers between 1000 and 9999? : #!/bin/bash
clear #Clears the screen to make it easier to read the output
echo -n “Creating a new random four digit PIN for access to the site: “
echo $((RANDOM%8999+1000))
how do I get this to print out 10 random numbers?
| 0debug
|
Match string in Item : Need to match by String in each item of a list and return the full item.
i have lists and i want to match items of each list by string "Name" and "Address"
['Server: Corp', 'Address: 10.17.2.5\r', '\r', 'Name: b.resolvers.level3.net\r', 'Address: 4.2.2.2\r', '\r', '']
['Server: Corp', 'Address: 10.17.2.5\r', '\r', 'Name: google-public-dns-a.google.com\r', 'Address: 8.8.8.8\r', '\r', '']
['Server: Corp', 'Address: 10.17.2.5\r', '\r', 'Name: dns.quad9.net\r', 'Address: 9.9.9.9\r', '\r', '']
import re
m = re.search(r'\bName\b'| \bAddress\b', line)
for line in output:
if m:
print(m.group())
What i want :
b.resolvers.level3.net , 4.2.2.2
google-public-dns-a.google.com , 8.8.8.8
dns.quad9.net , 9.9.9.9
| 0debug
|
Remove an item from a list by shifting all other elements : <p>I want to remove a value from a list to a randomly selected id and shift all element content according to the list is shorter than 1 .</p>
| 0debug
|
static int put_flac_codecpriv(AVFormatContext *s, ByteIOContext *pb, AVCodecContext *codec)
{
if (codec->extradata_size < FLAC_STREAMINFO_SIZE) {
av_log(s, AV_LOG_ERROR, "Invalid FLAC extradata\n");
return -1;
} else if (codec->extradata_size == FLAC_STREAMINFO_SIZE) {
put_buffer(pb, "fLaC", 4);
put_byte(pb, 0x80);
put_be24(pb, FLAC_STREAMINFO_SIZE);
} else if(memcmp("fLaC", codec->extradata, 4)) {
av_log(s, AV_LOG_ERROR, "Invalid FLAC extradata\n");
return -1;
}
put_buffer(pb, codec->extradata, codec->extradata_size);
return 0;
}
| 1threat
|
Is it necessary to create couple program OpenGL? : <p>I'm learning OpenGL and want to create simple program. I want to render different meshes with different shaders. Should I recreate program or I must reuse created program? (program - shader program, created by calling glCreateProgram)</p>
| 0debug
|
static void do_address_space_destroy(AddressSpace *as)
{
MemoryListener *listener;
address_space_destroy_dispatch(as);
QTAILQ_FOREACH(listener, &memory_listeners, link) {
assert(listener->address_space_filter != as);
}
flatview_unref(as->current_map);
g_free(as->name);
g_free(as->ioeventfds);
}
| 1threat
|
static int parse_channel_expressions(AVFilterContext *ctx,
int expected_nb_channels)
{
EvalContext *eval = ctx->priv;
char *args1 = av_strdup(eval->exprs);
char *expr, *last_expr, *buf;
double (* const *func1)(void *, double) = NULL;
const char * const *func1_names = NULL;
int i, ret = 0;
if (!args1)
return AVERROR(ENOMEM);
if (!eval->exprs) {
av_log(ctx, AV_LOG_ERROR, "Channels expressions list is empty\n");
return AVERROR(EINVAL);
}
if (!strcmp(ctx->filter->name, "aeval")) {
func1 = aeval_func1;
func1_names = aeval_func1_names;
}
#define ADD_EXPRESSION(expr_) do { \
if (!av_dynarray2_add((void **)&eval->expr, &eval->nb_channels, \
sizeof(*eval->expr), NULL)) { \
ret = AVERROR(ENOMEM); \
goto end; \
} \
eval->expr[eval->nb_channels-1] = NULL; \
ret = av_expr_parse(&eval->expr[eval->nb_channels - 1], expr_, \
var_names, func1_names, func1, \
NULL, NULL, 0, ctx); \
if (ret < 0) \
goto end; \
} while (0)
for (i = 0; i < eval->nb_channels; i++) {
av_expr_free(eval->expr[i]);
eval->expr[i] = NULL;
}
av_freep(&eval->expr);
eval->nb_channels = 0;
buf = args1;
while (expr = av_strtok(buf, "|", &buf)) {
ADD_EXPRESSION(expr);
last_expr = expr;
}
if (expected_nb_channels > eval->nb_channels)
for (i = eval->nb_channels; i < expected_nb_channels; i++)
ADD_EXPRESSION(last_expr);
if (expected_nb_channels > 0 && eval->nb_channels != expected_nb_channels) {
av_log(ctx, AV_LOG_ERROR,
"Mismatch between the specified number of channel expressions '%d' "
"and the number of expected output channels '%d' for the specified channel layout\n",
eval->nb_channels, expected_nb_channels);
ret = AVERROR(EINVAL);
goto end;
}
end:
av_free(args1);
return ret;
}
| 1threat
|
Classes multi functinos : I'm trying to program a sight reading app. Right now I want to be able to input (Num, staff, measure, note, notetype) and print out a note on the sheet music. I created a class "Note" to do this and the function ExNote is supposed to carry out all the functions I need for the translation. However it doesn't seem to be working. I basically want it to take in 'NoteF.ExNote' and print out screen.blit(EthnoteIMG, (x,y)), the x,y coordinates being numbers of course. Any help/tips are appreciated thanks.[enter image description here][1]
[1]: https://i.stack.imgur.com/drbGt.png
| 0debug
|
static int ppc_hash32_check_prot(int prot, int rwx)
{
int ret;
if (rwx == 2) {
if (prot & PAGE_EXEC) {
ret = 0;
} else {
ret = -2;
}
} else if (rwx) {
if (prot & PAGE_WRITE) {
ret = 0;
} else {
ret = -2;
}
} else {
if (prot & PAGE_READ) {
ret = 0;
} else {
ret = -2;
}
}
return ret;
}
| 1threat
|
Mysql foreign key constraint error when migrate in Laravel : I have create 2 migration file wich on file has a foreign key, when migrate , laravel show this error about
Mysql foreign key constraint error when migrate in Laravel
| 0debug
|
How to use componentWillMount() in React Hooks? : <p>In the official docs of React it mentions - </p>
<blockquote>
<p>If you’re familiar with React class lifecycle methods, you can think
of useEffect Hook as componentDidMount, componentDidUpdate, and
componentWillUnmount combined.</p>
</blockquote>
<p>My question is - how can we use the <code>componentWillMount()</code> lifecyle method in a hook?</p>
| 0debug
|
query = 'SELECT * FROM customers WHERE email = ' + email_input
| 1threat
|
Why the list doesn't change? [python] : i have a little problem.
i'm trying to add a value in a ordered list but the list wouldn't change:
def insert(V, x):
if len(V)!=0:
for i in range( 0 , len(V)-1):
if (V[i]<=x)and(V[i+1]>=x):
V=V[0:i+1]+[x]+V[i+1:len(V)]
print("\nExpected: \n"+ repr(V))
return
V=V+[x]
return
i have this:
V=[1,2,3,4,5,6,7,8,9,10]
insert(V, 6)
print("\nResult: \n"+ repr(V))enter code here
and this is the result:
Expected:
[1, 2, 3, 4, 5, 6, 6, 7, 8, 9, 10]
Result:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
i can solve the problem setting V as the return but i want the function to work on the list.
PS: sorry i don't speak english very well but i hope you can understand me :)
| 0debug
|
get dict value from variable key in ansible : <p>Here is my problem I need to get a dict value from key. But the key is also a var.
For example, I had an ansible role.</p>
<p>In <strong>vars/main.yml</strong>, I defined vars as below:</p>
<pre><code>---
location: "USA"
source: {
"China": "/net/server1/patha",
"USA": "/net/server2/pathb",
"Japan": "/net/server3/pathc"
}
</code></pre>
<p>So in my tasks: <strong>tasks/main.yml</strong>. How do get "/net/server2/pathb" using the vars. I tried below in tasks, all did not work.</p>
<p><code>-shell: "perl run.perl {{ source.location }}/script.pl"</code></p>
<p><code>-shell: "perl run.perl {{ source.{{ location }} }}/script.pl"</code></p>
<p>This may be a simple question. But I searched many posts for a long time and still cannot get a right answer. So please help and many thanks.</p>
| 0debug
|
static void floor_fit(venc_context_t * venc, floor_t * fc, float * coeffs, int * posts, int samples) {
int range = 255 / fc->multiplier + 1;
int i;
for (i = 0; i < fc->values; i++) {
int position = fc->list[fc->list[i].sort].x;
int begin = fc->list[fc->list[FFMAX(i-1, 0)].sort].x;
int end = fc->list[fc->list[FFMIN(i+1, fc->values - 1)].sort].x;
int j;
float average = 0;
begin = (position + begin) / 2;
end = (position + end ) / 2;
assert(end <= samples);
for (j = begin; j < end; j++) average += fabs(coeffs[j]);
average /= end - begin;
average /= 32;
for (j = 0; j < range - 1; j++) if (floor1_inverse_db_table[j * fc->multiplier] > average) break;
posts[fc->list[i].sort] = j;
}
}
| 1threat
|
static void ff_h264_idct8_add4_mmx2(uint8_t *dst, const int *block_offset, DCTELEM *block, int stride, const uint8_t nnzc[6*8]){
int i;
for(i=0; i<16; i+=4){
int nnz = nnzc[ scan8[i] ];
if(nnz){
if(nnz==1 && block[i*16]) ff_h264_idct8_dc_add_mmx2(dst + block_offset[i], block + i*16, stride);
else ff_h264_idct8_add_mmx (dst + block_offset[i], block + i*16, stride);
}
}
}
| 1threat
|
java IO I CREATE A TXT. FILE BUT I CANNOT FIND WHERE IT SAVE : import java.io.*;
public class FileReaderDemo
{
public static void main(String args[])throws Exception
{
File f = new File ("wayback.txt");
f.createNewFile();
System.out.println(f.exists());
}
}
| 0debug
|
static uint32_t parse_peak(const uint8_t *peak)
{
int64_t val = 0;
int64_t scale = 1;
if (!peak)
return 0;
peak += strspn(peak, " \t");
if (peak[0] == '1' && peak[1] == '.')
return UINT32_MAX;
else if (!(peak[0] == '0' && peak[1] == '.'))
return 0;
peak += 2;
while (av_isdigit(*peak)) {
int digit = *peak - '0';
if (scale > INT64_MAX / 10)
break;
val = 10 * val + digit;
scale *= 10;
peak++;
}
return av_rescale(val, UINT32_MAX, scale);
}
| 1threat
|
uint64_t HELPER(neon_abdl_s64)(uint32_t a, uint32_t b)
{
uint64_t result;
DO_ABD(result, a, b, int32_t);
return result;
}
| 1threat
|
Java NullPointerException on concatenating Double types but not on String types : <pre><code> Double d1 = null;
Double d2 = null;
System.out.println(d1+d2);//throw NullPointerException
String s1 = null;
String s2 = null;
System.out.println(s1+s2);//doesn't throw any exception prints nullnull
</code></pre>
<p>Since both Double and String are of type Object then why Double types throw exception??</p>
| 0debug
|
static void co_read_response(void *opaque)
{
BDRVSheepdogState *s = opaque;
if (!s->co_recv) {
s->co_recv = qemu_coroutine_create(aio_read_response);
}
qemu_coroutine_enter(s->co_recv, opaque);
}
| 1threat
|
static int skip_check(MpegEncContext *s, Picture *p, Picture *ref){
int x, y, plane;
int score=0;
int64_t score64=0;
for(plane=0; plane<3; plane++){
const int stride= p->linesize[plane];
const int bw= plane ? 1 : 2;
for(y=0; y<s->mb_height*bw; y++){
for(x=0; x<s->mb_width*bw; x++){
int v= s->dsp.frame_skip_cmp[1](s, p->data[plane] + 8*(x + y*stride), ref->data[plane] + 8*(x + y*stride), stride, 8);
switch(s->avctx->frame_skip_exp){
case 0: score= FFMAX(score, v); break;
case 1: score+= ABS(v);break;
case 2: score+= v*v;break;
case 3: score64+= ABS(v*v*(int64_t)v);break;
case 4: score64+= v*v*(int64_t)(v*v);break;
}
}
}
}
if(score) score64= score;
if(score64 < s->avctx->frame_skip_threshold)
return 1;
if(score64 < ((s->avctx->frame_skip_factor * (int64_t)s->lambda)>>8))
return 1;
return 0;
}
| 1threat
|
Find out number of words in a string with alot of special character : I need to find out the number of words in a string. However this string is not the normal type of string. It has alot of special character like < , /em, /p and many more. So most of the method used in stackoverflow does not work. As a result i need to define a regular expression by myself.
What i intend to do is to define what is a word using a regular expression and count the number of time a word appear.
This is how i define a word.
It must start with a letter and end with one of this : or , or ! or ? or ' or - or ) or . or "
This is how i define my regular expression
pattern = Pattern.compile("^[a-zA-Z](:|,|!|?|'|-|)|.|")$");
matcher = pattern.matcher(line);
while (matcher.find())
wordCount++;
However there is error with the first line
pattern = Pattern.compile("^[a-zA-Z](:|,|!|?|'|-|)|.|")$");
How can i fix this problem?
| 0debug
|
How can I find a perfect square in Ruby? : I'm trying to write a method in ruby that checks whether a number is a perfect square.
This is my code at the moment:
def is_square(x)
return true if
math.sqrt(x).is_a? Integer
end
Any idea why it isn't working?
Thanks very much in advance
Sarah
| 0debug
|
START_TEST(qdict_put_exists_test)
{
int value;
const char *key = "exists";
qdict_put(tests_dict, key, qint_from_int(1));
qdict_put(tests_dict, key, qint_from_int(2));
value = qdict_get_int(tests_dict, key);
fail_unless(value == 2);
fail_unless(qdict_size(tests_dict) == 1);
}
| 1threat
|
Python - Not able to store the output of Pattern Package : I am working with Python "Pattern.en" package that gives me the subject, object and other details about a particular sentence.
But I want to store this output into another variable or a Dataframe for further processing which I am not able to do so.
Any inputs on this will be helpful.
Sample code is mentioned below for reference.
from pattern.en import parse
from pattern.en import pprint
import pandas as pd
input = parse('I want to go to the Restaurant as I am hungry very much')
print(input)
I/PRP/B-NP/O want/VBP/B-VP/O to/TO/I-VP/O go/VB/I-VP/O to/TO/O/O the/DT/B-NP/O Restaurant/NNP/I-NP/O as/IN/B-PP/B-PNP I/PRP/B-NP/I-PNP am/VBP/B-VP/O hungry/JJ/B-ADJP/O very/RB/I-ADJP/O much/JJ/I-ADJP/O
pprint(input)
WORD TAG CHUNK ROLE ID PNP LEMMA
I PRP NP - - - -
want VBP VP - - - -
to TO VP ^ - - - -
go VB VP ^ - - - -
to TO - - - - -
the DT NP - - - -
Restaurant NNP NP ^ - - - -
as IN PP - - PNP -
I PRP NP - - PNP -
am VBP VP - - - -
hungry JJ ADJP - - - -
very RB ADJP ^ - - - -
much JJ ADJP ^ - - - -
Please note the output of both print and pprint statements. I am trying to store either one of them into a variable. It would be better if I can store the output of pprint statement into a Dataframe as it is printing in tabular format.
But when I try to do so I encounter the error mentioned below
df = pd.DataFrame(input)
> Traceback (most recent call last):
>
> File "<ipython-input-470-79452c72f8e4>", line 1, in <module>
> df = pd.DataFrame(input)
>
> File
> "C:\Users\BFSBICOE16\Anaconda3\lib\site-packages\pandas\core\frame.py",
> line 354, in __init__
> raise ValueError('DataFrame constructor not properly called!')
>
> ValueError: DataFrame constructor not properly called!
| 0debug
|
static void vc1_overlap_block(MpegEncContext *s, DCTELEM block[64], int n, int do_hor, int do_vert)
{
int i;
if(do_hor) {
}
if(do_vert) {
}
for(i = 0; i < 64; i++)
block[i] += 128;
}
| 1threat
|
Django Rest Framework, passing parameters with GET request, classed based views : <p>I would like a user to send a GET request to my Django REST API:</p>
<pre><code>127.0.0.1:8000/model/?radius=5&longitude=50&latitude=55.1214
</code></pre>
<p>with his longitude/latitude and radius, passed in parameters, and get the queryset using GeoDjango. </p>
<p>For example, currently I have:</p>
<pre><code>class ModelViewSet(viewsets.ModelViewSet):
queryset = Model.objects.all()
</code></pre>
<p>And what I ideally want is:</p>
<pre><code>class ModelViewSet(viewsets.ModelViewSet):
radius = request.data['radius']
location = Point(request.data['longitude'],request.data['latitude']
# filter results by distance using geodjango
queryset = Model.objects.filer(location__distance_lte=(location, D(m=distance))).distance(location).order_by('distance')
</code></pre>
<p>Now a couple of immediate errors:</p>
<p>1) <code>request</code> is not defined - should I use api_view, i.e. the function based view for this?</p>
<p>2) <a href="http://www.django-rest-framework.org/tutorial/2-requests-and-responses/" rel="noreferrer">DRF page</a> says that request.data is for POST, PUT and PATCH methods only. How can send parameters with GET?</p>
| 0debug
|
is this code correct for finding the sum of squares should be equal to a number given? : def sumofsquares(n):
for i in range(1, n):
for j in range(1, n):
if n == ((i*i)+(j*j)):
return (true)
break
else:
return (false)
| 0debug
|
Dynamic breadcrumbs using react router : <p>There is very good example of how to make a <a href="https://github.com/rackt/react-router/blob/master/examples/breadcrumbs/app.js" rel="noreferrer">breadcrumbs on site in examples folder of react-router repo</a>. But I'm wondering how to make breadcrumbs with dynamic routes.</p>
<p>Assume we have this configuration:</p>
<pre><code>ReactDOM.render((
<Router history={browserHistory}>
<Route path="/projects" component={ProjectsApp}>
<IndexRoute component={ProjectsDashboard} />
<Route path=":projectId" component={ProjectBoard}>
<Route path=":taskId" component={ProjectTaskBoard}>
</Route>
</Route>
</Router>
), document.getElementById('app'));
</code></pre>
<p>I want to make something like this:</p>
<p><em>Projects(link to '/projects') -> MyAwesomeProject (link to '/projects/11'. Title taken from somewhere (from store by id from routeParams or by another way)) -> MyTask (link to '/projects/11/999')</em></p>
<p>How can I achieve this result? Are there any best practices? Thanks.</p>
| 0debug
|
document.location = 'http://evil.com?username=' + user_input;
| 1threat
|
After update Mac OS Sierra, Can not use ssh login remote system,how can I fix this? : <p>when I use <code>user@ip</code> to login remote system, it report like this:</p>
<pre><code>debug1: /etc/ssh/ssh_config line 17: Applying options for *
/etc/ssh/ssh_config: line 20: Bad configuration option: gssapikeyexchange
/etc/ssh/ssh_config: line 21: Bad configuration option: gssapitrustdns
/etc/ssh/ssh_config: terminating, 2 bad configuration options
</code></pre>
| 0debug
|
php html class are corrupted : i'm trying to send an html code to database and then show the code in index.php
this is what i use to send the html code to DB:
$result = " <li>
<a href=$Link class=external item-link item-content>
<div class=item-media><img src=$f_image class=lazy lazy-fade-in style=border-radius: 10px; width=42px height=42px></div>
<div class=item-inner>
<div class=item-title>
$Name <span class=test-bull>•</span>
<div class=item-footer>$Info</div>
</div>
<div class=item-after></div>
</div>
</a>
</li>
";
$sql = "INSERT INTO table1 (test) VALUES ('$result')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully";
}else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
and this is what i use to show the code in index.php:
<?php
$sql = "SELECT test FROM table1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo $row ["test"];
}
} else {
echo "0 results";
}
?>
now as you can see there is more than one class in my html code:
<a href=$Link class=external item-link item-content>
the problem is when i get the html code from database and show it in index.php the class are corrupted like this:
<li>
<a href="test" class="external" item-link="" item-content="">
<div class="item-media"><img src="img/2ff4e.aa.png" class="lazy" lazy-fade-in="" style="border-radius:" 10px;="" width="42px" height="42px"></div>
<div class="item-inner">
<div class="item-title">
test <span class="test-bull">•</span>
<div class="item-footer">test</div>
</div>
<div class="item-after"></div>
</div>
</a>
</li>
what i did wrong? what i have to change/do?
sorry for my english
| 0debug
|
How to grep for case insensitive string in a file? : <p>I have a file <code>file1</code> which ends with
<code>Success...</code> OR
<code>success...</code></p>
<p>I want to <code>grep</code> for the word <code>success</code> in a way which is not case sensitive way.</p>
<p>I have written the following command but it is case sensitive</p>
<p><code>cat file1 | grep "success\.\.\."</code></p>
<p>How can i change it so that it <code>returns 0</code> with both <code>Success...</code> OR
<code>success...</code></p>
| 0debug
|
Store \ in java string variable(Special Character) : <h1>I want to store \ in a string variable #</h1>
<p>String var= "\" ;</p>
<pre><code>public class Main
{
public static void main(String[] args) {
String var="\"
System.out.println(var);
}
}
</code></pre>
| 0debug
|
Why does unique_ptr instantiation compile to larger binary than raw pointer? : <p>I was always under the impression that a <code>std::unique_ptr</code> had no overhead compared to using a raw pointer. However, compiling the following code</p>
<pre><code>#include <memory>
void raw_pointer() {
int* p = new int[100];
delete[] p;
}
void smart_pointer() {
auto p = std::make_unique<int[]>(100);
}
</code></pre>
<p>with <code>g++ -std=c++14 -O3</code> produces the following assembly:</p>
<pre><code>raw_pointer():
sub rsp, 8
mov edi, 400
call operator new[](unsigned long)
add rsp, 8
mov rdi, rax
jmp operator delete[](void*)
smart_pointer():
sub rsp, 8
mov edi, 400
call operator new[](unsigned long)
lea rdi, [rax+8]
mov rcx, rax
mov QWORD PTR [rax], 0
mov QWORD PTR [rax+392], 0
mov rdx, rax
xor eax, eax
and rdi, -8
sub rcx, rdi
add ecx, 400
shr ecx, 3
rep stosq
mov rdi, rdx
add rsp, 8
jmp operator delete[](void*)
</code></pre>
<p>Why is the output for <code>smart_pointer()</code> almost three times as large as <code>raw_pointer()</code>?</p>
| 0debug
|
How to compress video for upload server? : <p>I'm trying to upload video file to server. But size is too large so how i can compress video before upload to server.
Thank you for your help.</p>
| 0debug
|
static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx,
RowContext *row,
int n,
int index_bits,
int level_bias,
int level_shift,
int dc_shift)
{
int i, j, index1, index2, len, flags;
int level, component, sign;
const int *scale;
const uint8_t *weight_matrix;
const uint8_t *ac_info = ctx->cid_table->ac_info;
int16_t *block = row->blocks[n];
const int eob_index = ctx->cid_table->eob_index;
int ret = 0;
OPEN_READER(bs, &row->gb);
ctx->bdsp.clear_block(block);
if (!ctx->is_444) {
if (n & 2) {
component = 1 + (n & 1);
scale = row->chroma_scale;
weight_matrix = ctx->cid_table->chroma_weight;
} else {
component = 0;
scale = row->luma_scale;
weight_matrix = ctx->cid_table->luma_weight;
}
} else {
component = (n >> 1) % 3;
if (component) {
scale = row->chroma_scale;
weight_matrix = ctx->cid_table->chroma_weight;
} else {
scale = row->luma_scale;
weight_matrix = ctx->cid_table->luma_weight;
}
}
UPDATE_CACHE(bs, &row->gb);
GET_VLC(len, bs, &row->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1);
if (len) {
level = GET_CACHE(bs, &row->gb);
LAST_SKIP_BITS(bs, &row->gb, len);
sign = ~level >> 31;
level = (NEG_USR32(sign ^ level, len) ^ sign) - sign;
row->last_dc[component] += level << dc_shift;
}
block[0] = row->last_dc[component];
i = 0;
UPDATE_CACHE(bs, &row->gb);
GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table,
DNXHD_VLC_BITS, 2);
while (index1 != eob_index) {
level = ac_info[2*index1+0];
flags = ac_info[2*index1+1];
sign = SHOW_SBITS(bs, &row->gb, 1);
SKIP_BITS(bs, &row->gb, 1);
if (flags & 1) {
level += SHOW_UBITS(bs, &row->gb, index_bits) << 7;
SKIP_BITS(bs, &row->gb, index_bits);
}
if (flags & 2) {
UPDATE_CACHE(bs, &row->gb);
GET_VLC(index2, bs, &row->gb, ctx->run_vlc.table,
DNXHD_VLC_BITS, 2);
i += ctx->cid_table->run[index2];
}
if (++i > 63) {
av_log(ctx->avctx, AV_LOG_ERROR, "ac tex damaged %d, %d\n", n, i);
ret = -1;
break;
}
j = ctx->scantable.permutated[i];
level *= scale[i];
level += scale[i] >> 1;
if (level_bias < 32 || weight_matrix[i] != level_bias)
level += level_bias;
level >>= level_shift;
block[j] = (level ^ sign) - sign;
UPDATE_CACHE(bs, &row->gb);
GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table,
DNXHD_VLC_BITS, 2);
}
CLOSE_READER(bs, &row->gb);
return ret;
}
| 1threat
|
compile c++ program using g++ in windows command prompt : <p>Why do I always have to go the directory where I have my c++ program saved. Can't I give its path as some argument or something and compile the program from anywhere in command prompt? Is there any such functionality available?</p>
| 0debug
|
Program doesn't run. Says I am trying to assign value to a pointer. Please help to fix : I am trying to read file into an array, but the code doesn't run. Says I am trying to assign value to a pointer. Please help to fix
#include <stdio.h>
int main(){
FILE *ifile;
float num;
float*numbers[8001];
float pointer=numbers;
int i=0;
ifile = fopen("lotsOfNumbers.txt", "r");
if (ifile == NULL) {
printf("File not found!! Exiting.\n");
} else {
while (fscanf(ifile, "%f ", &num)!=EOF) {
//printf("I read %d from the file. \n", num);
numbers[i]=#
if (i<8801){
i++;
}
else
return 0;
}
}
fclose(ifile);
return 0;
}
| 0debug
|
Requirejs : Non amd library : <p>I have a script.js included in the website of my customer. This customer uses requirejs but he append script.js at the end of the body without explicitly using requirejs to load it.</p>
<p>In script.js i have libraries that are amd compatible and other not. The problem is that requirejs automatically load library which are amd. And i can't access them in my own library which is not amd compatible.</p>
<p>Do you have any idea ? </p>
<p>Thanks</p>
| 0debug
|
Get time difference between two times in swift 3 : <p>I have 2 variables where I get 2 times from datePicker and I need to save on a variable the difference between them.</p>
<pre><code> let timeFormatter = DateFormatter()
timeFormatter.dateFormat = "HHmm"
time2 = timeFormatter.date(from: timeFormatter.string(from: datePicker.date))!
</code></pre>
<p>I have tried to get the timeIntervalSince1970 from both of them and them substract them and get the difference on milliseconds which I will turn back to hours and minutes, but I get a very big number which doesn't corresponds to the actual time.</p>
<pre><code>let dateTest = time2.timeIntervalSince1970 - time1.timeIntervalSince1970
</code></pre>
<p>Then I have tried using time2.timeIntervalSince(date: time1), but again the result milliseconds are much much more than the actual time.</p>
<p>How I can get the correct time difference between 2 times and have the result as hours and minutes in format "0823" for 8 hours and 23 minutes?</p>
| 0debug
|
woocommerce product page - custom link which opens lightbox image : <p>I really would like to have a custom link on the product page which opens a lightbox image. These images should be set somewhere on the product edit page.
I guess it is a bit of coding but should not be that difficult.
Example:
<a href="https://www.armedangels.de/frauenbekleidung-kleider-web-allover-avril-full-palm-10252599-220.html" rel="nofollow noreferrer">https://www.armedangels.de/frauenbekleidung-kleider-web-allover-avril-full-palm-10252599-220.html</a>
Right under the Titel it says - "Was steckt drin" - I want something similar to this.
It would be great if someone could help me out with this problem.
Any held appreciated !!!
Thanks a lot and greetings from munich / Germany ...
Marc</p>
| 0debug
|
C Read file content into string just with stdio libary : <p>Im struggleing by trying to read the files content into a string (char*).
I just have to use the stdio.h libary, so I cant allocate memory with malloc.</p>
<p>How can I read all the content of a file and return it into a string?</p>
| 0debug
|
void scsi_req_data(SCSIRequest *req, int len)
{
trace_scsi_req_data(req->dev->id, req->lun, req->tag, len);
req->bus->ops->complete(req->bus, SCSI_REASON_DATA, req->tag, len);
}
| 1threat
|
Angular2 run Guard after another guard resolved : <p>In my project I have two guards. AuthGuard and PermissionGuard. I need to first AuthGuard runs and when it resolved and if true the permissionGuard begins but now this guards are running parallel and permissionGuard not working well. the way I used for this issue is that I called the AuthGuard CanActivate method in Permission guard but I think there is a quite better way for doing this. </p>
| 0debug
|
static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta,
MemoryRegion *sysmem,
hwaddr channel_base, qemu_irq irq, omap_clk clk,
CharDriverState *chr)
{
struct omap_sti_s *s = (struct omap_sti_s *)
g_malloc0(sizeof(struct omap_sti_s));
s->irq = irq;
omap_sti_reset(s);
s->chr = chr ?: qemu_chr_new("null", "null", NULL);
memory_region_init_io(&s->iomem, NULL, &omap_sti_ops, s, "omap.sti",
omap_l4_region_size(ta, 0));
omap_l4_attach(ta, 0, &s->iomem);
memory_region_init_io(&s->iomem_fifo, NULL, &omap_sti_fifo_ops, s,
"omap.sti.fifo", 0x10000);
memory_region_add_subregion(sysmem, channel_base, &s->iomem_fifo);
return s;
}
| 1threat
|
ITSAppUsesNonExemptEncryption export compliance while internal testing? : <p>I got this message while selecting build for internal testing.it says about setting <strong>ITSAppUsesNonExemptEncryption</strong> in info.plist what does it mean? is it necessary?</p>
<p><a href="https://i.stack.imgur.com/M0QBP.png"><img src="https://i.stack.imgur.com/M0QBP.png" alt="enter image description here"></a></p>
| 0debug
|
Loading and editing a CSV file in Java into a List<Class> : i'm working on a private project where i need to load a CSV file, keep it in the program and edit if needed.
The file looks like this:
ID;Name;Last Login;RevState;List
157;Guy;"01.11.19";false;"tag, cup, sting"
A60;Dud;"07.10.19";true;"ice, wood, cup, tag"
1D5;Wilfred;"11.11.19";true;"beer, food, cup, shower"
I will only ever have a single csv file loaded. I need to be able to edit every single data point. I need to be able to retrieve all the information of one "cathegory", e.g. get all names.
So what i plan to do is load the CSV via
Scanner scanner = new Scanner(new File(file.csv))
Create a class that holds the information of a line
public class User
private String id;
private String name;
private String lastLogin;
private String list;
public getter and setter methods
Create a list
private List<User> csvList = new List<User>();
And then store every line as
while (file.hasLine())
[...] parse the line
User user = new User(id, name, lastLogin, list);
csvList.add(user);
Would this work, or is there a better method that i can't think of right now? I appreciate your input!
| 0debug
|
def cube_nums(nums):
cube_nums = list(map(lambda x: x ** 3, nums))
return cube_nums
| 0debug
|
Is Python `list.extend(iterator)` guaranteed to be lazy? : <h1>Summary</h1>
<p>Suppose I have an <code>iterator</code> that, as elements are consumed from it, performs some side effect, such as modifying a list. If I define a list <code>l</code> and call <code>l.extend(iterator)</code>, is it guaranteed that <code>extend</code> will push elements onto <code>l</code> one-by-one, <em>as elements from the iterator are consumed</em>, as opposed to kept in a buffer and then pushed on all at once?</p>
<h1>My experiments</h1>
<p>I did a quick test in Python 3.7 on my computer, and <code>list.extend</code> seems to be lazy based on that test. (See code below.) Is this guaranteed by the spec, and if so, where in the spec is that mentioned?</p>
<p>(Also, feel free to criticize me and say "this is not Pythonic, you fool!"--though I would appreciate it if you also answer the question if you want to criticize me. Part of why I'm asking is for my own curiosity.)</p>
<p>Say I define an iterator that pushes onto a list as it runs:</p>
<pre class="lang-py prettyprint-override"><code>l = []
def iterator(k):
for i in range(5):
print([j in k for j in range(5)])
yield i
l.extend(iterator(l))
</code></pre>
<p>Here are examples of non-lazy (i.e. buffered) vs. lazy possible <code>extend</code> implementations:</p>
<pre class="lang-py prettyprint-override"><code>def extend_nonlazy(l, iterator):
l += list(iterator)
def extend_lazy(l, iterator):
for i in iterator:
l.append(i)
</code></pre>
<h1>Results</h1>
<p>Here's what happens when I run both <em>known</em> implementations of <code>extend</code>.</p>
<hr>
<p>Non-lazy:</p>
<pre class="lang-py prettyprint-override"><code>l = []
extend_nonlazy(l, iterator(l))
</code></pre>
<pre><code># output
[False, False, False, False, False]
[False, False, False, False, False]
[False, False, False, False, False]
[False, False, False, False, False]
[False, False, False, False, False]
# l = [0, 1, 2, 3, 4]
</code></pre>
<hr>
<p>Lazy:</p>
<pre class="lang-py prettyprint-override"><code>l = []
extend_lazy(l, iterator(l))
</code></pre>
<pre><code>[False, False, False, False, False]
[True, False, False, False, False]
[True, True, False, False, False]
[True, True, True, False, False]
[True, True, True, True, False]
</code></pre>
<hr>
<p>My own experimentation shows that native <code>list.extend</code> seems to work like the lazy version, but my question is: does the Python spec guarantee that?</p>
| 0debug
|
how do i get rid of the error in my python 3.0 program? : <p>I don't understand what is wrong with my syntax. its a program to get a long number.
code:</p>
<pre><code>int_num=input('enter digits')
long_num=''
While int_num.isdigit()== True:
long_num= long_num+int_num
int_num=input('enter digits')
print('long',long_num)
</code></pre>
<p>error:</p>
<pre><code>File "<ipython-input-1-c68f222d7f2f>", line 4
While int_num.isdigit()== True:
^
SyntaxError: invalid syntax
</code></pre>
<p>thanks.</p>
| 0debug
|
find content between two tag python : hi guys I want to extract only the number
"4" in this html code by python beautiful soup what should I do?
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<ul class="left slider_pinfo">
<li>
<i class="ihome-bed"></i>
" 4"
<div class="meta-tooltip">bed</div>
<span class="right listing-sp"></span>
</li>
<li>
<i class="ihome-arrows"></i>
"300meter"
<div class="meta-tooltip">meter</div>
</li>
<li>
<i class="ihome-building-age"></i>
"6years"
<div class="meta-tooltip">age</div>
</li>
</ul>
<!-- end snippet -->
| 0debug
|
Why is my SQL statement not returning results? : <p>The desired statement is: </p>
<pre><code>SELECT `id` FROM `user` WHERE `email`='[email protected]'
</code></pre>
<p>...which returns a single cell as results. </p>
<p>My PDO prepared statement doesn't return anything. What am I missing? </p>
<pre><code>$email = "[email protected]";
$statement = $db->prepare("SELECT `id` FROM `user` WHERE `email`=':email;'");
$statement->execute(['email' => $email]);
$user = $statement->fetch();
echo $user;
</code></pre>
| 0debug
|
Gradle Dependecies Command cant find other maven repos : <p>I want to check my projects dependencies but having problem when running </p>
<blockquote>
<p>./gradlew app:dependencies</p>
</blockquote>
<p>Here is the result of terminal.</p>
<p><a href="https://i.stack.imgur.com/T84pV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T84pV.png" alt="Terminal Result"></a></p>
<p>Thanks for helps.</p>
| 0debug
|
how to change offroute distance and timeout ? here maps android sdk : Is there any configuration to change offroute distance threshold and timeout
especially on turning offroutes here maps got a late reroute start.
| 0debug
|
Need help creating ibm watson conversation : <p>If user enters i want large pizza with topings in ibm watson conversation how does pizza guy know that. Need help iam new to ibm watson</p>
| 0debug
|
Got a error during initializing array's element globally outside main function : <p>When I compiled following code:</p>
<pre><code>#include<bits/stdc++.h>
using namespace std;
long int arr[100003],flag=0;
arr[0]=-1;
int main()
{
}
</code></pre>
<p>I got this error: 'arr' does not name a type arr[0]=-1
Please help me with this.</p>
| 0debug
|
New to testing, how would I test this method with Mocha, Chai, Enzyme, and Sinon? : <p>Here's my method</p>
<pre><code> handleKeyEvent(event) {
const code = event.keyCode;
if (UsedKeys.includes(code)) {
event.preventDefault();
if (code === KeyCodes.DOWN) {
this.modifyIndexBy(1);
} else if (code === KeyCodes.UP) {
this.modifyIndexBy(-1);
}
}
}
</code></pre>
<p>I'm still pretty new to testing, and I have no idea how I'd go about testing this piece.
The method takes an event, so do I have to synthesize an event object and pass it in? </p>
<p>After that, do I just somehow test that <code>this.modifyIndexBy()</code> gets called? </p>
<p>This method doesn't return anything. Do I modify my code to be more testable?</p>
| 0debug
|
IQKeyboarmanager all part scroll stop only scroll tableview contant : In My Chatting App textFieldDidBeginEditing time Keyboard height auto add using IQKeyboardmanager but that time scroll top all screen . i have reuirement only scroll tableview contact. my navigation header is fix but using this third party scroll all part in top so how can only scroll tableview
| 0debug
|
static void gen_ldstub_asi(DisasContext *dc, TCGv dst, TCGv addr, int insn)
{
TCGv_i32 r_asi, r_size, r_sign;
TCGv_i64 s64, d64 = tcg_temp_new_i64();
r_asi = gen_get_asi(dc, insn);
r_size = tcg_const_i32(1);
r_sign = tcg_const_i32(0);
gen_helper_ld_asi(d64, cpu_env, addr, r_asi, r_size, r_sign);
tcg_temp_free_i32(r_sign);
s64 = tcg_const_i64(0xff);
gen_helper_st_asi(cpu_env, addr, s64, r_asi, r_size);
tcg_temp_free_i64(s64);
tcg_temp_free_i32(r_size);
tcg_temp_free_i32(r_asi);
tcg_gen_trunc_i64_tl(dst, d64);
tcg_temp_free_i64(d64);
}
| 1threat
|
static void string_output_append_range(StringOutputVisitor *sov,
int64_t s, int64_t e)
{
Range *r = g_malloc0(sizeof(*r));
r->begin = s;
r->end = e + 1;
sov->ranges = range_list_insert(sov->ranges, r);
}
| 1threat
|
int rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, char *value, int value_size)
{
skip_spaces(p);
if(**p) {
get_word_sep(attr, attr_size, "=", p);
if (**p == '=')
(*p)++;
get_word_sep(value, value_size, ";", p);
if (**p == ';')
(*p)++;
return 1;
}
return 0;
}
| 1threat
|
query = 'SELECT * FROM customers WHERE email = ' + email_input
| 1threat
|
How to reset git authentication? : <p>I typed wrong ID (my mistake) and I think my computer's IP is permanently banned. I'd like to un-ban my IP so that I can git clone to my desired git repository. when I tried to git clone my git repository, it says
<code>remote: HTTP Basic: Access denied</code>
<code>fatal: Authentication failed for "~~my repository"</code></p>
<p>How can I re-access my git repository? Or how can I reset my banned-state? I think typing wrong ID only once and be permanently banned is somewhat harsh.</p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.