problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
target_phys_addr_t end_addr)
{
KVMState *s = kvm_state;
unsigned long size, allocated_size = 0;
KVMDirtyLog d;
KVMSlot *mem;
int ret = 0;
d.dirty_bitmap = NULL;
while (start_addr < end_addr) {
mem = kvm_lookup_overlapping_slot(s, start_addr, end_addr);
if (mem == NULL) {
break;
}
size = ALIGN(((mem->memory_size) >> TARGET_PAGE_BITS), HOST_LONG_BITS) / 8;
if (!d.dirty_bitmap) {
d.dirty_bitmap = qemu_malloc(size);
} else if (size > allocated_size) {
d.dirty_bitmap = qemu_realloc(d.dirty_bitmap, size);
}
allocated_size = size;
memset(d.dirty_bitmap, 0, allocated_size);
d.slot = mem->slot;
if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
DPRINTF("ioctl failed %d\n", errno);
ret = -1;
break;
}
kvm_get_dirty_pages_log_range(mem->start_addr, d.dirty_bitmap,
mem->start_addr, mem->memory_size);
start_addr = mem->start_addr + mem->memory_size;
}
qemu_free(d.dirty_bitmap);
return ret;
}
| 1threat |
static void gd_update_geometry_hints(VirtualConsole *vc)
{
GtkDisplayState *s = vc->s;
GdkWindowHints mask = 0;
GdkGeometry geo = {};
GtkWidget *geo_widget = NULL;
GtkWindow *geo_window;
if (vc->type == GD_VC_GFX) {
if (!vc->gfx.ds) {
return;
}
if (s->free_scale) {
geo.min_width = surface_width(vc->gfx.ds) * VC_SCALE_MIN;
geo.min_height = surface_height(vc->gfx.ds) * VC_SCALE_MIN;
mask |= GDK_HINT_MIN_SIZE;
} else {
geo.min_width = surface_width(vc->gfx.ds) * vc->gfx.scale_x;
geo.min_height = surface_height(vc->gfx.ds) * vc->gfx.scale_y;
mask |= GDK_HINT_MIN_SIZE;
}
geo_widget = vc->gfx.drawing_area;
gtk_widget_set_size_request(geo_widget, geo.min_width, geo.min_height);
#if defined(CONFIG_VTE)
} else if (vc->type == GD_VC_VTE) {
VteTerminal *term = VTE_TERMINAL(vc->vte.terminal);
GtkBorder *ib;
geo.width_inc = vte_terminal_get_char_width(term);
geo.height_inc = vte_terminal_get_char_height(term);
mask |= GDK_HINT_RESIZE_INC;
geo.base_width = geo.width_inc;
geo.base_height = geo.height_inc;
mask |= GDK_HINT_BASE_SIZE;
geo.min_width = geo.width_inc * VC_TERM_X_MIN;
geo.min_height = geo.height_inc * VC_TERM_Y_MIN;
mask |= GDK_HINT_MIN_SIZE;
gtk_widget_style_get(vc->vte.terminal, "inner-border", &ib, NULL);
geo.base_width += ib->left + ib->right;
geo.base_height += ib->top + ib->bottom;
geo.min_width += ib->left + ib->right;
geo.min_height += ib->top + ib->bottom;
geo_widget = vc->vte.terminal;
#endif
}
geo_window = GTK_WINDOW(vc->window ? vc->window : s->window);
gtk_window_set_geometry_hints(geo_window, geo_widget, &geo, mask);
}
| 1threat |
static void usb_serial_realize(USBDevice *dev, Error **errp)
{
USBSerialState *s = DO_UPCAST(USBSerialState, dev, dev);
usb_desc_create_serial(dev);
usb_desc_init(dev);
dev->auto_attach = 0;
if (!s->cs) {
error_setg(errp, "Property chardev is required");
return;
}
qemu_chr_add_handlers(s->cs, usb_serial_can_read, usb_serial_read,
usb_serial_event, s);
usb_serial_handle_reset(dev);
if (s->cs->be_open && !dev->attached) {
usb_device_attach(dev, errp);
}
}
| 1threat |
build_fadt(GArray *table_data, BIOSLinker *linker, AcpiPmInfo *pm,
unsigned facs_tbl_offset, unsigned dsdt_tbl_offset,
const char *oem_id, const char *oem_table_id)
{
AcpiFadtDescriptorRev1 *fadt = acpi_data_push(table_data, sizeof(*fadt));
unsigned fw_ctrl_offset = (char *)&fadt->firmware_ctrl - table_data->data;
unsigned dsdt_entry_offset = (char *)&fadt->dsdt - table_data->data;
bios_linker_loader_add_pointer(linker,
ACPI_BUILD_TABLE_FILE, fw_ctrl_offset, sizeof(fadt->firmware_ctrl),
ACPI_BUILD_TABLE_FILE, facs_tbl_offset);
fadt_setup(fadt, pm);
bios_linker_loader_add_pointer(linker,
ACPI_BUILD_TABLE_FILE, dsdt_entry_offset, sizeof(fadt->dsdt),
ACPI_BUILD_TABLE_FILE, dsdt_tbl_offset);
build_header(linker, table_data,
(void *)fadt, "FACP", sizeof(*fadt), 1, oem_id, oem_table_id);
}
| 1threat |
how can i convert this query result to date format (SQL-Server : this for example :
concat (concat('201',(substring('A41020',2,1)),'-',(substring('B210906',6,2))
and the result is 2014-06.
what additional query I can use to change this string (2014-06) to date format automatically while I retrieve the data?
please help me. | 0debug |
python : convert the key of a dictionnary into a string : I would like to convert the keys of my dictionary as strings to print
the title of my plot and to setup a path...
I tried str(key) but it didn't worked...
dicohist = {
'Cost': df.costcheck1,
'Cost2': df.costcheck2,}
for key in dicohist:
histo = Series.hist(dicohist[key],bins=300)
histo.set_xlabel("cost in dol")
histo.set_ylabel("number of subject")
histo.set_title(key)
fig = histo.get_figure()
fig.savefig('/path/%s.png'%(key)) | 0debug |
Ionic 2 cannot find module 'dgram' : <p>I have installed a template Ionic 2 application and want to add the NPM package <code>bonjour</code></p>
<p>After installing and including the package in my component like this:</p>
<pre><code>var Bonjour = require('bonjour');
var bonjour = new Bonjour();
</code></pre>
<p>The application won't run stating 'cannot find module dgram'</p>
<p>The application has both the bonjour package and bonjour types installed. </p>
<p><strong>The problem</strong></p>
<p>The application can't find the module dgram which is located in the @types/node file. The project is running <strong>TS 2.4.2</strong> and should not need any references to the @types, this should be picked up automatically.</p>
<p><strong>What have I tried</strong></p>
<p>I tried including the @types folder anyway in multiple ways, by setting typeroots or types in the ts.config.json file. This didn't change anything.</p>
<p>I tried specifying types : </p>
<pre><code>"types": ["node", "bonjour"]
</code></pre>
<p>I tried reinstalling all node modules and clearing the cache</p>
<p>I tried including a reference path in my component above the require statement:</p>
<pre><code>/// <reference path="node_modules/@types/node/index.d.ts" />
var Bonjour = require('bonjour');
var bonjour = new Bonjour();
</code></pre>
<p>This all did not help. Any ideas on how to make my application load this module properly?</p>
| 0debug |
All unit tests Inconclusive when run in VS 2019 : <p>I'm using <code>Unit Test Explorer</code> and <code>Unit Test Sessions</code> to run my tests and suddenly get the below error.</p>
<p>When running in <code>Test -> Test explorer</code>, the tests do not run at all and I see no errors.</p>
<p>In both cases there is nothing in <code>Output</code> window. I've reinstalled R#, cleared VS cache (in <code>%USERPROFILE%\AppData\Local\Microsoft</code>), restarted windows, restarted VS.</p>
<pre><code>2019.10.25 14:54:08.058 ERROR Remote: An exception occurred while invoking executor 'executor://mstestadapter/v2': Method not found: 'Void Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.set_CancellationTokenSource(System.Threading.CancellationTokenSource)'.
--- EXCEPTION #1/1 [LoggerException]
Message = “Remote: An exception occurred while invoking executor 'executor://mstestadapter/v2': Method not found: 'Void Microsoft.VisualStudio.TestTools.UnitTesting.TestContext.set_CancellationTokenSource(System.Threading.CancellationTokenSource)'.”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600
StackTraceString = “
at JetBrains.ReSharper.UnitTesting.MSTest.Provider.New.TestHost.TestHostMsTestRunner.TestExecutionEventHandler.HandleLogMessage(TestMessageLevel level, String message)
at Microsoft.TestPlatform.VsTestConsole.TranslationLayer.VsTestConsoleRequestSender.SendMessageAndListenAndReportTestResults(String messageType, Object payload, ITestRunEventsHandler eventHandler, ITestHostLauncher customHostLauncher)
(...)
</code></pre>
| 0debug |
Eloquent get only one column as an array : <p>How to get only one column as one dimentional array in laravel 5.2 using eloquent?</p>
<p>I have tried: </p>
<pre><code>$array = Word_relation::select('word_two')->where('word_one', $word_id)->get()->toArray();
</code></pre>
<p>but this one gives it as 2 dimentional array like:</p>
<pre><code>array(2) {
[0]=>
array(1) {
["word_one"]=>
int(2)
}
[1]=>
array(1) {
["word_one"]=>
int(3)
}
}
</code></pre>
<p>but I want to get it as:</p>
<pre><code>array(2) {
[0]=>2
[1]=>3
}
</code></pre>
| 0debug |
What is the difference between x_train and x_test in Keras? : <p>I've looked at a few tutorials to crack into Keras for deep learning using Convolutional Neural Networks. In the tutorial (and in Keras' official documentation), the MNIST dataset is loaded like so:</p>
<pre><code>from keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
</code></pre>
<p>However, no explanation is offered as to why we have two tuples of data. My question is: <strong>what are <code>x_train</code> and <code>y_train</code> and how do they differ from their <code>x_test</code> and <code>y_test</code> counterparts</strong>?</p>
| 0debug |
static int virtio_scsi_load(QEMUFile *f, void *opaque, int version_id)
{
VirtIOSCSI *s = opaque;
virtio_load(&s->vdev, f);
return 0;
}
| 1threat |
How to install wordcloud in python3.6 : ***enter code here******
> i try in window 64
conda install -c conda-forge word cloud
but that is python 3.4 i want to install word cloud in python 3.6
but i did search the google.
but it is not effect. so please teach me....
1. i try in window 64
conda install -c conda-forge word cloud
but that is python 3.4 i want to install word cloud in python 3.6
but i did search the google.
but it is not effect. so please teach me....
*** | 0debug |
static void encrypted_bdrv_it(void *opaque, BlockDriverState *bs)
{
Error **errp = opaque;
if (!error_is_set(errp) && bdrv_key_required(bs)) {
error_set(errp, QERR_DEVICE_ENCRYPTED, bdrv_get_device_name(bs),
bdrv_get_encrypted_filename(bs));
}
}
| 1threat |
Sorting a multi-dimensional, non associative array in PHP : <p>So i've been looking throughout Stack Overflow looking for a solution for this problem. I have a multidimensional, non associative array in php and i want to sort it by one of its values, while maintaining the rest of the values within the same child array.</p>
<p>In the next example i want to sort the array by $fruits[This value][0].</p>
<p>This is what i have:</p>
<pre><code>$fruits = array
(
array(2, apple),
array(1, orange),
array(4, banana),
array(3, kiwi),
);
</code></pre>
<p>This is what im looking for:</p>
<pre><code>$fruits = array
(
array(1, orange),
array(2, apple),
array(3, kiwi),
array(4, banana),
);
</code></pre>
<p>This is what i dont want:</p>
<pre><code>$fruits = array
(
array(1, apple),
array(2, orange),
array(3, banana),
array(4, kiwi),
);
</code></pre>
<p>Thanks in advanced!</p>
| 0debug |
Laravel $request->file() returns null : <p>having trouble trying to upload files using Laravel on the back-end.</p>
<h3>Issue</h3>
<p>Laravel <code>$request->file()</code> method returns null.</p>
<h3>Setup</h3>
<p>I build up an AJAX request using <a href="https://github.com/visionmedia/superagent" rel="noreferrer">superagent</a>, debugged the request and everything seems fine. The <code>Content-Length</code> changes depending on the image I add, indicating an image has been added to the request. The <code>Content-Type</code> is also set to <code>multipart/form-data</code>.</p>
<pre><code>// request headers
Content-Length:978599
Content-Type:multipart/form-data;
// request payload
Content-Disposition: form-data; name="files"; filename="item-keymoment.png"
Content-Type: image/png
</code></pre>
<p>But I'm unable to get the file in Laravel. Using <code>$request->file('files')</code> returns <code>NULL</code>, but if I debug the <code>$_FILES</code> array, I noticed that a my file has been uploaded.</p>
<pre><code>dd($request->file('files'))
// NULL
dd($_FILES);
// array:1 [
// "files" => array:5 [
// "name" => "item-keymoment.png"
// "type" => "image/png"
// "tmp_name" => "/tmp/phpipbeeM"
// "error" => 0
// "size" => 978274
// ]
// ]
dd($request->files->all())
// []
</code></pre>
<p>What might be causing Laravel to ignore the file?<br/>
<code>Content-Type</code> of the input file not being <code>application/octet-stream</code>?</p>
<p><strong>Below have answered the question.</strong></p>
| 0debug |
es6 import from underscore : <p>I wanted to double check to make sure I understand imports enough to know if it is ok to do <code>import {_.identity} from 'underscore'</code> opposed to <code>import _ from 'underscore'</code>? That is the only use of underscore if the particular file.</p>
<p>Thank you for your help</p>
| 0debug |
Fetch post with body data not working params empty : <p>I am trying to rewrite my ajax call to fetch:</p>
<p>Ajax:</p>
<pre><code> $.post({
context: this,
url: "/api/v1/users",
data: {
user:
{
email: email,
password: password
}
}
}).done((user) => {
}).fail((error) => {
})
</code></pre>
<p>Fetch:</p>
<pre><code> fetch('/api/v1/users', {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: {
"user" :
{
"email" : email,
"password" : password
}
}
})
.then(res => {
if (res.status !== 200) { {
console.log("error")
})
} else {
res.json().then(data => {
console.log(data)
})
}
})
</code></pre>
<p>I am getting an error empty params ~ bad request from my server.</p>
<p>I also found this way to do it, but in this code below I am getting an error: Unexpected token.</p>
<pre><code> var payload = {
"user" :
{
"email" : email,
"password" : password
}
};
var data = new FormData();
data.append( "json", JSON.stringify( payload ) );
fetch('/api/v1/users', {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: data
})
</code></pre>
<p>How can I rewrite the ajax request to fetch?</p>
| 0debug |
static int read_cpuinfo(const char *field, char *value, int len)
{
FILE *f;
int ret = -1;
int field_len = strlen(field);
char line[512];
f = fopen("/proc/cpuinfo", "r");
if (!f) {
return -1;
}
do {
if(!fgets(line, sizeof(line), f)) {
break;
}
if (!strncmp(line, field, field_len)) {
strncpy(value, line, len);
ret = 0;
break;
}
} while(*line);
fclose(f);
return ret;
}
| 1threat |
Calculate mean of values based on matching strings in R : <p>Say I have a dataframe <code>df</code>:</p>
<pre><code>c1 c2
A 1
A 3
A 1
A 3
B 3
B 3
B 3
</code></pre>
<p>I want to use this dataframe to generate a table that shows each unique value from <code>c1</code> and the mean of its corresponding values from <code>c2</code>, resulting in this:</p>
<pre><code>v1 v2
A 2
B 3
</code></pre>
<p>because the mean of A's values is 2 ((1+1+3+3)/4) and B's is 3 ((3+3+3)/3).</p>
<p>I'm guessing I need to use aggregate but I'm not sure how.</p>
| 0debug |
static bool run_poll_handlers_once(AioContext *ctx)
{
bool progress = false;
AioHandler *node;
QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) {
if (!node->deleted && node->io_poll &&
node->io_poll(node->opaque)) {
progress = true;
}
}
return progress;
}
| 1threat |
What's the first byte in memory? : <p>I'm writing an operating system, and I need an address where the value is NULL. I was thinking a really far address, but, does the BIOS use the first byte in memory? My kernel won't use it for anything besides the constant char NULL, so I was thinking the first byte might not be used, where a really far address might be, if you'd need to allocate a lot of memory.</p>
| 0debug |
How to add a download counter (number of downloads) in android ? : I am building an application where user can download a wallpaper or save it to desktop directly, what i want to do now is to add a download counter or number of downloads in a Textview for each image that user downloads (number of times the image is downloaded) which will be displayed on the image. I am not sure how to do it, i am guessing i can use google analytics, but is there any way to do it without using any library or service ? | 0debug |
The meaning of << operator in matrix operation : I see some codes in using `<<` with `Mat_` for matrix operations.
Example#A:
cv::Mat_<double> myMat_ = ( cv::Mat_<double>(3, 3) <<
1.0, 2.0, 3.0,
4.0, 5.0, 6.0,
7.0, 8.0, 9.0);
Example#B:
cv::Mat myMat = (Mat_<float>(2,3)<<1,skew,-0.5*SZ*skew,0,1,0)
cv::Mat sampleMat = (Mat_<float>(1,2) << j,i);
What does `<<` mean in these codes? Anyone can educate me a little bit? | 0debug |
Shortest way to iterate over non-list? : <p>Suppose I have 3 Scanner instances which I want to close.</p>
<p>I could do</p>
<pre><code>sc.close()
</code></pre>
<p>for each of the Scanners.</p>
<p>Or I could do something like</p>
<pre><code>for (Scanner sc: new Scanner[]{sc1,sc2,sc3}) {
sc.close();
}
</code></pre>
<p>Is there any shorter way of doing this with Java 8?</p>
<p>Something similar to?</p>
<pre><code>{sc1,sc2,sc3}.forEach((sc) -> sc.close());
</code></pre>
| 0debug |
int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, unsigned char **data)
{
if (s->buf_end - s->buf_ptr >= size && !s->write_flag) {
*data = s->buf_ptr;
s->buf_ptr += size;
return size;
} else {
*data = buf;
return avio_read(s, buf, size);
}
}
| 1threat |
static int loadvm_postcopy_handle_advise(MigrationIncomingState *mis)
{
PostcopyState ps = postcopy_state_set(POSTCOPY_INCOMING_ADVISE);
uint64_t remote_pagesize_summary, local_pagesize_summary, remote_tps;
trace_loadvm_postcopy_handle_advise();
if (ps != POSTCOPY_INCOMING_NONE) {
error_report("CMD_POSTCOPY_ADVISE in wrong postcopy state (%d)", ps);
return -1;
}
if (!migrate_postcopy_ram()) {
return 0;
}
if (!postcopy_ram_supported_by_host()) {
postcopy_state_set(POSTCOPY_INCOMING_NONE);
return -1;
}
remote_pagesize_summary = qemu_get_be64(mis->from_src_file);
local_pagesize_summary = ram_pagesize_summary();
if (remote_pagesize_summary != local_pagesize_summary) {
error_report("Postcopy needs matching RAM page sizes (s=%" PRIx64
" d=%" PRIx64 ")",
remote_pagesize_summary, local_pagesize_summary);
return -1;
}
remote_tps = qemu_get_be64(mis->from_src_file);
if (remote_tps != qemu_target_page_size()) {
error_report("Postcopy needs matching target page sizes (s=%d d=%zd)",
(int)remote_tps, qemu_target_page_size());
return -1;
}
if (ram_postcopy_incoming_init(mis)) {
return -1;
}
postcopy_state_set(POSTCOPY_INCOMING_ADVISE);
return 0;
}
| 1threat |
Using Vault with docker-compose file : <p>Currently I am using docker-compose file to setup my dev/prod environments. I am using environment variables to store secrets, database credentials etc. After some search, I found out that Vault can be used to secure the credentials. I tried couple of basic examples with vault, but still I have no idea of how to use Vault with a docker-compose file. Can someone point me to a correct way. If Vault is not a good solution with docker-compose, what are the mechanisms I could use to secure credentials rather than storing them in environment as plain text.</p>
| 0debug |
static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
{
SegmentContext *seg = s->priv_data;
AVFormatContext *oc = seg->avf;
AVStream *st = s->streams[pkt->stream_index];
int64_t end_pts = seg->recording_time * seg->number;
int ret, can_split = 1;
if (!oc)
return AVERROR(EINVAL);
if (seg->has_video) {
can_split = st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
pkt->flags & AV_PKT_FLAG_KEY;
}
if (can_split && av_compare_ts(pkt->pts, st->time_base, end_pts,
AV_TIME_BASE_Q) >= 0) {
av_log(s, AV_LOG_DEBUG, "Next segment starts at %d %"PRId64"\n",
pkt->stream_index, pkt->pts);
ret = segment_end(oc, seg->individual_header_trailer);
if (!ret)
ret = segment_start(s, seg->individual_header_trailer);
if (ret)
goto fail;
oc = seg->avf;
if (seg->list) {
if (seg->list_type == LIST_HLS) {
if ((ret = segment_hls_window(s, 0)) < 0)
goto fail;
} else {
avio_printf(seg->pb, "%s\n", oc->filename);
avio_flush(seg->pb);
if (seg->size && !(seg->number % seg->size)) {
avio_closep(&seg->pb);
if ((ret = avio_open2(&seg->pb, seg->list, AVIO_FLAG_WRITE,
&s->interrupt_callback, NULL)) < 0)
goto fail;
}
}
}
}
ret = ff_write_chained(oc, pkt->stream_index, pkt, s);
fail:
if (ret < 0)
seg_free_context(seg);
return ret;
}
| 1threat |
int avformat_write_header(AVFormatContext *s, AVDictionary **options)
{
int ret = 0, i;
AVStream *st;
AVDictionary *tmp = NULL;
AVCodecContext *codec = NULL;
AVOutputFormat *of = s->oformat;
if (options)
av_dict_copy(&tmp, *options, 0);
if ((ret = av_opt_set_dict(s, &tmp)) < 0)
goto fail;
if (s->nb_streams == 0 && !(of->flags & AVFMT_NOSTREAMS)) {
av_log(s, AV_LOG_ERROR, "no streams\n");
ret = AVERROR(EINVAL);
goto fail;
}
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
codec = st->codec;
switch (codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
if (codec->sample_rate <= 0) {
av_log(s, AV_LOG_ERROR, "sample rate not set\n");
ret = AVERROR(EINVAL);
goto fail;
}
if (!codec->block_align)
codec->block_align = codec->channels *
av_get_bits_per_sample(codec->codec_id) >> 3;
break;
case AVMEDIA_TYPE_VIDEO:
if (codec->time_base.num <= 0 ||
codec->time_base.den <= 0) {
av_log(s, AV_LOG_ERROR, "time base not set\n");
ret = AVERROR(EINVAL);
goto fail;
}
if ((codec->width <= 0 || codec->height <= 0) &&
!(of->flags & AVFMT_NODIMENSIONS)) {
av_log(s, AV_LOG_ERROR, "dimensions not set\n");
ret = AVERROR(EINVAL);
goto fail;
}
if (av_cmp_q(st->sample_aspect_ratio,
codec->sample_aspect_ratio)) {
av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between muxer "
"(%d/%d) and encoder layer (%d/%d)\n",
st->sample_aspect_ratio.num, st->sample_aspect_ratio.den,
codec->sample_aspect_ratio.num,
codec->sample_aspect_ratio.den);
ret = AVERROR(EINVAL);
goto fail;
}
break;
}
if (of->codec_tag) {
if (codec->codec_tag &&
codec->codec_id == AV_CODEC_ID_RAWVIDEO &&
!av_codec_get_tag(of->codec_tag, codec->codec_id) &&
!validate_codec_tag(s, st)) {
codec->codec_tag = 0;
}
if (codec->codec_tag) {
if (!validate_codec_tag(s, st)) {
char tagbuf[32];
av_get_codec_tag_string(tagbuf, sizeof(tagbuf), codec->codec_tag);
av_log(s, AV_LOG_ERROR,
"Tag %s/0x%08x incompatible with output codec id '%d'\n",
tagbuf, codec->codec_tag, codec->codec_id);
ret = AVERROR_INVALIDDATA;
goto fail;
}
} else
codec->codec_tag = av_codec_get_tag(of->codec_tag, codec->codec_id);
}
if (of->flags & AVFMT_GLOBALHEADER &&
!(codec->flags & CODEC_FLAG_GLOBAL_HEADER))
av_log(s, AV_LOG_WARNING,
"Codec for stream %d does not use global headers "
"but container format requires global headers\n", i);
}
if (!s->priv_data && of->priv_data_size > 0) {
s->priv_data = av_mallocz(of->priv_data_size);
if (!s->priv_data) {
ret = AVERROR(ENOMEM);
goto fail;
}
if (of->priv_class) {
*(const AVClass **)s->priv_data = of->priv_class;
av_opt_set_defaults(s->priv_data);
if ((ret = av_opt_set_dict(s->priv_data, &tmp)) < 0)
goto fail;
}
}
if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) {
av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0);
}
if (s->oformat->write_header) {
ret = s->oformat->write_header(s);
if (ret < 0)
goto fail;
}
for (i = 0; i < s->nb_streams; i++) {
int64_t den = AV_NOPTS_VALUE;
st = s->streams[i];
switch (st->codec->codec_type) {
case AVMEDIA_TYPE_AUDIO:
den = (int64_t)st->time_base.num * st->codec->sample_rate;
break;
case AVMEDIA_TYPE_VIDEO:
den = (int64_t)st->time_base.num * st->codec->time_base.den;
break;
default:
break;
}
if (den != AV_NOPTS_VALUE) {
if (den <= 0) {
ret = AVERROR_INVALIDDATA;
goto fail;
}
frac_init(&st->pts, 0, 0, den);
}
}
if (options) {
av_dict_free(options);
*options = tmp;
}
return 0;
fail:
av_dict_free(&tmp);
return ret;
}
| 1threat |
How to get the target of a JavaScript Proxy? : <pre><code>function createProxy() {
const myArray = [Math.random(), Math.random()];
return new Proxy(myArray, {});
}
const myProxy = createProxy();
</code></pre>
<p>How to access the <code>target</code> (which is <code>myArray</code>) of <code>myProxy</code> here?</p>
<p>I've tried many ways. Was googled many blog posts, but found no way to get the target :(</p>
| 0debug |
Graph on a different coordinate axis : I have he start and the end trips made by the bus according to the time in excel sheet. I want to make the graph as below :
[Figure][1]
[1]: https://i.stack.imgur.com/lDtcD.png
Any suggestions! I tried with Matlab nodes and graphs but did not got the exact figure.
Thanks
| 0debug |
Custom class extends AppCompatActivity: getResources() is recognized by IDE, but Context is not available : <p>Can't figure out why my following code is broken</p>
<p>I've got MainActivity class:</p>
<pre><code>public class MainActivity implements PresenterListener {
...
private Presenter presenter = new Presenter(this);
...
}
</code></pre>
<p>Presenter:</p>
<pre><code>public class Presenter extends PresenterUtils {
protected DateTimeFormatter dateFormat = DateTimeFormat.forPattern(getDateFormat());
}
</code></pre>
<p>PresenterUtils:</p>
<pre><code>public class PresenterUtils extends Utils {
public String getDateFormat() {
return getResources().getString(R.string.date_format);
}
}
</code></pre>
<p>Utils extends AppCompatActivity, so context has to be available for this class. But its not. I mean, IDE allows me to apply <code>getResources()</code> method, but I've got an exception right after launching:</p>
<blockquote>
<p>java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{...} java.lang.NullPointerException: Attempt to invoke
virtual method 'android.content.res.Resources
android.content.Context.getResources()' on a null object reference</p>
</blockquote>
<p>Exception points to <code>getResources().getString(R.string.date_format)</code></p>
<p>But! If I apply application context</p>
<pre><code>public class PresenterUtils extends Utils {
public String getDateFormat() {
return ContextProvider.getContext().getResources().getString(R.string.date_format);
}
}
</code></pre>
<p>where ContextProvider is</p>
<pre><code>public class ContextProvider extends Application {
private static ContextProvider instance;
public ContextProvider() {
instance = this;
}
public static Context getContext() {
return instance;
}
}
</code></pre>
<p>everything is fine</p>
<p>Why is that?</p>
| 0debug |
Gulp not defined : i am new to Gulp and have been struggling all day to make this work
**This is my Gulpfile.js**
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
'use strict';
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Automatically load required Grunt tasks
require('jit-grunt')(grunt);
module.exports = function(grunt) {
// Define the configuration for all the tasks
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Make sure code styles are up to par and there are no obvious mistakes
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: {
src: [
'Gruntfile.js',
'app/scripts/{,*/}*.js'
]
}
}
});
grunt.registerTask('build', [
'jshint'
]);
grunt.registerTask('default', ['build']);
};
<!-- end snippet -->
**This my package.json**
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
{
"name": "conFusion",
"private": true,
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-jshint": "^1.0.0",
"jit-grunt": "^0.10.0",
"jshint-stylish": "^2.2.1",
"time-grunt": "^1.4.0"
},
"engines": {
"node": ">=0.10.0"
}
}
<!-- end snippet -->
**And this is the error message i get**
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
grunt build
Loading "Gruntfile.js"
tasks...ERROR >>
ReferenceError: grunt is not defined
Warning: Task "build"
not found.Use--force to
continue.
Aborted due to warnings.
<!-- end snippet -->
Pls guys i need help. am working on windows 10, so am using the command line there | 0debug |
static void omap_mcbsp_write(void *opaque, target_phys_addr_t addr,
uint64_t value, unsigned size)
{
switch (size) {
case 2: return omap_mcbsp_writeh(opaque, addr, value);
case 4: return omap_mcbsp_writew(opaque, addr, value);
default: return omap_badwidth_write16(opaque, addr, value);
}
}
| 1threat |
static void gen_std(DisasContext *ctx)
{
int rs;
TCGv EA;
rs = rS(ctx->opcode);
if ((ctx->opcode & 0x3) == 0x2) {
#if defined(CONFIG_USER_ONLY)
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
#else
if (unlikely(ctx->mem_idx == 0)) {
gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
return;
}
if (unlikely(rs & 1)) {
gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
return;
}
if (unlikely(ctx->le_mode)) {
gen_exception_err(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE);
return;
}
gen_set_access_type(ctx, ACCESS_INT);
EA = tcg_temp_new();
gen_addr_imm_index(ctx, EA, 0x03);
gen_qemu_st64(ctx, cpu_gpr[rs], EA);
gen_addr_add(ctx, EA, EA, 8);
gen_qemu_st64(ctx, cpu_gpr[rs+1], EA);
tcg_temp_free(EA);
#endif
} else {
if (Rc(ctx->opcode)) {
if (unlikely(rA(ctx->opcode) == 0)) {
gen_inval_exception(ctx, POWERPC_EXCP_INVAL_INVAL);
return;
}
}
gen_set_access_type(ctx, ACCESS_INT);
EA = tcg_temp_new();
gen_addr_imm_index(ctx, EA, 0x03);
gen_qemu_st64(ctx, cpu_gpr[rs], EA);
if (Rc(ctx->opcode))
tcg_gen_mov_tl(cpu_gpr[rA(ctx->opcode)], EA);
tcg_temp_free(EA);
}
}
| 1threat |
void ff_get_unscaled_swscale(SwsContext *c)
{
const enum PixelFormat srcFormat = c->srcFormat;
const enum PixelFormat dstFormat = c->dstFormat;
const int flags = c->flags;
const int dstH = c->dstH;
int needsDither;
needsDither= isAnyRGB(dstFormat)
&& c->dstFormatBpp < 24
&& (c->dstFormatBpp < c->srcFormatBpp || (!isAnyRGB(srcFormat)));
if ((srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) && (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21)) {
c->swScale= planarToNv12Wrapper;
}
if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P || srcFormat==PIX_FMT_YUVA420P) && isAnyRGB(dstFormat)
&& !(flags & SWS_ACCURATE_RND) && !(dstH&1)) {
c->swScale= ff_yuv2rgb_get_func_ptr(c);
}
if (srcFormat==PIX_FMT_YUV410P && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_BITEXACT)) {
c->swScale= yvu9ToYv12Wrapper;
}
if (srcFormat==PIX_FMT_BGR24 && (dstFormat==PIX_FMT_YUV420P || dstFormat==PIX_FMT_YUVA420P) && !(flags & SWS_ACCURATE_RND))
c->swScale= bgr24ToYv12Wrapper;
if ( isAnyRGB(srcFormat)
&& isAnyRGB(dstFormat)
&& srcFormat != PIX_FMT_BGR8 && dstFormat != PIX_FMT_BGR8
&& srcFormat != PIX_FMT_RGB8 && dstFormat != PIX_FMT_RGB8
&& srcFormat != PIX_FMT_BGR4 && dstFormat != PIX_FMT_BGR4
&& srcFormat != PIX_FMT_RGB4 && dstFormat != PIX_FMT_RGB4
&& srcFormat != PIX_FMT_BGR4_BYTE && dstFormat != PIX_FMT_BGR4_BYTE
&& srcFormat != PIX_FMT_RGB4_BYTE && dstFormat != PIX_FMT_RGB4_BYTE
&& srcFormat != PIX_FMT_MONOBLACK && dstFormat != PIX_FMT_MONOBLACK
&& srcFormat != PIX_FMT_MONOWHITE && dstFormat != PIX_FMT_MONOWHITE
&& srcFormat != PIX_FMT_RGB48LE && dstFormat != PIX_FMT_RGB48LE
&& srcFormat != PIX_FMT_RGB48BE && dstFormat != PIX_FMT_RGB48BE
&& srcFormat != PIX_FMT_BGR48LE && dstFormat != PIX_FMT_BGR48LE
&& srcFormat != PIX_FMT_BGR48BE && dstFormat != PIX_FMT_BGR48BE
&& (!needsDither || (c->flags&(SWS_FAST_BILINEAR|SWS_POINT))))
c->swScale= rgbToRgbWrapper;
#define isByteRGB(f) (\
f == PIX_FMT_RGB32 ||\
f == PIX_FMT_RGB32_1 ||\
f == PIX_FMT_RGB24 ||\
f == PIX_FMT_BGR32 ||\
f == PIX_FMT_BGR32_1 ||\
f == PIX_FMT_BGR24)
if (isAnyRGB(srcFormat) && isPlanar(srcFormat) && isByteRGB(dstFormat))
c->swScale= planarRgbToRgbWrapper;
if ((usePal(srcFormat) && (
dstFormat == PIX_FMT_RGB32 ||
dstFormat == PIX_FMT_RGB32_1 ||
dstFormat == PIX_FMT_RGB24 ||
dstFormat == PIX_FMT_BGR32 ||
dstFormat == PIX_FMT_BGR32_1 ||
dstFormat == PIX_FMT_BGR24)))
c->swScale= palToRgbWrapper;
if (srcFormat == PIX_FMT_YUV422P) {
if (dstFormat == PIX_FMT_YUYV422)
c->swScale= yuv422pToYuy2Wrapper;
else if (dstFormat == PIX_FMT_UYVY422)
c->swScale= yuv422pToUyvyWrapper;
}
if (c->flags&(SWS_FAST_BILINEAR|SWS_POINT)) {
if (srcFormat == PIX_FMT_YUV420P || srcFormat == PIX_FMT_YUVA420P) {
if (dstFormat == PIX_FMT_YUYV422)
c->swScale= planarToYuy2Wrapper;
else if (dstFormat == PIX_FMT_UYVY422)
c->swScale= planarToUyvyWrapper;
}
}
if(srcFormat == PIX_FMT_YUYV422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
c->swScale= yuyvToYuv420Wrapper;
if(srcFormat == PIX_FMT_UYVY422 && (dstFormat == PIX_FMT_YUV420P || dstFormat == PIX_FMT_YUVA420P))
c->swScale= uyvyToYuv420Wrapper;
if(srcFormat == PIX_FMT_YUYV422 && dstFormat == PIX_FMT_YUV422P)
c->swScale= yuyvToYuv422Wrapper;
if(srcFormat == PIX_FMT_UYVY422 && dstFormat == PIX_FMT_YUV422P)
c->swScale= uyvyToYuv422Wrapper;
if ( srcFormat == dstFormat
|| (srcFormat == PIX_FMT_YUVA420P && dstFormat == PIX_FMT_YUV420P)
|| (srcFormat == PIX_FMT_YUV420P && dstFormat == PIX_FMT_YUVA420P)
|| (isPlanarYUV(srcFormat) && isGray(dstFormat))
|| (isPlanarYUV(dstFormat) && isGray(srcFormat))
|| (isGray(dstFormat) && isGray(srcFormat))
|| (isPlanarYUV(srcFormat) && isPlanarYUV(dstFormat)
&& c->chrDstHSubSample == c->chrSrcHSubSample
&& c->chrDstVSubSample == c->chrSrcVSubSample
&& dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21
&& srcFormat != PIX_FMT_NV12 && srcFormat != PIX_FMT_NV21))
{
if (isPacked(c->srcFormat))
c->swScale= packedCopyWrapper;
else
c->swScale= planarCopyWrapper;
}
if (ARCH_BFIN)
ff_bfin_get_unscaled_swscale(c);
if (HAVE_ALTIVEC)
ff_swscale_get_unscaled_altivec(c);
}
| 1threat |
Excel c# in computers Without visual basic : <p>i made a project in c# that use excel, in my computer and other computers with visual basic the project works but in other computer when i Click the buttom Who start Work with excel i get exeption.
Am i need to install some driver or something? Tnx</p>
| 0debug |
How to get self name : <p>Let's say i want to create connected system of toggling a textbox by radio button. So each radio manage visibility of textbox.</p>
<pre><code><RadioButton GroupName="Type" Content="First" Name="First" IsChecked="False" />
<TextBox Name="First" Visibility="FirstBox"/>
<RadioButton GroupName="Type" Content="Second" Name="Second" IsChecked="False" />
<TextBox Name="Second" Visibility="Secondbox"/>
</code></pre>
<p>Okay, as you can expect if you check First radio button FirstBox should be visible but after checking Second radio, FirstBox is gone and SecondBox is now visible.
But i don't how to implement it simply. Is possible to use only xaml without code-behind?</p>
| 0debug |
static void *do_data_decompress(void *opaque)
{
DecompressParam *param = opaque;
unsigned long pagesize;
while (!quit_decomp_thread) {
qemu_mutex_lock(¶m->mutex);
while (!param->start && !quit_decomp_thread) {
qemu_cond_wait(¶m->cond, ¶m->mutex);
pagesize = TARGET_PAGE_SIZE;
if (!quit_decomp_thread) {
uncompress((Bytef *)param->des, &pagesize,
(const Bytef *)param->compbuf, param->len);
}
param->start = false;
}
qemu_mutex_unlock(¶m->mutex);
}
return NULL;
}
| 1threat |
I am getting error in my implementation of BST : #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *left,*right;
Node()
{
data=NULL;
left=right=NULL;
}
};
Node *insertBST(Node *root,int value)
{
if(root==NULL)
{
root->data=value;
root->left=root->right=NULL;
}
if((root->data)>value)
insertBST(root->left,value);
if((root->data)<value)
insertBST(root->right,value);
}
Node *printBST(Node *root)
{
if(root!=NULL)
{
printBST(root->left);
cout<<"\n"<<root->data;
printBST(root->right);
}
}
int main()
{
Node *root=new Node;
insertBST(root,30);
insertBST(root,20);
insertBST(root,40);
insertBST(root,70);
insertBST(root,60);
insertBST(root,80);
printBST(root);
}
Above is the code which I wrote to implement Binary Search Tree. When I execute it, the program stops responding and closes. I tried getting help from pythontutor.com but I am not able to tackle it. Any help is appreciated,I am new to writing program. | 0debug |
static uint8_t *csrhci_out_packet(struct csrhci_s *s, int len)
{
int off = s->out_start + s->out_len;
s->out_len += len;
if (off < FIFO_LEN) {
if (off + len > FIFO_LEN && (s->out_size = off + len) > FIFO_LEN * 2) {
fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len);
exit(-1);
}
return s->outfifo + off;
}
if (s->out_len > s->out_size) {
fprintf(stderr, "%s: can't alloc %i bytes\n", __func__, len);
exit(-1);
}
return s->outfifo + off - s->out_size;
}
| 1threat |
FullScreen Webview in iPhone 6 : <p>I am new to iPhone development , Trying to embed webview using Storyboard but getting those black strips on top and bottom , I did set autoLayout also, I need to remove those. TIA</p>
<p><a href="http://i.stack.imgur.com/lVrSd.png" rel="nofollow">Screenshot</a></p>
| 0debug |
Update specific field in mongodb document : <p>I using C# driver to use MongoDb in small projects, and now I stuck with updating documents.
trying to figure out how to update the field <strong>AVG</strong> (int)</p>
<p>here is my code:</p>
<pre><code>IMongoCollection<Student> studentCollection = db.GetCollection<Student>("studentV1");
Student updatedStudent = new Student() { AVG = 100, FirstName = "Shmulik" });
studentCollection.UpdateOne(
o=>o.FirstName == student.FirstName,
**<What should I write here?>**);
</code></pre>
<p>there is simple and clean way to update specific field(s) like the method <code>ReplaceOne(updatedStudent)</code>?</p>
| 0debug |
def parallelogram_perimeter(b,h):
perimeter=2*(b*h)
return perimeter | 0debug |
static int decode_slice(AVCodecContext *c, void *arg)
{
FFV1Context *fs = *(void **)arg;
FFV1Context *f = fs->avctx->priv_data;
int width, height, x, y, ret;
const int ps = (av_pix_fmt_desc_get(c->pix_fmt)->flags & AV_PIX_FMT_FLAG_PLANAR)
? (c->bits_per_raw_sample > 8) + 1
: 4;
AVFrame *const p = f->cur;
if (f->version > 2) {
if (decode_slice_header(f, fs) < 0) {
fs->slice_damaged = 1;
return AVERROR_INVALIDDATA;
}
}
if ((ret = ffv1_init_slice_state(f, fs)) < 0)
return ret;
if (f->cur->key_frame)
ffv1_clear_slice_state(f, fs);
width = fs->slice_width;
height = fs->slice_height;
x = fs->slice_x;
y = fs->slice_y;
if (!fs->ac) {
if (f->version == 3 && f->minor_version > 1 || f->version > 3)
get_rac(&fs->c, (uint8_t[]) { 129 });
fs->ac_byte_count = f->version > 2 || (!x && !y) ? fs->c.bytestream - fs->c.bytestream_start - 1 : 0;
init_get_bits(&fs->gb, fs->c.bytestream_start + fs->ac_byte_count,
(fs->c.bytestream_end - fs->c.bytestream_start -
fs->ac_byte_count) * 8);
}
av_assert1(width && height);
if (f->colorspace == 0) {
const int chroma_width = -((-width) >> f->chroma_h_shift);
const int chroma_height = -((-height) >> f->chroma_v_shift);
const int cx = x >> f->chroma_h_shift;
const int cy = y >> f->chroma_v_shift;
decode_plane(fs, p->data[0] + ps * x + y * p->linesize[0], width,
height, p->linesize[0],
0);
if (f->chroma_planes) {
decode_plane(fs, p->data[1] + ps * cx + cy * p->linesize[1],
chroma_width, chroma_height, p->linesize[1],
1);
decode_plane(fs, p->data[2] + ps * cx + cy * p->linesize[2],
chroma_width, chroma_height, p->linesize[2],
1);
}
if (fs->transparency)
decode_plane(fs, p->data[3] + ps * x + y * p->linesize[3], width,
height, p->linesize[3],
2);
} else {
uint8_t *planes[3] = { p->data[0] + ps * x + y * p->linesize[0],
p->data[1] + ps * x + y * p->linesize[1],
p->data[2] + ps * x + y * p->linesize[2] };
decode_rgb_frame(fs, planes, width, height, p->linesize);
}
if (fs->ac && f->version > 2) {
int v;
get_rac(&fs->c, (uint8_t[]) { 129 });
v = fs->c.bytestream_end - fs->c.bytestream - 2 - 5 * f->ec;
if (v) {
av_log(f->avctx, AV_LOG_ERROR, "bytestream end mismatching by %d\n",
v);
fs->slice_damaged = 1;
}
}
emms_c();
return 0;
}
| 1threat |
void ff_put_h264_qpel8_mc11_msa(uint8_t *dst, const uint8_t *src,
ptrdiff_t stride)
{
avc_luma_hv_qrt_8w_msa(src - 2, src - (stride * 2), stride, dst, stride, 8);
}
| 1threat |
Is there a way to realize a function of type ((a -> b) -> b) -> Either a b? : <p>Propositions <code>(P -> Q) -> Q</code> and <code>P \/ Q</code> are equivalent.</p>
<p>Is there a way to witness this equivalence in Haskell:</p>
<pre><code>from :: Either a b -> ((a -> b) -> b)
from x = case x of
Left a -> \f -> f a
Right b -> \f -> b
to :: ((a -> b) -> b) -> Either a b
to = ???
</code></pre>
<p>such that</p>
<p><code>from . to = id</code> and <code>to . from = id</code>?</p>
| 0debug |
static av_cold int xcbgrab_read_header(AVFormatContext *s)
{
XCBGrabContext *c = s->priv_data;
int screen_num, ret;
const xcb_setup_t *setup;
char *display_name = av_strdup(s->filename);
if (s->filename) {
if (!display_name)
return AVERROR(ENOMEM);
if (!sscanf(s->filename, "%[^+]+%d,%d", display_name, &c->x, &c->y)) {
*display_name = 0;
sscanf(s->filename, "+%d,%d", &c->x, &c->y);
}
}
c->conn = xcb_connect(display_name, &screen_num);
av_freep(&display_name);
if ((ret = xcb_connection_has_error(c->conn))) {
av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n",
s->filename ? s->filename : "default", ret);
return AVERROR(EIO);
}
setup = xcb_get_setup(c->conn);
c->screen = get_screen(setup, screen_num);
if (!c->screen) {
av_log(s, AV_LOG_ERROR, "The screen %d does not exist.\n",
screen_num);
xcbgrab_read_close(s);
return AVERROR(EIO);
}
#if CONFIG_LIBXCB_SHM
c->segment = xcb_generate_id(c->conn);
#endif
ret = create_stream(s);
if (ret < 0) {
xcbgrab_read_close(s);
return ret;
}
#if CONFIG_LIBXCB_SHM
c->has_shm = check_shm(c->conn);
#endif
#if CONFIG_LIBXCB_XFIXES
if (c->draw_mouse) {
if (!(c->draw_mouse = check_xfixes(c->conn))) {
av_log(s, AV_LOG_WARNING,
"XFixes not available, cannot draw the mouse.\n");
}
if (c->bpp < 24) {
avpriv_report_missing_feature(s, "%d bits per pixel screen",
c->bpp);
c->draw_mouse = 0;
}
}
#endif
if (c->show_region)
setup_window(s);
return 0;
}
| 1threat |
void bdrv_io_unplugged_end(BlockDriverState *bs)
{
BdrvChild *child;
assert(bs->io_plug_disabled);
QLIST_FOREACH(child, &bs->children, next) {
bdrv_io_unplugged_end(child->bs);
}
if (--bs->io_plug_disabled == 0 && bs->io_plugged > 0) {
BlockDriver *drv = bs->drv;
if (drv && drv->bdrv_io_plug) {
drv->bdrv_io_plug(bs);
}
}
}
| 1threat |
Cannot use static class when placing a static constructor : <p>I have the following static class:</p>
<pre><code>public static class UnitTestDefinitions
{
public static int Foo = 4;
/// <summary>
/// static constructor
/// </summary>
static UnitTestDefinitions()
{
InitAccounts();
}
private static void InitAccounts()
{
// some code
}
// more code
}
</code></pre>
<p>I have a NUnit test that fails to run because I cannot access <code>Foo</code> :</p>
<p><a href="https://i.stack.imgur.com/AuHOj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AuHOj.png" alt="enter image description here"></a></p>
<p>The actual exception that I get is:</p>
<blockquote>
<p>System.TypeInitializationException was unhandled by user code<br>
HResult=-2146233036 Message=The type initializer for
'Ublux.Communications.PrimaryService.UnitTestDefinitions' threw an
exception. Source=Ublux.Communications.CoreService<br>
TypeName=Ublux.Communications.PrimaryService.UnitTestDefinitions<br>
StackTrace:
at Ublux.Communications.CoreService.UnitTests.TestCloudServicesCore.TestAuthentication()
in C:\GIT\Ublux\Ublux Communications Core
Service\Ublux.Communications.CoreService\Ublux.Communications.CoreService\UnitTests\TestCloudServices_Core.cs:line
146 InnerException:
HResult=-2146233040
Message=Exception of type 'System.Threading.ThreadAbortException' was thrown.</p>
</blockquote>
<p><strong>I been using c# for a while so to me it is obvious that the problem has to be in the static constructor, In other words there has to be a problem with the method <code>InitAccounts()</code>.</strong> </p>
<hr>
<p>Because of that I REMOVED the static constructor on the static class UnitTestDefinitions and call the <code>InitAccounts()</code> method manually as:</p>
<p><a href="https://i.stack.imgur.com/d5uQ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d5uQ8.png" alt="enter image description here"></a></p>
<h2>When I do that I get no exception and everything works great why?</h2>
| 0debug |
How to remove virus to wordpress. PLEASE HELP ME : How to remove virus to wordpress. PLEASE HELP ME
<script type="text/javascript" async="" src="https://examhome.net/stat.js?v=1.0.2"></script>
[enter image description here][1]
[enter image description here][2]
[1]: https://i.stack.imgur.com/oSbzE.png
[2]: https://i.stack.imgur.com/WJdck.png | 0debug |
What are the differences between feather and parquet? : <p>Both are <strong>columnar (disk-)storage formats</strong> for use in data analysis systems.
Both are integrated within <a href="https://arrow.apache.org/" rel="noreferrer">Apache Arrow</a> (<a href="https://pypi.python.org/pypi/pyarrow" rel="noreferrer">pyarrow</a> package for python) and are
designed to correspond with <a href="https://arrow.apache.org/docs/python/index.html" rel="noreferrer">Arrow</a> as a columnar in-memory analytics layer.</p>
<p>How do both formats differ?</p>
<p>Should you always prefer feather when working with pandas when possible?</p>
<p>What are the use cases where <a href="https://arrow.apache.org/docs/python/ipc.html#feather-format" rel="noreferrer">feather</a> is more suitable than <a href="https://arrow.apache.org/docs/python/parquet.html" rel="noreferrer">parquet</a> and the
other way round?</p>
<hr>
<p>Appendix</p>
<p>I found some hints here <a href="https://github.com/wesm/feather/issues/188" rel="noreferrer">https://github.com/wesm/feather/issues/188</a>,
but given the young age of this project, it's possibly a bit out of date.</p>
<p>Not a serious speed test because I'm just dumping and loading a whole
Dataframe but to give you some impression if you never
heard of the formats before:</p>
<pre><code> # IPython
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.feather as feather
import pyarrow.parquet as pq
import fastparquet as fp
df = pd.DataFrame({'one': [-1, np.nan, 2.5],
'two': ['foo', 'bar', 'baz'],
'three': [True, False, True]})
print("pandas df to disk ####################################################")
print('example_feather:')
%timeit feather.write_feather(df, 'example_feather')
# 2.62 ms ± 35.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
print('example_parquet:')
%timeit pq.write_table(pa.Table.from_pandas(df), 'example.parquet')
# 3.19 ms ± 51 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
print()
print("for comparison:")
print('example_pickle:')
%timeit df.to_pickle('example_pickle')
# 2.75 ms ± 18.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
print('example_fp_parquet:')
%timeit fp.write('example_fp_parquet', df)
# 7.06 ms ± 205 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)
print('example_hdf:')
%timeit df.to_hdf('example_hdf', 'key_to_store', mode='w', table=True)
# 24.6 ms ± 4.45 ms per loop (mean ± std. dev. of 7 runs, 100 loops each)
print()
print("pandas df from disk ##################################################")
print('example_feather:')
%timeit feather.read_feather('example_feather')
# 969 µs ± 1.8 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
print('example_parquet:')
%timeit pq.read_table('example.parquet').to_pandas()
# 1.9 ms ± 5.5 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
print("for comparison:")
print('example_pickle:')
%timeit pd.read_pickle('example_pickle')
# 1.07 ms ± 6.21 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)
print('example_fp_parquet:')
%timeit fp.ParquetFile('example_fp_parquet').to_pandas()
# 4.53 ms ± 260 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)
print('example_hdf:')
%timeit pd.read_hdf('example_hdf')
# 10 ms ± 43.4 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
# pandas version: 0.22.0
# fastparquet version: 0.1.3
# numpy version: 1.13.3
# pandas version: 0.22.0
# pyarrow version: 0.8.0
# sys.version: 3.6.3
# example Dataframe taken from https://arrow.apache.org/docs/python/parquet.html
</code></pre>
| 0debug |
Qt Quick Controls 2 and TableView : <p>Is it OK to use TableView in Quick Controls 2.0 application?
This will require to have both imports:</p>
<pre><code>import QtQuick.Controls 1.4
import QtQuick.Controls 2.0
</code></pre>
<p>Will I get any side effects?</p>
<p>Another related question: it seems that TableView belongs to Quick Controls 1.0 set. Is it? Does it mean that if it's possible to use TableView then it's possible to use all the Quick Controls 1.0 controls in Quick Controls 2.0 application?</p>
| 0debug |
Can you instantiate another class within the constructor? : <p>Can you instantiate another class within the constructor? If not then why?</p>
<pre><code>public class Class1() {}
public class Class2() {
public Class2() {
Class1 c1 = new Class1();
}
}
</code></pre>
| 0debug |
static int bdrv_rd_badreq_bytes(BlockDriverState *bs,
int64_t offset, int count)
{
int64_t size = bs->total_sectors << SECTOR_BITS;
return
count < 0 ||
size < 0 ||
count > size ||
offset > size - count;
}
| 1threat |
WPF rotate an image with it's base : I want to rotate and afterwards move an image in c#. The image is in a Canvas . My problem is if you rotate the image with the following
private void Schiff_OnMouseWheel(object sender, MouseWheelEventArgs e)
{
Image _schiff = (Image)sender;
if (!_schiff.IsMouseCaptured) return;
Matrix _mat = _schiff.RenderTransform.Value;
Point _mouse = e.GetPosition(_schiff);
if (e.Delta > 0)
{
_mat.RotateAtPrepend(22.5, _mouse.X, _mouse.Y);
}
else
{
_mat.RotateAtPrepend(-22.5, _mouse.X, _mouse.Y);
}
MatrixTransform _mtf = new MatrixTransform(_mat);
_schiff.RenderTransform = _mtf;
}
or RotateTransform
double _angle = 0.0;
_angle += 22.5;
if (_angle == 360.0) _angle = 0.0;
RotateTransform _rotate = new RotateTransform(_angle, _schiff.Width / 2, _schiff.Height / 2);
_schiff.RenderTransform = _rotate;
you just rotate the "picture", but not it's base. So if you want to move the image with Canvas.GetLeft/GetTop, it behaves like it is still not rotated. So if you set the Top/Left-corner, the actual corner of the rotated image isn't placed where I wanted it to be.
At https://wpf.2000things.com/2013/03/08/772-use-rendertransformorigin-to-change-center-point-for-rotation-transforms/, in the picture you can see what I mean. How can I possibly rotate the "base" with the actual image? I saw it is possible in WinForms, but (how) does it work in WPF?
Thanks in advance, if anything is unclear/wrong I will edit my question. | 0debug |
How to load JSON assets into Flutter App : <p>How do I load a JSON asset into my Flutter app?</p>
<p>My <code>pubspec.yaml</code> file has the following:</p>
<pre><code> assets:
- assets/data.json
</code></pre>
<p>I keep getting stuck trying to load the data. I tried </p>
<pre><code>final json = JSON.decode(
DefaultAssetBundle.of(context).loadString("assets/data.json")
);
</code></pre>
<p>But I get the error</p>
<blockquote>
<p>The argument type 'Future< String>' can't be assigned to the parameter type 'String'.</p>
</blockquote>
<p>Thanks!</p>
| 0debug |
static bool xhci_er_full(void *opaque, int version_id)
{
struct XHCIInterrupter *intr = opaque;
return intr->er_full;
}
| 1threat |
How to modify some elements in a matrix by some condition? : In the Matlab, there is a 10x14 matrix, how to increase all positive numbers that appear in the first 6 columns and which are less than 5 by 1? Of cause, I don't want to use for loop. I expect a more elegant way to solve this problem. | 0debug |
static void test_visitor_out_native_list_int64(TestOutputVisitorData *data,
const void *unused)
{
test_native_list(data, unused, USER_DEF_NATIVE_LIST_UNION_KIND_S64);
}
| 1threat |
If my vector doesn't contain a construct how to set it to zero : <p>I get the no default constructor exists for class "vector" Error</p>
<p>main.cpp</p>
<pre><code>#include <iostream>
#include <string>
#include "myVector.h"
using namespace std;
int main()
{
vector<int> myvecA;
cout << "Vector A size: " << myvecA.size() << endl;
system("Pause");
return 0;
}
</code></pre>
<p>myVector.h</p>
<pre><code>#include <iostream>
using namespace std;
template <class V>
class vector{
public:
vector(V x) {
bool(x = 0)
sizearr = 0;
if (x != 0)
return x;
sizearr = x;
}
V size();
private:
V sizearr;
};
template <class V>
V vector<V>::size() {
return sizearr;
}
</code></pre>
<p>I don't know how to make it so that if </p>
<pre><code>vector<int> myvecA;
</code></pre>
<p>doesn't contain a construct that it will set the construct to 0 so i can return size as 0.</p>
<p>I apologize if my question is not very clear. I'm just look for help so I can learn.I'm not very good at c++.</p>
| 0debug |
Increasing php array by 1 inside jQuery each function : <p>I'm struggle to find an answer for this so was hoping to hear from the community.</p>
<pre><code>$('.slick-dots button').each(function(index) {
$(this).html('<?php echo $headings[0]; ?>')
});
</code></pre>
<p>Within the above .each function, I am trying to increase $headings[0] by one on each loop.</p>
<p>Hopefully I'm missing something pretty simple and I've not gone down an impossible route?</p>
| 0debug |
Flutter: Expanded vs Flexible : <p>I've used both <code>Expanded</code> and <code>Flexible</code> widgets and they seem to work same. Is there any difference between the two that I missed?</p>
| 0debug |
int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
int srcRange, const int table[4], int dstRange,
int brightness, int contrast, int saturation)
{
const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(c->dstFormat);
const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(c->srcFormat);
memcpy(c->srcColorspaceTable, inv_table, sizeof(int) * 4);
memcpy(c->dstColorspaceTable, table, sizeof(int) * 4);
c->brightness = brightness;
c->contrast = contrast;
c->saturation = saturation;
c->srcRange = srcRange;
c->dstRange = dstRange;
if (isYUV(c->dstFormat) || isGray(c->dstFormat))
return -1;
c->dstFormatBpp = av_get_bits_per_pixel(desc_dst);
c->srcFormatBpp = av_get_bits_per_pixel(desc_src);
ff_yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness,
contrast, saturation);
if (HAVE_ALTIVEC && av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)
ff_yuv2rgb_init_tables_altivec(c, inv_table, brightness,
contrast, saturation);
return 0;
}
| 1threat |
static void RENAME(uyvytoyuv422)(uint8_t *ydst, uint8_t *udst, uint8_t *vdst, const uint8_t *src,
int width, int height,
int lumStride, int chromStride, int srcStride)
{
int y;
const int chromWidth = FF_CEIL_RSHIFT(width, 1);
for (y=0; y<height; y++) {
RENAME(extract_even)(src+1, ydst, width);
RENAME(extract_even2)(src, udst, vdst, chromWidth);
src += srcStride;
ydst+= lumStride;
udst+= chromStride;
vdst+= chromStride;
}
__asm__(
EMMS" \n\t"
SFENCE" \n\t"
::: "memory"
);
}
| 1threat |
static bool tracked_request_overlaps(BdrvTrackedRequest *req,
int64_t offset, unsigned int bytes)
{
if (offset >= req->overlap_offset + req->overlap_bytes) {
return false;
}
if (req->overlap_offset >= offset + bytes) {
return false;
}
return true;
}
| 1threat |
Local storage remove item : <p>I'm trying to make simple ToDo list using JQuery and I tried to implement locaStorage (it's my first time using it) into it. Adding elements to localStorage works fine, but i'm having problems with deleting them. I've tried this:</p>
<pre><code>localStorage.removeItem("todolist", $('#todoList').html());
</code></pre>
<p>and this:</p>
<pre><code>localStorage.removeItem("todolist");
</code></pre>
<p>in both cases when I use delete button, all of mine 'li' elements are deleted, but I want to delete individual element 'li' ,so could I use something like 'this' selector in JQuery. Here is mine JSBin so you better understand what I'm doing: <a href="http://jsbin.com/tenara/2/edit?html,js,output" rel="nofollow noreferrer">http://jsbin.com/tenara/2/edit?html,js,output</a></p>
| 0debug |
How to toggle the color of the border onclick? : <p>I have a panel which is of class panel-body. It has a default color blue. I have a button as well. When I click the button, I want to change the color of the border of the panel from blue to green and back to blue again (some transition would be even better). How can I achieve that with jquery and css.</p>
| 0debug |
Docker and --userns-remap, how to manage volume permissions to share data between host and container? : <p>In docker, files created inside containers tend to have unpredictable ownership while inspecting them from the host. The owner of the files on a volume is root (uid 0) by default, but as soon as non-root user accounts are involved in the container and writing to the file system, owners become more or less random from the host perspective.</p>
<p>It is a problem when you need to access volume data from the host using the same user account which is calling the docker commands. </p>
<p>Typical workarounds are </p>
<ul>
<li>forcing users uIDs at creation time in Dockerfiles (non portable) </li>
<li>passing the UID of the host user to the <code>docker run</code> command as an environment variable and then running some <code>chown</code> commands on the volumes in an entrypoint script. </li>
</ul>
<p>Both these solutions can give some control over the actual permissions outside the container.</p>
<p>I expected user namespaces to be the final solution to this problem. I have run some tests with the recently released version 1.10 and --userns-remap set to my desktop account. However, I am not sure that it can make file ownership on mounted volumes easier to deal with, I am afraid that it could actually be the opposite.</p>
<p>Suppose I start this basic container</p>
<pre><code>docker run -ti -v /data debian:jessie /bin/bash
echo 'hello' > /data/test.txt
exit
</code></pre>
<p>And then inspect the content from the host : </p>
<pre><code>ls -lh /var/lib/docker/100000.100000/volumes/<some-id>/_data/
-rw-r--r-- 1 100000 100000 6 Feb 8 19:43 test.txt
</code></pre>
<p>This number '100000' is a sub-UID of my host user, but since it does not correspond to my user's UID, I still can't edit test.txt without privileges. This sub-user does not seem to have any affinity with my actual regular user outside of docker. It's not mapped back.</p>
<p>The workarounds mentioned earlier in this post which consisted of aligning UIDs between the host and the container do not work anymore due to the <code>UID->sub-UID</code> mapping that occurs in the namespace.</p>
<p>Then, is there a way to run docker with user namespace enabled (for improved security), while still making it possible for the host user running docker to own the files generated on volumes? </p>
| 0debug |
Need help - I would like to set a limit to a double variable : first post here. I am a beginner so bare with me.
I am building a program to help my self and a co-worker quote jobs (We work in a machine shop).
This part of the program is for calculating how long it takes to face a part.
It starts with some basic info, work piece diameter, feed rate and surface speed you want to tool to operate at. Then it runs a while loop, each time the tool advances 0.010", it calculates the new rpm the piece will rotate at and calculates the time for that cut adding it all up at the end.
The problem: I need to be able to limit the rpms. As the tool gets closer to the center of the work piece the rpms will climb to a very high unattainable rpm, I want to be able to set a limit, 2000 for example.
I cannot figure out how to do that with out affecting my loop... I have searched, but I'm such a noob maybe I've stumbled across a solution that would work and never realized it, or I am not searching for the correct key words. Here is my code:
public static void main(String[] args) {
double startRadius = 6; //Radius of stock diameter
double faceFinish = 0;
double feed = .010; //Amount the tool will advance per revolution
double sfm = 200; //Surface speed of tool (Surface feet per minute)
double rpm = 0;
double totalTime = 0;
while(faceFinish < startRadius) {
startRadius -= feed; //reduces diameter by feed
rpm = (sfm * 3.82) / (startRadius * 2); //establishes new rpm per tool advance
totalTime += (feed / (feed * rpm)) * 60;
}
int hours = (int) (totalTime / 3600);
int minutes = (int) ((totalTime % 3600) / 60);
int seconds = (int) (totalTime % 60);
System.out.printf("%02d:%02d:%02d\n", hours, minutes, seconds);
}
Thank you for any advice.
| 0debug |
CONVERT FUNCTIONS WITH JOINS : SELECT D.DATEVAL,D.DAY,D.MONVAL,D.YEARVAL,E.HIREDATE FROM DATE1 D,EMP E WHERE TO_DATE('D.DATEVAL-D.MONVAL-D.YEARVAL','DD-MON-YYYY')=E.HIREDATE;
IS THIS SUBQUERY IS CORRECT OR NOT?
My requirement is dispaly date1 table columns along with hiredate, the date1 columns are derived from hiredate by using TO_CHAR() fn. Note:there is no hiredate column in date1 table | 0debug |
What are equality operators and how many are there in python : Are these all the operators in python or are there more?
Need help!
==, !=, >=, <=
| 0debug |
Any way to get mappings of a label encoder in Python pandas? : <p>I am converting strings to categorical values in my dataset using the following piece of code.</p>
<pre><code>data['weekday'] = pd.Categorical.from_array(data.weekday).labels
</code></pre>
<p>For eg,</p>
<pre><code>index weekday
0 Sunday
1 Sunday
2 Wednesday
3 Monday
4 Monday
5 Thursday
6 Tuesday
</code></pre>
<p>After encoding the weekday, my dataset appears like this:</p>
<pre><code>index weekday
0 3
1 3
2 6
3 1
4 1
5 4
6 5
</code></pre>
<p>Is there any way I can know that Sunday has been mapped to 3, Wednesday to 6 and so on?</p>
| 0debug |
static void map_exec(void *addr, long size)
{
DWORD old_protect;
VirtualProtect(addr, size,
PAGE_EXECUTE_READWRITE, &old_protect);
}
| 1threat |
Are Web Components actually useable in IE11 and Edge? : <p>Web Components are the hot new thing, and a true web standard, everybody is talking about them and presumably using them, and they seemed like the perfect solution to a problem we have (sharing components across very different sites).</p>
<p>So we build a couple of web components. The work fine in Chrome, but not in IE11. Use polyfills maybe? <a href="https://www.webcomponents.org/polyfills" rel="noreferrer">https://www.webcomponents.org/polyfills</a> has a ton of polyfills, but IE11 keeps complaining about <code>class</code>.</p>
<p>Compile down to ES5 perhaps? Various sources claim that web components require ES6, because you don't get the same kind of inheritance from HTMLElement in IE11. There's custom-elements-es5-adapter.js, but somehow it doesn't work. If I compile down, webcomponents don't work. If I don't, IE11 fails on <code>class</code>.</p>
<p>And yet everybody is using web components. How do you do it? Do you not support IE11/Edge at all? Am I doing something wrong?</p>
| 0debug |
GList *range_list_insert(GList *list, Range *data)
{
GList *l;
assert(data->begin < data->end || (data->begin && !data->end));
for (l = list; l && range_compare(l->data, data) < 0; l = l->next) {
}
if (!l || range_compare(l->data, data) > 0) {
return g_list_insert_before(list, l, data);
}
range_extend(l->data, data);
g_free(data);
while (l->next && range_compare(l->data, l->next->data) == 0) {
GList *new_l;
range_extend(l->data, l->next->data);
g_free(l->next->data);
new_l = g_list_delete_link(list, l->next);
assert(new_l == list);
}
return list;
}
| 1threat |
int net_init_vhost_user(const NetClientOptions *opts, const char *name,
NetClientState *peer)
{
return net_vhost_user_init(peer, "vhost_user", 0, 0, 0);
}
| 1threat |
static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_size, int first_field)
{
static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
int i, cid;
if (buf_size < 0x280)
return -1;
if (memcmp(buf, header_prefix, 5)) {
av_log(ctx->avctx, AV_LOG_ERROR, "error in header\n");
return -1;
}
if (buf[5] & 2) {
ctx->cur_field = buf[5] & 1;
ctx->picture.interlaced_frame = 1;
ctx->picture.top_field_first = first_field ^ ctx->cur_field;
av_log(ctx->avctx, AV_LOG_DEBUG, "interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field);
}
ctx->height = AV_RB16(buf + 0x18);
ctx->width = AV_RB16(buf + 0x1a);
av_dlog(ctx->avctx, "width %d, height %d\n", ctx->width, ctx->height);
if (buf[0x21] & 0x40) {
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P10;
ctx->avctx->bits_per_raw_sample = 10;
if (ctx->bit_depth != 10) {
ff_dsputil_init(&ctx->dsp, ctx->avctx);
ctx->bit_depth = 10;
ctx->decode_dct_block = dnxhd_decode_dct_block_10;
}
} else {
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
ctx->avctx->bits_per_raw_sample = 8;
if (ctx->bit_depth != 8) {
ff_dsputil_init(&ctx->dsp, ctx->avctx);
ctx->bit_depth = 8;
ctx->decode_dct_block = dnxhd_decode_dct_block_8;
}
}
cid = AV_RB32(buf + 0x28);
av_dlog(ctx->avctx, "compression id %d\n", cid);
if (dnxhd_init_vlc(ctx, cid) < 0)
return -1;
if (buf_size < ctx->cid_table->coding_unit_size) {
av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size\n");
return -1;
}
ctx->mb_width = ctx->width>>4;
ctx->mb_height = buf[0x16d];
av_dlog(ctx->avctx, "mb width %d, mb height %d\n", ctx->mb_width, ctx->mb_height);
if ((ctx->height+15)>>4 == ctx->mb_height && ctx->picture.interlaced_frame)
ctx->height <<= 1;
if (ctx->mb_height > 68 ||
(ctx->mb_height<<ctx->picture.interlaced_frame) > (ctx->height+15)>>4) {
av_log(ctx->avctx, AV_LOG_ERROR, "mb height too big: %d\n", ctx->mb_height);
return -1;
}
for (i = 0; i < ctx->mb_height; i++) {
ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i<<2));
av_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
if (buf_size < ctx->mb_scan_index[i] + 0x280) {
av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n");
return -1;
}
}
return 0;
}
| 1threat |
pre tag text not coming in innerText : <p>I was just testing something and noticed that text inside <code>pre</code> tag does not appear if you access it using <code>parent</code> element. </p>
<p>Following is the code example: </p>
<p><a href="https://jsfiddle.net/RajeshDixit/2wkvvapn/" rel="nofollow">JSFiddle</a></p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>(function() {
var _innerText = document.getElementById("content").innerText;
var _innerHTML = document.getElementById("content").innerHTML;
var _textContent = document.getElementById("content").textContent;
console.log(_innerText, _innerHTML, _textContent)
console.log($("#content").text());
})()</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<p id="content">
p text
<pre>Pre text</pre>
<small>small text</small>
</p></code></pre>
</div>
</div>
</p>
<p>I also noticed that anything after it is also not fetched. If you move <code>small</code> before <code>pre</code>, text appears. What could be the reason for it?</p>
| 0debug |
int coroutine_fn bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num,
int nb_sectors, int *pnum)
{
return bdrv_get_block_status(bs, sector_num, nb_sectors, pnum);
}
| 1threat |
Loop selenium python : <p>I'm trying to do this thing, I have a list of elements all equal, but if i create a loop that have to click on all the element it stops at the first one and clicking it infinite times, i don0t know how to pass to the next becouse the doesn't have difference on click or in other way. What can i do?</p>
<p>This is the loop</p>
<pre><code>a=0
while a < 3:
driver.find_element_by_xpath("/html/body/span/section/main/section/div[1]/div[1]/div/article[1]/div[2]/section[3]/form/textarea").click()
driver.find_element_by_css_selector("textarea._bilrf").send_keys("hi!", Keys.ENTER)
a += 1
</code></pre>
<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><section class="_km7ip _ti7l3 "><form class="_b6i0l"><textarea aria-label="Aggiungi un commento..." placeholder="Aggiungi un commento..." class="_bilrf" autocomplete="off" autocorrect="off" style="height: 18px;"></textarea></form></section>
<section class="_km7ip _ti7l3 "><form class="_b6i0l"><textarea aria-label="Aggiungi un commento..." placeholder="Aggiungi un commento..." class="_bilrf" autocomplete="off" autocorrect="off" style="height: 18px;"></textarea></form></section>
<section class="_km7ip _ti7l3 "><form class="_b6i0l"><textarea aria-label="Aggiungi un commento..." placeholder="Aggiungi un commento..." class="_bilrf" autocomplete="off" autocorrect="off" style="height: 18px;"></textarea></form></section>
<section class="_km7ip _ti7l3 "><form class="_b6i0l"><textarea aria-label="Aggiungi un commento..." placeholder="Aggiungi un commento..." class="_bilrf" autocomplete="off" autocorrect="off" style="height: 18px;"></textarea></form></section>
<section class="_km7ip _ti7l3 "><form class="_b6i0l"><textarea aria-label="Aggiungi un commento..." placeholder="Aggiungi un commento..." class="_bilrf" autocomplete="off" autocorrect="off" style="height: 18px;"></textarea></form></section>
<section class="_km7ip _ti7l3 "><form class="_b6i0l"><textarea aria-label="Aggiungi un commento..." placeholder="Aggiungi un commento..." class="_bilrf" autocomplete="off" autocorrect="off" style="height: 18px;"></textarea></form></section>
<section class="_km7ip _ti7l3 "><form class="_b6i0l"><textarea aria-label="Aggiungi un commento..." placeholder="Aggiungi un commento..." class="_bilrf" autocomplete="off" autocorrect="off" style="height: 18px;"></textarea></form></section></code></pre>
</div>
</div>
</p>
<p>And this the element</p>
<p><code><form class="_b6i0l"><textarea aria-label="Aggiungi un commento..."
placeholder="Aggiungi un commento..." class="_bilrf" autocomplete="off"
autocorrect="off" style="height: 18px;"></textarea></form></code></p>
| 0debug |
What is the difference between ViewModelProviders and ViewModelProvider class? : <p>I saw two classes with a similar name, ViewModelProviders, and ViewModelProvider. Can anyone explain what are the difference between these classes? which class actually provide the ViewModel?</p>
| 0debug |
alert('Hello ' + user_input); | 1threat |
static inline void tcg_out_ldst(TCGContext *s, int ret, int addr, int offset, int op)
{
if (offset == (offset & 0xfff))
tcg_out32(s, op | INSN_RD(ret) | INSN_RS1(addr) |
INSN_IMM13(offset));
else
fprintf(stderr, "unimplemented %s with offset %d\n", __func__, offset);
}
| 1threat |
i want to sort the order of the columns descendingly on the bottom row in python pandas for large data set : I try this nut this is not work.
df5[[c for c in sorted(list(df5.columns), key=df5.iloc[-1].get, reverse=True)]]
| 0debug |
int load_image_targphys(const char *filename,
target_phys_addr_t addr, int max_sz)
{
FILE *f;
size_t got;
f = fopen(filename, "rb");
if (!f) return -1;
got = fread_targphys(addr, max_sz, f);
if (ferror(f)) { fclose(f); return -1; }
fclose(f);
return got;
}
| 1threat |
static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend,
Error **errp)
{
bool is_listen = qemu_opt_get_bool(opts, "server", false);
bool is_waitconnect = is_listen && qemu_opt_get_bool(opts, "wait", true);
bool is_telnet = qemu_opt_get_bool(opts, "telnet", false);
bool is_tn3270 = qemu_opt_get_bool(opts, "tn3270", false);
bool do_nodelay = !qemu_opt_get_bool(opts, "delay", true);
int64_t reconnect = qemu_opt_get_number(opts, "reconnect", 0);
const char *path = qemu_opt_get(opts, "path");
const char *host = qemu_opt_get(opts, "host");
const char *port = qemu_opt_get(opts, "port");
const char *tls_creds = qemu_opt_get(opts, "tls-creds");
SocketAddress *addr;
ChardevSocket *sock;
backend->type = CHARDEV_BACKEND_KIND_SOCKET;
if (!path) {
if (!host) {
error_setg(errp, "chardev: socket: no host given");
return;
}
if (!port) {
error_setg(errp, "chardev: socket: no port given");
return;
}
} else {
if (tls_creds) {
error_setg(errp, "TLS can only be used over TCP socket");
return;
}
}
sock = backend->u.socket.data = g_new0(ChardevSocket, 1);
qemu_chr_parse_common(opts, qapi_ChardevSocket_base(sock));
sock->has_nodelay = true;
sock->nodelay = do_nodelay;
sock->has_server = true;
sock->server = is_listen;
sock->has_telnet = true;
sock->telnet = is_telnet;
sock->has_tn3270 = true;
sock->tn3270 = is_tn3270;
sock->has_wait = true;
sock->wait = is_waitconnect;
sock->has_reconnect = true;
sock->reconnect = reconnect;
sock->tls_creds = g_strdup(tls_creds);
addr = g_new0(SocketAddress, 1);
if (path) {
UnixSocketAddress *q_unix;
addr->type = SOCKET_ADDRESS_KIND_UNIX;
q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1);
q_unix->path = g_strdup(path);
} else {
addr->type = SOCKET_ADDRESS_KIND_INET;
addr->u.inet.data = g_new(InetSocketAddress, 1);
*addr->u.inet.data = (InetSocketAddress) {
.host = g_strdup(host),
.port = g_strdup(port),
.has_to = qemu_opt_get(opts, "to"),
.to = qemu_opt_get_number(opts, "to", 0),
.has_ipv4 = qemu_opt_get(opts, "ipv4"),
.ipv4 = qemu_opt_get_bool(opts, "ipv4", 0),
.has_ipv6 = qemu_opt_get(opts, "ipv6"),
.ipv6 = qemu_opt_get_bool(opts, "ipv6", 0),
};
}
sock->addr = addr;
}
| 1threat |
static void FUNCC(pred4x4_left_dc)(uint8_t *_src, const uint8_t *topright, int _stride){
pixel *src = (pixel*)_src;
int stride = _stride/sizeof(pixel);
const int dc= ( src[-1+0*stride] + src[-1+1*stride] + src[-1+2*stride] + src[-1+3*stride] + 2) >>2;
((pixel4*)(src+0*stride))[0]=
((pixel4*)(src+1*stride))[0]=
((pixel4*)(src+2*stride))[0]=
((pixel4*)(src+3*stride))[0]= PIXEL_SPLAT_X4(dc);
}
| 1threat |
static inline int dmg_read_chunk(BlockDriverState *bs, uint64_t sector_num)
{
BDRVDMGState *s = bs->opaque;
if (!is_sector_in_chunk(s, s->current_chunk, sector_num)) {
int ret;
uint32_t chunk = search_chunk(s, sector_num);
#ifdef CONFIG_BZIP2
uint64_t total_out;
#endif
if (chunk >= s->n_chunks) {
return -1;
}
s->current_chunk = s->n_chunks;
switch (s->types[chunk]) {
case 0x80000005: {
ret = bdrv_pread(bs->file, s->offsets[chunk],
s->compressed_chunk, s->lengths[chunk]);
if (ret != s->lengths[chunk]) {
return -1;
}
s->zstream.next_in = s->compressed_chunk;
s->zstream.avail_in = s->lengths[chunk];
s->zstream.next_out = s->uncompressed_chunk;
s->zstream.avail_out = 512 * s->sectorcounts[chunk];
ret = inflateReset(&s->zstream);
if (ret != Z_OK) {
return -1;
}
ret = inflate(&s->zstream, Z_FINISH);
if (ret != Z_STREAM_END ||
s->zstream.total_out != 512 * s->sectorcounts[chunk]) {
return -1;
}
break; }
#ifdef CONFIG_BZIP2
case 0x80000006:
ret = bdrv_pread(bs->file, s->offsets[chunk],
s->compressed_chunk, s->lengths[chunk]);
if (ret != s->lengths[chunk]) {
return -1;
}
ret = BZ2_bzDecompressInit(&s->bzstream, 0, 0);
if (ret != BZ_OK) {
return -1;
}
s->bzstream.next_in = (char *)s->compressed_chunk;
s->bzstream.avail_in = (unsigned int) s->lengths[chunk];
s->bzstream.next_out = (char *)s->uncompressed_chunk;
s->bzstream.avail_out = (unsigned int) 512 * s->sectorcounts[chunk];
ret = BZ2_bzDecompress(&s->bzstream);
total_out = ((uint64_t)s->bzstream.total_out_hi32 << 32) +
s->bzstream.total_out_lo32;
BZ2_bzDecompressEnd(&s->bzstream);
if (ret != BZ_STREAM_END ||
total_out != 512 * s->sectorcounts[chunk]) {
return -1;
}
break;
#endif
case 1:
ret = bdrv_pread(bs->file, s->offsets[chunk],
s->uncompressed_chunk, s->lengths[chunk]);
if (ret != s->lengths[chunk]) {
return -1;
}
break;
case 2:
memset(s->uncompressed_chunk, 0, 512 * s->sectorcounts[chunk]);
break;
}
s->current_chunk = chunk;
}
return 0;
}
| 1threat |
Regular Expression: 10 digits with dash on position 3,4 or 5 : <p>Im trying to verify an inputfield with regular expression. The user can enter a 10 digit number which can contain a dash on position 3,4 or 5. When i use only one expression, it works, but I can't get it to work with or-statements.
Offcourse it would be a solution to trim al the dashes, but i would like to do it this way.</p>
<p>Examples which should be allowed</p>
<pre><code>0123456789
01-23456789
012-3456789
0123-456789
</code></pre>
<p>What I think should work</p>
<pre><code>(^d{10}$)|
(^d{2}\-d{8}$)|
(^d{3}\-d{7}$)|
(^d{4}\-d{6}$)
</code></pre>
| 0debug |
I need a pdf reader plugin : How are you?
Today I'm trying to make a online pdf library app. As a result, I need a pdf reader plugin. If anyone know any reader, then please help me. Sorry to saw that, I'm poor in English.So, I'm stoping my talking here.
| 0debug |
Is window.confirm() accessible? : <p>Are native browser modals like <code>window.confirm</code>, <code>window.alert</code>, and <code>window.prompt</code> accessible, or is it better to implement something custom?</p>
| 0debug |
How do I make my table visible to phpstorm? : I am using phpstorm, when I execute it the browser shows me:
you have created case
---
test
----
Table 'test.users' doesn't exist
----
But the table users does exist? How do I fix this?
My php code looks like this:
```
<?php
define('dbuser','root');
define('dbpass','');
define('dbserver','localhost');
define('dbname','test');
$conn = mysqli_connect(dbserver,dbuser,dbpass,dbname);
if(!$conn){
die('error connecting to database');
}
echo 'you have created case';
?>
<h1>test</h1>
<?php
$query = "SELECT * FROM users";
$result = $conn->query($query);
if (!$result) die($conn->error);
?>
```
and in my microsoft sql server I have a database named test with table users with one user in it. | 0debug |
How to make this crawler more efficient : <p>I built this web crawler.</p>
<p><a href="https://github.com/shoutweb/WebsiteCrawlerEmailExtractor" rel="nofollow noreferrer">https://github.com/shoutweb/WebsiteCrawlerEmailExtractor</a></p>
<pre><code>//Regular expression function that scans individual pages for emails
function get_emails_from_webpage($url)
{
$text=file_get_contents($url);
$res = preg_match_all("/[a-z0-9]+[_a-z0-9\.-]*[a-z0-9]+@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})/i",$text,$matches);
if ($res) {
return array_unique($matches[0]);
}
else{
return null;
}
}
//URL Array
$URLArray = array();
//Inputted URL right now it just pulls it from a GET variable but you can do alter this any way you want
$inputtedURL = $_GET['url'];
//Crawling the inputted domain to get the URLS
$urlContent = file_get_contents("http://".urldecode($inputtedURL));
$dom = new DOMDocument();
@$dom->loadHTML($urlContent);
$xpath = new DOMXPath($dom);
$hrefs = $xpath->evaluate("/html/body//a");
$scrapedEmails = array();
for($i = 0; $i < $hrefs->length; $i++){
$href = $hrefs->item($i);
$url = $href->getAttribute('href');
$url = filter_var($url, FILTER_SANITIZE_URL);
//array_push($scrapedEmails, $hrefs->length);
// validate url
if(!filter_var($url, FILTER_VALIDATE_URL) === false){
if (strpos($url, $inputtedURL) !== false) {
array_push($URLArray, $url);
}
}
}
//Extracting the emails from URLS that were crawled
foreach ($URLArray as $key => $url) {
$emails = get_emails_from_webpage($url);
if($emails != null){
foreach($emails as $email) {
if(!in_array($email, $scrapedEmails)){
array_push($scrapedEmails,$email);
}
}
}
}
//Ouputting the scraped emails in addition to the the number of URLS crawled
foreach($scrapedEmails as $value) {
echo $value . " " . count($URLArray);
}
</code></pre>
<p>It basically goes to a domain that you enter, gets all the pages, and then checks to see if there is an email. </p>
<p>Each domain can take up to 30 seconds to crawl. I want to see if there is a way to speed up this webcrawler. One way I was thinking was to limit it to only contact pages, but I couldn't figure out a smart way of doing that. </p>
| 0debug |
C# Get Quarter months : i want to get the quarter months
scenario 1
```
input one: January / index 1
input two: February / index 2
result = invalid
```
scenario 2
```
input one: January / index 1
input two: July / index 7
result = invalid
```
scenario 3
```
input one: January / index 1
input two: March / index 3
result = valid
```
scenario 4
```
input one: January / index 1
input two: June / index 6
result = valid
``` | 0debug |
Pre compiling Asp.net MVC views on TFS Build defination : We currently run builds on TFS and Can I know if it is possible to pre compile views on on TFS builds?
| 0debug |
Error when I try to compile : <p>constructor in Transcript in class Transcript cannot be applied to given types;
required: java. lang.String, java. lang. String, int, int
found: java. lang. String
reason: actual and formal arguments differ in length</p>
<p>I keep getting this error when I try to compile and have no idea how to fix it.</p>
<pre><code>import java.util.Scanner;
public class TestTranscript {
public static void main(String[] args) {
Transcript t = new Transcript("student");
t.promptPIN();
t.printStudentInfo();
t.promptGrades();
t.printGrades();
t.printAverage();
}
}
</code></pre>
<p>The program is in 2 files for an assignment.</p>
<pre><code>import java.util.Scanner;
public class Transcript{
private int PIN = 164892; //student's personal identification number
private int grade1; //student's grades
private int grade2;
private int grade3;
private int grade4;
private int average; //student's total grade average
private String name; //student's full name
private String course; //student's course
private int year; //year student is attending
public Transcript(String name, String course, int year, int average)
{
this.name = name;
this.course = course;
this.year = year;
this.average = average;
}
//getters
public int getGrade1()
{
return grade1;
}
public int getGrade2()
{
return grade2;
}
public int getGrade3()
{
return grade3;
}
public int getGrade4()
{
return grade4;
}
//setters
public void setGrade1(int grade)
{
this.grade1 = grade;
}
public void setGrade2(int grade)
{
this.grade2 = grade;
}
public void setGrade3(int grade)
{
this.grade3 = grade;
}
public void setGrade4(int grade)
{
this.grade4 = grade;
}
public void printGrades(){
//grade 1
System.out.print("1st Grade: " + this.grade1 + " ");
if (grade1 < 101 && grade1 > 89) {
System.out.println("A");
} else if (grade1 < 90 && grade1 > 79) {
System.out.println("B");
} else if (grade1 < 80 && grade1 > 69) {
System.out.println("C");
} else if (grade1 < 70 && grade1 > 59) {
System.out.println("D");
} else if (grade1 < 60 && grade1 > 50) {
System.out.println("E");
} else if (grade1 <50 && grade1 > 0) {
System.out.println("F");
}
//grade 2
System.out.print("2nd Grade: " + this.grade2 + " ");
if (grade2 < 101 && grade2 > 89) {
System.out.println("A");
} else if (grade2 < 90 && grade2 > 79) {
System.out.println("B");
} else if (grade2 < 80 && grade2 > 69) {
System.out.println("C");
} else if (grade2 < 70 && grade2 > 59) {
System.out.println("D");
} else if (grade2 < 60 && grade2 > 50) {
System.out.println("E");
} else if (grade2 <50 && grade2 > 0) {
System.out.println("F");
}
//grade 3
System.out.print("3rd Grade: " + this.grade3 + " ");
if (grade3 < 101 && grade3 > 89) {
System.out.println("A");
} else if (grade3 < 90 && grade3 > 79) {
System.out.println("B");
} else if (grade3 < 80 && grade3 > 69) {
System.out.println("C");
} else if (grade3 < 70 && grade3 > 59) {
System.out.println("D");
} else if (grade3 < 60 && grade3 > 50) {
System.out.println("E");
} else if (grade3 <50 && grade3 > 0) {
System.out.println("F");
}
//grade 4
System.out.print("4th Grade: " + this.grade4 + " ");
if (grade4 < 101 && grade4 > 89) {
System.out.println("A");
} else if (grade4 < 90 && grade4 > 79) {
System.out.println("B");
} else if (grade4 < 80 && grade4 > 69) {
System.out.println("C");
} else if (grade4 < 70 && grade4 > 59) {
System.out.println("D");
} else if (grade4 < 60 && grade4 > 50) {
System.out.println("E");
} else if (grade4 <50 && grade4 > 0) {
System.out.println("F");
}
}
public void printStudentInfo() { //prints student's information
System.out.println("Student Information");
System.out.println(name); //prints student's name
System.out.println(course); //prints student's course
System.out.println(average); //prints student's grade average
System.out.println(year); //prints year of student's attendance
}
public void promptPIN() {
Scanner sc = new Scanner(System.in);
System.out.println("Enter PIN: ");
while (sc.nextInt() != PIN) {
System.out.print("Invalid PIN");
}
}
public void promptGrades() {
Scanner sc = new Scanner(System.in);
System.out.println("Course 1: ");
this.grade1 = sc.nextInt();
System.out.println("Course 2: ");
this.grade2 = sc.nextInt();
System.out.println("Course 3: ");
this.grade3 = sc.nextInt();
System.out.println("Course 4: ");
sc.close();
}
public void printAverage() {
Scanner in = new Scanner(System.in);
average = (grade1 + grade2 + grade3 + grade4)/4;
System.out.println("Grade Average: " + average);
}
}
</code></pre>
| 0debug |
put different rows from file in one column in postgres : I have a file which has different rows and I want to put all the values in a table in postgre in one column.
my file is like that:
Houses Houses
Palace
Clock
Bus Clock Sky Street Street Tower
bell clock faced face sun tower
stage underground
palace Palace river
and I want to have a table with just one column as tag ant put evrything in there! like this
Houses
Houses
Palace
Clock
Bus
| 0debug |
Profile is not an "iOS App Store" profile : <p>Using <strong>Xcode 9</strong>.</p>
<ol>
<li>Working on app store build validation. </li>
<li>Created an app with app store profile.</li>
<li>Archived successfully </li>
<li>Trying to validate build in
Organizer, I am getting the following error on selecting the
profile.</li>
</ol>
<p><a href="https://i.stack.imgur.com/oWdJC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/oWdJC.png" alt="enter image description here"></a>
This is the same profile used to archive and it is an app store profile.</p>
<p>2 Queries</p>
<ol>
<li>How to identify a profile if it is ad-hoc or app store</li>
<li>Why did this happen?Pretty sure this is an appstore profile.</li>
</ol>
| 0debug |
void cpu_x86_cpuid(CPUX86State *env, uint32_t index,
uint32_t *eax, uint32_t *ebx,
uint32_t *ecx, uint32_t *edx)
{
if (index & 0x80000000) {
if (index > env->cpuid_xlevel)
index = env->cpuid_level;
} else {
if (index > env->cpuid_level)
index = env->cpuid_level;
}
switch(index) {
case 0:
*eax = env->cpuid_level;
*ebx = env->cpuid_vendor1;
*edx = env->cpuid_vendor2;
*ecx = env->cpuid_vendor3;
if (kvm_enabled())
host_cpuid(0, NULL, ebx, ecx, edx);
break;
case 1:
*eax = env->cpuid_version;
*ebx = (env->cpuid_apic_id << 24) | 8 << 8;
*ecx = env->cpuid_ext_features;
*edx = env->cpuid_features;
if (kvm_enabled())
*ecx |= (1 << 31);
break;
case 2:
*eax = 1;
*ebx = 0;
*ecx = 0;
*edx = 0x2c307d;
break;
case 4:
switch (*ecx) {
case 0:
*eax = 0x0000121;
*ebx = 0x1c0003f;
*ecx = 0x000003f;
*edx = 0x0000001;
break;
case 1:
*eax = 0x0000122;
*ebx = 0x1c0003f;
*ecx = 0x000003f;
*edx = 0x0000001;
break;
case 2:
*eax = 0x0000143;
*ebx = 0x3c0003f;
*ecx = 0x0000fff;
*edx = 0x0000001;
break;
default:
*eax = 0;
*ebx = 0;
*ecx = 0;
*edx = 0;
break;
}
break;
case 5:
*eax = 0;
*ebx = 0;
*ecx = CPUID_MWAIT_EMX | CPUID_MWAIT_IBE;
*edx = 0;
break;
case 6:
*eax = 0;
*ebx = 0;
*ecx = 0;
*edx = 0;
break;
case 9:
*eax = 0;
*ebx = 0;
*ecx = 0;
*edx = 0;
break;
case 0xA:
*eax = 0;
*ebx = 0;
*ecx = 0;
*edx = 0;
break;
case 0x80000000:
*eax = env->cpuid_xlevel;
*ebx = env->cpuid_vendor1;
*edx = env->cpuid_vendor2;
*ecx = env->cpuid_vendor3;
break;
case 0x80000001:
*eax = env->cpuid_features;
*ebx = 0;
*ecx = env->cpuid_ext3_features;
*edx = env->cpuid_ext2_features;
if (kvm_enabled()) {
uint32_t h_eax, h_edx;
host_cpuid(0x80000001, &h_eax, NULL, NULL, &h_edx);
if ((h_edx & 0x20000000) == 0 )
*edx &= ~0x20000000;
if ((h_edx & 0x00000800) == 0)
*edx &= ~0x00000800;
if ((h_edx & 0x00100000) == 0)
*edx &= ~0x00100000;
*ecx &= ~4UL;
*edx = ~0xc0000000;
}
break;
case 0x80000002:
case 0x80000003:
case 0x80000004:
*eax = env->cpuid_model[(index - 0x80000002) * 4 + 0];
*ebx = env->cpuid_model[(index - 0x80000002) * 4 + 1];
*ecx = env->cpuid_model[(index - 0x80000002) * 4 + 2];
*edx = env->cpuid_model[(index - 0x80000002) * 4 + 3];
break;
case 0x80000005:
*eax = 0x01ff01ff;
*ebx = 0x01ff01ff;
*ecx = 0x40020140;
*edx = 0x40020140;
break;
case 0x80000006:
*eax = 0;
*ebx = 0x42004200;
*ecx = 0x02008140;
*edx = 0;
break;
case 0x80000008:
if (env->cpuid_ext2_features & CPUID_EXT2_LM) {
#if defined(USE_KQEMU)
*eax = 0x00003020;
#else
*eax = 0x00003028;
#endif
} else {
#if defined(USE_KQEMU)
*eax = 0x00000020;
#else
if (env->cpuid_features & CPUID_PSE36)
*eax = 0x00000024;
else
*eax = 0x00000020;
#endif
}
*ebx = 0;
*ecx = 0;
*edx = 0;
break;
case 0x8000000A:
*eax = 0x00000001;
*ebx = 0x00000010;
*ecx = 0;
*edx = 0;
break;
default:
*eax = 0;
*ebx = 0;
*ecx = 0;
*edx = 0;
break;
}
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.