problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
How to get count of number elements which are greater than current element in an arraylist : <p>I have an arraylist [10,11,1,2,3,6,11,10]. For each element, I want to get count of elements which are greater than current element.</p>
<p>For example, for 10, only 11 is greater than it and there are 2 occurances of it.
For 11, nothing is greater than it. So 0.</p>
<p>So we have to print output like
10,2
11,0
1,7
2,6
3,5
6,4
11,0
10,2</p>
| 0debug |
void virtio_setup_block(struct subchannel_id schid)
{
struct vq_info_block info;
struct vq_config_block config = {};
blk_cfg.blk_size = 0;
guessed_disk_nature = false;
virtio_reset(schid);
config.index = 0;
if (run_ccw(schid, CCW_CMD_READ_VQ_CONF, &config, sizeof(config))) {
virtio_panic("Could not get block device VQ configuration\n");
}
if (run_ccw(schid, CCW_CMD_READ_CONF, &blk_cfg, sizeof(blk_cfg))) {
virtio_panic("Could not get block device configuration\n");
}
vring_init(&block, config.num, ring_area,
KVM_S390_VIRTIO_RING_ALIGN);
info.queue = (unsigned long long) ring_area;
info.align = KVM_S390_VIRTIO_RING_ALIGN;
info.index = 0;
info.num = config.num;
block.schid = schid;
if (!run_ccw(schid, CCW_CMD_SET_VQ, &info, sizeof(info))) {
virtio_set_status(schid, VIRTIO_CONFIG_S_DRIVER_OK);
}
if (!virtio_ipl_disk_is_valid()) {
memset(&blk_cfg, 0, sizeof(blk_cfg));
virtio_assume_scsi();
}
}
| 1threat |
Pointers swap values in void function, but won't return swapped values: C : I'm trying to swap two strings passed in as char pointers. Debugging, I get the right answers at the end of the function, but returning the values after the function ends returns the same values as passed in. Here is the code for main:
#include <stdio.h>
int main(int argc, char const *argv[]) {
char *s1, *s2;
s1 = "12345678";
s2 = "87654321";
printf("s1 is %s\n", s1);
printf("s2 is %s\n", s2);
strswap(s1, s2);
printf("s1 is now %s\n", s1);
printf("s2 is now %s\n", s2);
}
and the code for the function itself
#include <stdio.h>
void strswap(char *s1, char *s2){
char *temp;
temp = s1;
printf("temp: %s\n", temp);
s1 = s2;
printf("s1: %s\n", s1);
s2 = temp;
printf("s1: %s\n", s1);
printf("s2: %s\n", s2);
printf("temp: %s\n", temp);
}
| 0debug |
Make an array of arrays with 10 items each : <p>I have an array that has X number of values.</p>
<p>I'm trying to make an array of arrays with 10 items each of X. How do I go on about in doing something like this?</p>
<p>I've tried using a count while iterating it and let's just say I didn't get anywhere with that. </p>
<p>I want something like </p>
<pre class="lang-py prettyprint-override"><code># Random list of 20 items
random_array = [1,...20]
# Do cool things here
# Output after doing cool thing
fancy_array = [[1,...10],[11,..20]]
</code></pre>
| 0debug |
Is there a tool for analyzing what a bash script does line by line? : <p>I need to understand few bash scripts from time to time, but I'm not a bash expert and I'd like to learn it during reading each script. Is there a tool which can tell me what each script line does?</p>
<p>for example, it can tell me what each line does, and through what grammar </p>
<pre><code>GPU_ID=$1
NET=$2
NET_lc=${NET,,}
DATASET=$3
</code></pre>
<p>for now I'm searching google by keywords "bash ${var,,}", but the search engine isn't smart enough to give me any thing useful, I can't find even the correct naming of this grammar.</p>
<p>Please don't tell me that asking on StackOverflow is my best option for all such kind of beginner's questions.</p>
| 0debug |
GET http://localhost:4200/null 404 (Not Found) in angular2 with angular-cli : <p>I'm working with angular2 project with angular-cli.
Today I updated version of below to 2.4.1.</p>
<pre><code>"@angular/common": "~2.4.1",
"@angular/compiler": "~2.4.1",
"@angular/compiler-cli": "^2.4.1",
"@angular/core": "~2.4.1",
"@angular/forms": "~2.4.1",
"@angular/http": "~2.4.1",
"@angular/platform-browser": "~2.4.1",
"@angular/platform-browser-dynamic": "~2.4.1",
"@angular/router": "~3.4.1",
"angular-cli": "^1.0.0-beta.24"
</code></pre>
<p>When I used 2.0.0, it doesn't make an error, but now, it makes an error like <code>GET http://localhost:4200/null 404 (Not Found)</code>.</p>
<p>Even though it makes an error, it's working well.
However, I want to know why it happens, and fix this error.
If anyone knows about this, please let me know.
Thank you :)</p>
<p><strong>Packages.json</strong></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-js lang-js prettyprint-override"><code>{
...
"private": true,
"dependencies": {
"@angular/common": "~2.4.1",
"@angular/compiler": "~2.4.1",
"@angular/compiler-cli": "^2.4.1",
"@angular/core": "~2.4.1",
"@angular/forms": "~2.4.1",
"@angular/http": "~2.4.1",
"@angular/material": "^2.0.0-beta.0",
"@angular/platform-browser": "~2.4.1",
"@angular/platform-browser-dynamic": "~2.4.1",
"@angular/router": "~3.4.1",
"@types/moment-timezone": "^0.2.33",
"angular-cli": "^1.0.0-beta.24",
"angular2-google-maps": "^0.17.0",
"bootstrap": "^3.3.7",
"bourbon": "^4.2.7",
"core-js": "^2.4.1",
"es6-promise": "^4.0.5",
"font-awesome": "^4.7.0",
"hammerjs": "^2.0.8",
"moment": "^2.17.1",
"moment-timezone": "^0.5.10",
"node-sass": "^3.13.0",
"primeng": "^1.1.0",
"pubnub-angular2": "^1.0.0-beta.6",
"quill": "^1.1.8",
"rxjs": "5.0.1",
"ts-helpers": "^1.1.1",
"typescript": "^2.0.10",
"typings": "^2.1.0",
"zone.js": "^0.7.4"
},
"devDependencies": {
"@types/hammerjs": "^2.0.33",
"@types/jasmine": "^2.2.30",
"@types/moment": "^2.13.0",
"@types/moment-timezone": "^0.2.33",
"@types/node": "^6.0.42",
"angular-cli": "^1.0.0-beta.24",
"bootstrap-sass": "^3.3.7",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.9",
"ts-loader": "^1.3.3",
"ts-node": "1.2.1",
"tslint": "4.2.0",
"typescript": "2.0.2"
}
}</code></pre>
</div>
</div>
</p>
<p><strong>angular-cli.json</strong></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-js lang-js prettyprint-override"><code>{
"project": {
"version": "1.0.0-beta.24",
"name": "five-delivery-admin"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": ["assets"],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"styles.scss",
"../node_modules/hammerjs/hammer.min.js",
"../node_modules/primeng/resources/themes/omega/theme.css",
"../node_modules/primeng/resources/primeng.min.css",
"../node_modules/font-awesome/css/font-awesome.min.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"../node_modules/quill/dist/quill.core.css",
"../node_modules/quill/dist/quill.snow.css",
"../node_modules/quill/dist/quill.bubble.css"
],
"scripts": [
"../node_modules/quill/dist/quill.min.js",
"../node_modules/hammerjs/hammer.min.js"
],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [],
"packages": [],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "scss",
"prefixInterfaces": false
}
}</code></pre>
</div>
</div>
</p>
<p><strong>tsconfig.json</strong></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-js lang-js prettyprint-override"><code>{
"compilerOptions": {
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"lib": ["es6", "dom"],
"mapRoot": "./",
"module": "es6",
"moduleResolution": "node",
"outDir": "../dist/out-tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": [
"../node_modules/@types"
]
}
}</code></pre>
</div>
</div>
</p>
| 0debug |
confused for setup angularjs.Many dependency found : <p>I google for setup angularjs.I found many tutorial but i am confused.I found</p>
<ol>
<li>angular-seed </li>
<li>Yeoman</li>
<li>bower</li>
<li>etc.</li>
</ol>
<p>it is necessary to use this dependency.
there is any scratch for start angularjs.</p>
| 0debug |
static int line_in_init (HWVoiceIn *hw, struct audsettings *as)
{
SpiceVoiceIn *in = container_of (hw, SpiceVoiceIn, hw);
struct audsettings settings;
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
settings.freq = spice_server_get_best_record_rate(NULL);
#else
settings.freq = SPICE_INTERFACE_RECORD_FREQ;
#endif
settings.nchannels = SPICE_INTERFACE_RECORD_CHAN;
settings.fmt = AUD_FMT_S16;
settings.endianness = AUDIO_HOST_ENDIANNESS;
audio_pcm_init_info (&hw->info, &settings);
hw->samples = LINE_IN_SAMPLES;
in->active = 0;
in->sin.base.sif = &record_sif.base;
qemu_spice_add_interface (&in->sin.base);
#if SPICE_INTERFACE_RECORD_MAJOR > 2 || SPICE_INTERFACE_RECORD_MINOR >= 3
spice_server_set_record_rate(&in->sin, settings.freq);
#endif
return 0;
}
| 1threat |
static int ide_drive_pio_post_load(void *opaque, int version_id)
{
IDEState *s = opaque;
if (s->end_transfer_fn_idx < 0 ||
s->end_transfer_fn_idx > ARRAY_SIZE(transfer_end_table)) {
return -EINVAL;
}
s->end_transfer_func = transfer_end_table[s->end_transfer_fn_idx];
s->data_ptr = s->io_buffer + s->cur_io_buffer_offset;
s->data_end = s->data_ptr + s->cur_io_buffer_len;
return 0;
}
| 1threat |
int kvm_arch_remove_sw_breakpoint(CPUState *cpu, struct kvm_sw_breakpoint *bp)
{
return -EINVAL;
}
| 1threat |
static int xen_remove_from_physmap(XenIOState *state,
hwaddr start_addr,
ram_addr_t size)
{
unsigned long i = 0;
int rc = 0;
XenPhysmap *physmap = NULL;
hwaddr phys_offset = 0;
physmap = get_physmapping(state, start_addr, size);
if (physmap == NULL) {
return -1;
}
phys_offset = physmap->phys_offset;
size = physmap->size;
DPRINTF("unmapping vram to %"HWADDR_PRIx" - %"HWADDR_PRIx", at "
"%"HWADDR_PRIx"\n", start_addr, start_addr + size, phys_offset);
size >>= TARGET_PAGE_BITS;
start_addr >>= TARGET_PAGE_BITS;
phys_offset >>= TARGET_PAGE_BITS;
for (i = 0; i < size; i++) {
unsigned long idx = start_addr + i;
xen_pfn_t gpfn = phys_offset + i;
rc = xc_domain_add_to_physmap(xen_xc, xen_domid, XENMAPSPACE_gmfn, idx, gpfn);
if (rc) {
fprintf(stderr, "add_to_physmap MFN %"PRI_xen_pfn" to PFN %"
PRI_xen_pfn" failed: %d\n", idx, gpfn, rc);
return -rc;
}
}
QLIST_REMOVE(physmap, list);
if (state->log_for_dirtybit == physmap) {
state->log_for_dirtybit = NULL;
}
g_free(physmap);
return 0;
}
| 1threat |
how to set up localhost to your domain name? : <p>I have created web page using following program: html,css and php, in mamp plate form. Now i don't not know how to connect the web page created on mamp to my domain. I have tried the following youtube video to set up my domain to local host, but I am not successful:</p>
<p><a href="https://www.youtube.com/watch?v=3COv1kjGT1c&t=210s&list=PL7BJ9Egki0pkOHkuthi7lCEDXSCXB_hK8&index=8" rel="nofollow noreferrer">https://www.youtube.com/watch?v=3COv1kjGT1c&t=210s&list=PL7BJ9Egki0pkOHkuthi7lCEDXSCXB_hK8&index=8</a>.</p>
<p>It there anything i should do on the website i bought my domain? like connecting my domain to ip address? like the following web page? </p>
<p><a href="https://support.aiso.net/index.php?/Knowledgebase/Article/View/240/2/how-do-i-add-my-domain-name-to-my-computers-host-file" rel="nofollow noreferrer">https://support.aiso.net/index.php?/Knowledgebase/Article/View/240/2/how-do-i-add-my-domain-name-to-my-computers-host-file</a> </p>
<p>I have tried for many day with no success. please any help would be much appreciated.</p>
<p>sincerely,
siva</p>
| 0debug |
best practice to iterate through array of arrays & create another array [Android] : i have an Array of Arrays such as
Arraylist<myObjec> subArray = {item1_1,item1_2, item1_3}<br></br>
Arraylist<myObjec> subArray = {item2_1,item2_2, item2_3, item2_4}
Arraylist<myObjec> mainArray = {subArray_1,subArray_2}
i want to create the newArray to be something like that:
newArray = {item1_1, item1_2, item2_1, item2_2, item1_3, item2_3, item2_4}
So i want to take a segment of item say get from every subArray 2 item and go back through array of Arrays till i finish.
what would be the best practices to approach this result? | 0debug |
query = 'SELECT * FROM customers WHERE email = ' + email_input | 1threat |
Javascript - combine two arrays in every possible way : <p>If I have two arrays:</p>
<pre><code>var arrOne = ['a','b','c']
var arrTwo = ['1','2','3']
</code></pre>
<p>How can I get a new array from this that will mix every value like so:</p>
<pre><code>var result = ['a1','a2','a3','b1','b2','b3','c1','c2','c3']
</code></pre>
| 0debug |
Delete object single property from list - C# : I want to delete object single property from list.
--------------------------------------------------
i have class,
Public class Employee
{
public int Id {get;set;}
public string Name {get;set;}
public string Address {get;set;}
}
and i have list,
List<Employee> lstEmployee = new List<Employee>();
Consider it has value like,
lstEmployee[0] = { Id = 0 , Name = "A" , Address = "ABC" }
lstEmployee[1] = { Id = 0 , Name = "B" , Address = "XYZ" }
lstEmployee[2] = { Id = 0 , Name = "C" , Address = "PQR" }
I want to delete property **Id** and rest record will remain as it is.
lstEmployee[0] = { Name = "A" , Address = "ABC" }
lstEmployee[1] = { Name = "B" , Address = "XYZ" }
lstEmployee[2] = { Name = "C" , Address = "PQR" }
Is it possible to achieve this? (Any other or alternate way)
| 0debug |
How to create a .txt file whose name is based on user input using c++ : <p>I wish to create several .txt files to store information about cars. Each .txt file will store the information for one car. I will ask the user to input the car information, such as CarId, Make, Model etc. I wish to name the .txt file using CarId given by the user. How can I realize this using c++ 11?</p>
<p>Thank you!</p>
| 0debug |
Run html class using JAVASCRIPT : i have html class using two class
<div class="container">
<div class="black">
<h1>hello<h1>
</div>
<div class="green">
<h1>hello<h1>
</div>
</div>
this is my css
.black{
background-color: black;
}
.green{
background-color: green;
}
iam need `container` `background color` black the mouse hover to class `black` h1.
and `container` `background color` gree the mouse hover to class `green` h1
this is tested java script. but this not work . plz friend help
$(document).ready(function() {
$(".container).hover(function() {
$('.green').addClass('display-on');
});
$(".container").mouseleave(function() {
$('.black').removeClass('display-on');
});
});
</script> | 0debug |
User interface design with Bootstrap : <p>I would like to make UI like in link that i have provided below. How is it possible with Bootstrap or with basic html table?</p>
<p><a href="https://imgur.com/COVjhAL" rel="nofollow">https://imgur.com/COVjhAL</a></p>
| 0debug |
How to register .Net 4.5.1 with IIS8 on windows 10 : <p>How to register .Net 4.5.1 with IIS8 on windows 10 machine?
it used to be simple as running command "aspnet_regiis -i"...but not anymore. if try to run this command i get error</p>
<blockquote>
<p>This option is not supported on this version of the operating system.
Administrators should instead install/uninstall ASP.NET 4.5 with IIS8
using the "Turn Windows Features On/Off" dialog, the Server Manager
management tool, or the dism.exe command line tool. For more details
please see <a href="http://go.microsoft.com/fwlink/?LinkID=216771" rel="noreferrer">http://go.microsoft.com/fwlink/?LinkID=216771</a>. Finished
installing ASP.NET (4.0.30319.0).</p>
</blockquote>
<p>Also in windows 10 under "Turn windows feature on & off" windows why i dont see .net 4.5 or 4.5.1? i do see 4.6 though. Is it same as 4.5.1?<br>
(note i am sure 4.5.1 is installed on my machine because visual studio allows me to set target framework 4.5.1 on web applications and i have several applications which runs on 4.5.1 without any issue)</p>
<p><a href="https://i.stack.imgur.com/xrcSW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xrcSW.png" alt="enter image description here"></a></p>
| 0debug |
pycharm analysis complete. One typo found. Where is it? : <p>I use Pycharm 2016.1.4 (latest version at the moment) and it has a small box on the right top corner of the window (a checkbox if everything is correct).</p>
<p><a href="https://i.stack.imgur.com/6Hc2W.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6Hc2W.png" alt="enter image description here"></a></p>
<p>When you click on it, it tells you some information about warnings/errors/typos.</p>
<p>Now that I understood that I have some problems, I would try to fix them. It is easy to see where errors and warnings are (their lines are highlighted on the right side of the scroll). But how can I quickly (without looking through whole text for a curly underline) identify positions of the typos?</p>
| 0debug |
void gdb_exit(CPUState *env, int code)
{
GDBState *s;
char buf[4];
s = &gdbserver_state;
if (gdbserver_fd < 0 || s->fd < 0)
return;
snprintf(buf, sizeof(buf), "W%02x", code);
put_packet(s, buf);
}
| 1threat |
static void test_validate_fail_union_flat(TestInputVisitorData *data,
const void *unused)
{
UserDefFlatUnion *tmp = NULL;
Error *err = NULL;
Visitor *v;
v = validate_test_init(data, "{ 'string': 'c', 'integer': 41, 'boolean': true }");
visit_type_UserDefFlatUnion(v, &tmp, NULL, &err);
g_assert(err);
qapi_free_UserDefFlatUnion(tmp);
} | 1threat |
static int vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size)
{
uint16_t flags;
uint8_t type;
flags = pci_get_word(vdev->pdev.config + pos + PCI_CAP_FLAGS);
type = (flags & PCI_EXP_FLAGS_TYPE) >> 4;
if (type != PCI_EXP_TYPE_ENDPOINT &&
type != PCI_EXP_TYPE_LEG_END &&
type != PCI_EXP_TYPE_RC_END) {
error_report("vfio: Assignment of PCIe type 0x%x "
"devices is not currently supported", type);
return -EINVAL;
}
if (!pci_bus_is_express(vdev->pdev.bus)) {
} else if (pci_bus_is_root(vdev->pdev.bus)) {
if (type == PCI_EXP_TYPE_ENDPOINT) {
vfio_add_emulated_word(vdev, pos + PCI_CAP_FLAGS,
PCI_EXP_TYPE_RC_END << 4,
PCI_EXP_FLAGS_TYPE);
if (size > PCI_EXP_LNKCTL) {
vfio_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP, 0, ~0);
vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL, 0, ~0);
vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA, 0, ~0);
#ifndef PCI_EXP_LNKCAP2
#define PCI_EXP_LNKCAP2 44
#endif
#ifndef PCI_EXP_LNKSTA2
#define PCI_EXP_LNKSTA2 50
#endif
if (size > PCI_EXP_LNKCAP2) {
vfio_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP2, 0, ~0);
vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL2, 0, ~0);
vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA2, 0, ~0);
}
}
} else if (type == PCI_EXP_TYPE_LEG_END) {
return 0;
}
} else {
if (type == PCI_EXP_TYPE_RC_END) {
vfio_add_emulated_word(vdev, pos + PCI_CAP_FLAGS,
PCI_EXP_TYPE_ENDPOINT << 4,
PCI_EXP_FLAGS_TYPE);
vfio_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP,
PCI_EXP_LNK_MLW_1 | PCI_EXP_LNK_LS_25, ~0);
vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL, 0, ~0);
}
vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA,
pci_get_word(vdev->pdev.config + pos +
PCI_EXP_LNKSTA),
PCI_EXP_LNKCAP_MLW | PCI_EXP_LNKCAP_SLS);
}
pos = pci_add_capability(&vdev->pdev, PCI_CAP_ID_EXP, pos, size);
if (pos >= 0) {
vdev->pdev.exp.exp_cap = pos;
}
return pos;
}
| 1threat |
static void tight_palette_rgb2buf(uint32_t rgb, int bpp, uint8_t buf[6])
{
memset(buf, 0, 6);
if (bpp == 32) {
buf[0] = ((rgb >> 24) & 0xFF);
buf[1] = ((rgb >> 16) & 0xFF);
buf[2] = ((rgb >> 8) & 0xFF);
buf[3] = ((rgb >> 0) & 0xFF);
buf[4] = ((buf[0] & 1) == 0) << 3 | ((buf[1] & 1) == 0) << 2;
buf[4]|= ((buf[2] & 1) == 0) << 1 | ((buf[3] & 1) == 0) << 0;
buf[0] |= 1;
buf[1] |= 1;
buf[2] |= 1;
buf[3] |= 1;
}
if (bpp == 16) {
buf[0] = ((rgb >> 8) & 0xFF);
buf[1] = ((rgb >> 0) & 0xFF);
buf[2] = ((buf[0] & 1) == 0) << 1 | ((buf[1] & 1) == 0) << 0;
buf[0] |= 1;
buf[1] |= 1;
}
}
| 1threat |
Node js and MongoDB app on AWS : <p>What are the steps for deploying a Node js app, with express.js framework and MongoDB as database on AWS?
This is my first such activity and I am not able to find any reliable source over the net.</p>
| 0debug |
Is there any way to detect month change in android calendar view(i.e. when user changes calendar to another month) : <p>I want to get month shown in calendar view and i cant figure it out. i tried </p>
<pre><code>calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
@Override
public void onSelectedDayChange(CalendarView view, int year, int month,
int dayOfMonth) {
int d = dayOfMonth;
int m = month;
Log.d("month", "" + m);
String curDate = String.valueOf(d);
}
});
</code></pre>
<p>but it only triggers when user click to the days of month. What i want is when user changes the month i want the changed month(i.e. the month shown in calendar view.)
Any help would be appreciated. Thanks in advance. </p>
| 0debug |
i want to automatically get a grade value for each subject after calculating the sum for each total field : after i have calculated the sum i want the grade to appear automatically without clicking on any button.
<tr class="row1">
<th>Class Name</th><th>1st</th><th>2nd</th><th>3rd</th><th>Total</th><th>Grade</th>
</tr>
<tr class="row">
<td>Class 1:</td>
<td><input type="number" name="1" id="1" class='first'></td>
<td><input type="number" name="2" id="2" class='second'></td>
<td><input type="number" name="3" id="3" class='third'></td>
<td><input type="text" name="4" id="4" class='total' readonly></td>
<td><input type="text" class='demo' readonly ></td>
</tr>
<tr class="row">
<td>Class 2:</td>
<td><input type="number" name="1" id="1" class='first'></td>
<td><input type="number" name="2" id="2" class='second'></td>
<td><input type="number" name="3" id="3" class='third'></td>
<td><input type="text" name="4" id="4" class='total' readonly></td>
<td><input type="text" class='demo' readonly ></td>
</tr>
i am having difficulty in making this javascript switch statement to work for me. pls i need help
function myFunction()
{
var num = document.getElementsByClassName("total").value;
switch(true)
{
case (num >= 91 && num <= 100):
document.getElementsByClassName("demo").innerHTML = "A+";;
break;
case (num >= 81 && num <= 90):
document.getElementsByClassName("demo").innerHTML = "A";
break;
case (num >= 71 && num <= 80):
document.getElementsByClassName("demo").innerHTML = "B+";
break;
case (num >= 61 && num <= 70):
document.getElementsByClassName("demo").innerHTML = "B";
break;
case (num >= 51 && num <= 60):
document.getElementsByClassName("demo").innerHTML = "C";
break;
case (num >= 41 && num <= 50):
document.getElementsByClassName("demo").innerHTML = "D";
break;
case (num >= 31 && num <= 40):
document.getElementsByClassName("demo").innerHTML = "E";
break;
case (num >= 0 && num <= 30):
document.getElementsByClassName("demo").innerHTML = "F";
break;
default:
document.getElementsByClassName("demo").innerHTML = "No grade yet";
break;
};
}; | 0debug |
static void vmxnet3_reset(VMXNET3State *s)
{
VMW_CBPRN("Resetting vmxnet3...");
vmxnet3_deactivate_device(s);
vmxnet3_reset_interrupt_states(s);
vmxnet_tx_pkt_reset(s->tx_pkt);
s->drv_shmem = 0;
s->tx_sop = true;
s->skip_current_tx_pkt = false;
}
| 1threat |
static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count)
{
int16_t weight[8][64];
DCTELEM orig[8][64];
const int mb_x= s->mb_x;
const int mb_y= s->mb_y;
int i;
int skip_dct[8];
int dct_offset = s->linesize*8;
uint8_t *ptr_y, *ptr_cb, *ptr_cr;
int wrap_y, wrap_c;
for(i=0; i<mb_block_count; i++) skip_dct[i]=s->skipdct;
if(s->adaptive_quant){
const int last_qp= s->qscale;
const int mb_xy= mb_x + mb_y*s->mb_stride;
s->lambda= s->lambda_table[mb_xy];
update_qscale(s);
if(!(s->flags&CODEC_FLAG_QP_RD)){
s->qscale= s->current_picture_ptr->qscale_table[mb_xy];
s->dquant= s->qscale - last_qp;
if(s->out_format==FMT_H263){
s->dquant= av_clip(s->dquant, -2, 2);
if(s->codec_id==CODEC_ID_MPEG4){
if(!s->mb_intra){
if(s->pict_type == FF_B_TYPE){
if(s->dquant&1 || s->mv_dir&MV_DIRECT)
s->dquant= 0;
}
if(s->mv_type==MV_TYPE_8X8)
s->dquant=0;
}
}
}
}
ff_set_qscale(s, last_qp + s->dquant);
}else if(s->flags&CODEC_FLAG_QP_RD)
ff_set_qscale(s, s->qscale + s->dquant);
wrap_y = s->linesize;
wrap_c = s->uvlinesize;
ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16;
ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8;
if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){
uint8_t *ebuf= s->edge_emu_buffer + 32;
ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height);
ptr_y= ebuf;
ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
ptr_cb= ebuf+18*wrap_y;
ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1);
ptr_cr= ebuf+18*wrap_y+8;
}
if (s->mb_intra) {
if(s->flags&CODEC_FLAG_INTERLACED_DCT){
int progressive_score, interlaced_score;
s->interlaced_dct=0;
progressive_score= s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y, 8)
+s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400;
if(progressive_score > 0){
interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y*2, 8)
+s->dsp.ildct_cmp[4](s, ptr_y + wrap_y , NULL, wrap_y*2, 8);
if(progressive_score > interlaced_score){
s->interlaced_dct=1;
dct_offset= wrap_y;
wrap_y<<=1;
if (s->chroma_format == CHROMA_422)
wrap_c<<=1;
}
}
}
s->dsp.get_pixels(s->block[0], ptr_y , wrap_y);
s->dsp.get_pixels(s->block[1], ptr_y + 8, wrap_y);
s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y);
s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y);
if(s->flags&CODEC_FLAG_GRAY){
skip_dct[4]= 1;
skip_dct[5]= 1;
}else{
s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c);
s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c);
if(!s->chroma_y_shift){
s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c);
s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c);
}
}
}else{
op_pixels_func (*op_pix)[4];
qpel_mc_func (*op_qpix)[16];
uint8_t *dest_y, *dest_cb, *dest_cr;
dest_y = s->dest[0];
dest_cb = s->dest[1];
dest_cr = s->dest[2];
if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){
op_pix = s->dsp.put_pixels_tab;
op_qpix= s->dsp.put_qpel_pixels_tab;
}else{
op_pix = s->dsp.put_no_rnd_pixels_tab;
op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab;
}
if (s->mv_dir & MV_DIR_FORWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix);
op_pix = s->dsp.avg_pixels_tab;
op_qpix= s->dsp.avg_qpel_pixels_tab;
}
if (s->mv_dir & MV_DIR_BACKWARD) {
MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix);
}
if(s->flags&CODEC_FLAG_INTERLACED_DCT){
int progressive_score, interlaced_score;
s->interlaced_dct=0;
progressive_score= s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y, 8)
+s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400;
if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400;
if(progressive_score>0){
interlaced_score = s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y*2, 8)
+s->dsp.ildct_cmp[0](s, dest_y + wrap_y , ptr_y + wrap_y , wrap_y*2, 8);
if(progressive_score > interlaced_score){
s->interlaced_dct=1;
dct_offset= wrap_y;
wrap_y<<=1;
if (s->chroma_format == CHROMA_422)
wrap_c<<=1;
}
}
}
s->dsp.diff_pixels(s->block[0], ptr_y , dest_y , wrap_y);
s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y);
s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset , dest_y + dct_offset , wrap_y);
s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y);
if(s->flags&CODEC_FLAG_GRAY){
skip_dct[4]= 1;
skip_dct[5]= 1;
}else{
s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c);
s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c);
if(!s->chroma_y_shift){
s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c);
s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c);
}
}
if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){
if(s->dsp.sad[1](NULL, ptr_y , dest_y , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1;
if(s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1;
if(s->dsp.sad[1](NULL, ptr_y +dct_offset , dest_y +dct_offset , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1;
if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1;
if(s->dsp.sad[1](NULL, ptr_cb , dest_cb , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1;
if(s->dsp.sad[1](NULL, ptr_cr , dest_cr , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1;
if(!s->chroma_y_shift){
if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1;
if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1;
}
}
}
if(s->avctx->quantizer_noise_shaping){
if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y);
if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y);
if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y);
if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y);
if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c);
if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c);
if(!s->chroma_y_shift){
if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c);
if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c);
}
memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count);
}
assert(s->out_format!=FMT_MJPEG || s->qscale==8);
{
for(i=0;i<mb_block_count;i++) {
if(!skip_dct[i]){
int overflow;
s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow);
if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]);
}else
s->block_last_index[i]= -1;
}
if(s->avctx->quantizer_noise_shaping){
for(i=0;i<mb_block_count;i++) {
if(!skip_dct[i]){
s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale);
}
}
}
if(s->luma_elim_threshold && !s->mb_intra)
for(i=0; i<4; i++)
dct_single_coeff_elimination(s, i, s->luma_elim_threshold);
if(s->chroma_elim_threshold && !s->mb_intra)
for(i=4; i<mb_block_count; i++)
dct_single_coeff_elimination(s, i, s->chroma_elim_threshold);
if(s->flags & CODEC_FLAG_CBP_RD){
for(i=0;i<mb_block_count;i++) {
if(s->block_last_index[i] == -1)
s->coded_score[i]= INT_MAX/256;
}
}
}
if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){
s->block_last_index[4]=
s->block_last_index[5]= 0;
s->block[4][0]=
s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale;
}
if(s->alternate_scan && s->dct_quantize != dct_quantize_c){
for(i=0; i<mb_block_count; i++){
int j;
if(s->block_last_index[i]>0){
for(j=63; j>0; j--){
if(s->block[i][ s->intra_scantable.permutated[j] ]) break;
}
s->block_last_index[i]= j;
}
}
}
switch(s->codec_id){
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
if (CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER)
mpeg1_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MPEG4:
if (CONFIG_MPEG4_ENCODER)
mpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MSMPEG4V2:
case CODEC_ID_MSMPEG4V3:
case CODEC_ID_WMV1:
if (CONFIG_MSMPEG4_ENCODER)
msmpeg4_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_WMV2:
if (CONFIG_WMV2_ENCODER)
ff_wmv2_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_H261:
if (CONFIG_H261_ENCODER)
ff_h261_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_H263:
case CODEC_ID_H263P:
case CODEC_ID_FLV1:
case CODEC_ID_RV10:
case CODEC_ID_RV20:
if (CONFIG_H263_ENCODER || CONFIG_H263P_ENCODER ||
CONFIG_FLV_ENCODER || CONFIG_RV10_ENCODER || CONFIG_RV20_ENCODER)
h263_encode_mb(s, s->block, motion_x, motion_y);
break;
case CODEC_ID_MJPEG:
if (CONFIG_MJPEG_ENCODER)
ff_mjpeg_encode_mb(s, s->block);
break;
default:
assert(0);
}
}
| 1threat |
static void intra_predict_mad_cow_dc_0lt_8x8_msa(uint8_t *src, int32_t stride)
{
uint8_t lp_cnt;
uint32_t src0, src1, src2 = 0, src3;
uint32_t out0, out1, out2, out3;
v16u8 src_top;
v8u16 add;
v4u32 sum;
src_top = LD_UB(src - stride);
add = __msa_hadd_u_h(src_top, src_top);
sum = __msa_hadd_u_w(add, add);
src0 = __msa_copy_u_w((v4i32) sum, 0);
src1 = __msa_copy_u_w((v4i32) sum, 1);
for (lp_cnt = 0; lp_cnt < 4; lp_cnt++) {
src2 += src[(4 + lp_cnt) * stride - 1];
}
src0 = (src0 + 2) >> 2;
src3 = (src1 + src2 + 4) >> 3;
src1 = (src1 + 2) >> 2;
src2 = (src2 + 2) >> 2;
out0 = src0 * 0x01010101;
out1 = src1 * 0x01010101;
out2 = src2 * 0x01010101;
out3 = src3 * 0x01010101;
for (lp_cnt = 4; lp_cnt--;) {
SW(out0, src);
SW(out1, src + 4);
SW(out2, src + stride * 4);
SW(out3, src + stride * 4 + 4);
src += stride;
}
}
| 1threat |
Error in my Navigation Drawer : <p>I'm new to android, I have designed a navigation drawer and I want to show a message (as Toast) as every item is clicked, It runs but the message is not shown, can anyone help me please? </p>
<p>this is my code for showing the message:</p>
<pre><code> @Override
public boolean onOptionsItemSelected(MenuItem item){
if (mToggle.onOptionsItemSelected(item)){
return true;
}
//return super.onOptionsItemSelected(item);
//}
int MyID = item.getItemId();
if (MyID == R.id.nav_account){
Toast.makeText(this, "Account", Toast.LENGTH_SHORT).show();
return true;
}
else if (MyID == R.id.nav_settings){
Toast.makeText(this, "Settings", Toast.LENGTH_SHORT).show();
return true;
}
else if (MyID == R.id.nav_logout){
Toast.makeText(this, "Log Out", Toast.LENGTH_SHORT).show();
return true;
}
return super.onOptionsItemSelected(item);
}
</code></pre>
| 0debug |
How to convert Metres to Centimetres in Monkey C : serious newbie question, but I can't seem to find the answer anywhere!
I'm trying to convert my height from Centimetres to Metres in an application for my Garmin device. This is written in Monkey C (very similar to Java and C++ from what I understand).
Here's how I'm currently doing it:
var height = angus.height;
var heightCM = height.format("%0.2f");
My height is 175, and so as you might expect, this gives me a result of 175.00
I can't seem to find any resource that tells my how to essentially move a decimal to the left! Any help would be really appreciated.
Here's the documentation on formatting in Monkey C, https://developer.garmin.com/downloads/connect-iq/monkey-c/doc/Toybox/Lang/Number.html#format-instance_method
Any explanation on formatting numbers would be great. I'm also attempting to truncate a number, so from 1234567 to 1234, for example. So any information on that would also be great.
Thanks in advance!
| 0debug |
What is the best way to create continious html parsing? : I have an html page in my local network. I need to get some figures every 1 second and save in database.
What is the best way to do that?
I think it may be parser is written using python. But how to do it that script keep passing constantly. Maybe using cron? | 0debug |
AndroidMy 6.0 targetSdkVersion 23 open failed: EACCES (Permission denied) : <p>I got a error, W/System.err: java.io.FileNotFoundException: open failed: EACCES (Permission denied) </p>
<p>Code has :</p>
<pre><code>Environment.getExternalStorageDirectory().getAbsolutePath()
</code></pre>
<p>AndroidManifest.xml has :</p>
<pre><code><uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
</code></pre>
<p>build.gradle has:</p>
<pre><code>targetSdkVersion is 23
</code></pre>
| 0debug |
static inline void load_seg_cache_raw_dt(SegmentCache *sc, uint32_t e1, uint32_t e2)
{
sc->base = get_seg_base(e1, e2);
sc->limit = get_seg_limit(e1, e2);
sc->flags = e2;
}
| 1threat |
static void pci_error_message(Monitor *mon)
{
monitor_printf(mon, "PCI devices not supported\n");
}
| 1threat |
How to refactor those quite similar arrow functions? : <p>I'm refactoring some code in a react file, and I have two functions which almost does the same thing... but one return a function and the other one execute some code.</p>
<p>I'm not really good for now with ES6 and arrow function. And I don't understand how to refactor this.</p>
<pre><code> switchEventSelectedSchedule = cb => option => {
this.setState(
// Mutate the state
() => ({
eventSelected: option.id,
isLoading: true
}),
// Callback to fire when the state has been mutated with the new event id
async () => {
await this.longPollingAllMatches();
this.setState(() => ({
isLoading: false
}));
const { currentRoundId, rounds } = this.state;
cb(rounds, currentRoundId);
}
);
};
switchEventSelectedRoundTable = option => {
this.setState(
// Mutate the state
() => ({
eventSelected: option.id,
isLoading: true
}),
// Callback to fire when the state has been mutated with the new event id
async () => {
await this.longPollingAllMatches();
this.setState(() => ({
isLoading: false
}));
}
);
};
</code></pre>
<p>in one case (imagine if(schedule)) I need to return the cb function else I must just execute the rest of the code.</p>
<p>Sorry seems dumb but I think I misunderstood something in the ES6 syntax to achieve this....</p>
<p>Many thx !</p>
| 0debug |
Google Colab is very slow compared to my PC : <p>I've recently started to use Google Colab, and wanted to train my first Convolutional NN. I imported the images from my Google Drive thanks to the answer I got <a href="https://stackoverflow.com/questions/49351071/load-image-dataset-folder-or-zip-located-in-google-drive-to-google-colab">here</a>.</p>
<p>Then I pasted my code to create the CNN into Colab and started the process.
Here is the complete code:</p>
<h2>Part 1: Setting up Colab to import picture from my Drive</h2>
<p>(part 1 is copied from <a href="https://stackoverflow.com/questions/49351071/load-image-dataset-folder-or-zip-located-in-google-drive-to-google-colab">here</a> as it worked as exptected for me</p>
<p>Step 1:</p>
<pre><code>!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
</code></pre>
<p>Step 2:</p>
<pre><code>from google.colab import auth
auth.authenticate_user()
</code></pre>
<p>Step 3:</p>
<pre><code>from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}
</code></pre>
<p>Step 4:</p>
<pre><code>!mkdir -p drive
!google-drive-ocamlfuse drive
</code></pre>
<p>Step 5:</p>
<pre><code>print('Files in Drive:')
!ls drive/
</code></pre>
<h2>Part 2: Copy pasting my CNN</h2>
<p>I created this CNN with tutorials from a Udemy Course. It uses keras with tensorflow as backend.
For the sake of simplicity I uploaded a really simple version, which is plenty enough to show my problems</p>
<pre><code>from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
from keras.layers import Dropout
from keras.optimizers import Adam
from keras.preprocessing.image import ImageDataGenerator
</code></pre>
<p>parameters </p>
<pre><code>imageSize=32
batchSize=64
epochAmount=50
</code></pre>
<p>CNN </p>
<pre><code>classifier=Sequential()
classifier.add(Conv2D(32, (3, 3), input_shape = (imageSize, imageSize, 3), activation = 'relu')) #convolutional layer
classifier.add(MaxPooling2D(pool_size = (2, 2))) #pooling layer
classifier.add(Flatten())
</code></pre>
<p>ANN </p>
<pre><code>classifier.add(Dense(units=64, activation='relu')) #hidden layer
classifier.add(Dense(units=1, activation='sigmoid')) #output layer
classifier.compile(optimizer = "adam", loss = 'binary_crossentropy', metrics = ['accuracy']) #training method
</code></pre>
<p>image preprocessing </p>
<pre><code>train_datagen = ImageDataGenerator(rescale = 1./255,
shear_range = 0.2,
zoom_range = 0.2,
horizontal_flip = True)
test_datagen = ImageDataGenerator(rescale = 1./255)
training_set = train_datagen.flow_from_directory('drive/School/sem-2-2018/BSP2/UdemyCourse/CNN/dataset/training_set',
target_size = (imageSize, imageSize),
batch_size = batchSize,
class_mode = 'binary')
test_set = test_datagen.flow_from_directory('drive/School/sem-2-2018/BSP2/UdemyCourse/CNN/dataset/test_set',
target_size = (imageSize, imageSize),
batch_size = batchSize,
class_mode = 'binary')
classifier.fit_generator(training_set,
steps_per_epoch = (8000//batchSize),
epochs = epochAmount,
validation_data = test_set,
validation_steps = (2000//batchSize))
</code></pre>
<h2>Now comes my Problem</h2>
<p>First of, the training set I used is a database with 10000 dog and cat pictures of various resolutions. (8000 training_set, 2000 test_set)</p>
<p>I ran this CNN on Google Colab (with GPU support enabled) and on my PC (tensorflow-gpu on GTX 1060)</p>
<p>This is an intermediate result from my PC:</p>
<pre><code>Epoch 2/50
63/125 [==============>...............] - ETA: 2s - loss: 0.6382 - acc: 0.6520
</code></pre>
<p>And this from Colab:</p>
<pre><code>Epoch 1/50
13/125 [==>...........................] - ETA: 1:00:51 - loss: 0.7265 - acc: 0.4916
</code></pre>
<p>Why is Google Colab so slow in my case? </p>
<p>Personally I suspect a bottleneck consisting of pulling and then reading the images from my Drive, but I don't know how to solve this other than choosing a different method to import the database.</p>
| 0debug |
static void gen_msgclr(DisasContext *ctx)
{
#if defined(CONFIG_USER_ONLY)
GEN_PRIV;
#else
CHK_SV;
gen_helper_msgclr(cpu_env, cpu_gpr[rB(ctx->opcode)]);
#endif
}
| 1threat |
HTML color of navigation bar : <p>I am designing a web page and I want the top navigation bar of my website to have a color like the image below.
This image is taken from the website of Virgin America airlines.
See how the color changes from left to right.
Any CSS/HTML tricks to accomplish this task.</p>
<p><a href="https://i.stack.imgur.com/xZNgl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xZNgl.png" alt="enter image description here"></a></p>
<p>PS:I did know how to frame this in words, so the poor title of the question.</p>
| 0debug |
void visit_type_any(Visitor *v, const char *name, QObject **obj, Error **errp)
{
v->type_any(v, name, obj, errp);
}
| 1threat |
int page_check_range(target_ulong start, target_ulong len, int flags)
{
PageDesc *p;
target_ulong end;
target_ulong addr;
#if TARGET_ABI_BITS > L1_MAP_ADDR_SPACE_BITS
assert(start < ((abi_ulong)1 << L1_MAP_ADDR_SPACE_BITS));
#endif
if (len == 0) {
return 0;
}
if (start + len - 1 < start) {
return -1;
}
end = TARGET_PAGE_ALIGN(start + len);
start = start & TARGET_PAGE_MASK;
for (addr = start, len = end - start;
len != 0;
len -= TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
p = page_find(addr >> TARGET_PAGE_BITS);
if (!p) {
return -1;
}
if (!(p->flags & PAGE_VALID)) {
return -1;
}
if ((flags & PAGE_READ) && !(p->flags & PAGE_READ)) {
return -1;
}
if (flags & PAGE_WRITE) {
if (!(p->flags & PAGE_WRITE_ORG)) {
return -1;
}
if (!(p->flags & PAGE_WRITE)) {
if (!page_unprotect(addr, 0, NULL)) {
return -1;
}
}
return 0;
}
}
return 0;
}
| 1threat |
static inline void FUNC(idctRowCondDC)(DCTELEM *row)
{
int a0, a1, a2, a3, b0, b1, b2, b3;
#if HAVE_FAST_64BIT
#define ROW0_MASK (0xffffLL << 48 * HAVE_BIGENDIAN)
if (((((uint64_t *)row)[0] & ~ROW0_MASK) | ((uint64_t *)row)[1]) == 0) {
uint64_t temp = (row[0] << DC_SHIFT) & 0xffff;
temp += temp << 16;
temp += temp << 32;
((uint64_t *)row)[0] = temp;
((uint64_t *)row)[1] = temp;
return;
}
#else
if (!(((uint32_t*)row)[1] |
((uint32_t*)row)[2] |
((uint32_t*)row)[3] |
row[1])) {
uint32_t temp = (row[0] << DC_SHIFT) & 0xffff;
temp += temp << 16;
((uint32_t*)row)[0]=((uint32_t*)row)[1] =
((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp;
return;
}
#endif
a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1));
a1 = a0;
a2 = a0;
a3 = a0;
a0 += W2 * row[2];
a1 += W6 * row[2];
a2 -= W6 * row[2];
a3 -= W2 * row[2];
b0 = MUL(W1, row[1]);
MAC(b0, W3, row[3]);
b1 = MUL(W3, row[1]);
MAC(b1, -W7, row[3]);
b2 = MUL(W5, row[1]);
MAC(b2, -W1, row[3]);
b3 = MUL(W7, row[1]);
MAC(b3, -W5, row[3]);
if (AV_RN64A(row + 4)) {
a0 += W4*row[4] + W6*row[6];
a1 += - W4*row[4] - W2*row[6];
a2 += - W4*row[4] + W2*row[6];
a3 += W4*row[4] - W6*row[6];
MAC(b0, W5, row[5]);
MAC(b0, W7, row[7]);
MAC(b1, -W1, row[5]);
MAC(b1, -W5, row[7]);
MAC(b2, W7, row[5]);
MAC(b2, W3, row[7]);
MAC(b3, W3, row[5]);
MAC(b3, -W1, row[7]);
}
row[0] = (a0 + b0) >> ROW_SHIFT;
row[7] = (a0 - b0) >> ROW_SHIFT;
row[1] = (a1 + b1) >> ROW_SHIFT;
row[6] = (a1 - b1) >> ROW_SHIFT;
row[2] = (a2 + b2) >> ROW_SHIFT;
row[5] = (a2 - b2) >> ROW_SHIFT;
row[3] = (a3 + b3) >> ROW_SHIFT;
row[4] = (a3 - b3) >> ROW_SHIFT;
}
| 1threat |
Check two elements are both int he same class : Im try to assert two elements are in the same class, image attached. So i want to assert the data-qa-card-id="id number" and data-qa-available-card are in the same class. But then i want to check that the data-qa-card-id="id number" and data-qa-active-card are now in the same class after the data qa-card-id-changes state? Could i just use an if statement??
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/r8Vbd.png
| 0debug |
node module version conflict when installing modules for electron : <p>I'm trying to make an Electron application (<a href="https://electron.atom.io/" rel="noreferrer">https://electron.atom.io/</a>) that reads data from my serial port. I'm new to web technologies in general, I know some javascript, but I'm a c++ guy. </p>
<p>So I pulled in their quick-start from github, ran </p>
<pre><code>npm install && npm start
</code></pre>
<p>With this easily working I tried to install and run serialport with</p>
<pre><code>npm install serialport
</code></pre>
<p>With that installed and running fine with a test file, I tried to combine the two and put <code>require('serialport')</code> in the index.html file. With this in there I get this error:</p>
<pre><code>Uncaught Error: The module '/home/user/Documents/Programing/Git/Arduino-mpu6050/electron-quick-start/node_modules/serialport/build/Release/serialport.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 51. This version of Node.js requires
NODE_MODULE_VERSION 53. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or`npm install`).
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20)
at Object.Module._extensions..node (module.js:598:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at bindings (/home/user/Documents/Programing/Git/Arduino-mpu6050/electron-quick-start/node_modules/bindings/bindings.js:76:44)
at Object.<anonymous> (/home/user/Documents/Programing/Git/Arduino-mpu6050/electron-quick-start/node_modules/serialport/lib/bindings.js:3:35)
</code></pre>
<p>Any ideas how to fix it? I'm not using two different versions of Node, why am I getting this error. </p>
<p>System OS info:</p>
<pre><code>Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
</code></pre>
| 0debug |
PHP Parse error: syntax error, unexpected 'lik' (T_STRING), expecting ',' or ';' : <pre><code>echo '<b><h2>Bu Fiyat İçin Oyun Sistemi Önermiyoruz. Bütçenize Yakın Bir Fiyatla 1800TL'lik Sistemimizi Tercih Ediniz.</h2></b><br><br><a href="'. $sistem1800 .'" target="_blank">Tıklayınız.</a><br><br> Şimdiden Hayırlı Olması Dileğiyle, İyi Günler.';
</code></pre>
<p>I'm giving that error. Please help me.</p>
| 0debug |
void virtio_scsi_dataplane_start(VirtIOSCSI *s)
{
int i;
int rc;
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(s)));
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
if (s->dataplane_started ||
s->dataplane_starting ||
s->dataplane_fenced ||
s->ctx != iothread_get_aio_context(vs->conf.iothread)) {
return;
}
s->dataplane_starting = true;
rc = k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, true);
if (rc != 0) {
fprintf(stderr, "virtio-scsi: Failed to set guest notifiers (%d), "
"ensure -enable-kvm is set\n", rc);
goto fail_guest_notifiers;
}
aio_context_acquire(s->ctx);
rc = virtio_scsi_vring_init(s, vs->ctrl_vq, 0,
virtio_scsi_data_plane_handle_ctrl);
if (rc) {
goto fail_vrings;
}
rc = virtio_scsi_vring_init(s, vs->event_vq, 1,
virtio_scsi_data_plane_handle_event);
if (rc) {
goto fail_vrings;
}
for (i = 0; i < vs->conf.num_queues; i++) {
rc = virtio_scsi_vring_init(s, vs->cmd_vqs[i], i + 2,
virtio_scsi_data_plane_handle_cmd);
if (rc) {
goto fail_vrings;
}
}
s->dataplane_starting = false;
s->dataplane_started = true;
aio_context_release(s->ctx);
return;
fail_vrings:
virtio_scsi_clear_aio(s);
aio_context_release(s->ctx);
for (i = 0; i < vs->conf.num_queues + 2; i++) {
virtio_bus_set_host_notifier(VIRTIO_BUS(qbus), i, false);
}
k->set_guest_notifiers(qbus->parent, vs->conf.num_queues + 2, false);
fail_guest_notifiers:
s->dataplane_fenced = true;
s->dataplane_starting = false;
s->dataplane_started = true;
}
| 1threat |
Can't Access Index of Associative Array php : <p>I'm sending my posted data to the server as a block of JSON data due to its size. Once it arrives, I decode it using <code>json_decode</code> and then go about my business. The problem I've run into is I can't access values at indexes. When I <code>print_r</code> the array it shows everything, but trying to echo the value at an index shows nothing. Why doesn't the echo work? Here's what I'm trying:</p>
<pre><code>$content = json_decode($_POST['result']);
print_r($content); //works
echo $content["rowCount"]; //doesn't work
</code></pre>
<p>Here's what <code>print_r($content);</code> prints out: </p>
<blockquote>
<p>stdClass Object ( [prodName] => [company] => [runTime] => [adLine]
=> [vintage] => [agency] => [vimeo] => [notes] => [displayOrder] => [infoId] => [prodName1] => test [company1] => test [runTime1] => 0
[adLine1] => [vintage1] => 0 [agency1] => [vimeo1] =>
<a href="https://vimeo.com/" rel="nofollow noreferrer">https://vimeo.com/</a> [notes1] => [displayOrder1] =>
0 [infoId1] => 339 [rowCount] => 1 )</p>
</blockquote>
| 0debug |
static void null_end_frame(AVFilterLink *inlink) { }
| 1threat |
static int mov_read_close(AVFormatContext *s)
{
int i;
MOVContext *mov = s->priv_data;
for(i=0; i<mov->total_streams; i++)
mov_free_stream_context(mov->streams[i]);
for(i=0; i<s->nb_streams; i++)
av_free(s->streams[i]);
return 0;
}
| 1threat |
Is there a Pythonic way to delete common indexes in multiple lists? : <p>Say I want to delete index <code>i</code> from <code>alist</code> and <code>blist</code>. Is there a clean, Pythonic way to achieve this?</p>
| 0debug |
How to subtract multiple string values from another string : <p>With:</p>
<pre><code>abc = 'abc'
xyz = 'xyz'
word = 'begin abc- middle_xyz_ end'
</code></pre>
<p>I need to extract the values of <code>abc</code> and <code>xyz</code> from <code>word</code>.
The result should be </p>
<pre><code>result = 'begin - middle__ end'
</code></pre>
<p>How to achieve this with a minimum amount of code?</p>
| 0debug |
Difference between Springboot 1.X and Springboot 2.0 : <p>We have been using Springboot 1.X for our applications.
Now were are getting ready to start on a few new applications and was wondering if we should go with SpringBoot2.0 or stick with SpringBoot 1.X?</p>
<p>Any thoughts on one way or the other?
Also, what are the differences between Spring Boot 1.X vs Spring Boot 2.0?</p>
<p>Thanks.</p>
| 0debug |
sinon stub not replacing function. : <p>I tried a dummy module and to stub it, but does not work.</p>
<p>the app.js</p>
<pre><code>function foo()
{
return run_func()
}
function run_func()
{
return '1'
}
exports._test = {foo: foo, run_func: run_func}
</code></pre>
<p>the test.js</p>
<pre><code>app = require("./app.js")._test
describe('test', function(){
it('test', function(){
var test_stub = sinon.stub(app, 'run_func').callsFake(
function(){
return '0'
})
test_stub.restore()
var res = app.foo()
assert.equal('0', res)
})
})
</code></pre>
<p>I tried the advice from:
<a href="https://stackoverflow.com/questions/40805349/sinon-stub-not-replacing-function">sinon stub not replacing function</a></p>
<p>But still the same. It does not replace the function.</p>
| 0debug |
static int omap_dma_ch_reg_write(struct omap_dma_s *s,
int ch, int reg, uint16_t value) {
switch (reg) {
case 0x00:
s->ch[ch].burst[1] = (value & 0xc000) >> 14;
s->ch[ch].pack[1] = (value & 0x2000) >> 13;
s->ch[ch].port[1] = (enum omap_dma_port) ((value & 0x1e00) >> 9);
s->ch[ch].burst[0] = (value & 0x0180) >> 7;
s->ch[ch].pack[0] = (value & 0x0040) >> 6;
s->ch[ch].port[0] = (enum omap_dma_port) ((value & 0x003c) >> 2);
s->ch[ch].data_type = (1 << (value & 3));
if (s->ch[ch].port[0] >= omap_dma_port_last)
printf("%s: invalid DMA port %i\n", __FUNCTION__,
s->ch[ch].port[0]);
if (s->ch[ch].port[1] >= omap_dma_port_last)
printf("%s: invalid DMA port %i\n", __FUNCTION__,
s->ch[ch].port[1]);
if ((value & 3) == 3)
printf("%s: bad data_type for DMA channel %i\n", __FUNCTION__, ch);
break;
case 0x02:
s->ch[ch].mode[1] = (omap_dma_addressing_t) ((value & 0xc000) >> 14);
s->ch[ch].mode[0] = (omap_dma_addressing_t) ((value & 0x3000) >> 12);
s->ch[ch].end_prog = (value & 0x0800) >> 11;
s->ch[ch].repeat = (value & 0x0200) >> 9;
s->ch[ch].auto_init = (value & 0x0100) >> 8;
s->ch[ch].priority = (value & 0x0040) >> 6;
s->ch[ch].fs = (value & 0x0020) >> 5;
s->ch[ch].sync = value & 0x001f;
if (value & 0x0080) {
if (s->ch[ch].running) {
if (!s->ch[ch].signalled &&
s->ch[ch].auto_init && s->ch[ch].end_prog)
omap_dma_channel_load(s, ch);
} else {
s->ch[ch].running = 1;
omap_dma_channel_load(s, ch);
}
if (!s->ch[ch].sync || (s->drq & (1 << s->ch[ch].sync)))
omap_dma_request_run(s, ch, 0);
} else {
s->ch[ch].running = 0;
omap_dma_request_stop(s, ch);
}
break;
case 0x04:
s->ch[ch].interrupts = value & 0x003f;
break;
case 0x06:
return 1;
case 0x08:
s->ch[ch].addr[0] &= 0xffff0000;
s->ch[ch].addr[0] |= value;
break;
case 0x0a:
s->ch[ch].addr[0] &= 0x0000ffff;
s->ch[ch].addr[0] |= value << 16;
break;
case 0x0c:
s->ch[ch].addr[1] &= 0xffff0000;
s->ch[ch].addr[1] |= value;
break;
case 0x0e:
s->ch[ch].addr[1] &= 0x0000ffff;
s->ch[ch].addr[1] |= value << 16;
break;
case 0x10:
s->ch[ch].elements = value & 0xffff;
break;
case 0x12:
s->ch[ch].frames = value & 0xffff;
break;
case 0x14:
s->ch[ch].frame_index = value & 0xffff;
break;
case 0x16:
s->ch[ch].element_index = value & 0xffff;
break;
case 0x18:
return 1;
default:
OMAP_BAD_REG((unsigned long) reg);
}
return 0;
}
| 1threat |
static BlockDriverAIOCB *raw_aio_readv(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
RawAIOCB *acb;
acb = raw_aio_setup(bs, sector_num, qiov, nb_sectors, cb, opaque);
if (!acb)
return NULL;
if (qemu_paio_read(&acb->aiocb) < 0) {
raw_aio_remove(acb);
return NULL;
}
return &acb->common;
}
| 1threat |
print a string n times in c : Having a variable
h = get_int()
how do I print (using prinft) this variable
e = " "
h times?
I know it may sound stupid, but I´m a rooky. | 0debug |
why my jquery toggle is not working : **Here why my toggle is not working**
<script>
$(document).ready(function () {
$("#tab").hide()
$("#btn1").click(function () {
$("#tab").toggle();
}) })
</script>
**Html Code**
<div>
<table>
<tr>
<th>
<b>Employee Name</b>
</th>
</tr>
<tr ng-repeat="Emp in John">
<td>
<input type="button" id="btn1" value="click" />
{{Emp.Name}}
<table id="tab">
<tr>
<th>
<b>OrderId</b>
</th>
</tr>
<tr ng-repeat="Joy in Emp.order">
<td>
{{Joy.OrderId}}
</td>
</tr>
</table>
</td>
</tr>
</table>
</div> | 0debug |
def is_abundant(n):
fctrsum = sum([fctr for fctr in range(1, n) if n % fctr == 0])
return fctrsum > n | 0debug |
CSS hover/active touch feedback not working on mobile until react-select is shown : <p>I am struggling to debug the issue here. Until a react-select is shown on the UI the feedback on mobile touch elements do not provide feedback on touch.</p>
<p>This can be seen here by completing the journey on mobile until step 4:
<a href="https://odd-panda-design.badgerbookings.com/booking" rel="noreferrer">https://odd-panda-design.badgerbookings.com/booking</a></p>
<p>When you first interact with the elements there is no feedback however when you get to the 4th screen in the journey and click "signup" (showing the react select) the hover elements suddenly provide feedback if you navigate back to them. This issue is only on mobile and not web. I have tested on iPhone 6 using Chrome.</p>
<p>Below is the react-select element that triggers the touch feedback interactions. </p>
<p><a href="https://i.stack.imgur.com/b9t50.png" rel="noreferrer"><img src="https://i.stack.imgur.com/b9t50.png" alt="enter image description here"></a></p>
<p>I have tried adding <code>onTouchStart</code> and changing the hover elements to include <code>:active</code> or <code>:focus</code></p>
<p>I am not sure if this is a react or javascript issue</p>
| 0debug |
VS 2015 debugging: how do I know whether 2 object variables have the same object reference? : <p>how do I know during debugging whether <code>obj</code> and <code>obj2</code> reference the same object in the following code?</p>
<pre><code>object obj = new object();
object obj2 = new object();
obj2 = obj;
</code></pre>
<p>In VS 2008 I could easily see that by looking in the watch window or locals window or on the value tooltip of the variable, because they all showed the object address, which was really useful (code sample is C++/CLI, but was tested in C# as well): </p>
<p><a href="https://i.stack.imgur.com/bx9dy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bx9dy.png" alt="enter image description here"></a></p>
<p><strong>But VS 2015 does not. How do I get that info here?</strong></p>
| 0debug |
void ff_init_elbg(int *points, int dim, int numpoints, int *codebook,
int numCB, int max_steps, int *closest_cb,
AVLFG *rand_state)
{
int i, k;
if (numpoints > 24*numCB) {
int *temp_points = av_malloc(dim*(numpoints/8)*sizeof(int));
for (i=0; i<numpoints/8; i++) {
k = (i*BIG_PRIME) % numpoints;
memcpy(temp_points + i*dim, points + k*dim, dim*sizeof(int));
}
ff_init_elbg(temp_points, dim, numpoints/8, codebook, numCB, 2*max_steps, closest_cb, rand_state);
ff_do_elbg(temp_points, dim, numpoints/8, codebook, numCB, 2*max_steps, closest_cb, rand_state);
av_free(temp_points);
} else
for (i=0; i < numCB; i++)
memcpy(codebook + i*dim, points + ((i*BIG_PRIME)%numpoints)*dim,
dim*sizeof(int));
}
| 1threat |
void qmp_drive_mirror(const char *device, const char *target,
bool has_format, const char *format,
enum MirrorSyncMode sync,
bool has_mode, enum NewImageMode mode,
bool has_speed, int64_t speed,
bool has_granularity, uint32_t granularity,
bool has_buf_size, int64_t buf_size,
bool has_on_source_error, BlockdevOnError on_source_error,
bool has_on_target_error, BlockdevOnError on_target_error,
Error **errp)
{
BlockDriverState *bs;
BlockDriverState *source, *target_bs;
BlockDriver *drv = NULL;
Error *local_err = NULL;
int flags;
int64_t size;
int ret;
if (!has_speed) {
speed = 0;
}
if (!has_on_source_error) {
on_source_error = BLOCKDEV_ON_ERROR_REPORT;
}
if (!has_on_target_error) {
on_target_error = BLOCKDEV_ON_ERROR_REPORT;
}
if (!has_mode) {
mode = NEW_IMAGE_MODE_ABSOLUTE_PATHS;
}
if (!has_granularity) {
granularity = 0;
}
if (!has_buf_size) {
buf_size = DEFAULT_MIRROR_BUF_SIZE;
}
if (granularity != 0 && (granularity < 512 || granularity > 1048576 * 64)) {
error_set(errp, QERR_INVALID_PARAMETER, device);
return;
}
if (granularity & (granularity - 1)) {
error_set(errp, QERR_INVALID_PARAMETER, device);
return;
}
bs = bdrv_find(device);
if (!bs) {
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
return;
}
if (!bdrv_is_inserted(bs)) {
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
return;
}
if (!has_format) {
format = mode == NEW_IMAGE_MODE_EXISTING ? NULL : bs->drv->format_name;
}
if (format) {
drv = bdrv_find_format(format);
if (!drv) {
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
return;
}
}
if (bdrv_in_use(bs)) {
error_set(errp, QERR_DEVICE_IN_USE, device);
return;
}
flags = bs->open_flags | BDRV_O_RDWR;
source = bs->backing_hd;
if (!source && sync == MIRROR_SYNC_MODE_TOP) {
sync = MIRROR_SYNC_MODE_FULL;
}
size = bdrv_getlength(bs);
if (size < 0) {
error_setg_errno(errp, -size, "bdrv_getlength failed");
return;
}
if (sync == MIRROR_SYNC_MODE_FULL && mode != NEW_IMAGE_MODE_EXISTING) {
assert(format && drv);
bdrv_img_create(target, format,
NULL, NULL, NULL, size, flags, &local_err, false);
} else {
switch (mode) {
case NEW_IMAGE_MODE_EXISTING:
break;
case NEW_IMAGE_MODE_ABSOLUTE_PATHS:
bdrv_img_create(target, format,
source->filename,
source->drv->format_name,
NULL, size, flags, &local_err, false);
break;
default:
abort();
}
}
if (error_is_set(&local_err)) {
error_propagate(errp, local_err);
return;
}
target_bs = bdrv_new("");
ret = bdrv_open(target_bs, target, NULL, flags | BDRV_O_NO_BACKING, drv,
&local_err);
if (ret < 0) {
bdrv_unref(target_bs);
error_propagate(errp, local_err);
return;
}
mirror_start(bs, target_bs, speed, granularity, buf_size, sync,
on_source_error, on_target_error,
block_job_cb, bs, &local_err);
if (local_err != NULL) {
bdrv_unref(target_bs);
error_propagate(errp, local_err);
return;
}
}
| 1threat |
static void openrisc_pic_cpu_handler(void *opaque, int irq, int level)
{
OpenRISCCPU *cpu = (OpenRISCCPU *)opaque;
CPUState *cs = CPU(cpu);
uint32_t irq_bit = 1 << irq;
if (irq > 31 || irq < 0) {
return;
}
if (level) {
cpu->env.picsr |= irq_bit;
} else {
cpu->env.picsr &= ~irq_bit;
}
if (cpu->env.picsr & cpu->env.picmr) {
cpu_interrupt(cs, CPU_INTERRUPT_HARD);
} else {
cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
cpu->env.picsr = 0;
}
}
| 1threat |
Double Pointer being modified in an array mysteriously : <p>Hello I have a function which populates a 2D array, consisting of words. I want to simply return the value of the pointer I entered the function with, but for some reason the pointer is now pointing to something else, strangely. I want to know how to fix this. Also wouldn't it be possible to do pointer arithmetic to fix this issue?(That's not what I want to do, I want to see what the issue is and fix it that way, but it'd be nice to know anyway). So it's supposed to be a 500 x 5 array, and even though I assign strings to 'dictPointer[i]', which I thought is supposed to represent "*dictPointer" and not "dictPointer", it seems as though I shouldn't have an issue. I need it to be this way because I wanted to print words starting from the initial pointer value. Also note that dictPointer is a pointer to pointer( **dictPointer)</p>
<pre><code>char** readAndPopulateArray(FILE *f, char *fileName, char **dictPointer, int x ) { // x represents the number of words
// point is the word pointer
int i = 0;
char tempStr[80];
char ch;
f = fopen(fileName, "r");
if ( f == NULL ) {
printf("Cannot open %s. Verify it's in the right location\n", fileName);
}
while (fscanf(f, "%s", tempStr) == 1 ) {
if( strlen(tempStr) == 4 ) {
if(i == 0 ) {
printf("Entering dictpointer points to %p\n", *dictPointer);
}
dictPointer[i] = tempStr;
if ( i == 499 ) {
printf("Exiting dictPointer points to %p\n", *dictPointer);
}
}
i++;
}
return dictPointer;
}
</code></pre>
<p>Below was how I called malloc for the matrix:</p>
<pre><code>char** makeStringWordArray(int x, int letters ) { // x represents number of words, function stores one character each per word
// letters represents number of letters in each word
char *hold;
int i, j = 0;
char **dict = (char **)(malloc(x * sizeof(char*)) );
for (i = 0; i<x; i++ ) {
dict[i] = (char*)(malloc(letters*sizeof(char) + 1 ) );
}
return dict;
}
</code></pre>
| 0debug |
static int alloc_tables(H264Context *h){
MpegEncContext * const s = &h->s;
const int big_mb_num= s->mb_stride * (s->mb_height+1);
int x,y;
CHECKED_ALLOCZ(h->intra4x4_pred_mode, big_mb_num * 8 * sizeof(uint8_t))
CHECKED_ALLOCZ(h->non_zero_count , big_mb_num * 16 * sizeof(uint8_t))
CHECKED_ALLOCZ(h->slice_table_base , (big_mb_num+s->mb_stride) * sizeof(*h->slice_table_base))
CHECKED_ALLOCZ(h->cbp_table, big_mb_num * sizeof(uint16_t))
CHECKED_ALLOCZ(h->chroma_pred_mode_table, big_mb_num * sizeof(uint8_t))
CHECKED_ALLOCZ(h->mvd_table[0], 32*big_mb_num * sizeof(uint16_t));
CHECKED_ALLOCZ(h->mvd_table[1], 32*big_mb_num * sizeof(uint16_t));
CHECKED_ALLOCZ(h->direct_table, 32*big_mb_num * sizeof(uint8_t));
memset(h->slice_table_base, -1, (big_mb_num+s->mb_stride) * sizeof(*h->slice_table_base));
h->slice_table= h->slice_table_base + s->mb_stride*2 + 1;
CHECKED_ALLOCZ(h->mb2b_xy , big_mb_num * sizeof(uint32_t));
CHECKED_ALLOCZ(h->mb2b8_xy , big_mb_num * sizeof(uint32_t));
for(y=0; y<s->mb_height; y++){
for(x=0; x<s->mb_width; x++){
const int mb_xy= x + y*s->mb_stride;
const int b_xy = 4*x + 4*y*h->b_stride;
const int b8_xy= 2*x + 2*y*h->b8_stride;
h->mb2b_xy [mb_xy]= b_xy;
h->mb2b8_xy[mb_xy]= b8_xy;
}
}
s->obmc_scratchpad = NULL;
if(!h->dequant4_coeff[0])
init_dequant_tables(h);
return 0;
fail:
free_tables(h);
return -1;
}
| 1threat |
static int vhdx_open(BlockDriverState *bs, QDict *options, int flags,
Error **errp)
{
BDRVVHDXState *s = bs->opaque;
int ret = 0;
uint32_t i;
uint64_t signature;
bool log_flushed = false;
s->bat = NULL;
s->first_visible_write = true;
qemu_co_mutex_init(&s->lock);
QLIST_INIT(&s->regions);
ret = bdrv_pread(bs->file, 0, &signature, sizeof(uint64_t));
if (ret < 0) {
goto fail;
}
if (memcmp(&signature, "vhdxfile", 8)) {
ret = -EINVAL;
goto fail;
}
vhdx_guid_generate(&s->session_guid);
ret = vhdx_parse_header(bs, s);
if (ret < 0) {
goto fail;
}
ret = vhdx_parse_log(bs, s, &log_flushed);
if (ret < 0) {
goto fail;
}
ret = vhdx_open_region_tables(bs, s);
if (ret < 0) {
goto fail;
}
ret = vhdx_parse_metadata(bs, s);
if (ret < 0) {
goto fail;
}
s->block_size = s->params.block_size;
bs->total_sectors = s->virtual_disk_size >> s->logical_sector_size_bits;
vhdx_calc_bat_entries(s);
s->bat_offset = s->bat_rt.file_offset;
if (s->bat_entries > s->bat_rt.length / sizeof(VHDXBatEntry)) {
ret = -EINVAL;
goto fail;
}
s->bat = qemu_blockalign(bs, s->bat_rt.length);
ret = bdrv_pread(bs->file, s->bat_offset, s->bat, s->bat_rt.length);
if (ret < 0) {
goto fail;
}
uint64_t payblocks = s->chunk_ratio;
for (i = 0; i < s->bat_entries; i++) {
le64_to_cpus(&s->bat[i]);
if (payblocks--) {
if ((s->bat[i] & VHDX_BAT_STATE_BIT_MASK) ==
PAYLOAD_BLOCK_FULLY_PRESENT) {
ret = vhdx_region_check(s, s->bat[i] & VHDX_BAT_FILE_OFF_MASK,
s->block_size);
if (ret < 0) {
goto fail;
}
}
} else {
payblocks = s->chunk_ratio;
}
}
if (flags & BDRV_O_RDWR) {
ret = vhdx_update_headers(bs, s, false, NULL);
if (ret < 0) {
goto fail;
}
}
error_set(&s->migration_blocker,
QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
"vhdx", bs->device_name, "live migration");
migrate_add_blocker(s->migration_blocker);
return 0;
fail:
vhdx_close(bs);
return ret;
}
| 1threat |
Lambda implementation of interface in kotlin : <p>What would be the equivalent of that code in kotlin, nothing seems to work of what I try:</p>
<pre><code>public interface AnInterface {
void doSmth(MyClass inst, int num);
}
</code></pre>
<p>init:</p>
<pre><code>AnInterface impl = (inst, num) -> {
//...
}
</code></pre>
| 0debug |
Kotlin - how to get annotation attribute value : <p>say, i have one Kotlin class with annotations:</p>
<pre><code>@Entity @Table(name="user") data class User (val id:Long, val name:String)
</code></pre>
<p>How can i get the value of name attribute from @Table annotation?</p>
<pre><code>fun <T> tableName(c: KClass<T>):String {
// i can get the @Table annotation like this:
val t = c.annotations.find { it.annotationClass == Table::class }
// but how can i get the value of "name" attribute from t?
}
</code></pre>
| 0debug |
Array concatenation function is returning gibberish. : <p>This involves two functions, both of which are listed below: </p>
<pre><code>char *catw(char *s1, char sep, char *s2)
{
char s[strlen(s1) + strlen(s2) + 1];
for(int i = 0; i < strlen(s1); i++) {
s[i] = s1[i];
}
s[strlen(s1)] = sep;
for(int j = 1; j <= strlen(s2); j++) {
s[j + strlen(s1)] = s2[j];
}
char *rs = s;
return rs;
}
</code></pre>
<p>The above function works fine, it takes two strings and concatenates them together using the character in between them. </p>
<pre><code>char *catw_arr(char *ss[], char sep)
{
char *ar = ss[0];
for(int i = 1; i < strlen(ss); i++)
{
ar = catw(ar, sep, ss[i]);
printf("%s\n", ar);
}
return ar;
}
</code></pre>
<p>This function, however, is the problem. It is supposed to take an array of strings, with an int that is the length of the array, and a separator, and concat all the strings together. The printf is in there because I wanted to test what was going on. </p>
<p>here's the main function I'm using:</p>
<pre><code>int main()
{
char *abc[3] = {"a", "b", "c"};
printf("%s\n", catw_arr(abc, 3, '/'));
return 0;
}
</code></pre>
<p>This is what it churns out: </p>
<pre><code>a/
?ĶS?/
?ĶS?/
</code></pre>
<p>I honestly have no idea what the problem is here. I'm assuming it's concatenating the first string with the separator, but then it's running into some crap that it can't process and starts outputting gibberish. </p>
| 0debug |
Preprocessing function of inception v3 in Keras : <p>This is preprocessing function of inception v3 in Keras. It is totally different from other models preprocessing.</p>
<pre><code>def preprocess_input(x):
x /= 255.
x -= 0.5
x *= 2.
return x
</code></pre>
<p><strong>1. Why there is no mean subtraction?</strong></p>
<p><strong>2. Why there is no RGB to BGR?</strong></p>
<p><strong>3. Mapping between [-1,1] is normal for this model?</strong></p>
<p>and this is preprocessing function of VGG and ResNet in Keras:</p>
<pre><code>def preprocess_input(x, data_format=None):
if data_format is None:
data_format = K.image_data_format()
assert data_format in {'channels_last', 'channels_first'}
if data_format == 'channels_first':
# 'RGB'->'BGR'
x = x[:, ::-1, :, :]
# Zero-center by mean pixel
x[:, 0, :, :] -= 103.939
x[:, 1, :, :] -= 116.779
x[:, 2, :, :] -= 123.68
else:
# 'RGB'->'BGR'
x = x[:, :, :, ::-1]
# Zero-center by mean pixel
x[:, :, :, 0] -= 103.939
x[:, :, :, 1] -= 116.779
x[:, :, :, 2] -= 123.68
return x
</code></pre>
<p>Also Caffe models use mean subtraction and RGB to BGR.</p>
| 0debug |
Can I keep my Intents and entities on-premise? : For security reasons, I don't want to save the Intents and Entities in the dialogflow cloud, instead I want to keep those on-premise. Is it possible? | 0debug |
static void decode_blocks(SnowContext *s){
int x, y;
int w= s->b_width;
int h= s->b_height;
for(y=0; y<h; y++){
for(x=0; x<w; x++){
decode_q_branch(s, 0, x, y);
}
}
}
| 1threat |
Parsing Vector<String> into a string. : I'm trying to tokenize a string. The strings I'm working on have the following format.... name,city,major,color,hobbies,age and I'm using the code below to do that. And temp is a string.
{
cin>>command;
vector <string> tokens;
stringstream check(command);
string middle;
while(getline(check, intermediate, ','))
{
tokens.push_back(intermidiate);
}
for(int i = 0; i<tokens.size(); i++)
{
cout << tokens[i] <<endl;
}
temp = tokens[1];
cout<<temp;
And I'm trying to parse the vector string into just a string but my program crashes when I tried to do that... Is there a way to parse it into just a string or should I try something else entirely?
Thanks! | 0debug |
def zip_list(list1,list2):
result = list(map(list.__add__, list1, list2))
return result | 0debug |
Bootstrap 4 Sticky Footer Not Sticking : <p>Not really sure why the sticky footer isn't working in Bootstrap 4. I have a TYPO3 website which I am a beginner at.</p>
<p>The sticky footer is not sticking at the bottom of the page.</p>
<p>Here is a copy of the page source as it has been rendered.</p>
<p>I basically copied the html file from bootstraps docs folder and then modified it and copied it into my TYPO3 template.</p>
<p>If I fill the page with content, the footer does not stick - I have to scroll the page down to see it.</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><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Landing Page</title>
<meta name="generator" content="TYPO3 CMS">
<link rel="stylesheet" type="text/css"
href="/typo3temp/assets/css/d42b6e1bdf.css?1507853162" media="all">
<link rel="stylesheet" type="text/css"
href="/fileadmin/templates/landing_page/css/bootstrap.min.css?1507860230"
media="all">
<link rel="stylesheet" type="text/css"
href="/fileadmin/templates/landing_page/css/sticky-footer.css?1507861966"
media="all">
<script
src="/fileadmin/templates/landing_page/js/jquery-3.2.1.min.js?1507862465"
type="text/javascript"></script>
<script
src="/fileadmin/templates/landing_page/js/tether.min.js?1507862602"
type="text/javascript"></script>
<script
src="/fileadmin/templates/landing_page/js/bootstrap.min.js?1507854311"
type="text/javascript"></script>
</head>
<body>
<div class="container">
<div class="mt-1">
<h1>Sticky footer</h1>
</div>
<p class="lead">Pin a fixed-height footer to the bottom of the
viewport in desktop browsers with this custom HTML and CSS.</p>
<p>
Use <a href="../sticky-footer-navbar">the sticky footer with a
fixed navbar</a> if need be, too.
</p>
<div class="row">
<div class="col">1 of 3</div>
<div class="col">1 of 3</div>
<div class="col">1 of 3</div>
</div>
</div>
<footer class="footer">
<div class="container">
<span class="text-muted">Place sticky footer content here.</span>
</div>
</footer>
</body>
</html></code></pre>
</div>
</div>
</p>
| 0debug |
int float64_le_quiet( float64 a, float64 b STATUS_PARAM )
{
flag aSign, bSign;
if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
|| ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
) {
if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {
float_raise( float_flag_invalid STATUS_VAR);
}
return 0;
}
aSign = extractFloat64Sign( a );
bSign = extractFloat64Sign( b );
if ( aSign != bSign ) return aSign || ( (bits64) ( ( a | b )<<1 ) == 0 );
return ( a == b ) || ( aSign ^ ( a < b ) );
}
| 1threat |
How to make three div with 2nth div is Add and Remove button in CSS : <p>I want to make it like below image:
<a href="https://i.stack.imgur.com/h90St.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/h90St.png" alt="enter image description here"></a></p>
| 0debug |
static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
{
RTPMuxContext *s = s1->priv_data;
AVStream *st = s1->streams[0];
int rtcp_bytes;
int size= pkt->size;
av_dlog(s1, "%d: write len=%d\n", pkt->stream_index, size);
rtcp_bytes = ((s->octet_count - s->last_octet_count) * RTCP_TX_RATIO_NUM) /
RTCP_TX_RATIO_DEN;
if ((s->first_packet || ((rtcp_bytes >= RTCP_SR_SIZE) &&
(ff_ntp_time() - s->last_rtcp_ntp_time > 5000000))) &&
!(s->flags & FF_RTP_FLAG_SKIP_RTCP)) {
rtcp_send_sr(s1, ff_ntp_time(), 0);
s->last_octet_count = s->octet_count;
s->first_packet = 0;
}
s->cur_timestamp = s->base_timestamp + pkt->pts;
switch(st->codec->codec_id) {
case AV_CODEC_ID_PCM_MULAW:
case AV_CODEC_ID_PCM_ALAW:
case AV_CODEC_ID_PCM_U8:
case AV_CODEC_ID_PCM_S8:
return rtp_send_samples(s1, pkt->data, size, 8 * st->codec->channels);
case AV_CODEC_ID_PCM_U16BE:
case AV_CODEC_ID_PCM_U16LE:
case AV_CODEC_ID_PCM_S16BE:
case AV_CODEC_ID_PCM_S16LE:
return rtp_send_samples(s1, pkt->data, size, 16 * st->codec->channels);
case AV_CODEC_ID_ADPCM_G722:
return rtp_send_samples(s1, pkt->data, size, 8 * st->codec->channels);
case AV_CODEC_ID_ADPCM_G726:
return rtp_send_samples(s1, pkt->data, size,
st->codec->bits_per_coded_sample * st->codec->channels);
case AV_CODEC_ID_MP2:
case AV_CODEC_ID_MP3:
rtp_send_mpegaudio(s1, pkt->data, size);
break;
case AV_CODEC_ID_MPEG1VIDEO:
case AV_CODEC_ID_MPEG2VIDEO:
ff_rtp_send_mpegvideo(s1, pkt->data, size);
break;
case AV_CODEC_ID_AAC:
if (s->flags & FF_RTP_FLAG_MP4A_LATM)
ff_rtp_send_latm(s1, pkt->data, size);
else
ff_rtp_send_aac(s1, pkt->data, size);
break;
case AV_CODEC_ID_AMR_NB:
case AV_CODEC_ID_AMR_WB:
ff_rtp_send_amr(s1, pkt->data, size);
break;
case AV_CODEC_ID_MPEG2TS:
rtp_send_mpegts_raw(s1, pkt->data, size);
break;
case AV_CODEC_ID_H264:
ff_rtp_send_h264(s1, pkt->data, size);
break;
case AV_CODEC_ID_H261:
ff_rtp_send_h261(s1, pkt->data, size);
break;
case AV_CODEC_ID_H263:
if (s->flags & FF_RTP_FLAG_RFC2190) {
int mb_info_size = 0;
const uint8_t *mb_info =
av_packet_get_side_data(pkt, AV_PKT_DATA_H263_MB_INFO,
&mb_info_size);
ff_rtp_send_h263_rfc2190(s1, pkt->data, size, mb_info, mb_info_size);
break;
}
case AV_CODEC_ID_H263P:
ff_rtp_send_h263(s1, pkt->data, size);
break;
case AV_CODEC_ID_HEVC:
ff_rtp_send_hevc(s1, pkt->data, size);
break;
case AV_CODEC_ID_VORBIS:
case AV_CODEC_ID_THEORA:
ff_rtp_send_xiph(s1, pkt->data, size);
break;
case AV_CODEC_ID_VP8:
ff_rtp_send_vp8(s1, pkt->data, size);
break;
case AV_CODEC_ID_ILBC:
rtp_send_ilbc(s1, pkt->data, size);
break;
case AV_CODEC_ID_MJPEG:
ff_rtp_send_jpeg(s1, pkt->data, size);
break;
case AV_CODEC_ID_OPUS:
if (size > s->max_payload_size) {
av_log(s1, AV_LOG_ERROR,
"Packet size %d too large for max RTP payload size %d\n",
size, s->max_payload_size);
return AVERROR(EINVAL);
}
default:
rtp_send_raw(s1, pkt->data, size);
break;
}
return 0;
}
| 1threat |
static int decode_picture_header(AVCodecContext *avctx, const uint8_t *buf, const int buf_size)
{
ProresContext *ctx = avctx->priv_data;
int i, hdr_size, slice_count;
unsigned pic_data_size;
int log2_slice_mb_width, log2_slice_mb_height;
int slice_mb_count, mb_x, mb_y;
const uint8_t *data_ptr, *index_ptr;
hdr_size = buf[0] >> 3;
if (hdr_size < 8 || hdr_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "error, wrong picture header size\n");
return -1;
}
pic_data_size = AV_RB32(buf + 1);
if (pic_data_size > buf_size) {
av_log(avctx, AV_LOG_ERROR, "error, wrong picture data size\n");
return -1;
}
log2_slice_mb_width = buf[7] >> 4;
log2_slice_mb_height = buf[7] & 0xF;
if (log2_slice_mb_width > 3 || log2_slice_mb_height) {
av_log(avctx, AV_LOG_ERROR, "unsupported slice resolution: %dx%d\n",
1 << log2_slice_mb_width, 1 << log2_slice_mb_height);
return -1;
}
ctx->mb_width = (avctx->width + 15) >> 4;
ctx->mb_height = (avctx->height + 15) >> 4;
slice_count = AV_RB16(buf + 5);
if (ctx->slice_count != slice_count || !ctx->slices) {
av_freep(&ctx->slices);
ctx->slices = av_mallocz(slice_count * sizeof(*ctx->slices));
if (!ctx->slices)
return AVERROR(ENOMEM);
ctx->slice_count = slice_count;
}
if (!slice_count)
return AVERROR(EINVAL);
if (hdr_size + slice_count*2 > buf_size) {
av_log(avctx, AV_LOG_ERROR, "error, wrong slice count\n");
return -1;
}
index_ptr = buf + hdr_size;
data_ptr = index_ptr + slice_count*2;
slice_mb_count = 1 << log2_slice_mb_width;
mb_x = 0;
mb_y = 0;
for (i = 0; i < slice_count; i++) {
SliceContext *slice = &ctx->slices[i];
slice->data = data_ptr;
data_ptr += AV_RB16(index_ptr + i*2);
while (ctx->mb_width - mb_x < slice_mb_count)
slice_mb_count >>= 1;
slice->mb_x = mb_x;
slice->mb_y = mb_y;
slice->mb_count = slice_mb_count;
slice->data_size = data_ptr - slice->data;
if (slice->data_size < 6) {
av_log(avctx, AV_LOG_ERROR, "error, wrong slice data size\n");
return -1;
}
mb_x += slice_mb_count;
if (mb_x == ctx->mb_width) {
slice_mb_count = 1 << log2_slice_mb_width;
mb_x = 0;
mb_y++;
}
if (data_ptr > buf + buf_size) {
av_log(avctx, AV_LOG_ERROR, "error, slice out of bounds\n");
return -1;
}
}
return pic_data_size;
}
| 1threat |
Notification vibrates on each progress update : <p>When on Android 8.0 (Oreo), every time there is an update to the progress of the notification, it vibrates. So the phone vibrates 100 times in the process. This only happens on Android 8.0 So i can assume I am having some improper use of their API. I am asking for help in stopping the vibration on each progress update of the notification. Here is my code:</p>
<p>Building Notification</p>
<pre><code>mNotifyManager = (NotificationManager) mActivity.getSystemService(Context.NOTIFICATION_SERVICE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) createChannel(mNotifyManager);
mBuilder = new NotificationCompat.Builder(mActivity, "FileDownload")
.setSmallIcon(android.R.drawable.stat_sys_download)
.setColor(ContextCompat.getColor(mActivity, R.color.colorNotification))
.setContentTitle(mFile.getName())
.setContentText(mActivity.getResources().getString(R.string.app_name))
.setProgress(0, 0, true);
mNotifyManager.notify(mFile.getId().hashCode(), mBuilder.build());
</code></pre>
<p>Create Channel method</p>
<pre><code> @TargetApi(26)
private void createChannel(NotificationManager notificationManager) {
String name = "FileDownload";
String description = "Notifications for download status";
int importance = NotificationManager.IMPORTANCE_MAX;
NotificationChannel mChannel = new NotificationChannel(name, name, importance);
mChannel.setDescription(description);
mChannel.enableLights(true);
mChannel.setLightColor(Color.BLUE);
notificationManager.createNotificationChannel(mChannel);
}
</code></pre>
<p>onProgress</p>
<pre><code> @Override
public void onProgress(File file, double progress, long downloadedBytes, long totalBytes) {
mBuilder.setProgress(100, (int) (progress * 100), false);
mNotifyManager.notify(file.getId().hashCode(), mBuilder.build());
}
</code></pre>
| 0debug |
Unable to override app name on mac os electron menu : <p>I'm banging my head against the wall on this one. I'm trying to override the name of a demo electron app to give it a custom name instead of just <code>Electron</code>. I created a module for doing this:</p>
<pre><code>const {app, Menu} = require('electron')
const template = [
{
label: 'New Name',
submenu:[
{
label: 'Test',
click: (menuItem, browserWindow, event) => {
console.log('menu item clicked')
}
},
{role: 'quit'}
]
},
{
label: 'test test',
submenu:[
{
label: 'Test',
click: (menuItem, browserWindow, event) => {
console.log('menu item clicked')
}
},
{role: 'quit'}
]
}
]
installApplicationMenu = function (){
const menu = Menu.buildFromTemplate(template)
let result = Menu.setApplicationMenu(menu)
}
module.exports = {
installApplicationMenu
}
</code></pre>
<p>And I'm invoking this module after creating my window:</p>
<pre><code>const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
const {installApplicationMenu} = require('./MenuInstaller')
require('electron-reload')(__dirname,{
electron: path.join(__dirname, 'node_modules', '.bin', 'electron')
})
let win
function createWindow(){
win = new BrowserWindow({
width: 800,
height: 600
})
win.loadURL(
url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
})
)
win.on('closed', () => {
win = null
})
}
app.on('ready', function (){
createWindow()
installApplicationMenu()
})
app.on('activate', () => {
if(win === null) createWindow()
})
</code></pre>
<p>When I do this the second menu set gets it's custom name of <code>test test</code> but the main menu name is still <code>Electron</code>:</p>
<p><a href="https://i.stack.imgur.com/h2e1O.png" rel="noreferrer"><img src="https://i.stack.imgur.com/h2e1O.png" alt="screenshot of menus not set"></a></p>
<p>I've been comparing the code to a different app I created where I was able to override the default name and I can't spot what's keeping the override from working in this case. </p>
<p>Any ideas?</p>
| 0debug |
Get the referer link using PHP or any other language : <p>I am presently working on a project that requires us been able to know the url which our visitors are redirected from.</p>
<p>For Example, If we send out newsletters and a visitor clicks the link and get redirected to our website. We want to know what url he was redirected from.</p>
<p>Is this possible? </p>
| 0debug |
static int mtv_probe(AVProbeData *p)
{
if(p->buf_size < 3)
return 0;
if(*(p->buf) != 'A' || *(p->buf+1) != 'M' || *(p->buf+2) != 'V')
return 0;
return AVPROBE_SCORE_MAX;
}
| 1threat |
How do I surround my line of text with tags : I'm using Visual Studio 2017, trying to do a search and replace using regular expressions to do the following. I would like to surround each line in my text file with `<li>line</li>`
For example:
This is line 1 to be surrounded with list item tags
This is line 2 to be surrounded with list item tags
This is line 3 to be surrounded with list item tags
The desired output
<li>This is line 1 to be surrounded with list item tags</li>
<li>This is line 2 to be surrounded with list item tags</li>
<li>This is line 3 to be surrounded with list item tags</li>
Can someone please help me? | 0debug |
Update flutter dependencies in /.pub-cache : <p>I erased in my folder <code>.pub-cache/hosted/pub.dartlang.org/this_plugin</code></p>
<p><strong>What is the command to update the dependencies inside <code>pubsec.yaml</code>?</strong> I believe it is</p>
<blockquote>
<p>flutter packages get</p>
</blockquote>
<p>The folder under <code>.pub-cache</code> is still not up to date.</p>
<p>Note: there was a <code>pubspec.lock</code> that I deleted</p>
| 0debug |
static void packet_id_queue_add(struct PacketIdQueue *q, uint64_t id)
{
USBRedirDevice *dev = q->dev;
struct PacketIdQueueEntry *e;
DPRINTF("adding packet id %"PRIu64" to %s queue\n", id, q->name);
e = g_malloc0(sizeof(struct PacketIdQueueEntry));
e->id = id;
QTAILQ_INSERT_TAIL(&q->head, e, next);
q->size++;
}
| 1threat |
Jquery UI css doesnt work : I've just watched a youtube video about Jquery UI and here is the link:
https://www.youtube.com/watch?v=WrHpzNMlhfo
and so i saw that we can try it also with this link:
http:// jsbin.com/chromebug/4
but the result turn me crazy, I really dont have any idea about it
[enter image description here][1]
[1]: https://i.stack.imgur.com/OXlKz.jpg
and my chrome version is 57.0.2987.133 | 0debug |
static int decode_gop_header(IVI45DecContext *ctx, AVCodecContext *avctx)
{
int result, i, p, tile_size, pic_size_indx, mb_size, blk_size, is_scalable;
int quant_mat, blk_size_changed = 0;
IVIBandDesc *band, *band1, *band2;
IVIPicConfig pic_conf;
ctx->gop_flags = get_bits(&ctx->gb, 8);
ctx->gop_hdr_size = (ctx->gop_flags & 1) ? get_bits(&ctx->gb, 16) : 0;
if (ctx->gop_flags & IVI5_IS_PROTECTED)
ctx->lock_word = get_bits_long(&ctx->gb, 32);
tile_size = (ctx->gop_flags & 0x40) ? 64 << get_bits(&ctx->gb, 2) : 0;
if (tile_size > 256) {
av_log(avctx, AV_LOG_ERROR, "Invalid tile size: %d\n", tile_size);
return AVERROR_INVALIDDATA;
}
pic_conf.luma_bands = get_bits(&ctx->gb, 2) * 3 + 1;
pic_conf.chroma_bands = get_bits1(&ctx->gb) * 3 + 1;
is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1;
if (is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) {
av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n",
pic_conf.luma_bands, pic_conf.chroma_bands);
return AVERROR_INVALIDDATA;
}
pic_size_indx = get_bits(&ctx->gb, 4);
if (pic_size_indx == IVI5_PIC_SIZE_ESC) {
pic_conf.pic_height = get_bits(&ctx->gb, 13);
pic_conf.pic_width = get_bits(&ctx->gb, 13);
} else {
pic_conf.pic_height = ivi5_common_pic_sizes[pic_size_indx * 2 + 1] << 2;
pic_conf.pic_width = ivi5_common_pic_sizes[pic_size_indx * 2 ] << 2;
}
if (ctx->gop_flags & 2) {
avpriv_report_missing_feature(avctx, "YV12 picture format");
return AVERROR_PATCHWELCOME;
}
pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2;
pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2;
if (!tile_size) {
pic_conf.tile_height = pic_conf.pic_height;
pic_conf.tile_width = pic_conf.pic_width;
} else {
pic_conf.tile_height = pic_conf.tile_width = tile_size;
}
if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf) || ctx->gop_invalid) {
result = ff_ivi_init_planes(ctx->planes, &pic_conf, 0);
if (result < 0) {
av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n");
return result;
}
ctx->pic_conf = pic_conf;
ctx->is_scalable = is_scalable;
blk_size_changed = 1;
}
for (p = 0; p <= 1; p++) {
for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) {
band = &ctx->planes[p].bands[i];
band->is_halfpel = get_bits1(&ctx->gb);
mb_size = get_bits1(&ctx->gb);
blk_size = 8 >> get_bits1(&ctx->gb);
mb_size = blk_size << !mb_size;
if (p==0 && blk_size==4) {
av_log(avctx, AV_LOG_ERROR, "4x4 luma blocks are unsupported!\n");
return AVERROR_PATCHWELCOME;
}
blk_size_changed = mb_size != band->mb_size || blk_size != band->blk_size;
if (blk_size_changed) {
band->mb_size = mb_size;
band->blk_size = blk_size;
}
if (get_bits1(&ctx->gb)) {
avpriv_report_missing_feature(avctx, "Extended transform info");
return AVERROR_PATCHWELCOME;
}
switch ((p << 2) + i) {
case 0:
band->inv_transform = ff_ivi_inverse_slant_8x8;
band->dc_transform = ff_ivi_dc_slant_2d;
band->scan = ff_zigzag_direct;
band->transform_size = 8;
break;
case 1:
band->inv_transform = ff_ivi_row_slant8;
band->dc_transform = ff_ivi_dc_row_slant;
band->scan = ff_ivi_vertical_scan_8x8;
band->transform_size = 8;
break;
case 2:
band->inv_transform = ff_ivi_col_slant8;
band->dc_transform = ff_ivi_dc_col_slant;
band->scan = ff_ivi_horizontal_scan_8x8;
band->transform_size = 8;
break;
case 3:
band->inv_transform = ff_ivi_put_pixels_8x8;
band->dc_transform = ff_ivi_put_dc_pixel_8x8;
band->scan = ff_ivi_horizontal_scan_8x8;
band->transform_size = 8;
break;
case 4:
band->inv_transform = ff_ivi_inverse_slant_4x4;
band->dc_transform = ff_ivi_dc_slant_2d;
band->scan = ff_ivi_direct_scan_4x4;
band->transform_size = 4;
break;
}
band->is_2d_trans = band->inv_transform == ff_ivi_inverse_slant_8x8 ||
band->inv_transform == ff_ivi_inverse_slant_4x4;
if (band->transform_size != band->blk_size) {
av_log(avctx, AV_LOG_ERROR, "transform and block size mismatch (%d != %d)\n", band->transform_size, band->blk_size);
return AVERROR_INVALIDDATA;
}
if (!p) {
quant_mat = (pic_conf.luma_bands > 1) ? i+1 : 0;
} else {
quant_mat = 5;
}
if (band->blk_size == 8) {
if(quant_mat >= 5){
av_log(avctx, AV_LOG_ERROR, "quant_mat %d too large!\n", quant_mat);
return -1;
}
band->intra_base = &ivi5_base_quant_8x8_intra[quant_mat][0];
band->inter_base = &ivi5_base_quant_8x8_inter[quant_mat][0];
band->intra_scale = &ivi5_scale_quant_8x8_intra[quant_mat][0];
band->inter_scale = &ivi5_scale_quant_8x8_inter[quant_mat][0];
} else {
band->intra_base = ivi5_base_quant_4x4_intra;
band->inter_base = ivi5_base_quant_4x4_inter;
band->intra_scale = ivi5_scale_quant_4x4_intra;
band->inter_scale = ivi5_scale_quant_4x4_inter;
}
if (get_bits(&ctx->gb, 2)) {
av_log(avctx, AV_LOG_ERROR, "End marker missing!\n");
return AVERROR_INVALIDDATA;
}
}
}
for (i = 0; i < pic_conf.chroma_bands; i++) {
band1 = &ctx->planes[1].bands[i];
band2 = &ctx->planes[2].bands[i];
band2->width = band1->width;
band2->height = band1->height;
band2->mb_size = band1->mb_size;
band2->blk_size = band1->blk_size;
band2->is_halfpel = band1->is_halfpel;
band2->intra_base = band1->intra_base;
band2->inter_base = band1->inter_base;
band2->intra_scale = band1->intra_scale;
band2->inter_scale = band1->inter_scale;
band2->scan = band1->scan;
band2->inv_transform = band1->inv_transform;
band2->dc_transform = band1->dc_transform;
band2->is_2d_trans = band1->is_2d_trans;
band2->transform_size= band1->transform_size;
}
if (blk_size_changed) {
result = ff_ivi_init_tiles(ctx->planes, pic_conf.tile_width,
pic_conf.tile_height);
if (result < 0) {
av_log(avctx, AV_LOG_ERROR,
"Couldn't reallocate internal structures!\n");
return result;
}
}
if (ctx->gop_flags & 8) {
if (get_bits(&ctx->gb, 3)) {
av_log(avctx, AV_LOG_ERROR, "Alignment bits are not zero!\n");
return AVERROR_INVALIDDATA;
}
if (get_bits1(&ctx->gb))
skip_bits_long(&ctx->gb, 24);
}
align_get_bits(&ctx->gb);
skip_bits(&ctx->gb, 23);
if (get_bits1(&ctx->gb)) {
do {
i = get_bits(&ctx->gb, 16);
} while (i & 0x8000);
}
align_get_bits(&ctx->gb);
return 0;
}
| 1threat |
perl finda text in a file and then a new line addition : <p>Basically my requirement is a replace in a file using perl. The string that to be found is ' = '. The contents of the file should be modified in a way that end of the line where this string is found, it should add one more line as below. Please hep me here. I am not able to find on adding a new line also on how to get the word just before " = ". This has to be replaced in all occurences of the string within the file.</p>
<pre><code>var b = "text"
var c = "integ"
</code></pre>
<p>should be replaced by </p>
<pre><code>var b = "text"
println "the variable b is $b"
var c = "integ"
println "the variable c is $c"
</code></pre>
| 0debug |
static void gen_ldf_asi(DisasContext *dc, TCGv addr,
int insn, int size, int rd)
{
TCGv_i32 r_asi, r_size, r_rd;
r_asi = gen_get_asi(dc, insn);
r_size = tcg_const_i32(size);
r_rd = tcg_const_i32(rd);
gen_helper_ldf_asi(cpu_env, addr, r_asi, r_size, r_rd);
tcg_temp_free_i32(r_rd);
tcg_temp_free_i32(r_size);
tcg_temp_free_i32(r_asi);
}
| 1threat |
static void *tcg_cpu_thread_fn(void *arg)
{
CPUState *env = arg;
qemu_tcg_init_cpu_signals();
qemu_thread_self(env->thread);
qemu_mutex_lock(&qemu_global_mutex);
for (env = first_cpu; env != NULL; env = env->next_cpu)
env->created = 1;
qemu_cond_signal(&qemu_cpu_cond);
while (!qemu_system_ready)
qemu_cond_timedwait(&qemu_system_cond, &qemu_global_mutex, 100);
while (1) {
cpu_exec_all();
qemu_tcg_wait_io_event();
}
return NULL;
}
| 1threat |
static ssize_t drop_sync(int fd, size_t size)
{
ssize_t ret, dropped = size;
uint8_t *buffer = g_malloc(MIN(65536, size));
while (size > 0) {
ret = read_sync(fd, buffer, MIN(65536, size));
if (ret < 0) {
g_free(buffer);
return ret;
}
assert(ret <= size);
size -= ret;
}
g_free(buffer);
return dropped;
}
| 1threat |
static av_cold int vtenc_init(AVCodecContext *avctx)
{
CFMutableDictionaryRef enc_info;
CFMutableDictionaryRef pixel_buffer_info;
CMVideoCodecType codec_type;
VTEncContext *vtctx = avctx->priv_data;
CFStringRef profile_level;
CFBooleanRef has_b_frames_cfbool;
CFNumberRef gamma_level = NULL;
int status;
pthread_once(&once_ctrl, loadVTEncSymbols);
codec_type = get_cm_codec_type(avctx->codec_id);
if (!codec_type) {
av_log(avctx, AV_LOG_ERROR, "Error: no mapping for AVCodecID %d\n", avctx->codec_id);
return AVERROR(EINVAL);
}
vtctx->has_b_frames = avctx->max_b_frames > 0;
if(vtctx->has_b_frames && vtctx->profile == H264_PROF_BASELINE){
av_log(avctx, AV_LOG_WARNING, "Cannot use B-frames with baseline profile. Output will not contain B-frames.\n");
vtctx->has_b_frames = false;
}
if (vtctx->entropy == VT_CABAC && vtctx->profile == H264_PROF_BASELINE) {
av_log(avctx, AV_LOG_WARNING, "CABAC entropy requires 'main' or 'high' profile, but baseline was requested. Encode will not use CABAC entropy.\n");
vtctx->entropy = VT_ENTROPY_NOT_SET;
}
if (!get_vt_profile_level(avctx, &profile_level)) return AVERROR(EINVAL);
vtctx->session = NULL;
enc_info = CFDictionaryCreateMutable(
kCFAllocatorDefault,
20,
&kCFCopyStringDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks
);
if (!enc_info) return AVERROR(ENOMEM);
#if !TARGET_OS_IPHONE
if (!vtctx->allow_sw) {
CFDictionarySetValue(enc_info,
compat_keys.kVTVideoEncoderSpecification_RequireHardwareAcceleratedVideoEncoder,
kCFBooleanTrue);
} else {
CFDictionarySetValue(enc_info,
compat_keys.kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder,
kCFBooleanTrue);
}
#endif
if (avctx->pix_fmt != AV_PIX_FMT_VIDEOTOOLBOX) {
status = create_cv_pixel_buffer_info(avctx, &pixel_buffer_info);
if (status)
goto init_cleanup;
} else {
pixel_buffer_info = NULL;
}
pthread_mutex_init(&vtctx->lock, NULL);
pthread_cond_init(&vtctx->cv_sample_sent, NULL);
vtctx->dts_delta = vtctx->has_b_frames ? -1 : 0;
get_cv_transfer_function(avctx, &vtctx->transfer_function, &gamma_level);
get_cv_ycbcr_matrix(avctx, &vtctx->ycbcr_matrix);
get_cv_color_primaries(avctx, &vtctx->color_primaries);
if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
status = vtenc_populate_extradata(avctx,
codec_type,
profile_level,
gamma_level,
enc_info,
pixel_buffer_info);
if (status)
goto init_cleanup;
}
status = vtenc_create_encoder(avctx,
codec_type,
profile_level,
gamma_level,
enc_info,
pixel_buffer_info,
&vtctx->session);
if (status < 0)
goto init_cleanup;
status = VTSessionCopyProperty(vtctx->session,
kVTCompressionPropertyKey_AllowFrameReordering,
kCFAllocatorDefault,
&has_b_frames_cfbool);
if (!status) {
vtctx->has_b_frames = CFBooleanGetValue(has_b_frames_cfbool);
CFRelease(has_b_frames_cfbool);
}
avctx->has_b_frames = vtctx->has_b_frames;
init_cleanup:
if (gamma_level)
CFRelease(gamma_level);
if (pixel_buffer_info)
CFRelease(pixel_buffer_info);
CFRelease(enc_info);
return status;
}
| 1threat |
How Can I pass a PHP array to a Javascript array : <p>I have an array which have some values stored in it but I want to transfer the elements of that array into javascript array for further processing. How can I do so?</p>
| 0debug |
How to use one image as full page background : <p>Please check below web template image.
URL - <a href="https://ibb.co/cD3iH8" rel="nofollow noreferrer">https://ibb.co/cD3iH8</a></p>
<p>I am expecting to use this bg-image for a full page. how can I achieve this?
Shall i cut this image in 7-8 part and then use a bg or 1 image alone enough.</p>
| 0debug |
static ssize_t qio_channel_command_writev(QIOChannel *ioc,
const struct iovec *iov,
size_t niov,
int *fds,
size_t nfds,
Error **errp)
{
QIOChannelCommand *cioc = QIO_CHANNEL_COMMAND(ioc);
ssize_t ret;
retry:
ret = writev(cioc->writefd, iov, niov);
if (ret <= 0) {
if (errno == EAGAIN ||
errno == EWOULDBLOCK) {
return QIO_CHANNEL_ERR_BLOCK;
}
if (errno == EINTR) {
goto retry;
}
error_setg_errno(errp, errno, "%s",
"Unable to write to command");
return -1;
}
return ret;
}
| 1threat |
What is the best way to add hover effect using html/js/css in any page builder editor without disturbing its view? : <p>I'm working in one page builder web application which is having page editor where application user can create their web page. In editor, all required components are available in form of widget which user can drag/drop into editor area. Please see attachment for more details.</p>
<p><a href="https://i.stack.imgur.com/943hC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/943hC.png" alt="enter image description here"></a></p>
<p>Here in editor, there is facility to edit any previously added components too. And this is achieved by highlighting hovered component. It happens one at a time so overall logic is been written in js for adding/removing hover css on focused component. Border css properties works perfect but the only issue with it is "it takes space". Whereas my client's basic requirement is that editor view should be exactly like page preview. When I allow border to take space in turn it disturb my actual page GUI which should match my preview. </p>
<p>Due to above reason I moved to outline, outline does not take any space but having another issue, it behave different in Firefox and other browsers. Along with this height lighted area I have setting icons too, which gets setup by subtracting margin, so now in this case outline area gets out of my "setting icon set" in firefox. Not only this icon set but anything been set using -(minus)margin is disturbing.</p>
<p>So basically either I need alternative solution to whole scenario or I need to resolve outline behaviour in firefox for -margin.</p>
<p>Let me know if somebody gone through such condition and having some alternative solution which works in all major browsers.</p>
| 0debug |
static void dma_bdrv_cb(void *opaque, int ret)
{
DMAAIOCB *dbs = (DMAAIOCB *)opaque;
dma_addr_t cur_addr, cur_len;
void *mem;
trace_dma_bdrv_cb(dbs, ret);
dbs->acb = NULL;
dbs->sector_num += dbs->iov.size / 512;
if (dbs->sg_cur_index == dbs->sg->nsg || ret < 0) {
dma_complete(dbs, ret);
return;
}
dma_bdrv_unmap(dbs);
while (dbs->sg_cur_index < dbs->sg->nsg) {
cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte;
cur_len = dbs->sg->sg[dbs->sg_cur_index].len - dbs->sg_cur_byte;
mem = dma_memory_map(dbs->sg->as, cur_addr, &cur_len, dbs->dir);
if (!mem)
break;
qemu_iovec_add(&dbs->iov, mem, cur_len);
dbs->sg_cur_byte += cur_len;
if (dbs->sg_cur_byte == dbs->sg->sg[dbs->sg_cur_index].len) {
dbs->sg_cur_byte = 0;
++dbs->sg_cur_index;
}
}
if (dbs->iov.size == 0) {
trace_dma_map_wait(dbs);
cpu_register_map_client(dbs, continue_after_map_failure);
return;
}
if (dbs->iov.size & ~BDRV_SECTOR_MASK) {
qemu_iovec_discard_back(&dbs->iov, dbs->iov.size & ~BDRV_SECTOR_MASK);
}
dbs->acb = dbs->io_func(dbs->bs, dbs->sector_num, &dbs->iov,
dbs->iov.size / 512, dma_bdrv_cb, dbs);
assert(dbs->acb);
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.