problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static void run_dependent_requests(QCowL2Meta *m)
{
QCowAIOCB *req;
QCowAIOCB *next;
if (m->nb_clusters != 0) {
LIST_REMOVE(m, next_in_flight);
}
for (req = m->dependent_requests.lh_first; req != NULL; req = next) {
next = req->next_depend.le_next;
qcow_aio_write_cb(req, 0);
}
LIST_INIT(&m->dependent_requests);
}
| 1threat |
How To stay Logged In, MySQL+Python 3+ tkinter : <p>I Made a Login+Register Page using the Tkinter, python3, and MySQL. Now I want to do the rest of my application but want to avoid trying to log in every time. I couldn't find the code to stay logged in. Does anyone know? </p>
| 0debug |
Method Math.random - how it work? : <p>Some teacher today teach us how work Math.random in Java language. I don't understand what he told. Can some explain? I have some code:</p>
<pre><code>import java.util.Random;
public class test {
public static void main(String[] args) {
Random random = new Random();
double r = Math.random() * 4.4 + 1.2;
System.out.println(r);
}
}
</code></pre>
<p>Next he ask us what is interval of this random. We don't know and he write:</p>
<pre><code><1.2, 5.6> --> <0, 4.4> + 1.2 --> double r = Math.random() * 4.4 + 1.2;
</code></pre>
<p>How can I calculate this, what is mathematical formula? <code><1.2, 5.6> --> <0, 4.4> + 1.2</code> </p>
| 0debug |
Loop to generate string and variables : <p>I have a set of confusionMatrixes of 100 models like wynik1, ... wynik100.</p>
<p>I want to have a vector of accuracies of all of these models.</p>
<p>I have written a loop, but it does not work.</p>
<p>Where is the problem?</p>
<p>The task is to generate strings and variables from the strings:</p>
<pre><code>confusionMatrix(m2pred,cats$Sex)-> wynik1
...
accuracy <- NULL
b_accuracy <- NULL
for (i in 1:100){
name <- paste0("wynik",i)
ac<- name$overall[1]
bac<- name$byClass[11]
accuracy <- c(accuracy, ac)
b_accuracy <- c(b_accuracy, bac)
}
accuracy
</code></pre>
<p>The output is:</p>
<blockquote>
<pre><code>Error in nazwa$overall : $ operator is invalid for atomic vectors
> accuracy
NULL
</code></pre>
</blockquote>
| 0debug |
static bool pte32_match(target_ulong pte0, target_ulong pte1,
bool secondary, target_ulong ptem)
{
return (pte0 & HPTE32_V_VALID)
&& (secondary == !!(pte0 & HPTE32_V_SECONDARY))
&& HPTE32_V_COMPARE(pte0, ptem);
}
| 1threat |
Change img on hovering other element : <p>I want to change an image src when hovering an link.</p>
<p>On this page: <a href="https://www.desaunois.nl/menu-opbouw/" rel="nofollow noreferrer">https://www.desaunois.nl/menu-opbouw/</a> the main menu has different items. </p>
<p>When you hover "Over ons" a submenu appears with a picture next to it.
The picture is related to the item "Geschiedenis". When I hover for example the subitem "FAQ" I want the picture on the left to be changed when hovering it. How can I achieve this with some jQuery?</p>
| 0debug |
How to stop the java application from command prompt gracefully : <p>I am developing a java standalone application where it has to upload batch of files to rest api. I want to stop the application whenever I needed from the command prompt but if the application is in the process of uploading a file it has to complete that and has to stop before starting to upload another file.</p>
| 0debug |
How to break ForEach Loop in TypeScript : <p>I have a the below code, on which i am unable to break the loop on certain conditions.</p>
<pre><code> isVoteTally(): boolean {
let count = false;
this.tab.committee.ratings.forEach(element => {
const _fo = this.isEmptyOrNull(element.ratings.finalOutcome.finaloutlook);
const _foreign = this.isEmptyOrNull(element.ratings.finalOutcome.foreign);
const _local = this.isEmptyOrNull(element.ratings.finalOutcome.local);
const _tally = element.ratings.finalOutcome.voteTally.maj + element.ratings.finalOutcome.voteTally.dis;
if (_fo == false && _foreign == false && _local == false) {
if (_tally > 0) {
**return count = false;**
}
} else {
if (_tally < 0) {
**return count = false;**
}
}
});
return count;
</code></pre>
<p>}</p>
<p>On the star-marked area, i want to <em>break</em> the code and return the boolean value, but i am unable to do it right now. Can anybody help me.</p>
<p>Thanks in advance.</p>
| 0debug |
How to merge data of one model into another? : <p>I am having two models. One is Model A and another is Model B. Both models have getter-setter. But only model A holds value and Model B is totally empty. I want to use Model A and set all those values in model B. How to do that?? </p>
<p>In Model A:</p>
<pre><code>public void setVideoUrl(String videoUrl){this.videoUrl = videoUrl;}
public String getVideoUrl(){return videoUrl;}
</code></pre>
<p>In Model B:</p>
<pre><code>public String getVideoUrl() {
return videoUrl;
}
public void setVideoUrl(String videoUrl) {
this.videoUrl = videoUrl;
}
</code></pre>
<p>In Model A "videoUrl" is already set. I want to set that same "videoUrl" in model B. How to do it?? </p>
| 0debug |
static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov,
MOVTrack *track, AVStream *st)
{
int64_t duration = av_rescale_rnd(track->track_duration, MOV_TIMESCALE,
track->timescale, AV_ROUND_UP);
int version = duration < INT32_MAX ? 0 : 1;
int flags = MOV_TKHD_FLAG_IN_MOVIE;
int rotation = 0;
int group = 0;
uint32_t *display_matrix = NULL;
int display_matrix_size, i;
if (st) {
if (mov->per_stream_grouping)
group = st->index;
else
group = st->codec->codec_type;
display_matrix = (uint32_t*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX,
&display_matrix_size);
if (display_matrix && display_matrix_size < 9 * sizeof(*display_matrix))
display_matrix = NULL;
}
if (track->flags & MOV_TRACK_ENABLED)
flags |= MOV_TKHD_FLAG_ENABLED;
if (track->mode == MODE_ISM)
version = 1;
(version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92);
ffio_wfourcc(pb, "tkhd");
avio_w8(pb, version);
avio_wb24(pb, flags);
if (version == 1) {
avio_wb64(pb, track->time);
avio_wb64(pb, track->time);
} else {
avio_wb32(pb, track->time);
avio_wb32(pb, track->time);
}
avio_wb32(pb, track->track_id);
avio_wb32(pb, 0);
if (!track->entry && mov->mode == MODE_ISM)
(version == 1) ? avio_wb64(pb, UINT64_C(0xffffffffffffffff)) : avio_wb32(pb, 0xffffffff);
else if (!track->entry)
(version == 1) ? avio_wb64(pb, 0) : avio_wb32(pb, 0);
else
(version == 1) ? avio_wb64(pb, duration) : avio_wb32(pb, duration);
avio_wb32(pb, 0);
avio_wb32(pb, 0);
avio_wb16(pb, 0);
avio_wb16(pb, group);
if (track->enc->codec_type == AVMEDIA_TYPE_AUDIO)
avio_wb16(pb, 0x0100);
else
avio_wb16(pb, 0);
avio_wb16(pb, 0);
if (st && st->metadata) {
AVDictionaryEntry *rot = av_dict_get(st->metadata, "rotate", NULL, 0);
rotation = (rot && rot->value) ? atoi(rot->value) : 0;
}
if (display_matrix) {
for (i = 0; i < 9; i++)
avio_wb32(pb, display_matrix[i]);
} else if (rotation == 90) {
write_matrix(pb, 0, 1, -1, 0, track->enc->height, 0);
} else if (rotation == 180) {
write_matrix(pb, -1, 0, 0, -1, track->enc->width, track->enc->height);
} else if (rotation == 270) {
write_matrix(pb, 0, -1, 1, 0, 0, track->enc->width);
} else {
write_matrix(pb, 1, 0, 0, 1, 0, 0);
}
if (st && (track->enc->codec_type == AVMEDIA_TYPE_VIDEO ||
track->enc->codec_type == AVMEDIA_TYPE_SUBTITLE)) {
if (track->mode == MODE_MOV) {
avio_wb32(pb, track->enc->width << 16);
avio_wb32(pb, track->height << 16);
} else {
int64_t track_width_1616 = av_rescale(st->sample_aspect_ratio.num,
track->enc->width * 0x10000LL,
st->sample_aspect_ratio.den);
if (!track_width_1616 || track->height != track->enc->height)
track_width_1616 = track->enc->width * 0x10000;
avio_wb32(pb, track_width_1616);
avio_wb32(pb, track->height * 0x10000);
}
} else {
avio_wb32(pb, 0);
avio_wb32(pb, 0);
}
return 0x5c;
}
| 1threat |
Syntax error, when I try initialize a key with hyphen (-) : <p>When the following object is initialized, it throws an error.</p>
<pre><code>var postData ={
file_path : "https://s3-us-west-2.amazonaws.com/ps/eams/6-48K.mxf",
template_type : "1",
template_name : "Basic Tests",
job_type : "0",
user_note : "my job",
access-key-ID : "AKAEBQ",
access-key-SECRET : "ZZHfO"
};
</code></pre>
<p>The error is </p>
<pre><code> access-key-ID : "AKAEBQ",
^
SyntaxError: Unexpected token -
</code></pre>
<p>How could I handle this?</p>
| 0debug |
What is the difference between id and tagname? : <p>An Interviewer asked this question in selenium webdriver
Please let me know the answer of this question</p>
<p>Thanks
Srinu Marri</p>
| 0debug |
static int kvmclock_post_load(void *opaque, int version_id)
{
KVMClockState *s = opaque;
struct kvm_clock_data data;
data.clock = s->clock;
data.flags = 0;
return kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &data);
}
| 1threat |
Incorparation of AWK in perl : Hai i have a BLAST out file in tab limited format.like this
p=BAC58264.1 CP014046.1 100.00 435 0 0 1 435 804117 8045 862
p=BAC58264.1 CP014046.1 100.00 160 0 0 3 372 444601 4443 32
p=BAC58264.1 BA000031.2 100.00 435 0 0 1 435 805024 371 862
i want to sort that like this based on the 3th column
p=BAC58264.1 CP014046.1 100.00 435 0 0 1 435 804117 8045 862
p=BAC58264.1 BA000031.2 100.00 435 0 0 1 435 805024 371 862
i usually did this by this awk code "$4>=435">BLASTSORT
how to incorporate this awk code in a perl programme
| 0debug |
Make Youtube 360 degree Videos work on mobile : <p>I recently embedded the youtube 360 degree videos in my side. But I found that the 360 videos don't work on mobile browsers in devices like Android or iOS. Is there anyway to make work the 360 videos on mobile or Is it possible that when someone clicks on video link, then youtube app installed in mobile opens up ? Because I found that 360 videos works really well in native youtube app.</p>
<p>Thanks</p>
| 0debug |
int socket_listen(SocketAddress *addr, Error **errp)
{
QemuOpts *opts;
int fd;
opts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
switch (addr->kind) {
case SOCKET_ADDRESS_KIND_INET:
inet_addr_to_opts(opts, addr->inet);
fd = inet_listen_opts(opts, 0, errp);
break;
case SOCKET_ADDRESS_KIND_UNIX:
qemu_opt_set(opts, "path", addr->q_unix->path, &error_abort);
fd = unix_listen_opts(opts, errp);
break;
case SOCKET_ADDRESS_KIND_FD:
fd = monitor_get_fd(cur_mon, addr->fd->str, errp);
break;
default:
abort();
}
qemu_opts_del(opts);
return fd;
}
| 1threat |
alert('Hello ' + user_input); | 1threat |
File encryption in Git Repository : <p>Is there any way (in built or add-on) to encrypt individual files in a repository, accessible by limited people. Files when checked in by those folks will auto encrypt and decrypt when checked out. They will stay encrypted if tried to be accessed by other people. </p>
| 0debug |
Actualy , what Git did, when ran git checkout branch_name : I have one repository which named as '**test-repo**'
now I have 2branches on above repository named as :
1. master
2. master-bkp
both branches contains only one file named as **test.txt**
and **test.txt->master** contains
hello I am here
and **test.txt->master-bkp** contains
hello I am there
now on local I write below command
git checkout master
git merge master-bkp
now **test.txt->master** contains
hello I am here
hello I am there
now someone can explain how internally git works when i trigger below command :
git checkout master
git checkout master-bkp
**Note :** Please don't start to giving opinion on 'git checkout' , I need explanation about internal logic behind it. | 0debug |
how do i read data fom a file from each line and i store it into a structure array : #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include "struct.h"
struct student{
char command[10];
char value[50];
char user[50];
};
int main(){
int size,i;
struct student s1[256];
FILE *file = fopen("file.txt","r");
if (file == NULL){
printf("Error in reading student data");
return 1;
}
size = 0;
while(fscanf(file,"%s,%s,%s",s1[size].command,s1[size].value,s1[size].user)!=EOF) {
printf("%s%s%s\n",s1[size].command,s1[size].value,s1[size].user);
printf("%s\n",s1[size].command);
size++;
}
fclose(file);
return 0;
}
Above is my, i have been working on this part for some structure am create a c socket server that can process data for clients.
but i got a problem in file handling. I wanted to pick data from a file and store it into a structure at specific portions and then i erase the file according to data i have picked.
i.e
a,w,a
r,e,1
I wanted to pick data from my file which contains the above information and i store it in specific portions of my structure array
ie if store a in
s1[0].command, w in s1[0].value......
r in s1[1].command, e in s1[1].value......etc
But when i try running my code it prints
a,w,a in s1[0].command and r,e,1 in s1[1].command.
so am kindly requesting for help because i have tried googling but i couldn't get a solution. | 0debug |
What is the difference between Publish methods provided in the Visual Studio? : <p>When I click on the Publish option following options come:
<a href="https://i.stack.imgur.com/93V8R.png" rel="noreferrer"><img src="https://i.stack.imgur.com/93V8R.png" alt="Publish Methods"></a></p>
<p>What is the significance of each method?</p>
| 0debug |
Truncate string containing HTML tags : It's given a sample string.
s = "<p class="paragraph">Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water <a href="https://www.google.pl/search?q=spinach" class="link">spinach</a> avocado daikon Süßkartoffel napa cabbage <strong>asparagus winter purslane kale. Celery potato scallion desert</strong> raisin horseradish spinach carrot soko. Lotus root water spinach fennel kombu maize <span style="font-size: 19px;color: blue;">bamboo shoot green bean swiss chard seakale pumpkin onion chickpea gram corn pea.</span> Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi beetroot carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p>"
The string is UTF-8 encoded.
I need to develop a function to truncate the string and add ellipsis to its end. The truncated string shall not to exceed n characters including ellipsis under the following conditions:
do not break a word apart;
do not break a html element apart;
all open tags must be closed in an appropriate order.
| 0debug |
Could someone help me with create an application into kivy? : I just found out recently about kivy. Python i'm also studing recently. I would like application, made into kivy, which has 2 windows for input text and returning a label with result after clicking a button. This code must be in him:
`def word_detect(a,b):
y = []
e = []
s = []
for i in range(len(b)):
z = []
for k in a:
ml = 0
index = -1
for j in k:
index += 1
if j == (b[i])[index]:
ml += 1
if ml == int((b[i])[-1]):
z.append(k)
y.append(z)
e.extend(z)
for i in e:
if (y[0]).count(i)==(y[1]).count(i)==(y[2]).count(i)==1 and s.count(i)==0:
s.append(i)
return s
print word_detect(raw_input('list: '). upper(). split(','),raw_input('words: '). upper(). split(','))
'''
e.g:
list : total,relax,mixer,remix,scope,candy,water
words: helix 3, botex 1, below 2
result: ['relax']
RELAX
hELiX - 3 matched letters
boteX - 1 matched letter
bELow - 2 matched letters
'''` | 0debug |
Registering BOOT_COMPLETED receiver in Android 8 : <p>We are about to update our App Android API 26. In the documentation about <a href="https://developer.android.com/about/versions/oreo/background.html#broadcasts" rel="noreferrer">Broadcast receiver</a> it says that </p>
<blockquote>
<p>Apps that target Android 8.0 or higher can no longer register broadcast receivers for implicit broadcasts in their manifest</p>
</blockquote>
<p>Implicit broadcast receivers are described as </p>
<blockquote>
<p>a broadcast that does not target that app specifically. For example, ACTION_PACKAGE_REPLACED</p>
</blockquote>
<p>So I assume that <code>android.intent.action.BOOT_COMPLETED</code> is considered an implicit receiver.</p>
<p>Further it states that implicit receivers must be registered within an <code>Activity</code> by using <code>Context.registerReceiver()</code>. But that wouldn't make sense for a receiver, which is listening for the <code>BOOT_COMPLETED</code> event.</p>
<p>What is the proper way to handle this? Can i keep this receiver in my manifest?</p>
| 0debug |
Which namespaces of C# can I use for writing xamarin packages compatible with all OSs? : I want to create some nuget package that contains API compatible with all the OSs (UWP, iOS, Android), in order to use it across all the device that can run Xamarin apps.
I heard that the
> System.*
namespaces are the ones compatible with them all… is there any other namespace that is universal?
I think that the
> Windows.*
namespace is the one compatible only with UWP, right?
Would like to have a detailed explanation of this topic.
Thank you | 0debug |
Adding to an ArrayList / Searching to see if element exists and then also adding to it : <p>Using ArrayList - I would like to accomplish the following using the adds and contains methods...</p>
<p>Essentially I want to add objects that have shipping prices attached to them ie.</p>
<pre><code>B("Baseball Bat", 0.8),
G ("Glove", 0.9),
H ("Helmut", 1.0),
</code></pre>
<p>If I add $100 worth of Baseball Bats and none are in the list it adds, if baseball bats are already in the list it just adds to the already existent amount...</p>
<p>Any and all insight would be much appreciated!</p>
| 0debug |
static void gic_init(gic_state *s, int num_cpu, int num_irq)
#else
static void gic_init(gic_state *s, int num_irq)
#endif
{
int i;
#if NCPU > 1
s->num_cpu = num_cpu;
if (s->num_cpu > NCPU) {
hw_error("requested %u CPUs exceeds GIC maximum %d\n",
num_cpu, NCPU);
}
#endif
s->num_irq = num_irq + GIC_BASE_IRQ;
if (s->num_irq > GIC_MAXIRQ) {
hw_error("requested %u interrupt lines exceeds GIC maximum %d\n",
num_irq, GIC_MAXIRQ);
}
if (s->num_irq < 32 || (s->num_irq % 32)) {
hw_error("%d interrupt lines unsupported: not divisible by 32\n",
num_irq);
}
qdev_init_gpio_in(&s->busdev.qdev, gic_set_irq, s->num_irq - GIC_INTERNAL);
for (i = 0; i < NUM_CPU(s); i++) {
sysbus_init_irq(&s->busdev, &s->parent_irq[i]);
}
memory_region_init_io(&s->iomem, &gic_dist_ops, s, "gic_dist", 0x1000);
#ifndef NVIC
memory_region_init_io(&s->cpuiomem[0], &gic_thiscpu_ops, s,
"gic_cpu", 0x100);
for (i = 0; i < NUM_CPU(s); i++) {
s->backref[i] = s;
memory_region_init_io(&s->cpuiomem[i+1], &gic_cpu_ops, &s->backref[i],
"gic_cpu", 0x100);
}
#endif
gic_reset(s);
register_savevm(NULL, "arm_gic", -1, 2, gic_save, gic_load, s);
}
| 1threat |
Pandas dataframe to pivot_table : I have a df dataframe with 4 columns 'year', 'cath1', 'cath2' and 'cath3'
and 2000 entries corresponding to products, with corresponding year of production, and a value in each 3 cathegories.
i would like to create another dataframe with the same 3 cathegory columns and compute the average value of all products for each specific year in each of these cathegories.
i tried with the folling code but it does not work.
Thank you for your help
df1=pd.pivot_table(df,index=['year'],values=['0','1','2'],aggfunc=np.mean)
Exception has occurred: KeyError
'0'
| 0debug |
static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
{
int n;
AVStream *st;
OutputStream *ost;
AVCodecContext *audio_enc;
ost = new_output_stream(o, oc, AVMEDIA_TYPE_AUDIO, source_index);
st = ost->st;
audio_enc = st->codec;
audio_enc->codec_type = AVMEDIA_TYPE_AUDIO;
if (!ost->stream_copy) {
char *sample_fmt = NULL;
MATCH_PER_STREAM_OPT(audio_channels, i, audio_enc->channels, oc, st);
MATCH_PER_STREAM_OPT(sample_fmts, str, sample_fmt, oc, st);
if (sample_fmt &&
(audio_enc->sample_fmt = av_get_sample_fmt(sample_fmt)) == AV_SAMPLE_FMT_NONE) {
av_log(NULL, AV_LOG_FATAL, "Invalid sample format '%s'\n", sample_fmt);
exit_program(1);
}
MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st);
ost->rematrix_volume=1.0;
MATCH_PER_STREAM_OPT(rematrix_volume, f, ost->rematrix_volume, oc, st);
}
for (n = 0; n < o->nb_audio_channel_maps; n++) {
AudioChannelMap *map = &o->audio_channel_maps[n];
InputStream *ist = input_streams[ost->source_index];
if ((map->channel_idx == -1 || (ist->file_index == map->file_idx && ist->st->index == map->stream_idx)) &&
(map->ofile_idx == -1 || ost->file_index == map->ofile_idx) &&
(map->ostream_idx == -1 || ost->st->index == map->ostream_idx)) {
if (ost->audio_channels_mapped < FF_ARRAY_ELEMS(ost->audio_channels_map))
ost->audio_channels_map[ost->audio_channels_mapped++] = map->channel_idx;
else
av_log(NULL, AV_LOG_FATAL, "Max channel mapping for output %d.%d reached\n",
ost->file_index, ost->st->index);
}
}
return ost;
}
| 1threat |
Selecting all numerical values in data-frame and converting it to int in panda : <p>I have data like:</p>
<p><a href="https://i.stack.imgur.com/6CKlF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6CKlF.jpg" alt="enter image description here"></a></p>
<p>I want to make all numerical values to int, no decimal will be here.
like this:</p>
<p><a href="https://i.stack.imgur.com/lV99z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lV99z.jpg" alt="enter image description here"></a></p>
<p>I was using code like list:</p>
<pre><code> df=pd.read_csv("file.csv")
df = df.astype('int64')
</code></pre>
<p>But it was not working. Because it was saying:</p>
<pre><code> ValueError: Cannot convert NA to integer
</code></pre>
<p>Because, I have some nan value inside. There are string also in the column one row 2&3.
I think the solution could be, selecting all numerical values from the data frame and converting to int. Can you suggest anything?</p>
| 0debug |
Not able to checkboxes for ListViewItems in WPF : I want to display checkboxes alongside text in ListView .And I have multiple ListViews in my WPF window, hence I want to specify this behavior as style in resources.But,the checkboxes are nnot displayed, only text is displayed.So,please, find below my code and suggests edits.
<Window.Resources>
<Style TargetType="ListView" x:Key="ListViewTemplate">
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="BorderBrush" Value="Transparent"></Setter>
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}" Content=""></CheckBox>
<Separator Width="5"></Separator>
<TextBlock Text="{Binding Text}"></TextBlock>
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<ListView Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="8" Grid.RowSpan="5" x:Name="listViewDocTypes" Style="{DynamicResource ListViewTemplate}" >
</ListView>
</Grid> | 0debug |
static inline void kqemu_save_seg(SegmentCache *sc,
const struct kqemu_segment_cache *ksc)
{
sc->selector = ksc->selector;
sc->flags = ksc->flags;
sc->limit = ksc->limit;
sc->base = ksc->base;
}
| 1threat |
Kotlin. How to check if the field is nullable via reflection? : <p>I'm developing a code generator that takes the data from the classes during runtime. This generator is designed to work only with Kotlin. At the moment, I was faced with the problem, as I don't know how to check if the field is nullable. </p>
<p>So the main question is how to implement this check via reflection?</p>
| 0debug |
Why do we really need Comparator in Java? : <p>My questions is basically divided into two sub-questions:</p>
<ol>
<li><p>Comparable talks about natural ordering. Who is stopping us from implementing a non-natural ordering login in the compareTo method ?</p></li>
<li><p>Comparator can do the same stuff as Comparable (ASC or DESC sort). So the only reason it exists is because that if we have a third party class which we cannot change (make it implement Comparable) then we can externalise the sorting logic using Comparator. Is this correct ?</p></li>
</ol>
| 0debug |
Firebase still retrieving authData after deletion : <p>After I manually deleted the account connected to the uid that my iphone simulator is on (from firebase dashboard), when I run the code below it's somehow still authenticating and retrieving a uid. How is this possible?</p>
<pre><code>let ref = Firebase(url: "https://moviebuffapp.firebaseio.com/")
override func viewDidLoad() {
super.viewDidLoad()
if ref.authData != nil {
let uid = ref.authData.uid
print(uid)
</code></pre>
| 0debug |
av_cold void ff_fft_init_x86(FFTContext *s)
{
int cpu_flags = av_get_cpu_flags();
#if ARCH_X86_32
if (EXTERNAL_AMD3DNOW(cpu_flags)) {
s->imdct_calc = ff_imdct_calc_3dnow;
s->imdct_half = ff_imdct_half_3dnow;
s->fft_calc = ff_fft_calc_3dnow;
}
if (EXTERNAL_AMD3DNOWEXT(cpu_flags)) {
s->imdct_calc = ff_imdct_calc_3dnowext;
s->imdct_half = ff_imdct_half_3dnowext;
s->fft_calc = ff_fft_calc_3dnowext;
}
#endif
if (EXTERNAL_SSE(cpu_flags)) {
s->imdct_calc = ff_imdct_calc_sse;
s->imdct_half = ff_imdct_half_sse;
s->fft_permute = ff_fft_permute_sse;
s->fft_calc = ff_fft_calc_sse;
s->fft_permutation = FF_FFT_PERM_SWAP_LSBS;
}
if (EXTERNAL_AVX(cpu_flags) && s->nbits >= 5) {
s->imdct_half = ff_imdct_half_avx;
s->fft_calc = ff_fft_calc_avx;
s->fft_permutation = FF_FFT_PERM_AVX;
}
}
| 1threat |
Find Difference Between Two Numbers in Comma Separated Array : Suppose I have a MySQL table which has two rows and two columns.
Column 1 = ID
Column 2 = NUMBERS
NUMBERS field in first row & second row has following comma separated value:
NUMBERS(Row 1) = 1,2,3,4,5,6,7,8
NUMBERS(Row 2) = 6,7,8,9,10,11
Now I need to find all the numbers which are between 1 & 11. I have tried MYSQL BETWEEN function but it has not returned desired results. Is there a way I can get desired result?
| 0debug |
static int asf_read_packet(AVFormatContext *s, AVPacket *pkt)
{
ASFContext *asf = s->priv_data;
ASFStream *asf_st = 0;
ByteIOContext *pb = &s->pb;
static int pc = 0;
for (;;) {
int rsize = 0;
if (asf->packet_size_left < FRAME_HEADER_SIZE
|| asf->packet_segments < 0) {
int ret;
if (asf->packet_size_left)
url_fskip(pb, asf->packet_size_left);
if (asf->packet_padsize)
url_fskip(pb, asf->packet_padsize);
ret = asf_get_packet(s);
if (ret < 0)
return -EIO;
asf->packet_time_start = 0;
continue;
}
if (asf->packet_time_start == 0) {
int num;
if (--asf->packet_segments < 0)
continue;
num = get_byte(pb);
rsize++;
asf->packet_key_frame = (num & 0x80) >> 7;
asf->stream_index = asf->asfid2avid[num & 0x7f];
if (asf->stream_index < 0)
{
url_fskip(pb, asf->packet_frag_size);
asf->packet_size_left -= asf->packet_frag_size;
printf("ff asf skip %d %d\n", asf->packet_frag_size, num &0x7f);
continue;
}
asf->asf_st = s->streams[asf->stream_index]->priv_data;
DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0);
DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0);
DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);
if (asf->packet_replic_size > 1) {
asf->packet_obj_size = get_le32(pb);
asf->packet_frag_timestamp = get_le32(pb);
rsize += asf->packet_replic_size;
} else {
asf->packet_time_start = asf->packet_frag_offset;
asf->packet_frag_offset = 0;
asf->packet_frag_timestamp = asf->packet_timestamp;
if (asf->packet_replic_size == 1) {
asf->packet_time_delta = get_byte(pb);
rsize++;
}
}
if (asf->packet_flags & 0x01) {
DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0);
} else {
asf->packet_frag_size = asf->packet_size_left - rsize;
}
if (asf->packet_replic_size == 1)
{
asf->packet_multi_size = asf->packet_frag_size;
if (asf->packet_multi_size > asf->packet_size_left)
{
asf->packet_segments = 0;
continue;
}
}
#undef DO_2BITS
asf->packet_size_left -= rsize;
}
asf_st = asf->asf_st;
if ((asf->packet_frag_offset != asf_st->frag_offset
|| (asf->packet_frag_offset
&& asf->packet_seq != asf_st->seq))
) {
printf("ff asf parser skips: %d - %d o:%d - %d %d %d fl:%d\n",
asf_st->pkt.size,
asf->packet_obj_size,
asf->packet_frag_offset, asf_st->frag_offset,
asf->packet_seq, asf_st->seq, asf->packet_frag_size);
if (asf_st->pkt.size)
av_free_packet(&asf_st->pkt);
asf_st->frag_offset = 0;
if (asf->packet_frag_offset != 0) {
url_fskip(pb, asf->packet_frag_size);
printf("ff asf parser skiping %db\n", asf->packet_frag_size);
asf->packet_size_left -= asf->packet_frag_size;
continue;
}
}
if (asf->packet_replic_size == 1) {
asf->packet_frag_timestamp = asf->packet_time_start;
asf->packet_time_start += asf->packet_time_delta;
asf->packet_obj_size = asf->packet_frag_size = get_byte(pb);
asf->packet_size_left--;
asf->packet_multi_size--;
if (asf->packet_multi_size < asf->packet_obj_size)
{
asf->packet_time_start = 0;
url_fskip(pb, asf->packet_multi_size);
asf->packet_size_left -= asf->packet_multi_size;
continue;
}
asf->packet_multi_size -= asf->packet_obj_size;
}
if (asf_st->frag_offset == 0) {
av_new_packet(&asf_st->pkt, asf->packet_obj_size);
asf_st->seq = asf->packet_seq;
asf_st->pkt.pts = asf->packet_frag_timestamp - asf->hdr.preroll;
asf_st->pkt.stream_index = asf->stream_index;
if (asf->packet_key_frame)
asf_st->pkt.flags |= PKT_FLAG_KEY;
}
asf->packet_size_left -= asf->packet_frag_size;
if (asf->packet_size_left < 0)
continue;
get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset,
asf->packet_frag_size);
asf_st->frag_offset += asf->packet_frag_size;
if (asf_st->frag_offset == asf_st->pkt.size) {
if (asf_st->ds_span > 1) {
char* newdata = av_malloc(asf_st->pkt.size);
if (newdata) {
int offset = 0;
while (offset < asf_st->pkt.size) {
int off = offset / asf_st->ds_chunk_size;
int row = off / asf_st->ds_span;
int col = off % asf_st->ds_span;
int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size;
memcpy(newdata + offset,
asf_st->pkt.data + idx * asf_st->ds_chunk_size,
asf_st->ds_chunk_size);
offset += asf_st->ds_chunk_size;
}
av_free(asf_st->pkt.data);
asf_st->pkt.data = newdata;
}
}
asf_st->frag_offset = 0;
memcpy(pkt, &asf_st->pkt, sizeof(AVPacket));
asf_st->pkt.size = 0;
asf_st->pkt.data = 0;
break;
}
}
return 0;
}
| 1threat |
Delphi - You can close all the database tables : can you close all database tables except some?
(what I need)
And then reopen them?
I use absolute database that is similar to BDE
If so, how to do so many thanks.
Simo | 0debug |
static void register_all(void)
{
REGISTER_HWACCEL(H263_VAAPI, h263_vaapi);
REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
REGISTER_HWACCEL(H264_CUVID, h264_cuvid);
REGISTER_HWACCEL(H264_D3D11VA, h264_d3d11va);
REGISTER_HWACCEL(H264_D3D11VA2, h264_d3d11va2);
REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);
REGISTER_HWACCEL(H264_MEDIACODEC, h264_mediacodec);
REGISTER_HWACCEL(H264_MMAL, h264_mmal);
REGISTER_HWACCEL(H264_NVDEC, h264_nvdec);
REGISTER_HWACCEL(H264_QSV, h264_qsv);
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox);
REGISTER_HWACCEL(HEVC_CUVID, hevc_cuvid);
REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va);
REGISTER_HWACCEL(HEVC_D3D11VA2, hevc_d3d11va2);
REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2);
REGISTER_HWACCEL(HEVC_NVDEC, hevc_nvdec);
REGISTER_HWACCEL(HEVC_MEDIACODEC, hevc_mediacodec);
REGISTER_HWACCEL(HEVC_QSV, hevc_qsv);
REGISTER_HWACCEL(HEVC_VAAPI, hevc_vaapi);
REGISTER_HWACCEL(HEVC_VDPAU, hevc_vdpau);
REGISTER_HWACCEL(HEVC_VIDEOTOOLBOX, hevc_videotoolbox);
REGISTER_HWACCEL(MJPEG_CUVID, mjpeg_cuvid);
REGISTER_HWACCEL(MPEG1_CUVID, mpeg1_cuvid);
REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);
REGISTER_HWACCEL(MPEG2_CUVID, mpeg2_cuvid);
REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc);
REGISTER_HWACCEL(MPEG2_D3D11VA, mpeg2_d3d11va);
REGISTER_HWACCEL(MPEG2_D3D11VA2, mpeg2_d3d11va2);
REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
REGISTER_HWACCEL(MPEG2_MMAL, mpeg2_mmal);
REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv);
REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
REGISTER_HWACCEL(MPEG2_MEDIACODEC, mpeg2_mediacodec);
REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_HWACCEL(MPEG4_MEDIACODEC, mpeg4_mediacodec);
REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal);
REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi);
REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau);
REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);
REGISTER_HWACCEL(VC1_CUVID, vc1_cuvid);
REGISTER_HWACCEL(VC1_D3D11VA, vc1_d3d11va);
REGISTER_HWACCEL(VC1_D3D11VA2, vc1_d3d11va2);
REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2);
REGISTER_HWACCEL(VC1_NVDEC, vc1_nvdec);
REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);
REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);
REGISTER_HWACCEL(VC1_MMAL, vc1_mmal);
REGISTER_HWACCEL(VC1_QSV, vc1_qsv);
REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid);
REGISTER_HWACCEL(VP8_MEDIACODEC, vp8_mediacodec);
REGISTER_HWACCEL(VP8_QSV, vp8_qsv);
REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid);
REGISTER_HWACCEL(VP9_D3D11VA, vp9_d3d11va);
REGISTER_HWACCEL(VP9_D3D11VA2, vp9_d3d11va2);
REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2);
REGISTER_HWACCEL(VP9_MEDIACODEC, vp9_mediacodec);
REGISTER_HWACCEL(VP9_NVDEC, vp9_nvdec);
REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi);
REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va);
REGISTER_HWACCEL(WMV3_D3D11VA2, wmv3_d3d11va2);
REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);
REGISTER_HWACCEL(WMV3_NVDEC, wmv3_nvdec);
REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi);
REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau);
REGISTER_ENCODER(A64MULTI, a64multi);
REGISTER_ENCODER(A64MULTI5, a64multi5);
REGISTER_DECODER(AASC, aasc);
REGISTER_DECODER(AIC, aic);
REGISTER_ENCDEC (ALIAS_PIX, alias_pix);
REGISTER_ENCDEC (AMV, amv);
REGISTER_DECODER(ANM, anm);
REGISTER_DECODER(ANSI, ansi);
REGISTER_ENCDEC (APNG, apng);
REGISTER_ENCDEC (ASV1, asv1);
REGISTER_ENCDEC (ASV2, asv2);
REGISTER_DECODER(AURA, aura);
REGISTER_DECODER(AURA2, aura2);
REGISTER_ENCDEC (AVRP, avrp);
REGISTER_DECODER(AVRN, avrn);
REGISTER_DECODER(AVS, avs);
REGISTER_ENCDEC (AVUI, avui);
REGISTER_ENCDEC (AYUV, ayuv);
REGISTER_DECODER(BETHSOFTVID, bethsoftvid);
REGISTER_DECODER(BFI, bfi);
REGISTER_DECODER(BINK, bink);
REGISTER_ENCDEC (BMP, bmp);
REGISTER_DECODER(BMV_VIDEO, bmv_video);
REGISTER_DECODER(BRENDER_PIX, brender_pix);
REGISTER_DECODER(C93, c93);
REGISTER_DECODER(CAVS, cavs);
REGISTER_DECODER(CDGRAPHICS, cdgraphics);
REGISTER_DECODER(CDXL, cdxl);
REGISTER_DECODER(CFHD, cfhd);
REGISTER_ENCDEC (CINEPAK, cinepak);
REGISTER_DECODER(CLEARVIDEO, clearvideo);
REGISTER_ENCDEC (CLJR, cljr);
REGISTER_DECODER(CLLC, cllc);
REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);
REGISTER_DECODER(CPIA, cpia);
REGISTER_DECODER(CSCD, cscd);
REGISTER_DECODER(CYUV, cyuv);
REGISTER_DECODER(DDS, dds);
REGISTER_DECODER(DFA, dfa);
REGISTER_DECODER(DIRAC, dirac);
REGISTER_ENCDEC (DNXHD, dnxhd);
REGISTER_ENCDEC (DPX, dpx);
REGISTER_DECODER(DSICINVIDEO, dsicinvideo);
REGISTER_DECODER(DVAUDIO, dvaudio);
REGISTER_ENCDEC (DVVIDEO, dvvideo);
REGISTER_DECODER(DXA, dxa);
REGISTER_DECODER(DXTORY, dxtory);
REGISTER_DECODER(DXV, dxv);
REGISTER_DECODER(EACMV, eacmv);
REGISTER_DECODER(EAMAD, eamad);
REGISTER_DECODER(EATGQ, eatgq);
REGISTER_DECODER(EATGV, eatgv);
REGISTER_DECODER(EATQI, eatqi);
REGISTER_DECODER(EIGHTBPS, eightbps);
REGISTER_DECODER(EIGHTSVX_EXP, eightsvx_exp);
REGISTER_DECODER(EIGHTSVX_FIB, eightsvx_fib);
REGISTER_DECODER(ESCAPE124, escape124);
REGISTER_DECODER(ESCAPE130, escape130);
REGISTER_DECODER(EXR, exr);
REGISTER_ENCDEC (FFV1, ffv1);
REGISTER_ENCDEC (FFVHUFF, ffvhuff);
REGISTER_DECODER(FIC, fic);
REGISTER_ENCDEC (FITS, fits);
REGISTER_ENCDEC (FLASHSV, flashsv);
REGISTER_ENCDEC (FLASHSV2, flashsv2);
REGISTER_DECODER(FLIC, flic);
REGISTER_ENCDEC (FLV, flv);
REGISTER_DECODER(FMVC, fmvc);
REGISTER_DECODER(FOURXM, fourxm);
REGISTER_DECODER(FRAPS, fraps);
REGISTER_DECODER(FRWU, frwu);
REGISTER_DECODER(G2M, g2m);
REGISTER_DECODER(GDV, gdv);
REGISTER_ENCDEC (GIF, gif);
REGISTER_ENCDEC (H261, h261);
REGISTER_ENCDEC (H263, h263);
REGISTER_DECODER(H263I, h263i);
REGISTER_ENCDEC (H263P, h263p);
REGISTER_DECODER(H263_V4L2M2M, h263_v4l2m2m);
REGISTER_DECODER(H264, h264);
REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd);
REGISTER_DECODER(H264_V4L2M2M, h264_v4l2m2m);
REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec);
REGISTER_DECODER(H264_MMAL, h264_mmal);
REGISTER_DECODER(H264_QSV, h264_qsv);
REGISTER_DECODER(H264_RKMPP, h264_rkmpp);
REGISTER_ENCDEC (HAP, hap);
REGISTER_DECODER(HEVC, hevc);
REGISTER_DECODER(HEVC_QSV, hevc_qsv);
REGISTER_DECODER(HEVC_RKMPP, hevc_rkmpp);
REGISTER_DECODER(HEVC_V4L2M2M, hevc_v4l2m2m);
REGISTER_DECODER(HNM4_VIDEO, hnm4_video);
REGISTER_DECODER(HQ_HQA, hq_hqa);
REGISTER_DECODER(HQX, hqx);
REGISTER_ENCDEC (HUFFYUV, huffyuv);
REGISTER_DECODER(IDCIN, idcin);
REGISTER_DECODER(IFF_ILBM, iff_ilbm);
REGISTER_DECODER(INDEO2, indeo2);
REGISTER_DECODER(INDEO3, indeo3);
REGISTER_DECODER(INDEO4, indeo4);
REGISTER_DECODER(INDEO5, indeo5);
REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video);
REGISTER_ENCDEC (JPEG2000, jpeg2000);
REGISTER_ENCDEC (JPEGLS, jpegls);
REGISTER_DECODER(JV, jv);
REGISTER_DECODER(KGV1, kgv1);
REGISTER_DECODER(KMVC, kmvc);
REGISTER_DECODER(LAGARITH, lagarith);
REGISTER_ENCODER(LJPEG, ljpeg);
REGISTER_DECODER(LOCO, loco);
REGISTER_DECODER(M101, m101);
REGISTER_ENCDEC (MAGICYUV, magicyuv);
REGISTER_DECODER(MDEC, mdec);
REGISTER_DECODER(MIMIC, mimic);
REGISTER_ENCDEC (MJPEG, mjpeg);
REGISTER_DECODER(MJPEGB, mjpegb);
REGISTER_DECODER(MMVIDEO, mmvideo);
REGISTER_DECODER(MOTIONPIXELS, motionpixels);
REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
REGISTER_ENCDEC (MPEG4, mpeg4);
REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd);
REGISTER_DECODER(MPEG4_V4L2M2M, mpeg4_v4l2m2m);
REGISTER_DECODER(MPEG4_MMAL, mpeg4_mmal);
REGISTER_DECODER(MPEGVIDEO, mpegvideo);
REGISTER_DECODER(MPEG1_V4L2M2M, mpeg1_v4l2m2m);
REGISTER_DECODER(MPEG2_MMAL, mpeg2_mmal);
REGISTER_DECODER(MPEG2_CRYSTALHD, mpeg2_crystalhd);
REGISTER_DECODER(MPEG2_V4L2M2M, mpeg2_v4l2m2m);
REGISTER_DECODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MPEG2_MEDIACODEC, mpeg2_mediacodec);
REGISTER_DECODER(MSA1, msa1);
REGISTER_DECODER(MSCC, mscc);
REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);
REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
REGISTER_DECODER(MSRLE, msrle);
REGISTER_DECODER(MSS1, mss1);
REGISTER_DECODER(MSS2, mss2);
REGISTER_ENCDEC (MSVIDEO1, msvideo1);
REGISTER_DECODER(MSZH, mszh);
REGISTER_DECODER(MTS2, mts2);
REGISTER_DECODER(MVC1, mvc1);
REGISTER_DECODER(MVC2, mvc2);
REGISTER_DECODER(MXPEG, mxpeg);
REGISTER_DECODER(NUV, nuv);
REGISTER_DECODER(PAF_VIDEO, paf_video);
REGISTER_ENCDEC (PAM, pam);
REGISTER_ENCDEC (PBM, pbm);
REGISTER_ENCDEC (PCX, pcx);
REGISTER_ENCDEC (PGM, pgm);
REGISTER_ENCDEC (PGMYUV, pgmyuv);
REGISTER_DECODER(PICTOR, pictor);
REGISTER_DECODER(PIXLET, pixlet);
REGISTER_ENCDEC (PNG, png);
REGISTER_ENCDEC (PPM, ppm);
REGISTER_ENCDEC (PRORES, prores);
REGISTER_ENCODER(PRORES_AW, prores_aw);
REGISTER_ENCODER(PRORES_KS, prores_ks);
REGISTER_DECODER(PRORES_LGPL, prores_lgpl);
REGISTER_DECODER(PSD, psd);
REGISTER_DECODER(PTX, ptx);
REGISTER_DECODER(QDRAW, qdraw);
REGISTER_DECODER(QPEG, qpeg);
REGISTER_ENCDEC (QTRLE, qtrle);
REGISTER_ENCDEC (R10K, r10k);
REGISTER_ENCDEC (R210, r210);
REGISTER_ENCDEC (RAWVIDEO, rawvideo);
REGISTER_DECODER(RL2, rl2);
REGISTER_ENCDEC (ROQ, roq);
REGISTER_DECODER(RPZA, rpza);
REGISTER_DECODER(RSCC, rscc);
REGISTER_ENCDEC (RV10, rv10);
REGISTER_ENCDEC (RV20, rv20);
REGISTER_DECODER(RV30, rv30);
REGISTER_DECODER(RV40, rv40);
REGISTER_ENCDEC (S302M, s302m);
REGISTER_DECODER(SANM, sanm);
REGISTER_DECODER(SCPR, scpr);
REGISTER_DECODER(SCREENPRESSO, screenpresso);
REGISTER_DECODER(SDX2_DPCM, sdx2_dpcm);
REGISTER_ENCDEC (SGI, sgi);
REGISTER_DECODER(SGIRLE, sgirle);
REGISTER_DECODER(SHEERVIDEO, sheervideo);
REGISTER_DECODER(SMACKER, smacker);
REGISTER_DECODER(SMC, smc);
REGISTER_DECODER(SMVJPEG, smvjpeg);
REGISTER_ENCDEC (SNOW, snow);
REGISTER_DECODER(SP5X, sp5x);
REGISTER_DECODER(SPEEDHQ, speedhq);
REGISTER_DECODER(SRGC, srgc);
REGISTER_ENCDEC (SUNRAST, sunrast);
REGISTER_ENCDEC (SVQ1, svq1);
REGISTER_DECODER(SVQ3, svq3);
REGISTER_ENCDEC (TARGA, targa);
REGISTER_DECODER(TARGA_Y216, targa_y216);
REGISTER_DECODER(TDSC, tdsc);
REGISTER_DECODER(THEORA, theora);
REGISTER_DECODER(THP, thp);
REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo);
REGISTER_ENCDEC (TIFF, tiff);
REGISTER_DECODER(TMV, tmv);
REGISTER_DECODER(TRUEMOTION1, truemotion1);
REGISTER_DECODER(TRUEMOTION2, truemotion2);
REGISTER_DECODER(TRUEMOTION2RT, truemotion2rt);
REGISTER_DECODER(TSCC, tscc);
REGISTER_DECODER(TSCC2, tscc2);
REGISTER_DECODER(TXD, txd);
REGISTER_DECODER(ULTI, ulti);
REGISTER_ENCDEC (UTVIDEO, utvideo);
REGISTER_ENCDEC (V210, v210);
REGISTER_DECODER(V210X, v210x);
REGISTER_ENCDEC (V308, v308);
REGISTER_ENCDEC (V408, v408);
REGISTER_ENCDEC (V410, v410);
REGISTER_DECODER(VB, vb);
REGISTER_DECODER(VBLE, vble);
REGISTER_DECODER(VC1, vc1);
REGISTER_DECODER(VC1_CRYSTALHD, vc1_crystalhd);
REGISTER_DECODER(VC1IMAGE, vc1image);
REGISTER_DECODER(VC1_MMAL, vc1_mmal);
REGISTER_DECODER(VC1_QSV, vc1_qsv);
REGISTER_DECODER(VC1_V4L2M2M, vc1_v4l2m2m);
REGISTER_ENCODER(VC2, vc2);
REGISTER_DECODER(VCR1, vcr1);
REGISTER_DECODER(VMDVIDEO, vmdvideo);
REGISTER_DECODER(VMNC, vmnc);
REGISTER_DECODER(VP3, vp3);
REGISTER_DECODER(VP5, vp5);
REGISTER_DECODER(VP6, vp6);
REGISTER_DECODER(VP6A, vp6a);
REGISTER_DECODER(VP6F, vp6f);
REGISTER_DECODER(VP7, vp7);
REGISTER_DECODER(VP8, vp8);
REGISTER_DECODER(VP8_RKMPP, vp8_rkmpp);
REGISTER_DECODER(VP8_V4L2M2M, vp8_v4l2m2m);
REGISTER_DECODER(VP9, vp9);
REGISTER_DECODER(VP9_RKMPP, vp9_rkmpp);
REGISTER_DECODER(VP9_V4L2M2M, vp9_v4l2m2m);
REGISTER_DECODER(VQA, vqa);
REGISTER_DECODER(BITPACKED, bitpacked);
REGISTER_DECODER(WEBP, webp);
REGISTER_ENCDEC (WRAPPED_AVFRAME, wrapped_avframe);
REGISTER_ENCDEC (WMV1, wmv1);
REGISTER_ENCDEC (WMV2, wmv2);
REGISTER_DECODER(WMV3, wmv3);
REGISTER_DECODER(WMV3_CRYSTALHD, wmv3_crystalhd);
REGISTER_DECODER(WMV3IMAGE, wmv3image);
REGISTER_DECODER(WNV1, wnv1);
REGISTER_DECODER(XAN_WC3, xan_wc3);
REGISTER_DECODER(XAN_WC4, xan_wc4);
REGISTER_ENCDEC (XBM, xbm);
REGISTER_ENCDEC (XFACE, xface);
REGISTER_DECODER(XL, xl);
REGISTER_DECODER(XPM, xpm);
REGISTER_ENCDEC (XWD, xwd);
REGISTER_ENCDEC (Y41P, y41p);
REGISTER_DECODER(YLC, ylc);
REGISTER_DECODER(YOP, yop);
REGISTER_ENCDEC (YUV4, yuv4);
REGISTER_DECODER(ZERO12V, zero12v);
REGISTER_DECODER(ZEROCODEC, zerocodec);
REGISTER_ENCDEC (ZLIB, zlib);
REGISTER_ENCDEC (ZMBV, zmbv);
REGISTER_ENCDEC (AAC, aac);
REGISTER_DECODER(AAC_FIXED, aac_fixed);
REGISTER_DECODER(AAC_LATM, aac_latm);
REGISTER_ENCDEC (AC3, ac3);
REGISTER_ENCDEC (AC3_FIXED, ac3_fixed);
REGISTER_ENCDEC (ALAC, alac);
REGISTER_DECODER(ALS, als);
REGISTER_DECODER(AMRNB, amrnb);
REGISTER_DECODER(AMRWB, amrwb);
REGISTER_DECODER(APE, ape);
REGISTER_ENCDEC (APTX, aptx);
REGISTER_DECODER(ATRAC1, atrac1);
REGISTER_DECODER(ATRAC3, atrac3);
REGISTER_DECODER(ATRAC3AL, atrac3al);
REGISTER_DECODER(ATRAC3P, atrac3p);
REGISTER_DECODER(ATRAC3PAL, atrac3pal);
REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);
REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);
REGISTER_DECODER(BMV_AUDIO, bmv_audio);
REGISTER_DECODER(COOK, cook);
REGISTER_ENCDEC (DCA, dca);
REGISTER_DECODER(DOLBY_E, dolby_e);
REGISTER_DECODER(DSD_LSBF, dsd_lsbf);
REGISTER_DECODER(DSD_MSBF, dsd_msbf);
REGISTER_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar);
REGISTER_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar);
REGISTER_DECODER(DSICINAUDIO, dsicinaudio);
REGISTER_DECODER(DSS_SP, dss_sp);
REGISTER_DECODER(DST, dst);
REGISTER_ENCDEC (EAC3, eac3);
REGISTER_DECODER(EVRC, evrc);
REGISTER_DECODER(FFWAVESYNTH, ffwavesynth);
REGISTER_ENCDEC (FLAC, flac);
REGISTER_ENCDEC (G723_1, g723_1);
REGISTER_DECODER(G729, g729);
REGISTER_DECODER(GSM, gsm);
REGISTER_DECODER(GSM_MS, gsm_ms);
REGISTER_DECODER(IAC, iac);
REGISTER_DECODER(IMC, imc);
REGISTER_DECODER(INTERPLAY_ACM, interplay_acm);
REGISTER_DECODER(MACE3, mace3);
REGISTER_DECODER(MACE6, mace6);
REGISTER_DECODER(METASOUND, metasound);
REGISTER_ENCDEC (MLP, mlp);
REGISTER_DECODER(MP1, mp1);
REGISTER_DECODER(MP1FLOAT, mp1float);
REGISTER_ENCDEC (MP2, mp2);
REGISTER_DECODER(MP2FLOAT, mp2float);
REGISTER_ENCODER(MP2FIXED, mp2fixed);
REGISTER_DECODER(MP3, mp3);
REGISTER_DECODER(MP3FLOAT, mp3float);
REGISTER_DECODER(MP3ADU, mp3adu);
REGISTER_DECODER(MP3ADUFLOAT, mp3adufloat);
REGISTER_DECODER(MP3ON4, mp3on4);
REGISTER_DECODER(MP3ON4FLOAT, mp3on4float);
REGISTER_DECODER(MPC7, mpc7);
REGISTER_DECODER(MPC8, mpc8);
REGISTER_ENCDEC (NELLYMOSER, nellymoser);
REGISTER_DECODER(ON2AVC, on2avc);
REGISTER_ENCDEC (OPUS, opus);
REGISTER_DECODER(PAF_AUDIO, paf_audio);
REGISTER_DECODER(QCELP, qcelp);
REGISTER_DECODER(QDM2, qdm2);
REGISTER_DECODER(QDMC, qdmc);
REGISTER_ENCDEC (RA_144, ra_144);
REGISTER_DECODER(RA_288, ra_288);
REGISTER_DECODER(RALF, ralf);
REGISTER_DECODER(SHORTEN, shorten);
REGISTER_DECODER(SIPR, sipr);
REGISTER_DECODER(SMACKAUD, smackaud);
REGISTER_ENCDEC (SONIC, sonic);
REGISTER_ENCODER(SONIC_LS, sonic_ls);
REGISTER_DECODER(TAK, tak);
REGISTER_ENCDEC (TRUEHD, truehd);
REGISTER_DECODER(TRUESPEECH, truespeech);
REGISTER_ENCDEC (TTA, tta);
REGISTER_DECODER(TWINVQ, twinvq);
REGISTER_DECODER(VMDAUDIO, vmdaudio);
REGISTER_ENCDEC (VORBIS, vorbis);
REGISTER_ENCDEC (WAVPACK, wavpack);
REGISTER_DECODER(WMALOSSLESS, wmalossless);
REGISTER_DECODER(WMAPRO, wmapro);
REGISTER_ENCDEC (WMAV1, wmav1);
REGISTER_ENCDEC (WMAV2, wmav2);
REGISTER_DECODER(WMAVOICE, wmavoice);
REGISTER_DECODER(WS_SND1, ws_snd1);
REGISTER_DECODER(XMA1, xma1);
REGISTER_DECODER(XMA2, xma2);
REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);
REGISTER_DECODER(PCM_BLURAY, pcm_bluray);
REGISTER_DECODER(PCM_DVD, pcm_dvd);
REGISTER_DECODER(PCM_F16LE, pcm_f16le);
REGISTER_DECODER(PCM_F24LE, pcm_f24le);
REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
REGISTER_ENCDEC (PCM_F64LE, pcm_f64le);
REGISTER_DECODER(PCM_LXF, pcm_lxf);
REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw);
REGISTER_ENCDEC (PCM_S8, pcm_s8);
REGISTER_ENCDEC (PCM_S8_PLANAR, pcm_s8_planar);
REGISTER_ENCDEC (PCM_S16BE, pcm_s16be);
REGISTER_ENCDEC (PCM_S16BE_PLANAR, pcm_s16be_planar);
REGISTER_ENCDEC (PCM_S16LE, pcm_s16le);
REGISTER_ENCDEC (PCM_S16LE_PLANAR, pcm_s16le_planar);
REGISTER_ENCDEC (PCM_S24BE, pcm_s24be);
REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud);
REGISTER_ENCDEC (PCM_S24LE, pcm_s24le);
REGISTER_ENCDEC (PCM_S24LE_PLANAR, pcm_s24le_planar);
REGISTER_ENCDEC (PCM_S32BE, pcm_s32be);
REGISTER_ENCDEC (PCM_S32LE, pcm_s32le);
REGISTER_ENCDEC (PCM_S32LE_PLANAR, pcm_s32le_planar);
REGISTER_ENCDEC (PCM_S64BE, pcm_s64be);
REGISTER_ENCDEC (PCM_S64LE, pcm_s64le);
REGISTER_ENCDEC (PCM_U8, pcm_u8);
REGISTER_ENCDEC (PCM_U16BE, pcm_u16be);
REGISTER_ENCDEC (PCM_U16LE, pcm_u16le);
REGISTER_ENCDEC (PCM_U24BE, pcm_u24be);
REGISTER_ENCDEC (PCM_U24LE, pcm_u24le);
REGISTER_ENCDEC (PCM_U32BE, pcm_u32be);
REGISTER_ENCDEC (PCM_U32LE, pcm_u32le);
REGISTER_DECODER(PCM_ZORK, pcm_zork);
REGISTER_DECODER(GREMLIN_DPCM, gremlin_dpcm);
REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);
REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm);
REGISTER_DECODER(SOL_DPCM, sol_dpcm);
REGISTER_DECODER(XAN_DPCM, xan_dpcm);
REGISTER_DECODER(ADPCM_4XM, adpcm_4xm);
REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx);
REGISTER_DECODER(ADPCM_AFC, adpcm_afc);
REGISTER_DECODER(ADPCM_AICA, adpcm_aica);
REGISTER_DECODER(ADPCM_CT, adpcm_ct);
REGISTER_DECODER(ADPCM_DTK, adpcm_dtk);
REGISTER_DECODER(ADPCM_EA, adpcm_ea);
REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);
REGISTER_DECODER(ADPCM_EA_R1, adpcm_ea_r1);
REGISTER_DECODER(ADPCM_EA_R2, adpcm_ea_r2);
REGISTER_DECODER(ADPCM_EA_R3, adpcm_ea_r3);
REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);
REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
REGISTER_ENCDEC (ADPCM_G726LE, adpcm_g726le);
REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);
REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);
REGISTER_DECODER(ADPCM_IMA_DAT4, adpcm_ima_dat4);
REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3);
REGISTER_DECODER(ADPCM_IMA_DK4, adpcm_ima_dk4);
REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
REGISTER_DECODER(ADPCM_IMA_ISS, adpcm_ima_iss);
REGISTER_DECODER(ADPCM_IMA_OKI, adpcm_ima_oki);
REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);
REGISTER_DECODER(ADPCM_IMA_RAD, adpcm_ima_rad);
REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);
REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws);
REGISTER_ENCDEC (ADPCM_MS, adpcm_ms);
REGISTER_DECODER(ADPCM_MTAF, adpcm_mtaf);
REGISTER_DECODER(ADPCM_PSX, adpcm_psx);
REGISTER_DECODER(ADPCM_SBPRO_2, adpcm_sbpro_2);
REGISTER_DECODER(ADPCM_SBPRO_3, adpcm_sbpro_3);
REGISTER_DECODER(ADPCM_SBPRO_4, adpcm_sbpro_4);
REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf);
REGISTER_DECODER(ADPCM_THP, adpcm_thp);
REGISTER_DECODER(ADPCM_THP_LE, adpcm_thp_le);
REGISTER_DECODER(ADPCM_VIMA, adpcm_vima);
REGISTER_DECODER(ADPCM_XA, adpcm_xa);
REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha);
REGISTER_ENCDEC (SSA, ssa);
REGISTER_ENCDEC (ASS, ass);
REGISTER_DECODER(CCAPTION, ccaption);
REGISTER_ENCDEC (DVBSUB, dvbsub);
REGISTER_ENCDEC (DVDSUB, dvdsub);
REGISTER_DECODER(JACOSUB, jacosub);
REGISTER_DECODER(MICRODVD, microdvd);
REGISTER_ENCDEC (MOVTEXT, movtext);
REGISTER_DECODER(MPL2, mpl2);
REGISTER_DECODER(PGSSUB, pgssub);
REGISTER_DECODER(PJS, pjs);
REGISTER_DECODER(REALTEXT, realtext);
REGISTER_DECODER(SAMI, sami);
REGISTER_ENCDEC (SRT, srt);
REGISTER_DECODER(STL, stl);
REGISTER_ENCDEC (SUBRIP, subrip);
REGISTER_DECODER(SUBVIEWER, subviewer);
REGISTER_DECODER(SUBVIEWER1, subviewer1);
REGISTER_ENCDEC (TEXT, text);
REGISTER_DECODER(VPLAYER, vplayer);
REGISTER_ENCDEC (WEBVTT, webvtt);
REGISTER_ENCDEC (XSUB, xsub);
REGISTER_ENCDEC (AAC_AT, aac_at);
REGISTER_DECODER(AC3_AT, ac3_at);
REGISTER_DECODER(ADPCM_IMA_QT_AT, adpcm_ima_qt_at);
REGISTER_ENCDEC (ALAC_AT, alac_at);
REGISTER_DECODER(AMR_NB_AT, amr_nb_at);
REGISTER_DECODER(EAC3_AT, eac3_at);
REGISTER_DECODER(GSM_MS_AT, gsm_ms_at);
REGISTER_ENCDEC (ILBC_AT, ilbc_at);
REGISTER_DECODER(MP1_AT, mp1_at);
REGISTER_DECODER(MP2_AT, mp2_at);
REGISTER_DECODER(MP3_AT, mp3_at);
REGISTER_ENCDEC (PCM_ALAW_AT, pcm_alaw_at);
REGISTER_ENCDEC (PCM_MULAW_AT, pcm_mulaw_at);
REGISTER_DECODER(QDMC_AT, qdmc_at);
REGISTER_DECODER(QDM2_AT, qdm2_at);
REGISTER_DECODER(LIBCELT, libcelt);
REGISTER_ENCDEC (LIBFDK_AAC, libfdk_aac);
REGISTER_ENCDEC (LIBGSM, libgsm);
REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
REGISTER_ENCDEC (LIBILBC, libilbc);
REGISTER_ENCODER(LIBMP3LAME, libmp3lame);
REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);
REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb);
REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);
REGISTER_ENCDEC (LIBOPUS, libopus);
REGISTER_DECODER(LIBRSVG, librsvg);
REGISTER_ENCODER(LIBSHINE, libshine);
REGISTER_ENCDEC (LIBSPEEX, libspeex);
REGISTER_ENCODER(LIBTHEORA, libtheora);
REGISTER_ENCODER(LIBTWOLAME, libtwolame);
REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc);
REGISTER_ENCDEC (LIBVORBIS, libvorbis);
REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8);
REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9);
REGISTER_ENCODER(LIBWAVPACK, libwavpack);
REGISTER_ENCODER(LIBWEBP_ANIM, libwebp_anim);
REGISTER_ENCODER(LIBWEBP, libwebp);
REGISTER_ENCODER(LIBX262, libx262);
REGISTER_ENCODER(LIBX264, libx264);
REGISTER_ENCODER(LIBX264RGB, libx264rgb);
REGISTER_ENCODER(LIBX265, libx265);
REGISTER_ENCODER(LIBXAVS, libxavs);
REGISTER_ENCODER(LIBXVID, libxvid);
REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext);
REGISTER_DECODER(BINTEXT, bintext);
REGISTER_DECODER(XBIN, xbin);
REGISTER_DECODER(IDF, idf);
REGISTER_ENCODER(H263_V4L2M2M, h263_v4l2m2m);
REGISTER_ENCDEC (LIBOPENH264, libopenh264);
REGISTER_DECODER(H264_CUVID, h264_cuvid);
REGISTER_ENCODER(H264_NVENC, h264_nvenc);
REGISTER_ENCODER(H264_OMX, h264_omx);
REGISTER_ENCODER(H264_QSV, h264_qsv);
REGISTER_ENCODER(H264_V4L2M2M, h264_v4l2m2m);
REGISTER_ENCODER(H264_VAAPI, h264_vaapi);
REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox);
#if FF_API_NVENC_OLD_NAME
REGISTER_ENCODER(NVENC, nvenc);
REGISTER_ENCODER(NVENC_H264, nvenc_h264);
REGISTER_ENCODER(NVENC_HEVC, nvenc_hevc);
#endif
REGISTER_DECODER(HEVC_CUVID, hevc_cuvid);
REGISTER_DECODER(HEVC_MEDIACODEC, hevc_mediacodec);
REGISTER_ENCODER(HEVC_NVENC, hevc_nvenc);
REGISTER_ENCODER(HEVC_QSV, hevc_qsv);
REGISTER_ENCODER(HEVC_V4L2M2M, hevc_v4l2m2m);
REGISTER_ENCODER(HEVC_VAAPI, hevc_vaapi);
REGISTER_ENCODER(HEVC_VIDEOTOOLBOX, hevc_videotoolbox);
REGISTER_ENCODER(LIBKVAZAAR, libkvazaar);
REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid);
REGISTER_ENCODER(MJPEG_QSV, mjpeg_qsv);
REGISTER_ENCODER(MJPEG_VAAPI, mjpeg_vaapi);
REGISTER_DECODER(MPEG1_CUVID, mpeg1_cuvid);
REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid);
REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_ENCODER(MPEG2_VAAPI, mpeg2_vaapi);
REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_DECODER(MPEG4_MEDIACODEC, mpeg4_mediacodec);
REGISTER_ENCODER(MPEG4_V4L2M2M, mpeg4_v4l2m2m);
REGISTER_DECODER(VC1_CUVID, vc1_cuvid);
REGISTER_DECODER(VP8_CUVID, vp8_cuvid);
REGISTER_DECODER(VP8_MEDIACODEC, vp8_mediacodec);
REGISTER_DECODER(VP8_QSV, vp8_qsv);
REGISTER_ENCODER(VP8_V4L2M2M, vp8_v4l2m2m);
REGISTER_ENCODER(VP8_VAAPI, vp8_vaapi);
REGISTER_DECODER(VP9_CUVID, vp9_cuvid);
REGISTER_DECODER(VP9_MEDIACODEC, vp9_mediacodec);
REGISTER_ENCODER(VP9_VAAPI, vp9_vaapi);
REGISTER_PARSER(AAC, aac);
REGISTER_PARSER(AAC_LATM, aac_latm);
REGISTER_PARSER(AC3, ac3);
REGISTER_PARSER(ADX, adx);
REGISTER_PARSER(BMP, bmp);
REGISTER_PARSER(CAVSVIDEO, cavsvideo);
REGISTER_PARSER(COOK, cook);
REGISTER_PARSER(DCA, dca);
REGISTER_PARSER(DIRAC, dirac);
REGISTER_PARSER(DNXHD, dnxhd);
REGISTER_PARSER(DPX, dpx);
REGISTER_PARSER(DVAUDIO, dvaudio);
REGISTER_PARSER(DVBSUB, dvbsub);
REGISTER_PARSER(DVDSUB, dvdsub);
REGISTER_PARSER(DVD_NAV, dvd_nav);
REGISTER_PARSER(FLAC, flac);
REGISTER_PARSER(G729, g729);
REGISTER_PARSER(GSM, gsm);
REGISTER_PARSER(H261, h261);
REGISTER_PARSER(H263, h263);
REGISTER_PARSER(H264, h264);
REGISTER_PARSER(HEVC, hevc);
REGISTER_PARSER(MJPEG, mjpeg);
REGISTER_PARSER(MLP, mlp);
REGISTER_PARSER(MPEG4VIDEO, mpeg4video);
REGISTER_PARSER(MPEGAUDIO, mpegaudio);
REGISTER_PARSER(MPEGVIDEO, mpegvideo);
REGISTER_PARSER(OPUS, opus);
REGISTER_PARSER(PNG, png);
REGISTER_PARSER(PNM, pnm);
REGISTER_PARSER(RV30, rv30);
REGISTER_PARSER(RV40, rv40);
REGISTER_PARSER(SIPR, sipr);
REGISTER_PARSER(TAK, tak);
REGISTER_PARSER(VC1, vc1);
REGISTER_PARSER(VORBIS, vorbis);
REGISTER_PARSER(VP3, vp3);
REGISTER_PARSER(VP8, vp8);
REGISTER_PARSER(VP9, vp9);
REGISTER_PARSER(XMA, xma);
} | 1threat |
A strangely frustrating Java Syntax error : <p>I just can't figure out what is wrong here, I always get the error
"Syntax error on token "=", Expression expected after this token",
but I just cannot figure out what this means.</p>
<pre><code> import java.util.Arrays;
public class Zeitmessen {
public static void main(String[] args) {
int zahl = 1;
while (zahl <= 8) {
long zeit = System.currentTimeMillis();
double[][] quicktipp = new double[zahl][6];
for (int i = 0; i < quicktipp[0].length; i++) {
double random = (int) (Math.random() * 45);
zahl++;
quicktipp = [zahl][6];
quicktipp[0][i] = random;
zahl++;
quicktipp[1][i] = random;
zahl++;
quicktipp[2][i] = random;
zahl++;
quicktipp[3][i] = random;
zahl++;
quicktipp[4][i] = random;
zahl++;
quicktipp[5][i] = random;
zahl++;
quicktipp[6][i] = random;
zahl++;
quicktipp[7][i] = random;
}
for (int x = 0; x < quicktipp.length; x++) {
System.out.println(Arrays.toString(quicktipp[x]));
}
zeit = System.currentTimeMillis() - zeit;
System.out.println(zeit);
System.out.println("");
}
}
</code></pre>
<p>}</p>
<pre><code> quicktipp = [zahl][6];
</code></pre>
<p>here I get the error</p>
<p>Can somebody please help me?</p>
| 0debug |
"prototype does not match any class" error when separating into .h and .cpp files : <p>Writing a program for a game of "Mastermind". In one of my classes, code, I have seperated it into .h and .cpp files and I'm not sure why my cpp file keeps giving me this error when compiling: Error: prototype for 'int code :: getVector()' does not match any class in 'code'</p>
<p>To my knowledge I have the correct header for getVector() in my code.h file:</p>
<pre><code>#include <vector>
#include <iostream>
#ifndef CODE_H
#define CODE_H
using namespace std;
class code //strores code vector and checks for correct and incorrect numbers
{
private:
vector<int> codeVector {0,0,0,0}; //vector storing code (guess and secret code depending on object)
public:
vector<int> getVector(); //retrievs private codeVector
void setCodeVectorToGuess(vector<int> guess); //sets private codeVector to vector passed in
void setCodeVectorToSecretCode(); //uses rand function to set random secret code vector
int checkCorrect(code guessObject); //uses for loop to check what values are correct number correct location by checking equivalence at each vector index
int checkIncorrect(code guessObject); //checks numbers between the two vectors using two for loops which each replace values in the vectors with non-equivalent out-of-range numbers
};
#endif // CODE_H
</code></pre>
<p>and the right syntax in my .cpp file:</p>
<pre><code>#include <iostream>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "code.h"
using namespace std;
//code :: codeVector = {0,0,0,0};
code :: getVector() //retrieves private codeVector
{
return codeVector;
}
code :: setCodeVectorToGuess(vector<int> guess) //sets private codeVector to vector passed in
{
codeVector = guess;
}
code :: setCodeVectorToSecretCode() //uses rand function to set random secret code vector
{
srand (time(NULL));
codeVector = {rand() % 5 + 1, rand() % 5 + 1, rand() % 5 + 1, rand() % 5 + 1};
}
code :: checkCorrect(code guessObject) //uses simple for loop to check what values are correct number correct location
{
int correctPlaceCorrectNum = 0;
vector<int> guessVector;
guessVector = guessObject.getVector();
for (int o=0; o<codeVector.size(); o++)
{
if (codeVector[o] == guessVector[o])
{
correctPlaceCorrectNum ++;
}
}
return correctPlaceCorrectNum;
}
code :: checkIncorrect(code guessObject) //checks numbers between the two vectors using two for loops which each replace values in the vectors with non-equivalent out-of-range numbers
{
int incorrectPlaceCorrectNum = 0;
int counter(0), counter2(0);
int array1[8] = {6,7,8,9}; //two arrays used for the elimination of vector values by substitution of non-equivalent values
int array2[8] = {10,11,12,13}; //
vector<int> secretCodeVector {0,0,0,0}; //copy of secret code vector
secretCodeVector = getVector();
vector<int> guessVector {0,0,0,0}; //copy of guess vector
guessVector = guessObject.getVector();
for (int u=0; u<secretCodeVector.size(); u++) //checks and replaces all correct number correct location values in secret code vector
{
if (secretCodeVector[u] == guessVector[u])
{
secretCodeVector[u] = array1[counter];
counter++;
}
}
for (int i=0; i<secretCodeVector.size(); i++) //checks and replaces all correct number incorrect location values in both vectors
{
for (int l=0; l<secretCodeVector.size(); l++) //checks each digit of secret code with all digits of guess code
{
if (secretCodeVector[i] == guessVector[l])
{
secretCodeVector[i] = array1[counter];
guessVector[l] = array2[counter2];
incorrectPlaceCorrectNum++;
counter++;
counter2++;
break;
}
}
}
return incorrectPlaceCorrectNum;
}
</code></pre>
| 0debug |
Number of Integers : <p>Write a function that receives a string as input and returns the number of integer numbers present in every token from the string. Example:</p>
<p>Input: potato 123 potato potata 1 23423p 12/4 test </p>
<p>Output: 2</p>
<p>This is the code that I have tried, but it doesn't work</p>
<pre><code>import re
text = input("Enter a sentence both string and intenger: ")
print("The original sting: " + text)
temp = re.findall(r'\d+', text)
res = list(map(int, temp))
print("The numbers list is: " + str(res))
</code></pre>
| 0debug |
Docker container keeps restarting : <p>I was trying rancher.
I used the command:
sudo docker run -d --restart=always -p 8080:8080 rancher/server
to start run it.
Then I stopped the container and removed it. But if I stop and restart the docker daemon or reboot my laptop, and lookup running containers using docker ps command, it will have rancher server running again. How do I stop/remove it completely and make sure it will not run again. </p>
| 0debug |
static void char_socket_test(void)
{
Chardev *chr = qemu_chr_new("server", "tcp:127.0.0.1:0,server,nowait");
Chardev *chr_client;
QObject *addr;
QDict *qdict, *data;
const char *port;
SocketIdleData d = { .chr = chr };
CharBackend be;
CharBackend client_be;
char *tmp;
d.be = &be;
d.client_be = &be;
g_assert_nonnull(chr);
g_assert(!object_property_get_bool(OBJECT(chr), "connected", &error_abort));
addr = object_property_get_qobject(OBJECT(chr), "addr", &error_abort);
qdict = qobject_to_qdict(addr);
data = qdict_get_qdict(qdict, "data");
port = qdict_get_str(data, "port");
tmp = g_strdup_printf("tcp:127.0.0.1:%s", port);
QDECREF(qdict);
qemu_chr_fe_init(&be, chr, &error_abort);
qemu_chr_fe_set_handlers(&be, socket_can_read, socket_read,
NULL, &d, NULL, true);
chr_client = qemu_chr_new("client", tmp);
qemu_chr_fe_init(&client_be, chr_client, &error_abort);
qemu_chr_fe_set_handlers(&client_be, socket_can_read_hello,
socket_read_hello,
NULL, &d, NULL, true);
g_free(tmp);
d.conn_expected = true;
guint id = g_idle_add(char_socket_test_idle, &d);
g_source_set_name_by_id(id, "test-idle");
g_assert_cmpint(id, >, 0);
main_loop();
g_assert(object_property_get_bool(OBJECT(chr), "connected", &error_abort));
g_assert(object_property_get_bool(OBJECT(chr_client),
"connected", &error_abort));
qemu_chr_write_all(chr_client, (const uint8_t *)"Z", 1);
main_loop();
object_unparent(OBJECT(chr_client));
d.conn_expected = false;
g_idle_add(char_socket_test_idle, &d);
main_loop();
object_unparent(OBJECT(chr));
}
| 1threat |
static int output_packet(InputStream *ist, int ist_index,
OutputStream *ost_table, int nb_ostreams,
const AVPacket *pkt)
{
AVFormatContext *os;
OutputStream *ost;
int ret, i;
int got_output;
void *buffer_to_free = NULL;
static unsigned int samples_size= 0;
AVSubtitle subtitle, *subtitle_to_free;
int64_t pkt_pts = AV_NOPTS_VALUE;
#if CONFIG_AVFILTER
int frame_available;
#endif
float quality;
AVPacket avpkt;
int bps = av_get_bytes_per_sample(ist->st->codec->sample_fmt);
if(ist->next_pts == AV_NOPTS_VALUE)
ist->next_pts= ist->pts;
if (pkt == NULL) {
av_init_packet(&avpkt);
avpkt.data = NULL;
avpkt.size = 0;
goto handle_eof;
} else {
avpkt = *pkt;
}
if(pkt->dts != AV_NOPTS_VALUE)
ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q);
if(pkt->pts != AV_NOPTS_VALUE)
pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q);
while (avpkt.size > 0 || (!pkt && got_output)) {
uint8_t *data_buf, *decoded_data_buf;
int data_size, decoded_data_size;
AVFrame *decoded_frame, *filtered_frame;
handle_eof:
ist->pts= ist->next_pts;
if(avpkt.size && avpkt.size != pkt->size)
av_log(NULL, ist->showed_multi_packet_warning ? AV_LOG_VERBOSE : AV_LOG_WARNING,
"Multiple frames in a packet from stream %d\n", pkt->stream_index);
ist->showed_multi_packet_warning=1;
decoded_frame = filtered_frame = NULL;
decoded_data_buf = NULL;
decoded_data_size= 0;
data_buf = avpkt.data;
data_size = avpkt.size;
subtitle_to_free = NULL;
if (ist->decoding_needed) {
switch(ist->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:{
if(pkt && samples_size < FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE)) {
samples_size = FFMAX(pkt->size*sizeof(*samples), AVCODEC_MAX_AUDIO_FRAME_SIZE);
av_free(samples);
samples= av_malloc(samples_size);
}
decoded_data_size= samples_size;
ret = avcodec_decode_audio3(ist->st->codec, samples, &decoded_data_size,
&avpkt);
if (ret < 0)
return ret;
avpkt.data += ret;
avpkt.size -= ret;
data_size = ret;
got_output = decoded_data_size > 0;
if (!got_output) {
continue;
}
decoded_data_buf = (uint8_t *)samples;
ist->next_pts += ((int64_t)AV_TIME_BASE/bps * decoded_data_size) /
(ist->st->codec->sample_rate * ist->st->codec->channels);
break;}
case AVMEDIA_TYPE_VIDEO:
decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2;
if (!(decoded_frame = avcodec_alloc_frame()))
return AVERROR(ENOMEM);
avpkt.pts = pkt_pts;
avpkt.dts = ist->pts;
pkt_pts = AV_NOPTS_VALUE;
ret = avcodec_decode_video2(ist->st->codec,
decoded_frame, &got_output, &avpkt);
quality = same_quant ? decoded_frame->quality : 0;
if (ret < 0)
goto fail;
if (!got_output) {
av_freep(&decoded_frame);
goto discard_packet;
}
ist->next_pts = ist->pts = decoded_frame->best_effort_timestamp;
if (ist->st->codec->time_base.num != 0) {
int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
ist->next_pts += ((int64_t)AV_TIME_BASE *
ist->st->codec->time_base.num * ticks) /
ist->st->codec->time_base.den;
}
avpkt.size = 0;
buffer_to_free = NULL;
pre_process_video_frame(ist, (AVPicture *)decoded_frame, &buffer_to_free);
break;
case AVMEDIA_TYPE_SUBTITLE:
ret = avcodec_decode_subtitle2(ist->st->codec,
&subtitle, &got_output, &avpkt);
if (ret < 0)
return ret;
if (!got_output) {
goto discard_packet;
}
subtitle_to_free = &subtitle;
avpkt.size = 0;
break;
default:
return -1;
}
} else {
switch(ist->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
ist->next_pts += ((int64_t)AV_TIME_BASE * ist->st->codec->frame_size) /
ist->st->codec->sample_rate;
break;
case AVMEDIA_TYPE_VIDEO:
if (ist->st->codec->time_base.num != 0) {
int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame;
ist->next_pts += ((int64_t)AV_TIME_BASE *
ist->st->codec->time_base.num * ticks) /
ist->st->codec->time_base.den;
}
break;
}
avpkt.size = 0;
}
#if CONFIG_AVFILTER
if(ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO)
for(i=0;i<nb_ostreams;i++) {
OutputFile *of = &output_files[ost_table[i].file_index];
if (of->start_time == 0 || ist->pts >= of->start_time) {
ost = &ost_table[i];
if (ost->input_video_filter && ost->source_index == ist_index) {
if (!decoded_frame->sample_aspect_ratio.num)
decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio;
decoded_frame->pts = ist->pts;
av_vsrc_buffer_add_frame(ost->input_video_filter, decoded_frame, AV_VSRC_BUF_FLAG_OVERWRITE);
}
}
}
#endif
if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
if (audio_volume != 256) {
short *volp;
volp = samples;
for(i=0;i<(decoded_data_size / sizeof(short));i++) {
int v = ((*volp) * audio_volume + 128) >> 8;
*volp++ = av_clip_int16(v);
}
}
}
if (input_files[ist->file_index].rate_emu) {
int64_t pts = av_rescale(ist->pts, 1000000, AV_TIME_BASE);
int64_t now = av_gettime() - ist->start;
if (pts > now)
usleep(pts - now);
}
for (i = 0; i < nb_ostreams; i++) {
OutputFile *of = &output_files[ost_table[i].file_index];
int frame_size;
ost = &ost_table[i];
if (ost->source_index != ist_index)
continue;
if (of->start_time && ist->pts < of->start_time)
continue;
if (of->recording_time != INT64_MAX &&
av_compare_ts(ist->pts, AV_TIME_BASE_Q, of->recording_time + of->start_time,
(AVRational){1, 1000000}) >= 0) {
ost->is_past_recording_time = 1;
continue;
}
#if CONFIG_AVFILTER
frame_available = ist->st->codec->codec_type != AVMEDIA_TYPE_VIDEO ||
!ost->output_video_filter || avfilter_poll_frame(ost->output_video_filter->inputs[0]);
while (frame_available) {
if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ost->output_video_filter) {
AVRational ist_pts_tb = ost->output_video_filter->inputs[0]->time_base;
if (av_buffersink_get_buffer_ref(ost->output_video_filter, &ost->picref, 0) < 0)
goto cont;
if (!filtered_frame && !(filtered_frame = avcodec_alloc_frame())) {
ret = AVERROR(ENOMEM);
goto fail;
}
*filtered_frame= *decoded_frame;
if (ost->picref) {
avfilter_fill_frame_from_video_buffer_ref(filtered_frame, ost->picref);
ist->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q);
}
}
#else
filtered_frame = decoded_frame;
#endif
os = output_files[ost->file_index].ctx;
if (ost->encoding_needed) {
av_assert0(ist->decoding_needed);
switch(ost->st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
do_audio_out(os, ost, ist, decoded_data_buf, decoded_data_size);
break;
case AVMEDIA_TYPE_VIDEO:
#if CONFIG_AVFILTER
if (ost->picref->video && !ost->frame_aspect_ratio)
ost->st->codec->sample_aspect_ratio = ost->picref->video->sample_aspect_ratio;
#endif
do_video_out(os, ost, ist, filtered_frame, &frame_size,
same_quant ? quality : ost->st->codec->global_quality);
if (vstats_filename && frame_size)
do_video_stats(os, ost, frame_size);
break;
case AVMEDIA_TYPE_SUBTITLE:
do_subtitle_out(os, ost, ist, &subtitle,
pkt->pts);
break;
default:
abort();
}
} else {
AVPicture pict;
AVPacket opkt;
int64_t ost_tb_start_time= av_rescale_q(of->start_time, AV_TIME_BASE_Q, ost->st->time_base);
av_init_packet(&opkt);
if ((!ost->frame_number && !(pkt->flags & AV_PKT_FLAG_KEY)) && !copy_initial_nonkeyframes)
#if !CONFIG_AVFILTER
continue;
#else
goto cont;
#endif
if(ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
audio_size += data_size;
else if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
video_size += data_size;
ost->sync_opts++;
}
opkt.stream_index= ost->index;
if(pkt->pts != AV_NOPTS_VALUE)
opkt.pts= av_rescale_q(pkt->pts, ist->st->time_base, ost->st->time_base) - ost_tb_start_time;
else
opkt.pts= AV_NOPTS_VALUE;
if (pkt->dts == AV_NOPTS_VALUE)
opkt.dts = av_rescale_q(ist->pts, AV_TIME_BASE_Q, ost->st->time_base);
else
opkt.dts = av_rescale_q(pkt->dts, ist->st->time_base, ost->st->time_base);
opkt.dts -= ost_tb_start_time;
opkt.duration = av_rescale_q(pkt->duration, ist->st->time_base, ost->st->time_base);
opkt.flags= pkt->flags;
if( ost->st->codec->codec_id != CODEC_ID_H264
&& ost->st->codec->codec_id != CODEC_ID_MPEG1VIDEO
&& ost->st->codec->codec_id != CODEC_ID_MPEG2VIDEO
) {
if(av_parser_change(ist->st->parser, ost->st->codec, &opkt.data, &opkt.size, data_buf, data_size, pkt->flags & AV_PKT_FLAG_KEY))
opkt.destruct= av_destruct_packet;
} else {
opkt.data = data_buf;
opkt.size = data_size;
}
if (os->oformat->flags & AVFMT_RAWPICTURE) {
avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height);
opkt.data = (uint8_t *)&pict;
opkt.size = sizeof(AVPicture);
opkt.flags |= AV_PKT_FLAG_KEY;
}
write_frame(os, &opkt, ost->st->codec, ost->bitstream_filters);
ost->st->codec->frame_number++;
ost->frame_number++;
av_free_packet(&opkt);
}
#if CONFIG_AVFILTER
cont:
frame_available = (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) &&
ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]);
avfilter_unref_buffer(ost->picref);
}
av_freep(&filtered_frame);
#endif
}
fail:
av_free(buffer_to_free);
if (subtitle_to_free) {
avsubtitle_free(subtitle_to_free);
subtitle_to_free = NULL;
}
av_freep(&decoded_frame);
if (ret < 0)
return ret;
}
discard_packet:
return 0;
}
| 1threat |
IEnumberable<<anonymous type canot be convert to IEnumerable<DataRow> C# : <p>I want to insert a Linq query into a Datatable but i get the following error
IEnumberable"<<" anonymous type canot be convert to IEnumerable. Why i get this Error and how to fix it?</p>
<pre><code>IEnumerable<DataRow> sql = from dr in Csvdaten.AsEnumerable()
join dr2 in Csvimportdaten.AsEnumerable() on dr.Field<string>("customer_id_spam") equals dr2.Field<string>("customer_id_spam")
select new
{
CAMPAIGN_ID = Convert.ToInt32(dr2["CAMPAIGN_ID"]),
MEDIUM_CODE = Convert.ToString(dr2["MEDIUM_CODE"])
};
DataTable dt = sql.CopyToDataTable();
</code></pre>
| 0debug |
How to set ANDROID_HOME path in windows environment? : <p>Unable to set How to set ANDROID_HOME path in windows environment.</p>
<p>Please provide the steps.</p>
| 0debug |
Can I build UWP with .NET Core? : <p>As I know that the .net-core can run UWP, can we build or write UWP with Core?
I've read the <a href="https://msdn.microsoft.com/en-us/magazine/mt694084.aspx" rel="noreferrer">https://msdn.microsoft.com/en-us/magazine/mt694084.aspx</a></p>
| 0debug |
static int get_transform_coeffs(AC3DecodeContext * ctx)
{
int i;
ac3_audio_block *ab = &ctx->audio_block;
float *samples = ctx->samples;
int got_cplchan = 0;
int dithflag = 0;
samples += (ctx->bsi.flags & AC3_BSI_LFEON) ? 256 : 0;
for (i = 0; i < ctx->bsi.nfchans; i++) {
if ((ab->flags & AC3_AB_CPLINU) && (ab->chincpl & (1 << i)))
dithflag = 0;
else
dithflag = ab->dithflag & (1 << i);
if (_get_transform_coeffs(ab->dexps[i], ab->bap[i], ab->chcoeffs[i], samples + (i * 256),
0, ab->endmant[i], dithflag, &ctx->gb, &ctx->state))
return -1;
if ((ab->flags & AC3_AB_CPLINU) && (ab->chincpl & (1 << i)) && !got_cplchan) {
if (_get_transform_coeffs(ab->dcplexps, ab->cplbap, 1.0f, ab->cplcoeffs,
ab->cplstrtmant, ab->cplendmant, 0, &ctx->gb, &ctx->state))
return -1;
got_cplchan = 1;
}
}
if (ctx->bsi.flags & AC3_BSI_LFEON)
if (_get_transform_coeffs(ab->lfeexps, ab->lfebap, 1.0f, samples - 256, 0, 7, 0, &ctx->gb, &ctx->state))
return -1;
if (ab->flags & AC3_AB_CPLINU)
if (uncouple_channels(ctx))
return -1;
return 0;
}
| 1threat |
I need to export my table datas to .csv file using codeignitor : I am using codeignitor, I have listed records from a table. I want to download all the records to excel. I have used PHPExcel library but it was not supporting. Could you please help to how to achieve it. | 0debug |
Why XPath exaluate gives snapshotLength = 1 for /html/body and 0 for /html/body/div[3]/div[3]/div/div[6]/div[2]/div/div/div : could you tell me why XPath exaluate gives
snapshotLength = 1 for /html/body
and 0 for
/html/body/div[3]/div[3]/div/div[6]/div[2]/div/div/div
The longer XPath is for real, calculated by Firepath for an object on this page
[http://srv1.yogh.io/#mine:height:0][1]
I run the following script in Greasemonkey
[1]: http://srv1.yogh.io/#mine:height:0
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
// ==UserScript==
// @name xpath greasemonkey
// @namespace bbb
// @description f
// @match http://srv1.yogh.io/#mine:height:0
// @version 1
// @grant none
// ==/UserScript==
var allLinks, thisLink;
console.log("dfsdsdsdfg");
allLinks = document.evaluate(
"/html/body/div",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
// for (var i = 0; i < allLinks.snapshotLength; i++) {
// thisLink = allLinks.snapshotItem(i);
// console.log("found");
// }
console.log(allLinks.snapshotLength)
// /html/body/div[3]/div[3]/div/div[6]/div[2]/div/div/div
<!-- end snippet -->
I would like the code to find the XPathed DIV object on web page
highlight it and return via console.log as:
<div class="gwt-Label">2083236893</div>
for postprocessing to read string 2083236893 via
.innerText or .innerHTML
Any idea or any working script demo to work in GM or in Fiddle ?
thank you
| 0debug |
static void id3v2_read_ttag(AVFormatContext *s, int taglen, char *dst, int dstlen)
{
char *q;
int len;
if(dstlen > 0)
dst[0]= 0;
if(taglen < 1)
return;
taglen--;
dstlen--;
switch(get_byte(s->pb)) {
case 0:
q = dst;
while(taglen--) {
uint8_t tmp;
PUT_UTF8(get_byte(s->pb), tmp, if (q - dst < dstlen - 1) *q++ = tmp;)
}
*q = '\0';
break;
case 3:
len = FFMIN(taglen, dstlen);
get_buffer(s->pb, dst, len);
dst[len] = 0;
break;
}
}
| 1threat |
void iothread_stop_all(void)
{
Object *container = object_get_objects_root();
BlockDriverState *bs;
BdrvNextIterator it;
for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
AioContext *ctx = bdrv_get_aio_context(bs);
if (ctx == qemu_get_aio_context()) {
continue;
}
aio_context_acquire(ctx);
bdrv_set_aio_context(bs, qemu_get_aio_context());
aio_context_release(ctx);
}
object_child_foreach(container, iothread_stop, NULL);
}
| 1threat |
static bool get_phys_addr(CPUARMState *env, target_ulong address,
MMUAccessType access_type, ARMMMUIdx mmu_idx,
hwaddr *phys_ptr, MemTxAttrs *attrs, int *prot,
target_ulong *page_size, uint32_t *fsr,
ARMMMUFaultInfo *fi)
{
if (mmu_idx == ARMMMUIdx_S12NSE0 || mmu_idx == ARMMMUIdx_S12NSE1) {
if (arm_feature(env, ARM_FEATURE_EL2)) {
hwaddr ipa;
int s2_prot;
int ret;
ret = get_phys_addr(env, address, access_type,
stage_1_mmu_idx(mmu_idx), &ipa, attrs,
prot, page_size, fsr, fi);
if (ret || regime_translation_disabled(env, ARMMMUIdx_S2NS)) {
*phys_ptr = ipa;
return ret;
}
ret = get_phys_addr_lpae(env, ipa, access_type, ARMMMUIdx_S2NS,
phys_ptr, attrs, &s2_prot,
page_size, fsr, fi);
fi->s2addr = ipa;
*prot &= s2_prot;
return ret;
} else {
mmu_idx = stage_1_mmu_idx(mmu_idx);
}
}
attrs->secure = regime_is_secure(env, mmu_idx);
attrs->user = regime_is_user(env, mmu_idx);
if (address < 0x02000000 && mmu_idx != ARMMMUIdx_S2NS
&& !arm_feature(env, ARM_FEATURE_V8)) {
if (regime_el(env, mmu_idx) == 3) {
address += env->cp15.fcseidr_s;
} else {
address += env->cp15.fcseidr_ns;
}
}
if (arm_feature(env, ARM_FEATURE_PMSA)) {
bool ret;
*page_size = TARGET_PAGE_SIZE;
if (arm_feature(env, ARM_FEATURE_V8)) {
ret = get_phys_addr_pmsav8(env, address, access_type, mmu_idx,
phys_ptr, prot, fsr);
} else if (arm_feature(env, ARM_FEATURE_V7)) {
ret = get_phys_addr_pmsav7(env, address, access_type, mmu_idx,
phys_ptr, prot, fsr);
} else {
ret = get_phys_addr_pmsav5(env, address, access_type, mmu_idx,
phys_ptr, prot, fsr);
}
qemu_log_mask(CPU_LOG_MMU, "PMSA MPU lookup for %s at 0x%08" PRIx32
" mmu_idx %u -> %s (prot %c%c%c)\n",
access_type == MMU_DATA_LOAD ? "reading" :
(access_type == MMU_DATA_STORE ? "writing" : "execute"),
(uint32_t)address, mmu_idx,
ret ? "Miss" : "Hit",
*prot & PAGE_READ ? 'r' : '-',
*prot & PAGE_WRITE ? 'w' : '-',
*prot & PAGE_EXEC ? 'x' : '-');
return ret;
}
if (regime_translation_disabled(env, mmu_idx)) {
*phys_ptr = address;
*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
*page_size = TARGET_PAGE_SIZE;
return 0;
}
if (regime_using_lpae_format(env, mmu_idx)) {
return get_phys_addr_lpae(env, address, access_type, mmu_idx, phys_ptr,
attrs, prot, page_size, fsr, fi);
} else if (regime_sctlr(env, mmu_idx) & SCTLR_XP) {
return get_phys_addr_v6(env, address, access_type, mmu_idx, phys_ptr,
attrs, prot, page_size, fsr, fi);
} else {
return get_phys_addr_v5(env, address, access_type, mmu_idx, phys_ptr,
prot, page_size, fsr, fi);
}
}
| 1threat |
static void qfloat_destroy_obj(QObject *obj)
{
assert(obj != NULL);
g_free(qobject_to_qfloat(obj));
}
| 1threat |
Why do I keep getting this indexing erorr? : I keep getting StringIndexOutOfBoundsException. I'm trying to take a String and replace each letter with the one after it, then return the new manipulated String. For example, "Hey", is "Ifz".
I've tried changing the indexing but nothing is working.
String change = "";
char[] alpha = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
for(int i = 0; i < alpha.length; i++) {
if(str.charAt(i) == alpha[i]) {
change =+ str.charAt(i+1) + "";
}
}
return change;
}
public static void main (String[] args) {
// keep this function call here
Scanner s = new Scanner(System.in);
System.out.print(LetterChanges(s.nextLine()));
}
I've already tried to change the indexing. | 0debug |
static int get_std_framerate(int i){
if(i<60*12) return i*1001;
else return ((const int[]){24,30,60,12,15,48})[i-60*12]*1000*12;
}
| 1threat |
static void virtio_scsi_handle_event(VirtIODevice *vdev, VirtQueue *vq)
{
VirtIOSCSI *s = VIRTIO_SCSI(vdev);
if (s->ctx && !s->dataplane_started) {
virtio_scsi_dataplane_start(s);
return;
}
if (s->events_dropped) {
virtio_scsi_push_event(s, NULL, VIRTIO_SCSI_T_NO_EVENT, 0);
}
}
| 1threat |
I need sql query for below table : I've two integer columns and need to display consecutive one's
ID NUM
1 1
2 1
3 1
4 2
5 1
6 2
7 2
Expected O/P:
id num
1 1
2 1
3 1 | 0debug |
int qemu_read_password(char *buf, int buf_size)
{
uint8_t ch;
int i, ret;
printf("password: ");
fflush(stdout);
term_init();
i = 0;
for (;;) {
ret = read(0, &ch, 1);
if (ret == -1) {
if (errno == EAGAIN || errno == EINTR) {
continue;
} else {
break;
}
} else if (ret == 0) {
ret = -1;
break;
} else {
if (ch == '\r') {
ret = 0;
break;
}
if (i < (buf_size - 1)) {
buf[i++] = ch;
}
}
}
term_exit();
buf[i] = '\0';
printf("\n");
return ret;
}
| 1threat |
static int dirac_unpack_idwt_params(DiracContext *s)
{
GetBitContext *gb = &s->gb;
int i, level;
unsigned tmp;
#define CHECKEDREAD(dst, cond, errmsg) \
tmp = svq3_get_ue_golomb(gb); \
if (cond) { \
av_log(s->avctx, AV_LOG_ERROR, errmsg); \
return -1; \
}\
dst = tmp;
align_get_bits(gb);
s->zero_res = s->num_refs ? get_bits1(gb) : 0;
if (s->zero_res)
return 0;
CHECKEDREAD(s->wavelet_idx, tmp > 6, "wavelet_idx is too big\n")
CHECKEDREAD(s->wavelet_depth, tmp > MAX_DWT_LEVELS || tmp < 1, "invalid number of DWT decompositions\n")
if (!s->low_delay) {
if (get_bits1(gb)) {
for (i = 0; i <= s->wavelet_depth; i++) {
CHECKEDREAD(s->codeblock[i].width , tmp < 1, "codeblock width invalid\n")
CHECKEDREAD(s->codeblock[i].height, tmp < 1, "codeblock height invalid\n")
}
CHECKEDREAD(s->codeblock_mode, tmp > 1, "unknown codeblock mode\n")
} else
for (i = 0; i <= s->wavelet_depth; i++)
s->codeblock[i].width = s->codeblock[i].height = 1;
} else {
s->lowdelay.num_x = svq3_get_ue_golomb(gb);
s->lowdelay.num_y = svq3_get_ue_golomb(gb);
s->lowdelay.bytes.num = svq3_get_ue_golomb(gb);
s->lowdelay.bytes.den = svq3_get_ue_golomb(gb);
if (s->lowdelay.bytes.den <= 0) {
av_log(s->avctx,AV_LOG_ERROR,"Invalid lowdelay.bytes.den\n");
return AVERROR_INVALIDDATA;
}
if (get_bits1(gb)) {
av_log(s->avctx,AV_LOG_DEBUG,"Low Delay: Has Custom Quantization Matrix!\n");
s->lowdelay.quant[0][0] = svq3_get_ue_golomb(gb);
for (level = 0; level < s->wavelet_depth; level++) {
s->lowdelay.quant[level][1] = svq3_get_ue_golomb(gb);
s->lowdelay.quant[level][2] = svq3_get_ue_golomb(gb);
s->lowdelay.quant[level][3] = svq3_get_ue_golomb(gb);
}
} else {
if (s->wavelet_depth > 4) {
av_log(s->avctx,AV_LOG_ERROR,"Mandatory custom low delay matrix missing for depth %d\n", s->wavelet_depth);
return AVERROR_INVALIDDATA;
}
for (level = 0; level < s->wavelet_depth; level++)
for (i = 0; i < 4; i++) {
s->lowdelay.quant[level][i] = default_qmat[s->wavelet_idx][level][i];
if (s->wavelet_idx == 3)
s->lowdelay.quant[level][i] += 4*(s->wavelet_depth-1 - level);
}
}
}
return 0;
}
| 1threat |
Typescript how to move child nodes in array to parent array? : <p>Here is my json</p>
<pre><code>[{"Name":"Ancil Abdul Rahuman","map":{"Core Java":null,"JSP":null,"HTML":"Level 1: Proficient","JavaScript":null,"Spring MVC":null,"SOAP":null,"REST Web Services":null,"Oracle DB":null,"Tomcat":null}},{"Name":"Neha Agrawal","map":{"Core Java":null,"JSP":null,"HTML":null,"JavaScript":null,"Spring MVC":null,"SOAP":null,"REST Web Services":null,"Oracle DB":null,"Tomcat":null}}]
</code></pre>
<p>I need to move the items from the "map" array into the level where it says "Name"</p>
<p>I tried
to use map.map but it gives an error</p>
| 0debug |
static int write_elf32_load(DumpState *s, MemoryMapping *memory_mapping,
int phdr_index, target_phys_addr_t offset)
{
Elf32_Phdr phdr;
int ret;
int endian = s->dump_info.d_endian;
memset(&phdr, 0, sizeof(Elf32_Phdr));
phdr.p_type = cpu_convert_to_target32(PT_LOAD, endian);
phdr.p_offset = cpu_convert_to_target32(offset, endian);
phdr.p_paddr = cpu_convert_to_target32(memory_mapping->phys_addr, endian);
if (offset == -1) {
phdr.p_filesz = 0;
} else {
phdr.p_filesz = cpu_convert_to_target32(memory_mapping->length, endian);
}
phdr.p_memsz = cpu_convert_to_target32(memory_mapping->length, endian);
phdr.p_vaddr = cpu_convert_to_target32(memory_mapping->virt_addr, endian);
ret = fd_write_vmcore(&phdr, sizeof(Elf32_Phdr), s);
if (ret < 0) {
dump_error(s, "dump: failed to write program header table.\n");
return -1;
}
return 0;
}
| 1threat |
Proc syntax in Haskell Arrows leads to severe performance penalty : <p>Using <code>proc</code> notation for <code>Arrow</code> seems to kill performance in my project. Here is a toy example of the problem:</p>
<p>We define Coroutine newtype (mostly copying from <a href="https://github.com/leonidas/codeblog/blob/master/2012/2012-01-08-streams-coroutines.md" rel="noreferrer" title="Generalizing Streams into Coroutines">Generalizing Streams into Coroutines</a>) to represent Mealy machines (i.e. functions that carry some state) with instances of <code>Category</code> and <code>Arrow</code>, write <code>scan</code> wrapper function and <code>evalList</code> runner function for lists.</p>
<p>Then we have <code>sumArr</code> and <code>sumArr'</code> functions where the latter is the former called within <code>proc</code> block.</p>
<p>Compiling with <code>stack ghc -- --make test.hs -O2</code> using ghc-8.0.2 on OS X I get runtime of 0.087 secs for <code>sumArr</code> and 3.263 secs for <code>sumArr'</code> (with a heavy memory footprint).</p>
<p>I would like to know if this in fact caused by using <code>proc</code> and if I can do something to have normal runtime behaviour when using <code>proc</code> notation (writing arrow code without it is painful). Thank you.</p>
<pre><code>{-# LANGUAGE Arrows #-}
{-# LANGUAGE BangPatterns #-}
import Prelude hiding (id, (.))
import Control.Arrow
import Control.Category
import qualified Data.List as L
newtype Coroutine i o = Coroutine { runC :: i -> (o, Coroutine i o) }
instance Category Coroutine where
id = Coroutine $ \i -> (i, id)
cof . cog = Coroutine $ \i ->
let (x, cog') = runC cog i
(y, cof') = runC cof x
in (y, cof' . cog')
instance Arrow Coroutine where
arr f = Coroutine $ \i -> (f i, arr f)
first co = Coroutine $ \(a,b) ->
let (c, co') = runC co a in ((c,b), first co')
scan :: (o -> t -> o) -> o -> Coroutine t o
scan f = go where
go i = Coroutine $ step i where
step a b = let !a' = f a b in (a', go a')
evalList :: Coroutine a b -> [a] -> [b]
evalList a = L.map fst . L.drop 1 . L.scanl' (\(_, acc) v -> let !x = runC acc v in x) (undefined, a)
sumArr, sumArr' :: Coroutine Int Int
sumArr = scan (\acc x -> let !newAcc = acc + x in newAcc) 0
sumArr' = proc v -> do sumArr -< v
testData :: [Int]
testData = [1..1000000]
main = print $ L.last $ evalList sumArr' testData
</code></pre>
| 0debug |
display you tube video from you tube url : I want to load you tube video in my php script.
This is my you tube video url - 'https://www.youtube.com/watch?v=sDDhDmh87Yw'.
I have already tried with iframe but it can not work .
I also did some reaserch but it said that load youtube url with embed tag,but I want to load without embed tag.
Can you please help me?
Thanks | 0debug |
Check only last 3 digits of sensor output C/C++ : I have a library from WiringPi for DHT11 sensor and I need to modify condition which checks if the value read from sensor is good.
Sometimes the library reads bad values which are 255.255,255.255 or 55,255.255 etc. There is conditions in the library:
if(counter==255)
break;
But it doesn't work if the value is e.g. 55,255.255
How can I modify this condition the check last 3 digits of output?
If the output is wrong, there are always "255" at the end of value.
I tried to add conditions like
if(counter==255)
break;
else if(counter==255.255)
break;
But it doesn't solve all possible situations and I realy don't know anything about C/C++
Here is the whole library:
#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#define MAX_TIME 85
#define DHT11PIN 7
#define ATTEMPTS 5
int dht11_val[5]={0,0,0,0,0};
int dht11_read_val()
{
uint8_t lststate=HIGH;
uint8_t counter=0;
uint8_t j=0,i;
for(i=0;i<5;i++)
dht11_val[i]=0;
pinMode(DHT11PIN,OUTPUT);
digitalWrite(DHT11PIN,LOW);
delay(18);
digitalWrite(DHT11PIN,HIGH);
delayMicroseconds(40);
pinMode(DHT11PIN,INPUT);
for(i=0;i<MAX_TIME;i++)
{
counter=0;
while(digitalRead(DHT11PIN)==lststate){
counter++;
delayMicroseconds(1);
if(counter==255)
break;
}
lststate=digitalRead(DHT11PIN);
if(counter==255)
break;
// top 3 transistions are ignored
if((i>=4)&&(i%2==0)){
dht11_val[j/8]<<=1;
if(counter>16)
dht11_val[j/8]|=1;
j++;
}
}
// verify checksum and print the verified data
if((j>=40)&&(dht11_val[4]==((dht11_val[0]+dht11_val[1]+dht11_val[2]+dht11_val[3])& 0xFF)))
{
printf("%d.%d,%d.%d\n",dht11_val[0],dht11_val[1],dht11_val[2],dht11_val[3]);
return 1;
}
else
return 0;
}
int main(void)
{
int attempts=ATTEMPTS;
if(wiringPiSetup()==-1)
exit(1);
while(attempts)
{
int success = dht11_read_val();
if (success) {
break;
}
attempts--;
delay(500);
}
return 0;
} | 0debug |
int net_client_init(QemuOpts *opts, int is_netdev, Error **errp)
{
const char *name;
const char *type;
int i;
type = qemu_opt_get(opts, "type");
if (!type) {
error_set(errp, QERR_MISSING_PARAMETER, "type");
return -1;
}
if (is_netdev) {
if (strcmp(type, "tap") != 0 &&
#ifdef CONFIG_NET_BRIDGE
strcmp(type, "bridge") != 0 &&
#endif
#ifdef CONFIG_SLIRP
strcmp(type, "user") != 0 &&
#endif
#ifdef CONFIG_VDE
strcmp(type, "vde") != 0 &&
#endif
strcmp(type, "socket") != 0) {
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "type",
"a netdev backend type");
return -1;
}
if (qemu_opt_get(opts, "vlan")) {
error_set(errp, QERR_INVALID_PARAMETER, "vlan");
return -1;
}
if (qemu_opt_get(opts, "name")) {
error_set(errp, QERR_INVALID_PARAMETER, "name");
return -1;
}
if (!qemu_opts_id(opts)) {
error_set(errp, QERR_MISSING_PARAMETER, "id");
return -1;
}
}
name = qemu_opts_id(opts);
if (!name) {
name = qemu_opt_get(opts, "name");
}
for (i = 0; i < NET_CLIENT_OPTIONS_KIND_MAX; i++) {
if (net_client_types[i].type != NULL &&
!strcmp(net_client_types[i].type, type)) {
Error *local_err = NULL;
VLANState *vlan = NULL;
int ret;
qemu_opts_validate(opts, &net_client_types[i].desc[0], &local_err);
if (error_is_set(&local_err)) {
error_propagate(errp, local_err);
return -1;
}
if (!(is_netdev ||
(strcmp(type, "nic") == 0 && qemu_opt_get(opts, "netdev")))) {
vlan = qemu_find_vlan(qemu_opt_get_number(opts, "vlan", 0), 1);
}
ret = 0;
if (net_client_types[i].init) {
ret = net_client_types[i].init(opts, name, vlan);
if (ret < 0) {
error_set(errp, QERR_DEVICE_INIT_FAILED, type);
return -1;
}
}
return ret;
}
}
error_set(errp, QERR_INVALID_PARAMETER_VALUE, "type",
"a network client type");
return -1;
}
| 1threat |
static coroutine_fn int qcow2_co_pwritev(BlockDriverState *bs, uint64_t offset,
uint64_t bytes, QEMUIOVector *qiov,
int flags)
{
BDRVQcow2State *s = bs->opaque;
int offset_in_cluster;
int ret;
unsigned int cur_bytes;
uint64_t cluster_offset;
QEMUIOVector hd_qiov;
uint64_t bytes_done = 0;
uint8_t *cluster_data = NULL;
QCowL2Meta *l2meta = NULL;
trace_qcow2_writev_start_req(qemu_coroutine_self(), offset, bytes);
qemu_iovec_init(&hd_qiov, qiov->niov);
s->cluster_cache_offset = -1;
qemu_co_mutex_lock(&s->lock);
while (bytes != 0) {
l2meta = NULL;
trace_qcow2_writev_start_part(qemu_coroutine_self());
offset_in_cluster = offset_into_cluster(s, offset);
cur_bytes = MIN(bytes, INT_MAX);
if (bs->encrypted) {
cur_bytes = MIN(cur_bytes,
QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size
- offset_in_cluster);
}
ret = qcow2_alloc_cluster_offset(bs, offset, &cur_bytes,
&cluster_offset, &l2meta);
if (ret < 0) {
goto fail;
}
assert((cluster_offset & 511) == 0);
qemu_iovec_reset(&hd_qiov);
qemu_iovec_concat(&hd_qiov, qiov, bytes_done, cur_bytes);
if (bs->encrypted) {
Error *err = NULL;
assert(s->cipher);
if (!cluster_data) {
cluster_data = qemu_try_blockalign(bs->file->bs,
QCOW_MAX_CRYPT_CLUSTERS
* s->cluster_size);
if (cluster_data == NULL) {
ret = -ENOMEM;
goto fail;
}
}
assert(hd_qiov.size <=
QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size);
qemu_iovec_to_buf(&hd_qiov, 0, cluster_data, hd_qiov.size);
if (qcow2_encrypt_sectors(s, offset >> BDRV_SECTOR_BITS,
cluster_data,
cur_bytes >>BDRV_SECTOR_BITS,
true, &err) < 0) {
error_free(err);
ret = -EIO;
goto fail;
}
qemu_iovec_reset(&hd_qiov);
qemu_iovec_add(&hd_qiov, cluster_data, cur_bytes);
}
ret = qcow2_pre_write_overlap_check(bs, 0,
cluster_offset + offset_in_cluster, cur_bytes);
if (ret < 0) {
goto fail;
}
if (!merge_cow(offset, cur_bytes, &hd_qiov, l2meta)) {
qemu_co_mutex_unlock(&s->lock);
BLKDBG_EVENT(bs->file, BLKDBG_WRITE_AIO);
trace_qcow2_writev_data(qemu_coroutine_self(),
cluster_offset + offset_in_cluster);
ret = bdrv_co_pwritev(bs->file,
cluster_offset + offset_in_cluster,
cur_bytes, &hd_qiov, 0);
qemu_co_mutex_lock(&s->lock);
if (ret < 0) {
goto fail;
}
}
while (l2meta != NULL) {
QCowL2Meta *next;
ret = qcow2_alloc_cluster_link_l2(bs, l2meta);
if (ret < 0) {
goto fail;
}
if (l2meta->nb_clusters != 0) {
QLIST_REMOVE(l2meta, next_in_flight);
}
qemu_co_queue_restart_all(&l2meta->dependent_requests);
next = l2meta->next;
g_free(l2meta);
l2meta = next;
}
bytes -= cur_bytes;
offset += cur_bytes;
bytes_done += cur_bytes;
trace_qcow2_writev_done_part(qemu_coroutine_self(), cur_bytes);
}
ret = 0;
fail:
qemu_co_mutex_unlock(&s->lock);
while (l2meta != NULL) {
QCowL2Meta *next;
if (l2meta->nb_clusters != 0) {
QLIST_REMOVE(l2meta, next_in_flight);
}
qemu_co_queue_restart_all(&l2meta->dependent_requests);
next = l2meta->next;
g_free(l2meta);
l2meta = next;
}
qemu_iovec_destroy(&hd_qiov);
qemu_vfree(cluster_data);
trace_qcow2_writev_done_req(qemu_coroutine_self(), ret);
return ret;
}
| 1threat |
Key-Value from long list of similar items : I have a python dictionary looking like this
[{'actual': 4.99, 'estimate': 4.55, 'period': '2019-12-31', 'symbol': 'AAPL'}, {'actual': 3.03, 'estimate': 2.84, 'period': '2019-09-30', 'symbol': 'AAPL'}, {'actual': 2.18, 'estimate': 2.1, 'period': '2019-06-30', 'symbol': 'AAPL'}]
and I need to extract the actual/estimate values for each period. Then I need to divide these vales each other. Thanks
| 0debug |
very basic.started learning python only 3 days ago.Kind of frustrating when code doesn't run : def calculate_average(runs,games):
runs_list = [5, 7, 3, 1, 4]
num_games = len(runs_list)
total_runs=0
for runs in runs_list:
total_runs += runs
return total_runs/num_games
print(calculate_average(runs, num_games))
This gives me an error saying"runs is not defined".I don't get it.Again I am a newbie.I knew it is a steep learning curve. | 0debug |
Expression for a type : <p>I need to find an expression for a Haskell function.
The function: test :: (c,b,c) -> (b,c,b)</p>
<p>My code of course does not work, because there are "Conflicting definitions for ‘c’".</p>
<pre><code>test (c,b,c) = (b, c, b)
</code></pre>
| 0debug |
Is there an API to list all Azure Regions? : <p>I would like to list all Azure locations via some API (I need to generate some config files for every region, and use the exact naming that Azure does to avoid typos). I found <a href="https://stackoverflow.com/questions/41543587/list-all-the-regions-using-the-azure-api">this question</a>, but it only lists regions a particular subscription is authorized to use.</p>
<p>I want to list all regions that exist whether my subscription has access or not.</p>
| 0debug |
Can't call a variable inside os.system method in Python : <pre><code>ENV=raw_input("Enter Environment (QA/Prod):")
print(ENV)
os.system('aws ec2 describe-instances --filters "Name=tag:Environment,Values=ENV" "Name=instance-state-code, Values=16" > FilteredOP')
</code></pre>
<p>Hi,
I am quite noob to Python. Here,
I cannot able to call ENV variable in os.system command. Is there anything wrong with the syntax. </p>
| 0debug |
multiple root tags at RecyclerView : <p>I working on Android app in Android Studio, I was confronted with the error: "multiple root tags"</p>
<p>My application code:</p>
<pre><code><? Xml version = "1.0" encoding = "utf-8"?>
<LinearLayout
xmlns: android = "http://schemas.android.com/apk/res/android"
xmlns: tools = "http: // schemas .android.com / tools
"android: layout_width =" match_parent
"android: orientation =" vertical
"android: layout_height =" match_parent
"android: paddingLeft =" @ dimen / activity_horizontal_margin
"android: paddingRight =" @ dimen / activity_horizontal_margin
"android: paddingTop = "@ dimen / activity_vertical_margin" android: paddingBottom = "@ dimen / activity_vertical_margin" tools: context = ". MainActivity">
<Android.support.v7.widget.RecyclerView
android: id = "@ + id / recyclerView"
android: layout_width = "wrap_content"
android: layout_height = "wrap_content"
android: layout_marginLeft = "20dp"
android: paddingLeft = "40dp">
</android.support.v7.widget.RecyclerView>
</ LinearLayout>
</code></pre>
<p>...
How do I fix this error hands?
Thankful</p>
| 0debug |
Javascript Growth Population Problem --> Code Returning Wrong Answer : I have the following problem:
In a small town the population is p0 = 1000 at the beginning of a year. The population regularly increases by 2 percent per year and moreover 50 new inhabitants per year come to live in the town. How many years does the town need to see its population greater or equal to p = 1200 inhabitants?
Below is my code:
function nbYear(p0, percent, aug, p) {
for (var i=0; p0 < p; i++){
p0 = p0 * (1 + percent/100) + aug;
return i
}
}
nbYear(1000, 2, 50, 1200)
My solution return 0 which is wrong. The correct answer is 3. I know if I removed the {}, it will give me the right answer. But I want to understand what is wrong with my code ... why is it returning 0? | 0debug |
How to interrupt, exit a compose or pipe? : <p>What's the proper way to interrupt a long chain of compose or pipe functions ?</p>
<p>Let's say the chain doesn't need to run after the second function because it found an invalid value and it doesn't need to continue the next 5 functions as long as user submitted value is invalid.</p>
<p>Do you return an undefined / empty parameter, so the rest of the functions just check if there is no value returned, and in this case just keep passing the empty param ?</p>
| 0debug |
jQuery equivalent of requirejs function : What's the equivalent of the below in jQuery?
require(['jquery', 'SunCalc'], function ($, SunCalc) {
var position = SunCalc.getMoonPosition(new Date(), 51.5, -0.1);
});
I don't want to use requireJS but I want to use a specific library (SunCalc). I've installed it via npm and created a gulp task to minify the library file and include it but how could I do the above with requireJS?
Or is it required? HAH! | 0debug |
What is the correct name for IEEE Std 1003.1, 2004 Edition: POSIX.1-2001 or POSIX.1-2004? : <p>I came across two POSIX documents online.</p>
<ul>
<li><a href="http://pubs.opengroup.org/onlinepubs/009695399/">http://pubs.opengroup.org/onlinepubs/009695399/</a> (IEEE Std 1003.1, 2004 Edition)
<blockquote>
<p><strong>Abstract:</strong> The 2004 edition incorporates Technical Corrigendum Number 1 and Technical Corrigendum 2 addressing problems discovered since the approval of the 2001 edition. These are mainly due to resolving integration issues raised by the merger of the Base documents.</p>
</blockquote></li>
<li><a href="http://pubs.opengroup.org/onlinepubs/9699919799/">http://pubs.opengroup.org/onlinepubs/9699919799/</a> (IEEE Std 1003.1™, 2013 Edition)
<blockquote>
<p><strong>Abstract:</strong> POSIX.1-2008 is simultaneously IEEE Std 1003.1™-2008 and The Open Group Technical Standard Base Specifications, Issue 7. This 2013 Edition includes IEEE Std 1003.1-2008/Cor 1-2013 incorporated into IEEE Std 1003.1-2008 (the base document). The 2013 edition incorporates Technical Corrigendum 1 addressing problems discovered since the approval of the 2008 edition.</p>
</blockquote></li>
</ul>
<p>I want to know whether the first document is known as POSIX.1-2001 or POSIX.1-2004.</p>
<p>The <a href="https://en.wikipedia.org/wiki/POSIX">Wikipedia article on POSIX</a> mentions the first one as POSIX.1-2004. But why? The base document of the first one is 2001 edition. So shouldn't it still be called POSIX.1-2001? The 2004 edition only adds TC1 and TC2 to the base document.</p>
<p>For example, see the second one. Although it is 2013 edition but since the base document is 2008 edition, it is called POSIX.1-2008. Then why is the first one not called POSIX.1-2001?</p>
| 0debug |
static int handle_secondary_tcp_pkt(NetFilterState *nf,
Connection *conn,
Packet *pkt)
{
struct tcphdr *tcp_pkt;
tcp_pkt = (struct tcphdr *)pkt->transport_header;
if (trace_event_get_state(TRACE_COLO_FILTER_REWRITER_DEBUG)) {
trace_colo_filter_rewriter_pkt_info(__func__,
inet_ntoa(pkt->ip->ip_src), inet_ntoa(pkt->ip->ip_dst),
ntohl(tcp_pkt->th_seq), ntohl(tcp_pkt->th_ack),
tcp_pkt->th_flags);
trace_colo_filter_rewriter_conn_offset(conn->offset);
}
if (((tcp_pkt->th_flags & (TH_ACK | TH_SYN)) == (TH_ACK | TH_SYN))) {
conn->offset = ntohl(tcp_pkt->th_seq);
}
if ((tcp_pkt->th_flags & (TH_ACK | TH_SYN)) == TH_ACK) {
tcp_pkt->th_seq = htonl(ntohl(tcp_pkt->th_seq) - conn->offset);
net_checksum_calculate((uint8_t *)pkt->data, pkt->size);
}
return 0;
}
| 1threat |
How to replace all numbers in a string with custom string in python? : <p>I want to replace all the numbers in a given string with <code>Mat(number)</code>.For example the string <code>A*256+B*12+C*256</code> after conversion must look like this <code>A*Mat(256)+B*Mat(12)+C*Mat(256)</code>.<strong>How can I perform this in python 3?</strong>.</p>
| 0debug |
Alternative to using shebang : <p>I am trying to set up my system so that php can be run without including the shebang in every file. Is there an alternative to using <code>#!/usr/bin/php</code> in every php file I write?</p>
| 0debug |
static CharDriverState *qemu_chr_open_win_con(const char *id,
ChardevBackend *backend,
ChardevReturn *ret,
Error **errp)
{
return qemu_chr_open_win_file(GetStdHandle(STD_OUTPUT_HANDLE));
}
| 1threat |
HTML How do I change my address bar icon? : <p>I was wondering what code do I use to change my address bar icon? I have my 16x16.png file ready. It is in the same folder as my home.html on my desktop.</p>
<p>Also for the folder being on my desktop, what do I use as the directory? I quite do not understand what to put.</p>
| 0debug |
Python client error 'Connection reset by peer' : <p>I have written a very small python client to access confluence restful api. I am using https protocol to connect with the confluence. I am running into <code>Connection reset by peer</code> error.
Here is the full stack trace.</p>
<pre><code>/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Traceback (most recent call last):
File "wpToConfluence.py", line 15, in <module>
main()
File "wpToConfluence.py", line 11, in main
headers={'content-type': 'application/json'})
File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/api.py", line 71, in get
return request('get', url, params=params, **kwargs)
File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/api.py", line 57, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, **send_kwargs)
File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/sessions.py", line 585, in send
r = adapter.send(request, **kwargs)
File "/Users/rakesh.kumar/.virtualenvs/wpToConfluence.py/lib/python2.7/site-packages/requests/adapters.py", line 453, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(54, 'Connection reset by peer'))
</code></pre>
<p>Here is my client code:</p>
<pre><code>import requests
def main():
auth = open('/tmp/confluence', 'r').readline().strip()
username = 'rakesh.kumar'
response = requests.get("https://<HOST-NAME>/rest/api/content/",
auth=(username, auth),
headers={'content-type': 'application/json'})
print response
if __name__ == "__main__":
main()
</code></pre>
<p>I am running this script in a virtual environment and following packages are installed on that environment:</p>
<pre><code>(wpToConfluence.py)➜ Python pip list
You are using pip version 6.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
appnope (0.1.0)
backports.shutil-get-terminal-size (1.0.0)
decorator (4.0.10)
ipdb (0.10.1)
ipython (5.0.0)
ipython-genutils (0.1.0)
pathlib2 (2.1.0)
pexpect (4.2.0)
pickleshare (0.7.3)
pip (6.1.1)
prompt-toolkit (1.0.5)
ptyprocess (0.5.1)
Pygments (2.1.3)
requests (2.10.0)
setuptools (25.1.6)
simplegeneric (0.8.1)
six (1.10.0)
traitlets (4.2.2)
urllib3 (1.16)
wcwidth (0.1.7)
</code></pre>
<p>It does complain about the python version number but I am not sure how to update my Mac/Virtual environment python.</p>
<p>I have tried to curl command and Postman both of them work fine for the given parameters.</p>
| 0debug |
How does malloc in assembly 8086 work? : <p>I'm doing C and assembly ,I thought i'll write a simple code to make sure that i understand how using malloc in assembly works ,I just want to allocate a size 4 int array and fill it with 1,2,3,4 values in assembly and then print in C.</p>
<p>C file:</p>
<pre><code>#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
extern void myproc(int *arr);
void main() {
int *p;
myproc(p);//call the assembly function ,where i do p=malloc(sizeof(int)*4)
printf("%d %d %d %d ",p[0],p[1],p[2],p[3]);//supposed to print 1 2 3 4 but its not
} // main
</code></pre>
<p>Assembly file:</p>
<pre><code>.MODEL small
.STACK 100H
.DATA
.CODE
.386
.387
PUBLIC _myproc
EXTRN _malloc:NEAR
_myproc PROC NEAR
;This procedure is supposed to do p=malloc(sizeof(int)*4) then p[0]=1 ,p[1]=2,p[2]=3,p[3]=4.
PUSH BP
MOV BP,SP
XOR DX,DX
PUSH BX
MOV AX,4;prepare to pass the parameter for malloc
SHL AX,1;multiply by 2 for int array
PUSH AX;pass 4*2 to malloc
CALL _malloc;calling malloc
ADD SP,2
MOV WORD PTR [BP+4],AX;set the pointer to the newly allocated array
MOV BX,WORD PTR [BP+4]
;do p[0]=1 ,p[1]=2,p[2]=3,p[3]=4
MOV WORD PTR [BX],1
ADD BX,2
MOV WORD PTR [BX],2
ADD BX,2
MOV WORD PTR [BX],3
ADD BX,2
MOV WORD PTR [BX], 4
POP BX
POP BP
RET;;when i get back to the C file to print the values it doesnt work ,its like i didn't set 1,2,3,4.
_myproc ENDP
END
</code></pre>
| 0debug |
Getting error msg while running on localhost : <p>I am getting error msg while running on localhost. following msg i am getting. i added the db connection code also.</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>( ! ) Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\common\conf\database.conf.php on line 51
Call Stack
# Time Memory Function Location
1 0.0470 142760 {main}( ) ..\index.php:0
2 0.4050 634848 require_once( 'C:\wamp\www\common\conf\database.conf.php' ) ..\index.php:16
3 0.4060 635416 mysql_connect ( ) ..\database.conf.php:51
Database connection code
<?php
/*******************************************************
* File name: database.conf.php
*
* Purpose: this file is used to store database
* table name constants and it also starts
* the database connection
*
* CVS ID: $Id$
*
********************************************************/
// If main configuration file which defines VERSION constant
// is not loaded, die!
if (! defined('VERSION'))
{
echo "You cannot access this file directly!";
die();
}
// Please note:
// in production mode, the database authentication information
// may vary.
define('DB_USER', 'root');
define('DB_PASS', '');
//
define('DB_NAME', 'myrentbd-db');
define('DB_HOST', 'localhost');
/**
* Common Table Constant
*/
// Common Tables
define('APP_INFO_TBL', DB_NAME . '.app_info');
define('APP_LANGUAGE_TBL', DB_NAME . '.app_language');
define('APP_MESSAGE_TBL', DB_NAME . '.app_message');
define('APP_META_TBL', DB_NAME . '.app_meta');
define('APP_PROFILE_TBL', DB_NAME . '.app_profile');
define('COUNTRY_LOOKUP_TBL', DB_NAME . '.country_lookup');
define('US_STATE_TBL', DB_NAME . '.us_states');
define('DOCUMENT_TBL', DB_NAME . '.document');
define('GROUP_TBL', DB_NAME . '.group');
if (AUTO_CONNECT_TO_DATABASE)
{
$dbcon = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Could not connect: " . mysql_error());
mysql_select_db(DB_NAME, $dbcon) or die("Could not find: " . mysql_error());
}
?></code></pre>
</div>
</div>
</p>
| 0debug |
static int pci_add_option_rom(PCIDevice *pdev, bool is_default_rom)
{
int size;
char *path;
void *ptr;
char name[32];
const VMStateDescription *vmsd;
if (!pdev->romfile)
return 0;
if (strlen(pdev->romfile) == 0)
return 0;
if (!pdev->rom_bar) {
int class = pci_get_word(pdev->config + PCI_CLASS_DEVICE);
if (class == 0x0300) {
rom_add_vga(pdev->romfile);
} else {
rom_add_option(pdev->romfile, -1);
}
return 0;
}
path = qemu_find_file(QEMU_FILE_TYPE_BIOS, pdev->romfile);
if (path == NULL) {
path = g_strdup(pdev->romfile);
}
size = get_image_size(path);
if (size < 0) {
error_report("%s: failed to find romfile \"%s\"",
__FUNCTION__, pdev->romfile);
g_free(path);
return -1;
}
if (size & (size - 1)) {
size = 1 << qemu_fls(size);
}
vmsd = qdev_get_vmsd(DEVICE(pdev));
if (vmsd) {
snprintf(name, sizeof(name), "%s.rom", vmsd->name);
} else {
snprintf(name, sizeof(name), "%s.rom", object_get_typename(OBJECT(pdev)));
}
pdev->has_rom = true;
memory_region_init_ram(&pdev->rom, name, size);
vmstate_register_ram(&pdev->rom, &pdev->qdev);
ptr = memory_region_get_ram_ptr(&pdev->rom);
load_image(path, ptr);
g_free(path);
if (is_default_rom) {
pci_patch_ids(pdev, ptr, size);
}
qemu_put_ram_ptr(ptr);
pci_register_bar(pdev, PCI_ROM_SLOT, 0, &pdev->rom);
return 0;
}
| 1threat |
"symbol not found" trying to reference an array : <p>I made an array, let's call it x[], and in a seperate function "xprint", I typed</p>
<pre><code>public static void xprint(){
System.out.println(x.length)
</code></pre>
<p>}</p>
<p>and it gave me: "cannot find symbol variable x"</p>
<p>why can't it see my array? they are both in the same class?</p>
| 0debug |
Creating a list of variable types in R : <p>Perhaps there is a much simplier way to do this but I do not know. I am trying to create a list of the variable types in R. I have a dataframe with about 20 variables and I want to be create a list where each element is the class of the variable in its corresponding position.</p>
<p>Lets say the dataframe is called USData.</p>
| 0debug |
what is diffrence between instert into tblname()values() and instert tblname()values() in sql : what is diffrence between instert into tblname()values() and instert tblname()values() in sql | 0debug |
what I need to know to create an animated hover with javascript : <p>what I need to know to create an animated hover like this in <a href="http://www.webdesignerdepot.com/" rel="nofollow">http://www.webdesignerdepot.com/</a> menu? I know this menu is done with javascript, I have no doubt about where I should look for icons like these.</p>
| 0debug |
Fixing android app : I created an android app. That app is running successfully in android studio emulator but after installing the same apk file in my mobile it is installing and it is showing "Unfortunately app stopped" while I try to open it.
how to fix? My android version is 6.0(both emulator and mobile). | 0debug |
view and then close the figure automatically in matplotlib? : <p>I have to check whether my parameters setting is right, so I need to draw many plots, and for drawing these plots, I choose to use matplotlib. After each checking, I need to click the close button on the top left conner. It's trivial. So is there any method that can make the plot show in about 3 or 5 seconds and automatically close without clicking? I know about the <code>plt.close()</code>, but it doesn't work. Here is my code.</p>
<pre><code>from math import *
import sys
import numpy as np
from scipy import special
import matplotlib.pyplot as plt
x1=[]
y1=[]
x2=[]
y2=[]
x3=[]
y3=[]
with open('fort.222','r') as f:
for line in f:
a,b=line.split()
x1.append(float(a))
y1.append(float(b))
n=int(sys.argv[1])
i=0
with open('fort.777','r') as f:
for line in f:
if i==0:
k1=float(line)
i=i+1
x1,y1=np.array(x1),np.array(y1)
z1=special.eval_hermite(n,x1*k1)*sqrt(1/(sqrt(pi)*pow(2,n)*factorial(n)))*sqrt(k1)*np.exp(-np.power(k1*x1,2)/2.)
plt.figure()
plt.plot(x1,z1)
plt.plot(x1,y1)
plt.plot(x1,np.zeros(len(x1)))
plt.title('single center & double center')
plt.xlim(x1.min(),x1.max())
plt.ylim(-max(abs(y1.min()-0.1),y1.max()+0.1),max(abs(y1.min()-0.2),y1.max()+0.2))
plt.xlabel('$\zeta$'+'/fm')
plt.legend(('single, n='+sys.argv[1],'double, n='+sys.argv[1]),loc=2,frameon=True)
plt.show()
plt.close()
</code></pre>
| 0debug |
void usb_packet_setup(USBPacket *p, int pid, uint8_t addr, uint8_t ep)
{
assert(!usb_packet_is_inflight(p));
p->state = USB_PACKET_SETUP;
p->pid = pid;
p->devaddr = addr;
p->devep = ep;
p->result = 0;
qemu_iovec_reset(&p->iov);
}
| 1threat |
What does "+=" operator do? : <p>I've seen code example that had </p>
<pre><code>x += y
</code></pre>
<p>and I can't seem to find any explanation for this.</p>
<p>Please help. Thanks.</p>
| 0debug |
why the loop show 20 as result instead of 120 : ORG 100H
facto dw ?
START:
MOV CX, 5
MOV AX, 5
DEC CX
repeat :
MUL CX
MOV facto , AX
LOOP repeat
ENDS
END START : | 0debug |
static int filter_frame(AVFilterLink *link, AVFrame *picref)
{
AVFilterContext *ctx = link->dst;
IDETContext *idet = ctx->priv;
if (idet->prev)
av_frame_free(&idet->prev);
idet->prev = idet->cur;
idet->cur = idet->next;
idet->next = picref;
if (!idet->cur)
return 0;
if (!idet->prev)
idet->prev = av_frame_clone(idet->cur);
if (!idet->csp)
idet->csp = av_pix_fmt_desc_get(link->format);
if (idet->csp->comp[0].depth_minus1 / 8 == 1){
idet->filter_line = (ff_idet_filter_func)ff_idet_filter_line_c_16bit;
if (ARCH_X86)
ff_idet_init_x86(idet, 1);
}
filter(ctx);
return ff_filter_frame(ctx->outputs[0], av_frame_clone(idet->cur));
}
| 1threat |
gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
int search_pc)
{
uint16_t *gen_opc_end;
uint32_t pc_start;
unsigned int insn_len;
int j, lj;
struct DisasContext ctx;
struct DisasContext *dc = &ctx;
uint32_t next_page_start;
target_ulong npc;
int num_insns;
int max_insns;
qemu_log_try_set_file(stderr);
if (env->pregs[PR_VR] == 32) {
dc->decoder = crisv32_decoder;
dc->clear_locked_irq = 0;
} else {
dc->decoder = crisv10_decoder;
dc->clear_locked_irq = 1;
}
pc_start = tb->pc & ~1;
dc->env = env;
dc->tb = tb;
gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
dc->is_jmp = DISAS_NEXT;
dc->ppc = pc_start;
dc->pc = pc_start;
dc->singlestep_enabled = env->singlestep_enabled;
dc->flags_uptodate = 1;
dc->flagx_known = 1;
dc->flags_x = tb->flags & X_FLAG;
dc->cc_x_uptodate = 0;
dc->cc_mask = 0;
dc->update_cc = 0;
dc->clear_prefix = 0;
cris_update_cc_op(dc, CC_OP_FLAGS, 4);
dc->cc_size_uptodate = -1;
dc->tb_flags = tb->flags & (S_FLAG | P_FLAG | U_FLAG \
| X_FLAG | PFIX_FLAG);
dc->delayed_branch = !!(tb->flags & 7);
if (dc->delayed_branch) {
dc->jmp = JMP_INDIRECT;
} else {
dc->jmp = JMP_NOJMP;
}
dc->cpustate_changed = 0;
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
qemu_log(
"srch=%d pc=%x %x flg=%" PRIx64 " bt=%x ds=%u ccs=%x\n"
"pid=%x usp=%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n"
"%x.%x.%x.%x\n",
search_pc, dc->pc, dc->ppc,
(uint64_t)tb->flags,
env->btarget, (unsigned)tb->flags & 7,
env->pregs[PR_CCS],
env->pregs[PR_PID], env->pregs[PR_USP],
env->regs[0], env->regs[1], env->regs[2], env->regs[3],
env->regs[4], env->regs[5], env->regs[6], env->regs[7],
env->regs[8], env->regs[9],
env->regs[10], env->regs[11],
env->regs[12], env->regs[13],
env->regs[14], env->regs[15]);
qemu_log("--------------\n");
qemu_log("IN: %s\n", lookup_symbol(pc_start));
}
next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
lj = -1;
num_insns = 0;
max_insns = tb->cflags & CF_COUNT_MASK;
if (max_insns == 0) {
max_insns = CF_COUNT_MASK;
}
gen_icount_start();
do {
check_breakpoint(env, dc);
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
if (lj < j) {
lj++;
while (lj < j) {
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
}
if (dc->delayed_branch == 1) {
tcg_ctx.gen_opc_pc[lj] = dc->ppc | 1;
} else {
tcg_ctx.gen_opc_pc[lj] = dc->pc;
}
tcg_ctx.gen_opc_instr_start[lj] = 1;
tcg_ctx.gen_opc_icount[lj] = num_insns;
}
LOG_DIS("%8.8x:\t", dc->pc);
if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) {
gen_io_start();
}
dc->clear_x = 1;
insn_len = dc->decoder(env, dc);
dc->ppc = dc->pc;
dc->pc += insn_len;
if (dc->clear_x) {
cris_clear_x_flag(dc);
}
num_insns++;
if (dc->delayed_branch) {
dc->delayed_branch--;
if (dc->delayed_branch == 0) {
if (tb->flags & 7) {
t_gen_mov_env_TN(dslot, tcg_const_tl(0));
}
if (dc->cpustate_changed || !dc->flagx_known
|| (dc->flags_x != (tb->flags & X_FLAG))) {
cris_store_direct_jmp(dc);
}
if (dc->clear_locked_irq) {
dc->clear_locked_irq = 0;
t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));
}
if (dc->jmp == JMP_DIRECT_CC) {
int l1;
l1 = gen_new_label();
cris_evaluate_flags(dc);
tcg_gen_brcondi_tl(TCG_COND_EQ,
env_btaken, 0, l1);
gen_goto_tb(dc, 1, dc->jmp_pc);
gen_set_label(l1);
gen_goto_tb(dc, 0, dc->pc);
dc->is_jmp = DISAS_TB_JUMP;
dc->jmp = JMP_NOJMP;
} else if (dc->jmp == JMP_DIRECT) {
cris_evaluate_flags(dc);
gen_goto_tb(dc, 0, dc->jmp_pc);
dc->is_jmp = DISAS_TB_JUMP;
dc->jmp = JMP_NOJMP;
} else {
t_gen_cc_jmp(env_btarget, tcg_const_tl(dc->pc));
dc->is_jmp = DISAS_JUMP;
}
break;
}
}
if (!(tb->pc & 1) && env->singlestep_enabled) {
break;
}
} while (!dc->is_jmp && !dc->cpustate_changed
&& tcg_ctx.gen_opc_ptr < gen_opc_end
&& !singlestep
&& (dc->pc < next_page_start)
&& num_insns < max_insns);
if (dc->clear_locked_irq) {
t_gen_mov_env_TN(locked_irq, tcg_const_tl(0));
}
npc = dc->pc;
if (tb->cflags & CF_LAST_IO)
gen_io_end();
if (dc->is_jmp == DISAS_NEXT
&& (dc->cpustate_changed || !dc->flagx_known
|| (dc->flags_x != (tb->flags & X_FLAG)))) {
dc->is_jmp = DISAS_UPDATE;
tcg_gen_movi_tl(env_pc, npc);
}
if (dc->delayed_branch == 1) {
t_gen_mov_env_TN(dslot, tcg_const_tl(dc->pc - dc->ppc));
cris_store_direct_jmp(dc);
}
cris_evaluate_flags(dc);
if (unlikely(env->singlestep_enabled)) {
if (dc->is_jmp == DISAS_NEXT) {
tcg_gen_movi_tl(env_pc, npc);
}
t_gen_raise_exception(EXCP_DEBUG);
} else {
switch (dc->is_jmp) {
case DISAS_NEXT:
gen_goto_tb(dc, 1, npc);
break;
default:
case DISAS_JUMP:
case DISAS_UPDATE:
tcg_gen_exit_tb(0);
break;
case DISAS_SWI:
case DISAS_TB_JUMP:
break;
}
}
gen_icount_end(tb, num_insns);
*tcg_ctx.gen_opc_ptr = INDEX_op_end;
if (search_pc) {
j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
lj++;
while (lj <= j) {
tcg_ctx.gen_opc_instr_start[lj++] = 0;
}
} else {
tb->size = dc->pc - pc_start;
tb->icount = num_insns;
}
#ifdef DEBUG_DISAS
#if !DISAS_CRIS
if (qemu_loglevel_mask(CPU_LOG_TB_IN_ASM)) {
log_target_disas(env, pc_start, dc->pc - pc_start,
dc->env->pregs[PR_VR]);
qemu_log("\nisize=%d osize=%td\n",
dc->pc - pc_start, tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf);
}
#endif
#endif
}
| 1threat |
pci_ebus_init1(PCIDevice *s)
{
isa_bus_new(&s->qdev);
s->config[0x04] = 0x06;
s->config[0x05] = 0x00;
s->config[0x06] = 0xa0;
s->config[0x07] = 0x03;
s->config[0x09] = 0x00;
s->config[0x0D] = 0x0a;
pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY,
ebus_mmio_mapfunc);
pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY,
ebus_mmio_mapfunc);
return 0;
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.