problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Argument labels '(_:, _:)' do not match any available overloads , help me when i put following code in my project :
self.physicsWorld.gravity = CGVector(CGFloat((data?.acceleration.x)!) * 10, CGFloat((data?.acceleration.y)!) * 10)
im getting error
Argument labels '(_:, _:)' do not match any available overloads
`
| 0debug |
segmentation fault(core dumped) while declaring vectors in c++ : I have been trying to use vectors but whenever i declare them globally , I get a segmentation fault(core dumped ) error. But when I specify a size on the vector I declared the error no longer occurs. If dynamic allocation occurs in vector then why is there a need of giving a size and what is this error? Someone please kindly explain | 0debug |
Silent breaking of constructor calls after adding initializer_list constructor : <p>Let's consider the following:</p>
<pre><code>#include <iostream>
#include <initializer_list>
class Foo {
public:
Foo(int) {
std::cout << "with int\n";
}
};
int main() {
Foo a{10}; // new style initialization
Foo b(20); // old style initialization
}
</code></pre>
<p>Upon running it prints:</p>
<pre><code>with int
with int
</code></pre>
<p>All good. Now due to new requirements I have added a constructor which takes an initializer list.</p>
<pre><code>Foo(std::initializer_list<int>) {
std::cout << "with initializer list\n";
}
</code></pre>
<p>Now it prints:</p>
<pre><code>with initializer list
with int
</code></pre>
<p>So my old code <code>Foo a{10}</code> got silently broken. <code>a</code> was supposed to be initialized with an <code>int</code>. </p>
<p>I understand that the language syntax is considering <code>{10}</code> as a list with one item. But how can I prevent such silent breaking of old code?</p>
<ol>
<li>Is there any compiler option which will give us warning on such cases? Since this will be compiler specific I'm mostly interested with gcc. I have already tried <code>-Wall -Wextra</code>.</li>
<li>If there is no such option then do we always need to use old style construction, i.e. with <code>()</code> <code>Foo b(20)</code>, for other constructors and use <code>{}</code> only when we really meant an initializer list?</li>
</ol>
| 0debug |
How to make custom text and styling : <p>I male website where user can make website profile.
How can user from mywebsite can custom text and styling like make bold, coloring,etc ?</p>
| 0debug |
error of compilation when I open j5 on my computer : when I want to open the p5 file on my computer, it tell me an error. Can you help me to solve it. Thank you
the file that I think there is an error (1)
the error (1)
[1]: https://i.stack.imgur.com/6PsP1.png
[2]: https://i.stack.imgur.com/nJx3u.png | 0debug |
Styled-components and react-bootstrap? : <p>Is there a way to use <a href="http://styled-components.com" rel="noreferrer">styled-components</a> together with <a href="https://react-bootstrap.github.io/" rel="noreferrer">react-bootstrap</a>? react-bootstrap exposes <code>bsClass</code>properties instead of <code>className</code> for their component which seems to be incompatible with styled-components.</p>
<p>Any experiences?</p>
| 0debug |
javascript object array Group By and Get values : I want to do a groupBy for the below object array on deptId and I should be able to display the data on page using angular as below
I have an object like this
var arr = [
{deptId: '12345',deptName: 'Marketing', divId: '1231',divName: 'Lead'},
{deptId: '12345',deptName: 'Marketing', divId: '8796',divName: 'Assistants'},
{deptId: '32145',deptName: 'Sales', divId: '1231',divName: 'Lead'},
{deptId: '32145',deptName: 'Sales', divId: '8796',divName: 'Assistants'},
{deptId: '32145',deptName: 'Sales', divId: '8221',divName: 'Associates'}
]
Display on ui as below
Marketing
<ul><li>Lead
<li>Assistants
</ul>
Sales
<ul>
<li>Lead
<li> Assistants
<li> Associates
</ul> | 0debug |
window.location.href = 'http://attack.com?user=' + user_input; | 1threat |
async / await boilerplate in protractor : <p>I'm trying to use <code>async</code> / <code>await</code> with <code>protractor</code> in <code>TypeScript</code>. I'm following the example at: <a href="https://github.com/angular/protractor/tree/master/exampleTypescript/asyncAwait" rel="noreferrer">https://github.com/angular/protractor/tree/master/exampleTypescript/asyncAwait</a></p>
<p>It's working fine in my experiments. However, I have to use <code>await</code> on every calls related to browser interactions.</p>
<p>For example:</p>
<p>I have a page object for a login page:</p>
<p>login.ts:</p>
<pre><code>import {browser, element, by, By, $, $$, ExpectedConditions} from "protractor";
import { DashboardPage } from "./dashboard";
export class LoginPage {
usernameInput = element(by.id("username"));
passwordInput = element(by.id("password"));
loginButton = element(by.id("login_button"));
async get() {
await browser.get(login_url);
return this;
}
async getTitle() {
let title = await browser.getTitle();
return title;
}
async typeUsername(username: string) {
await this.usernameInput.sendKeys(username);
}
async typePassword(password: string) {
await this.passwordInput.sendKeys(password);
}
async login() {
await this.loginButton.click();
return new DashboardPage();
}
}
</code></pre>
<p>LoginSpec.ts:</p>
<pre><code>import {browser, element, by, By, $, $$, ExpectedConditions} from "protractor";
import { LoginPage } from "../pages/login";
describe("Login Page", function() {
beforeEach(() => {
// login page is not an angular page.
browser.ignoreSynchronization = true;
});
afterEach(() => {
browser.ignoreSynchronization = false;
});
it("should go to dashboard page after successfully login", async (): Promise<any> => {
let loginPage = new LoginPage();
await loginPage.get();
await loginPage.typeUsername(username);
await loginPage.typePassword(password);
let dashboard = await loginPage.login();
expect(await dashboard.getTitle()).toEqual(`Dashboard`);
});
});
</code></pre>
<p>In the above test spec, I have to use many <code>await</code> for all the calls to browser interactions. That introduces a lot of boilerplate for <code>await</code>.</p>
<p>The question is, is there any idea or way to reduce the boilerplate? Also, is this the right way to use <code>async</code> / <code>await</code> with <code>protractor</code>?</p>
| 0debug |
embed openstreetmap iframe in github markdown : <p>From the share tab on the openstreetmap page, I can export a map view as HTML e.g.:</p>
<pre><code><iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=6.047544479370118%2C46.23053702499607%2C6.061706542968751%2C46.23821801159735&amp;layer=mapnik" style="border: 1px solid black"></iframe>
<br/><small><a href="https://www.openstreetmap.org/#map=17/46.23438/6.05463">View Larger Map</a></small>
</code></pre>
<p>I would like to embed this in a README.md page on github e.g.</p>
<p>Searching around, the closest to embedding <code>iframe</code>s in markdown was the <a href="https://about.gitlab.com/handbook/product/technical-writing/markdown-guide/#embed-documents" rel="noreferrer">git<strong>lab</strong> guide</a>. Following which I tried the <code><figure class="video_container"></code> tag, but don't see that working either on gitlab or github.</p>
<pre><code># how to find us?
we will be here:
<figure class="video_container">
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=6.047544479370118%2C46.23053702499607%2C6.061706542968751%2C46.23821801159735&amp;layer=mapnik" style="border: 1px solid black"></iframe>
</figure>
</code></pre>
<p>Am I missing something, or is this something better left to real HTML and beyond what markdown can/should do?</p>
| 0debug |
How to replace missing characters in a string with a dictionary : <p>I want to replace missing characters in a string with a dictionary. Take <strong>t-a-19-/</strong> for example. I want to replace the dashes with every possible letter or number from an array.</p>
<p>I tried using the replace() function, but it can't take arrays. How would I do the same function but with arrays?</p>
<p>Here's my code:</p>
<pre><code>word = "t-a-19-/"
# Alpha numeric dictionary
alphanumericdict = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
# Replaces string with dictionary
brute = word.replace('-', alphanumericdict);
print(brute);
</code></pre>
<p>I get this error because the replace() function only takes strings, not lists.</p>
<pre><code>Traceback (most recent call last):
File "bruteforce.py", line 17, in <module>
brute = word.replace('-', alphanumericdict);
TypeError: replace() argument 2 must be str, not list
</code></pre>
| 0debug |
static uint64_t get_cluster_offset(BlockDriverState *bs,
VmdkExtent *extent,
VmdkMetaData *m_data,
uint64_t offset, int allocate)
{
unsigned int l1_index, l2_offset, l2_index;
int min_index, i, j;
uint32_t min_count, *l2_table, tmp = 0;
uint64_t cluster_offset;
if (m_data)
m_data->valid = 0;
l1_index = (offset >> 9) / extent->l1_entry_sectors;
if (l1_index >= extent->l1_size) {
return 0;
}
l2_offset = extent->l1_table[l1_index];
if (!l2_offset) {
return 0;
}
for (i = 0; i < L2_CACHE_SIZE; i++) {
if (l2_offset == extent->l2_cache_offsets[i]) {
if (++extent->l2_cache_counts[i] == 0xffffffff) {
for (j = 0; j < L2_CACHE_SIZE; j++) {
extent->l2_cache_counts[j] >>= 1;
}
}
l2_table = extent->l2_cache + (i * extent->l2_size);
goto found;
}
}
min_index = 0;
min_count = 0xffffffff;
for (i = 0; i < L2_CACHE_SIZE; i++) {
if (extent->l2_cache_counts[i] < min_count) {
min_count = extent->l2_cache_counts[i];
min_index = i;
}
}
l2_table = extent->l2_cache + (min_index * extent->l2_size);
if (bdrv_pread(
extent->file,
(int64_t)l2_offset * 512,
l2_table,
extent->l2_size * sizeof(uint32_t)
) != extent->l2_size * sizeof(uint32_t)) {
return 0;
}
extent->l2_cache_offsets[min_index] = l2_offset;
extent->l2_cache_counts[min_index] = 1;
found:
l2_index = ((offset >> 9) / extent->cluster_sectors) % extent->l2_size;
cluster_offset = le32_to_cpu(l2_table[l2_index]);
if (!cluster_offset) {
if (!allocate)
return 0;
cluster_offset = bdrv_getlength(extent->file);
bdrv_truncate(
extent->file,
cluster_offset + (extent->cluster_sectors << 9)
);
cluster_offset >>= 9;
tmp = cpu_to_le32(cluster_offset);
l2_table[l2_index] = tmp;
if (get_whole_cluster(
bs, extent, cluster_offset, offset, allocate) == -1)
return 0;
if (m_data) {
m_data->offset = tmp;
m_data->l1_index = l1_index;
m_data->l2_index = l2_index;
m_data->l2_offset = l2_offset;
m_data->valid = 1;
}
}
cluster_offset <<= 9;
return cluster_offset;
}
| 1threat |
Open one div per call (html) : I'd like that when I open a div, all the others close himself. I've looked for around and I found only answer with jquery and not javascript.
The problem is that I'm still learning javascript and I don't know jquery at all so I'm not be able to implement it in my code.
This is my html (css is at the end)
<html>
<div class="row_team_pic" id="riga1">
<div class="container">
<div class="photo">
<img src="#" alt="" width="125" height="125"/>
</div>
<div class="name" onclick="openDescription('description1')">Name1</div>
<div class="description1" id="description1_id" style="display:none">
It's ok. It's working. It's ok. It's working. It's ok. It's working.
It's ok. It's working. It's ok. It's working.
</div>
</div>
<div class="container">
<div class="photo">
<img src="#" alt="" width="125" height="125"/>
</div>
<div class="name" onclick="openDescription('description2_id')">Name2</div>
<div class="description2" id="description2_id" style="display:none">
It's ok. It's working. It's ok. It's working. It's ok. It's working.
It's ok. It's working. It's ok. It's working.
</div>
</div>
<div class="container">
<div class="photo">
<img src="#" alt="" width="125" height="125"/>
</div>
<div class="name" onclick="openDescription('description3_id')">Name3</div>
<div class="description3" id="description3_id" style="display:none">
It's ok. It's working. It's ok. It's working. It's ok. It's working.
It's ok. It's working. It's ok. It's working.
</div>
</div>
<div class="container">
<div class="photo">
<img src="#" alt="" width="125" height="125"/>
</div>
<div class="name" onclick="openDescription('description4_id')">Name4</div>
<div class="description4" id="description4_id" style="display:none">
It's ok. It's working. It's ok. It's working. It's ok. It's working.
It's ok. It's working. It's ok. It's working.
</div>
</div>
I would like that when I click on a name the description div open and close.
I wrote this javascript that should do this
<script>
function openDescription(description_id) {
var x = document.getElementById(description_id);
if (x.style.display === "block") {
x.style.display = "none";
} else {
x.style.display = "block";
}
};
</script>
Obviously this javascript code don't do all I want. For example if I click on name2 it give me the description2, but if I click on name3 it doesn't close the description2 but overlap only.
How should I improve it? Consider that I could have a lot of this module (I don't know how many I have) so I can't put all of them
Here is CSS
.row_team_pic{
text-align:center;
margin:-72px;
margin-top:0px;
margin-bottom: 15px;
}
.container{
background-color:silver;
width:150px;
display:inline-block;
margin-top:0px;
margin-left:10px;
}
.photo{
min-height:125px;
width:125px;
margin:10px;
padding-top:10px;
}
.name{
text-align: center;
padding-bottom: 10px;
cursor: pointer;
}
.description1{
float:left;
margin-left:0%;
margin-top:10px;
background-color:silver;
width:322px;
}
.description2{
float:left;
margin-left:-57%;
margin-top:10px;
background-color:silver;
width:322px;
}
.description3{
float:left;
margin-left:-57%;
margin-top:10px;
background-color:silver;
width:322px;
}
.description4{
float:left;
margin-left:-114%;
margin-top:10px;
background-color:silver;
width:322px;
}
Thanks for the help. | 0debug |
how to make an app like truecaller with react native? : I would like to create an app like truecaller using react native
I tried to use detection libraries but they didn't work in background mode especially for iOS.
Is there any workaround to do this?
Thanks in advance | 0debug |
static av_cold int mdct_init(AVCodecContext *avctx, AC3MDCTContext *mdct,
int nbits)
{
int i, n, n4, ret;
n = 1 << nbits;
n4 = n >> 2;
mdct->nbits = nbits;
ret = fft_init(avctx, mdct, nbits - 2);
if (ret)
return ret;
mdct->window = ff_ac3_window;
FF_ALLOC_OR_GOTO(avctx, mdct->xcos1, n4 * sizeof(*mdct->xcos1), mdct_alloc_fail);
FF_ALLOC_OR_GOTO(avctx, mdct->xsin1, n4 * sizeof(*mdct->xsin1), mdct_alloc_fail);
FF_ALLOC_OR_GOTO(avctx, mdct->rot_tmp, n * sizeof(*mdct->rot_tmp), mdct_alloc_fail);
FF_ALLOC_OR_GOTO(avctx, mdct->cplx_tmp, n4 * sizeof(*mdct->cplx_tmp), mdct_alloc_fail);
for (i = 0; i < n4; i++) {
float alpha = 2.0 * M_PI * (i + 1.0 / 8.0) / n;
mdct->xcos1[i] = FIX15(-cos(alpha));
mdct->xsin1[i] = FIX15(-sin(alpha));
}
return 0;
mdct_alloc_fail:
mdct_end(mdct);
return AVERROR(ENOMEM);
}
| 1threat |
Kafka topic partitions to Spark streaming : <p>I have some use cases that I would like to be more clarified, about Kafka topic partitioning -> spark streaming resource utilization.</p>
<p>I use spark standalone mode, so only settings I have are "total number of executors" and "executor memory". As far as I know and according to documentation, way to introduce parallelism into Spark streaming is using partitioned Kafka topic -> RDD will have same number of partitions as kafka, when I use spark-kafka direct stream integration.</p>
<p>So if I have 1 partition in the topic, and 1 executor core, that core will sequentially read from Kafka.</p>
<p>What happens if I have:</p>
<ul>
<li><p>2 partitions in the topic and only 1 executor core? Will that core read first from one partition and then from the second one, so there will be no benefit in partitioning the topic?</p></li>
<li><p>2 partitions in the topic and 2 cores? Will then 1 executor core read from 1 partition, and second core from the second partition?</p></li>
<li><p>1 kafka partition and 2 executor cores?</p></li>
</ul>
<p>Thank you.</p>
| 0debug |
from array import array
def zero_count(nums):
n = len(nums)
n1 = 0
for x in nums:
if x == 0:
n1 += 1
else:
None
return round(n1/n,2) | 0debug |
css trick to disable parallax effect on phones- help please :
//html code for parallax - help required here. I have added div for parallax with name parallax and parallax css in stylesheet. please note. any help in disabling it for the mobile and desktop view will be appreciated.Thanks. I had gone through numerous posts but no help.
but I don't want it to be disabled for desktop. I just want it to stop working for the mobile. Can something be done about it?
</head>
<style>
//parallax code
.parallax {
/* The image used */
margin-top: 30px;
background-image: url("images/teodorik-mensl-316897-unsplash.jpg");
/* Set a specific height */
height: 500px;
/* Create the parallax scrolling effect */
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
</style>
<body>
//parallax declaration
<div id="PaperCall" class="parallax"></div>
</body>
any suggestions will be appreciated.
| 0debug |
How to call a api in didFinishLaunchingWithOptions. and start all the execution after the responce : i waant call a api when app is lunch first time, in appdelegate didFinishLaunchingWithOptions. and start all the execution after the responce | 0debug |
static void vgafb_write(void *opaque, target_phys_addr_t addr, uint64_t value,
unsigned size)
{
MilkymistVgafbState *s = opaque;
trace_milkymist_vgafb_memory_write(addr, value);
addr >>= 2;
switch (addr) {
case R_CTRL:
s->regs[addr] = value;
vgafb_resize(s);
break;
case R_HSYNC_START:
case R_HSYNC_END:
case R_HSCAN:
case R_VSYNC_START:
case R_VSYNC_END:
case R_VSCAN:
case R_BURST_COUNT:
case R_DDC:
case R_SOURCE_CLOCK:
s->regs[addr] = value;
break;
case R_BASEADDRESS:
if (value & 0x1f) {
error_report("milkymist_vgafb: framebuffer base address have to "
"be 32 byte aligned");
break;
}
s->regs[addr] = value & s->fb_mask;
s->invalidate = 1;
break;
case R_HRES:
case R_VRES:
s->regs[addr] = value;
vgafb_resize(s);
break;
case R_BASEADDRESS_ACT:
error_report("milkymist_vgafb: write to read-only register 0x"
TARGET_FMT_plx, addr << 2);
break;
default:
error_report("milkymist_vgafb: write access to unknown register 0x"
TARGET_FMT_plx, addr << 2);
break;
}
}
| 1threat |
import math
import sys
def sd_calc(data):
n = len(data)
if n <= 1:
return 0.0
mean, sd = avg_calc(data), 0.0
for el in data:
sd += (float(el) - mean)**2
sd = math.sqrt(sd / float(n-1))
return sd
def avg_calc(ls):
n, mean = len(ls), 0.0
if n <= 1:
return ls[0]
for el in ls:
mean = mean + float(el)
mean = mean / float(n)
return mean | 0debug |
Android: Databinding expression with enum comparison : <p>is it possible to create a databinding expression and control the visibility of a view element by using enumerations? What I want to achieve is the following</p>
<pre><code><LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="@{user.editType == EditType.EDIT_PROFIL ? View.VISIBLE : View.GONE}">
</code></pre>
<p>The EditType class is very simple</p>
<pre><code>public enum EditType {
NONE,
EDIT_PROFIL,
EDIT_ADDRESSES; }
</code></pre>
<p>It would be awesome if I can use this enumeration within the XML to control the visibility of my <code>LinearLayout</code>.</p>
<p>Anybody got an idea how to achieve this?</p>
| 0debug |
How to multiple class add on contact form 7 submit button : <p>When i add bootstrap button class, like..</p>
<pre><code>[submit class:btn btn-main btn-lg "Send"]
</code></pre>
<p>on browser i see it show only one class add.</p>
<pre><code><input class="wpcf7-form-control wpcf7-submit btn" >
</code></pre>
<p>I need others 2 class add also Help Me..</p>
| 0debug |
generate a vector with set number of 1s : <p>I want to generate a large vector of just 0's and 1's of arbitrary length. But I want at max 10 1's in the vector.
(For those familiar, a 10-sparse vector of some arbitrary length)
How can I do this in R/Rstudio</p>
| 0debug |
Serviceworker conflict with HTTP basic auth? : <p>I'm trying to protect a site during an early stage of development from casual prying eyes. Basic auth over HTTPS seemed like a reasonable solution but the presence of a serviceworker seems to prevent it from working in Chrome. This happens specifically if a serviceworker is already installed, but the browser does not have an active authorisation for the desired realm.</p>
<p>Chrome shows that the response was a 401 in the network timeline</p>
<p><a href="https://i.stack.imgur.com/WUole.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WUole.png" alt="401 in Network timeline"></a></p>
<p>And also shows that the browser tab is receiving the right response headers:</p>
<pre><code>HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="My realm"
Date: Tue, 21 Jun 2016 03:09:35 GMT
Connection: close
Cache-Control: no-cache
</code></pre>
<p>But it does not prompt for a login, it just shows the content body of the 401 response.</p>
<p>Is this a Chrome bug, or is it likely to be a problem with my ServiceWorker?</p>
| 0debug |
R: find missing data and add it with a zero : <p>I have the following set of data:</p>
<p><a href="https://i.stack.imgur.com/wYwVy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wYwVy.png" alt="enter image description here"></a></p>
<p>The rows in Yellow is an example of a good situation, because for Vaer=B both Var2=F and Var2=G a freq value is present.</p>
<p>But, rows in red are example of a bad situation, because row 13 where Var2=F have freq value at date 07.02.2018 but I do not have a value for Var2=G at the same date.</p>
<p>On the other hand, row 27 in red, I have freq value for Var2=G at date 04:02:2018 but I do not have freq value for Var2=F at the same date.</p>
<p><strong>What I need is:</strong>
For all type of Var1 (A, B, ..) and For each Var2 (F, G) If freq is present in Var2=F but not in Var2=G create for Var2=G freq=0 at the same date.</p>
<p>The same have to be mabe for Var2=G where Var2=F is not present.</p>
<p>Could you give me some idea how to do that in R?</p>
| 0debug |
def is_lower(string):
return (string.lower()) | 0debug |
How to draw this signal in Matlab? : [enter image description here][1]
[1]: https://i.stack.imgur.com/5anQH.png
I am a very new in Matlab . How can I draw this signal? | 0debug |
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{
if (min_size < *size)
return ptr;
min_size = FFMAX(17 * min_size / 16 + 32, min_size);
ptr = av_realloc(ptr, min_size);
if (!ptr)
min_size = 0;
*size = min_size;
return ptr;
}
| 1threat |
In cypress, how do I wait for a page to load? : <p>Don't tell anyone, but our app is not yet single-page. I can <a href="https://docs.cypress.io/api/commands/wait.html#Alias" rel="noreferrer">wait on a given XHR request</a> by giving the route an alias, but <strong>how do I wait until some navigation completes and the browser is safely on a new page?</strong></p>
| 0debug |
IabHelper class not working? : <p>I have implemented the IabHelper class in my android project and it says that the 'getBuyIntentToReplaceSkus' cannot be resolved. The full method:</p>
<pre><code>buyIntentBundle = mService.getBuyIntentToReplaceSkus(5,
mContext.getPackageName(),oldSkus, sku, itemType, extraData);
</code></pre>
<p>I implemented in app billing in my project but I have not yet created any items to be purchased, though the rest of the methods don't have any problems.</p>
| 0debug |
static int sp5x_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
{
#if 0
MJpegDecodeContext *s = avctx->priv_data;
#endif
const int qscale = 5;
uint8_t *buf_ptr, *buf_end, *recoded;
int i = 0, j = 0;
if (buf_size == 0)
return 0;
if (!avctx->width || !avctx->height)
return -1;
buf_ptr = buf;
buf_end = buf + buf_size;
#if 1
recoded = av_mallocz(buf_size + 1024);
if (!recoded)
return -1;
recoded[j++] = 0xFF;
recoded[j++] = 0xD8;
memcpy(recoded+j, &sp5x_data_dqt[0], sizeof(sp5x_data_dqt));
memcpy(recoded+j+5, &sp5x_quant_table[qscale * 2], 64);
memcpy(recoded+j+70, &sp5x_quant_table[(qscale * 2) + 1], 64);
j += sizeof(sp5x_data_dqt);
memcpy(recoded+j, &sp5x_data_dht[0], sizeof(sp5x_data_dht));
j += sizeof(sp5x_data_dht);
memcpy(recoded+j, &sp5x_data_sof[0], sizeof(sp5x_data_sof));
recoded[j+5] = (avctx->coded_height >> 8) & 0xFF;
recoded[j+6] = avctx->coded_height & 0xFF;
recoded[j+7] = (avctx->coded_width >> 8) & 0xFF;
recoded[j+8] = avctx->coded_width & 0xFF;
j += sizeof(sp5x_data_sof);
memcpy(recoded+j, &sp5x_data_sos[0], sizeof(sp5x_data_sos));
j += sizeof(sp5x_data_sos);
for (i = 14; i < buf_size && j < buf_size+1024-2; i++)
{
recoded[j++] = buf[i];
if (buf[i] == 0xff)
recoded[j++] = 0;
}
recoded[j++] = 0xFF;
recoded[j++] = 0xD9;
i = mjpeg_decode_frame(avctx, data, data_size, recoded, j);
av_free(recoded);
#else
s->bits = 8;
s->width = avctx->coded_width;
s->height = avctx->coded_height;
s->nb_components = 3;
s->component_id[0] = 0;
s->h_count[0] = 2;
s->v_count[0] = 2;
s->quant_index[0] = 0;
s->component_id[1] = 1;
s->h_count[1] = 1;
s->v_count[1] = 1;
s->quant_index[1] = 1;
s->component_id[2] = 2;
s->h_count[2] = 1;
s->v_count[2] = 1;
s->quant_index[2] = 1;
s->h_max = 2;
s->v_max = 2;
s->qscale_table = av_mallocz((s->width+15)/16);
avctx->pix_fmt = s->cs_itu601 ? PIX_FMT_YUV420P : PIX_FMT_YUVJ420;
s->interlaced = 0;
s->picture.reference = 0;
if (avctx->get_buffer(avctx, &s->picture) < 0)
{
fprintf(stderr, "get_buffer() failed\n");
return -1;
}
s->picture.pict_type = I_TYPE;
s->picture.key_frame = 1;
for (i = 0; i < 3; i++)
s->linesize[i] = s->picture.linesize[i] << s->interlaced;
for (i = 0; i < 64; i++)
{
j = s->scantable.permutated[i];
s->quant_matrixes[0][j] = sp5x_quant_table[(qscale * 2) + i];
}
s->qscale[0] = FFMAX(
s->quant_matrixes[0][s->scantable.permutated[1]],
s->quant_matrixes[0][s->scantable.permutated[8]]) >> 1;
for (i = 0; i < 64; i++)
{
j = s->scantable.permutated[i];
s->quant_matrixes[1][j] = sp5x_quant_table[(qscale * 2) + 1 + i];
}
s->qscale[1] = FFMAX(
s->quant_matrixes[1][s->scantable.permutated[1]],
s->quant_matrixes[1][s->scantable.permutated[8]]) >> 1;
s->comp_index[0] = 0;
s->nb_blocks[0] = s->h_count[0] * s->v_count[0];
s->h_scount[0] = s->h_count[0];
s->v_scount[0] = s->v_count[0];
s->dc_index[0] = 0;
s->ac_index[0] = 0;
s->comp_index[1] = 1;
s->nb_blocks[1] = s->h_count[1] * s->v_count[1];
s->h_scount[1] = s->h_count[1];
s->v_scount[1] = s->v_count[1];
s->dc_index[1] = 1;
s->ac_index[1] = 1;
s->comp_index[2] = 2;
s->nb_blocks[2] = s->h_count[2] * s->v_count[2];
s->h_scount[2] = s->h_count[2];
s->v_scount[2] = s->v_count[2];
s->dc_index[2] = 1;
s->ac_index[2] = 1;
for (i = 0; i < 3; i++)
s->last_dc[i] = 1024;
s->mb_width = (s->width * s->h_max * 8 -1) / (s->h_max * 8);
s->mb_height = (s->height * s->v_max * 8 -1) / (s->v_max * 8);
init_get_bits(&s->gb, buf+14, (buf_size-14)*8);
return mjpeg_decode_scan(s);
#endif
return i;
}
| 1threat |
i am not getting the error for the regularizer? : model = Sequential()
model.add(Conv2D(32, kernel_size=(3, 3), kernel_regularizer=regularizers.l2(w_l2),
input_shape=input_shape))
model.add(BatchNormalization())
model.add(Activation('sigmoid'))
model.add(Conv2D(64, (3, 3), kernel_regularizer=regularizers.l2(w_l2)))
model.add(BatchNormalization())
model.add(Activation('sigmoid'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(128, kernel_regularizer=regularizers.l2(w_l2)))
model.add(BatchNormalization())
model.add(Activation('sigmoid'))
model.add(Dropout(0.5))
model.add(Dense(num_classes, activation='softmax'))
model.compile(loss=keras.losses.categorical_crossentropy,
optimizer=keras.optimizers.Adam(),
metrics=['accuracy'])
model.summary()
[enter image description here][1]
[enter image description here][2]
the code needed more challenges for the architecture and also I am also working on my own architecture so I asked this as the semantics are changing every day is the presentsymantics ok.
[1]: https://i.stack.imgur.com/u8yf0.png
[2]: https://i.stack.imgur.com/FS3oF.png | 0debug |
static void wmv2_idct_col(short * b)
{
int s1,s2;
int a0,a1,a2,a3,a4,a5,a6,a7;
a1 = (W1*b[8*1]+W7*b[8*7] + 4)>>3;
a7 = (W7*b[8*1]-W1*b[8*7] + 4)>>3;
a5 = (W5*b[8*5]+W3*b[8*3] + 4)>>3;
a3 = (W3*b[8*5]-W5*b[8*3] + 4)>>3;
a2 = (W2*b[8*2]+W6*b[8*6] + 4)>>3;
a6 = (W6*b[8*2]-W2*b[8*6] + 4)>>3;
a0 = (W0*b[8*0]+W0*b[8*4] )>>3;
a4 = (W0*b[8*0]-W0*b[8*4] )>>3;
s1 = (181*(a1-a5+a7-a3)+128)>>8;
s2 = (181*(a1-a5-a7+a3)+128)>>8;
b[8*0] = (a0+a2+a1+a5 + (1<<13))>>14;
b[8*1] = (a4+a6 +s1 + (1<<13))>>14;
b[8*2] = (a4-a6 +s2 + (1<<13))>>14;
b[8*3] = (a0-a2+a7+a3 + (1<<13))>>14;
b[8*4] = (a0-a2-a7-a3 + (1<<13))>>14;
b[8*5] = (a4-a6 -s2 + (1<<13))>>14;
b[8*6] = (a4+a6 -s1 + (1<<13))>>14;
b[8*7] = (a0+a2-a1-a5 + (1<<13))>>14;
}
| 1threat |
Node already installed, it's just not linked : <p>I tried to fix the error where you have to use sudo when running npm. I blindly followed a link to uninstall node, the code was from this <a href="https://gist.github.com/nicerobot/2697848" rel="noreferrer">gist</a></p>
<p>After running the command and I tried to install it back with brew: <code>brew install node</code>. Which gave me the following error:</p>
<pre><code>Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink share/doc/node/gdbinit
/usr/local/share/doc/node is not writable.
You can try again using:
brew link node
</code></pre>
<p>Trying to run <code>brew link node</code>, I got:</p>
<pre><code>Linking /usr/local/Cellar/node/5.4.0...
Error: Could not symlink share/systemtap/tapset/node.stp
/usr/local/share/systemtap/tapset is not writable.
</code></pre>
<p>Then when I write <code>brew install npm</code>, I get:</p>
<pre><code>Warning: node-5.4.0 already installed, it's just not linked
</code></pre>
<p>When I write <code>npm -v</code> I get:</p>
<pre><code>env: node: No such file or directory
</code></pre>
<p>Any ideas on how to solve this?</p>
| 0debug |
Array Sorting in PHP. I need to write my own asort() and ksort() functions? : <p>So I have this array</p>
<pre><code>$employee_salary = array("Peter"=>35000, "Ben"=>25000, "Joe"=>48000);
</code></pre>
<p>and I need to sort the array : 1) by value, ascending order 2) by key, ascending order. </p>
<p>I am not allowed to use the asort and ksort functions, so I have no idea how else to do it. Any ideas please? Thank you!</p>
| 0debug |
"git config --list" shows duplicate names : <p><code>git config --list</code> shows two values for <code>user.name</code>, one global, one local:</p>
<pre><code>user.name=My Name
...
user.name=My Other Name
...
</code></pre>
<p>My understanding is that local values override global ones. How can I get <code>git config</code> to only show the values that are actually in effect? I only want to see one value of user.name -- the one that will be used if I commit in the current context.</p>
<p>If my question is based on a misunderstanding, or if this is caused by something wrong with my git install, that would also be very helpful.</p>
| 0debug |
How can I close a popup window in android studio : I have an activity which starts a popup window when a button is clicked. I have create a PopupWindow activity and also the appropriate resource xml file. I added a button to the xml file (close popup) button. and I don't know what code should I use for closing the popup window. here's my PopupWindow class
public class AuthorsPopup extends Activity {
public Button closePopupButton;
@Override
public void onCreate(Bundle savedInstanceSlate) {
super.onCreate(savedInstanceSlate);
setContentView(R.layout.authors_popup);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
//multiply times 0.8 of screen size
getWindow().setLayout((int) (width * 0.8), (int) (height * 0.8));
closePopupButton = (Button) findViewById(R.id.close_button);
closePopupButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View popupView) {
}
});
}
} | 0debug |
Anyone know how to rectify a Win 7 Prof upgrade that killed Borland/Delphi licence? : Does anyone know how to correct this?
The same day that the monthly Win 7 Professional upgrade was performed, Delphi 7 refused to run, giving only this message
**Register Delphi**
---------------
Borland licence information was found, but it is not valid for Delphi.
You can not run Delphi without this information
Click the Exit button to exit Delphi
No further help was provided as to how to register Delphi, and it cannot be done through this App as it simply provides an exit option.
Am re-installing Delphi 7 (it is a school academic licence - i.e. free) as I wait, but I suspect that the licence was somehow damaged by the Win upgrade (and the site admin for my system has no clue).
Thanks for any help, it's kind of urgent - a school project due tomorrow
| 0debug |
static int update_size(AVCodecContext *ctx, int w, int h)
{
VP9Context *s = ctx->priv_data;
uint8_t *p;
if (s->above_partition_ctx && w == ctx->width && h == ctx->height)
return 0;
ctx->width = w;
ctx->height = h;
s->sb_cols = (w + 63) >> 6;
s->sb_rows = (h + 63) >> 6;
s->cols = (w + 7) >> 3;
s->rows = (h + 7) >> 3;
#define assign(var, type, n) var = (type) p; p += s->sb_cols * n * sizeof(*var)
av_free(s->above_partition_ctx);
p = av_malloc(s->sb_cols * (240 + sizeof(*s->lflvl) + 16 * sizeof(*s->above_mv_ctx) +
64 * s->sb_rows * (1 + sizeof(*s->mv[0]) * 2)));
if (!p)
return AVERROR(ENOMEM);
assign(s->above_partition_ctx, uint8_t *, 8);
assign(s->above_skip_ctx, uint8_t *, 8);
assign(s->above_txfm_ctx, uint8_t *, 8);
assign(s->above_mode_ctx, uint8_t *, 16);
assign(s->above_y_nnz_ctx, uint8_t *, 16);
assign(s->above_uv_nnz_ctx[0], uint8_t *, 8);
assign(s->above_uv_nnz_ctx[1], uint8_t *, 8);
assign(s->intra_pred_data[0], uint8_t *, 64);
assign(s->intra_pred_data[1], uint8_t *, 32);
assign(s->intra_pred_data[2], uint8_t *, 32);
assign(s->above_segpred_ctx, uint8_t *, 8);
assign(s->above_intra_ctx, uint8_t *, 8);
assign(s->above_comp_ctx, uint8_t *, 8);
assign(s->above_ref_ctx, uint8_t *, 8);
assign(s->above_filter_ctx, uint8_t *, 8);
assign(s->lflvl, struct VP9Filter *, 1);
assign(s->above_mv_ctx, VP56mv(*)[2], 16);
assign(s->segmentation_map, uint8_t *, 64 * s->sb_rows);
assign(s->mv[0], struct VP9mvrefPair *, 64 * s->sb_rows);
assign(s->mv[1], struct VP9mvrefPair *, 64 * s->sb_rows);
#undef assign
return 0;
}
| 1threat |
What are the condiions in which JVM throw notserializableexception? : <p>Can any on explain me in which condition JVM throw notserializableexception.</p>
<p>exmaple </p>
<pre><code>class Emp implemenst Serializable
{
Address address = new Address();
}
class Address
{
Strign address;
}
</code></pre>
<p>in above case does JVM will throw the exception because address class is not serializable?</p>
<p>can anybody explain?</p>
| 0debug |
i cant pass intent , neither using array nor by bundles : how to pass intent with parameters.
'Intent intent = new Intent(Apply_leave_Activity.this,
ApplyingReason_Activity.class);
intent.putExtra("ID_EXTRA", new String[] { "21",countOfCL,countOfSL ,countOfEL,startDatey,endDatey,currentDatey});
startActivity(intent);'
receiving code
' String x[]=new String[10];
x =getIntent().getStringArrayExtra("ID_EXTRA");
'
| 0debug |
def sum_three_smallest_nums(lst):
return sum(sorted([x for x in lst if x > 0])[:3]) | 0debug |
static int check_arg(const CmdArgs *cmd_args, QDict *args)
{
QObject *value;
const char *name;
name = qstring_get_str(cmd_args->name);
if (!args) {
return check_opt(cmd_args, name, args);
}
value = qdict_get(args, name);
if (!value) {
return check_opt(cmd_args, name, args);
}
switch (cmd_args->type) {
case 'F':
case 'B':
case 's':
if (qobject_type(value) != QTYPE_QSTRING) {
qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "string");
return -1;
}
break;
case '/': {
int i;
const char *keys[] = { "count", "format", "size", NULL };
for (i = 0; keys[i]; i++) {
QObject *obj = qdict_get(args, keys[i]);
if (!obj) {
qerror_report(QERR_MISSING_PARAMETER, name);
return -1;
}
if (qobject_type(obj) != QTYPE_QINT) {
qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "int");
return -1;
}
}
break;
}
case 'i':
case 'l':
case 'M':
if (qobject_type(value) != QTYPE_QINT) {
qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "int");
return -1;
}
break;
case 'f':
case 'T':
if (qobject_type(value) != QTYPE_QINT && qobject_type(value) != QTYPE_QFLOAT) {
qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "number");
return -1;
}
break;
case 'b':
if (qobject_type(value) != QTYPE_QBOOL) {
qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "bool");
return -1;
}
break;
case '-':
if (qobject_type(value) != QTYPE_QINT &&
qobject_type(value) != QTYPE_QBOOL) {
qerror_report(QERR_INVALID_PARAMETER_TYPE, name, "bool");
return -1;
}
break;
case 'O':
default:
abort();
}
return 0;
}
| 1threat |
static int wma_decode_init(AVCodecContext * avctx)
{
WMADecodeContext *s = avctx->priv_data;
int i, flags1, flags2;
float *window;
uint8_t *extradata;
float bps1, high_freq, bps;
int sample_rate1;
int coef_vlc_table;
s->sample_rate = avctx->sample_rate;
s->nb_channels = avctx->channels;
s->bit_rate = avctx->bit_rate;
s->block_align = avctx->block_align;
if (avctx->codec_id == CODEC_ID_WMAV1) {
s->version = 1;
} else {
s->version = 2;
}
flags1 = 0;
flags2 = 0;
extradata = avctx->extradata;
if (s->version == 1 && avctx->extradata_size >= 4) {
flags1 = extradata[0] | (extradata[1] << 8);
flags2 = extradata[2] | (extradata[3] << 8);
} else if (s->version == 2 && avctx->extradata_size >= 6) {
flags1 = extradata[0] | (extradata[1] << 8) |
(extradata[2] << 16) | (extradata[3] << 24);
flags2 = extradata[4] | (extradata[5] << 8);
}
s->use_exp_vlc = flags2 & 0x0001;
s->use_bit_reservoir = flags2 & 0x0002;
s->use_variable_block_len = flags2 & 0x0004;
if (s->sample_rate <= 16000) {
s->frame_len_bits = 9;
} else if (s->sample_rate <= 22050 ||
(s->sample_rate <= 32000 && s->version == 1)) {
s->frame_len_bits = 10;
} else {
s->frame_len_bits = 11;
}
s->frame_len = 1 << s->frame_len_bits;
if (s->use_variable_block_len) {
s->nb_block_sizes = s->frame_len_bits - BLOCK_MIN_BITS + 1;
} else {
s->nb_block_sizes = 1;
}
s->use_noise_coding = 1;
high_freq = s->sample_rate * 0.5;
sample_rate1 = s->sample_rate;
if (s->version == 2) {
if (sample_rate1 >= 44100)
sample_rate1 = 44100;
else if (sample_rate1 >= 22050)
sample_rate1 = 22050;
else if (sample_rate1 >= 16000)
sample_rate1 = 16000;
else if (sample_rate1 >= 11025)
sample_rate1 = 11025;
else if (sample_rate1 >= 8000)
sample_rate1 = 8000;
}
bps = (float)s->bit_rate / (float)(s->nb_channels * s->sample_rate);
s->byte_offset_bits = av_log2((int)(bps * s->frame_len / 8.0)) + 2;
bps1 = bps;
if (s->nb_channels == 2)
bps1 = bps * 1.6;
if (sample_rate1 == 44100) {
if (bps1 >= 0.61)
s->use_noise_coding = 0;
else
high_freq = high_freq * 0.4;
} else if (sample_rate1 == 22050) {
if (bps1 >= 1.16)
s->use_noise_coding = 0;
else if (bps1 >= 0.72)
high_freq = high_freq * 0.7;
else
high_freq = high_freq * 0.6;
} else if (sample_rate1 == 16000) {
if (bps > 0.5)
high_freq = high_freq * 0.5;
else
high_freq = high_freq * 0.3;
} else if (sample_rate1 == 11025) {
high_freq = high_freq * 0.7;
} else if (sample_rate1 == 8000) {
if (bps <= 0.625) {
high_freq = high_freq * 0.5;
} else if (bps > 0.75) {
s->use_noise_coding = 0;
} else {
high_freq = high_freq * 0.65;
}
} else {
if (bps >= 0.8) {
high_freq = high_freq * 0.75;
} else if (bps >= 0.6) {
high_freq = high_freq * 0.6;
} else {
high_freq = high_freq * 0.5;
}
}
#ifdef DEBUG_PARAMS
printf("flags1=0x%x flags2=0x%x\n", flags1, flags2);
printf("version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n",
s->version, s->nb_channels, s->sample_rate, s->bit_rate,
s->block_align);
printf("bps=%f bps1=%f high_freq=%f bitoffset=%d\n",
bps, bps1, high_freq, s->byte_offset_bits);
printf("use_noise_coding=%d use_exp_vlc=%d\n",
s->use_noise_coding, s->use_exp_vlc);
#endif
{
int a, b, pos, lpos, k, block_len, i, j, n;
const uint8_t *table;
if (s->version == 1) {
s->coefs_start = 3;
} else {
s->coefs_start = 0;
}
for(k = 0; k < s->nb_block_sizes; k++) {
block_len = s->frame_len >> k;
if (s->version == 1) {
lpos = 0;
for(i=0;i<25;i++) {
a = wma_critical_freqs[i];
b = s->sample_rate;
pos = ((block_len * 2 * a) + (b >> 1)) / b;
if (pos > block_len)
pos = block_len;
s->exponent_bands[0][i] = pos - lpos;
if (pos >= block_len) {
i++;
break;
}
lpos = pos;
}
s->exponent_sizes[0] = i;
} else {
table = NULL;
a = s->frame_len_bits - BLOCK_MIN_BITS - k;
if (a < 3) {
if (s->sample_rate >= 44100)
table = exponent_band_44100[a];
else if (s->sample_rate >= 32000)
table = exponent_band_32000[a];
else if (s->sample_rate >= 22050)
table = exponent_band_22050[a];
}
if (table) {
n = *table++;
for(i=0;i<n;i++)
s->exponent_bands[k][i] = table[i];
s->exponent_sizes[k] = n;
} else {
j = 0;
lpos = 0;
for(i=0;i<25;i++) {
a = wma_critical_freqs[i];
b = s->sample_rate;
pos = ((block_len * 2 * a) + (b << 1)) / (4 * b);
pos <<= 2;
if (pos > block_len)
pos = block_len;
if (pos > lpos)
s->exponent_bands[k][j++] = pos - lpos;
if (pos >= block_len)
break;
lpos = pos;
}
s->exponent_sizes[k] = j;
}
}
s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k;
s->high_band_start[k] = (int)((block_len * 2 * high_freq) /
s->sample_rate + 0.5);
n = s->exponent_sizes[k];
j = 0;
pos = 0;
for(i=0;i<n;i++) {
int start, end;
start = pos;
pos += s->exponent_bands[k][i];
end = pos;
if (start < s->high_band_start[k])
start = s->high_band_start[k];
if (end > s->coefs_end[k])
end = s->coefs_end[k];
if (end > start)
s->exponent_high_bands[k][j++] = end - start;
}
s->exponent_high_sizes[k] = j;
#if 0
trace("%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ",
s->frame_len >> k,
s->coefs_end[k],
s->high_band_start[k],
s->exponent_high_sizes[k]);
for(j=0;j<s->exponent_high_sizes[k];j++)
trace(" %d", s->exponent_high_bands[k][j]);
trace("\n");
#endif
}
}
#ifdef DEBUG_TRACE
{
int i, j;
for(i = 0; i < s->nb_block_sizes; i++) {
trace("%5d: n=%2d:",
s->frame_len >> i,
s->exponent_sizes[i]);
for(j=0;j<s->exponent_sizes[i];j++)
trace(" %d", s->exponent_bands[i][j]);
trace("\n");
}
}
#endif
for(i = 0; i < s->nb_block_sizes; i++)
ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 1);
for(i = 0; i < s->nb_block_sizes; i++) {
int n, j;
float alpha;
n = 1 << (s->frame_len_bits - i);
window = av_malloc(sizeof(float) * n);
alpha = M_PI / (2.0 * n);
for(j=0;j<n;j++) {
window[n - j - 1] = sin((j + 0.5) * alpha);
}
s->windows[i] = window;
}
s->reset_block_lengths = 1;
if (s->use_noise_coding) {
if (s->use_exp_vlc)
s->noise_mult = 0.02;
else
s->noise_mult = 0.04;
#if defined(DEBUG_TRACE)
for(i=0;i<NOISE_TAB_SIZE;i++)
s->noise_table[i] = 1.0 * s->noise_mult;
#else
{
unsigned int seed;
float norm;
seed = 1;
norm = (1.0 / (float)(1LL << 31)) * sqrt(3) * s->noise_mult;
for(i=0;i<NOISE_TAB_SIZE;i++) {
seed = seed * 314159 + 1;
s->noise_table[i] = (float)((int)seed) * norm;
}
}
#endif
init_vlc(&s->hgain_vlc, 9, sizeof(hgain_huffbits),
hgain_huffbits, 1, 1,
hgain_huffcodes, 2, 2);
}
if (s->use_exp_vlc) {
init_vlc(&s->exp_vlc, 9, sizeof(scale_huffbits),
scale_huffbits, 1, 1,
scale_huffcodes, 4, 4);
} else {
wma_lsp_to_curve_init(s, s->frame_len);
}
coef_vlc_table = 2;
if (s->sample_rate >= 32000) {
if (bps1 < 0.72)
coef_vlc_table = 0;
else if (bps1 < 1.16)
coef_vlc_table = 1;
}
init_coef_vlc(&s->coef_vlc[0], &s->run_table[0], &s->level_table[0],
&coef_vlcs[coef_vlc_table * 2]);
init_coef_vlc(&s->coef_vlc[1], &s->run_table[1], &s->level_table[1],
&coef_vlcs[coef_vlc_table * 2 + 1]);
return 0;
}
| 1threat |
static BlockMeasureInfo *qcow2_measure(QemuOpts *opts, BlockDriverState *in_bs,
Error **errp)
{
Error *local_err = NULL;
BlockMeasureInfo *info;
uint64_t required = 0;
uint64_t virtual_size;
uint64_t refcount_bits;
uint64_t l2_tables;
size_t cluster_size;
int version;
char *optstr;
PreallocMode prealloc;
bool has_backing_file;
cluster_size = qcow2_opt_get_cluster_size_del(opts, &local_err);
if (local_err) {
goto err;
}
version = qcow2_opt_get_version_del(opts, &local_err);
if (local_err) {
goto err;
}
refcount_bits = qcow2_opt_get_refcount_bits_del(opts, version, &local_err);
if (local_err) {
goto err;
}
optstr = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);
prealloc = qapi_enum_parse(&PreallocMode_lookup, optstr,
PREALLOC_MODE_OFF, &local_err);
g_free(optstr);
if (local_err) {
goto err;
}
optstr = qemu_opt_get_del(opts, BLOCK_OPT_BACKING_FILE);
has_backing_file = !!optstr;
g_free(optstr);
virtual_size = align_offset(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0),
cluster_size);
l2_tables = DIV_ROUND_UP(virtual_size / cluster_size,
cluster_size / sizeof(uint64_t));
if (l2_tables * sizeof(uint64_t) > QCOW_MAX_L1_SIZE) {
error_setg(&local_err, "The image size is too large "
"(try using a larger cluster size)");
goto err;
}
if (in_bs) {
int64_t ssize = bdrv_getlength(in_bs);
if (ssize < 0) {
error_setg_errno(&local_err, -ssize,
"Unable to get image virtual_size");
goto err;
}
virtual_size = align_offset(ssize, cluster_size);
if (has_backing_file) {
required = virtual_size;
} else {
int64_t offset;
int pnum = 0;
for (offset = 0; offset < ssize;
offset += pnum * BDRV_SECTOR_SIZE) {
int nb_sectors = MIN(ssize - offset,
BDRV_REQUEST_MAX_BYTES) / BDRV_SECTOR_SIZE;
BlockDriverState *file;
int64_t ret;
ret = bdrv_get_block_status_above(in_bs, NULL,
offset >> BDRV_SECTOR_BITS,
nb_sectors,
&pnum, &file);
if (ret < 0) {
error_setg_errno(&local_err, -ret,
"Unable to get block status");
goto err;
}
if (ret & BDRV_BLOCK_ZERO) {
} else if ((ret & (BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED)) ==
(BDRV_BLOCK_DATA | BDRV_BLOCK_ALLOCATED)) {
pnum = (ROUND_UP(offset + pnum * BDRV_SECTOR_SIZE,
cluster_size) - offset) >> BDRV_SECTOR_BITS;
required += offset % cluster_size + pnum * BDRV_SECTOR_SIZE;
}
}
}
}
if (prealloc == PREALLOC_MODE_FULL || prealloc == PREALLOC_MODE_FALLOC) {
required = virtual_size;
}
info = g_new(BlockMeasureInfo, 1);
info->fully_allocated =
qcow2_calc_prealloc_size(virtual_size, cluster_size,
ctz32(refcount_bits));
info->required = info->fully_allocated - virtual_size + required;
return info;
err:
error_propagate(errp, local_err);
return NULL;
}
| 1threat |
Store a large number of java objects : I am trying to proccess a large number of rows imported from hive table(hundred millions of rows). As output it will be much more. I need to generate new rows if some conditions are valid. But this is not a problem. The problem is how to store these hive rows. In this moment i use ArrayList because the order is very important for my algorithm of inserting new rows, but i get an "GC overhead limit exceeded". | 0debug |
Commanddelage parameter : Why am I not receiving the parameter into my delagate command? I've been stock on this issue for a couple of days now, but still cant get my head around it, I'm relatively new to the .NET framework. I am using MVVM and a command delegate to get x and Y coordinates of the click button shape like a circle. However, my keeps on failing. Please, help me with this if possible.
this is my view
public class ViewModel : INotifyPropertyChanged
{
#region constructor plus member val
public event PropertyChangedEventHandler PropertyChanged;
public ObservableCollection<CartesianPoint> points { get; set; }
public ObservableCollection<CartesianPoint> missPoints { get; set; }
public DelegateCommand<CartesianPoint> SelectCommand { get; set; }
public CartesianPoint SelectedPoint { get; set; }
public ViewModel()
{
points = new ObservableCollection<CartesianPoint>();
missPoints = new ObservableCollection<CartesianPoint>();
this.testData();
}
private void InitializeCommands()
{
SelectCommand = new DelegateCommand<CartesianPoint>( (p) => SelectedPoint = p );
}
#endregion constructor plus member val
protected void OnPropertyChanged(String propertyName)
{
if( PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
Console.WriteLine( "from on propertity change");
}
public ICommand touchCommand
{
get
{
if (SelectCommand == null)
{
SelectCommand = new DelegateCommand<CartesianPoint>(( p) => Executed( p));
}
return SelectCommand;
}
}
public bool CanExecute()
{
return false;
}
public void Executed(object sender)
{
if (sender != null)
{
Console.WriteLine("this is a test");
CartesianPoint input = sender as CartesianPoint;
Console.WriteLine("{0} {1}"input.X, input.Y);
}
} | 0debug |
static void qht_do_test(unsigned int mode, size_t init_entries)
{
qht_init(&ht, 0, mode);
insert(0, N);
check(0, N, true);
check_n(N);
check(-N, -1, false);
iter_check(N);
rm(101, 102);
check_n(N - 1);
insert(N, N * 2);
check_n(N + N - 1);
rm(N, N * 2);
check_n(N - 1);
insert(101, 102);
check_n(N);
rm(10, 200);
check_n(N - 190);
insert(150, 200);
check_n(N - 190 + 50);
insert(10, 150);
check_n(N);
rm(1, 2);
check_n(N - 1);
qht_reset_size(&ht, 0);
check(0, N, false);
qht_destroy(&ht);
} | 1threat |
Flutter How to not show the [] Brackets of a list when being displayed as a text? : <p>I am trying to display a list rendered in text. But when I do I see the []</p>
<p>I have tried the following.</p>
<pre><code>Text(hashList.toString().replaceAll("(^\\[|\\])", ""))
</code></pre>
<p>Brackets are still there.</p>
| 0debug |
Declaring float variable with small value in autoit : when i try to declare a float variable with a very small value it gives me an error
Global $interior = 0.00008972
MsgBox(4096, "1", $interior)
it shows : 8.972e-005 not 0.00008972
Thanks in advance | 0debug |
Write text on images. Facing error : I have two images one on left and one on right. I am facing issues in writing text on both images. I am pasting html code and css code. Please correct it.
Html code
<div id="header">
<img src="images/banner-img1.jpg"alt="" class="left" > <p id="text"> jhcjdhdjshdjdhjd</p>
<img src="images/banner-img2.jpg"alt="" class="right"><p id="text"> jgdhdgdhddhhsd </p>
</div>
Css Code.
#container {
height: 400px;
width: 400px;
position: relative;
}
#image {
position: absolute;
left: 0;
top: 0;
}
#text {
z-index: 100;
position: absolute;
color: white;
font-size: 24px;
font-weight: bold;
left: 150px;
top: 600px;
}
| 0debug |
React Native - How to detect font size after a font scaling? : <p>I need to detect what is the font size for text component after a font scaling.
Let's say that I have a Text component with font size 18px</p>
<pre><code><Text style={{fontSize: 18}}>My Text</Text>
</code></pre>
<p>The user has set a large font through the OS accessibility settings.
Now my text has been rendered with a larger font size (more than 18px).
I'm aware that I can use <code>allowFontScaling={false}</code> but I don't want to lose the text accessibility.
I saw that React native have an API for getting the font scale <code>PixelRatio.getFontScale()</code> but it doesn't work for iOS </p>
<blockquote>
<p>Returns the scaling factor for font sizes. This is the ratio that is
used to calculate the absolute font size, so any elements that heavily
depend on that should use this to do calculations.</p>
<p>If a font scale is not set, this returns the device pixel ratio.</p>
<p>Currently this is only implemented on Android and reflects the user
preference set in Settings > Display > Font size, on iOS it will
always return the default pixel ratio. @platform android</p>
</blockquote>
<p>Any ideas?</p>
| 0debug |
query = 'SELECT * FROM customers WHERE email = ' + email_input | 1threat |
when visual studio 2017 build from github source, c1083 error : <p>i am new at visual studio. so i don`t know anyting.</p>
<p>i am :
using Visual studio 2017
source code from <a href="https://github.com/Bionus/imgbrd-grabber" rel="nofollow noreferrer">https://github.com/Bionus/imgbrd-grabber</a></p>
<p>what i do :
open File-> New -> Project from existing code -> Visual c++ -> select extracted imgbrd-grabber source -> Finish </p>
<p>what happen :</p>
<p>when i build solution,
`Severity Code Description Project File Line Suppression State
Error C1083 Cannot open include file: 'QtTest': No such file or directory grabber c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\tests\src\test-suite.h 4<br>
-5.5.0\lib\src\downloader\download-query-group.h 4<br>
Error C1083 Cannot open include file: 'QString': No such file or directory grabber c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\lib\src\danbooru-downloader-importer.h 4<br>
Error C1083 Cannot open include file: 'QNetworkAccessManager': No such file or directory grabber c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\lib\src\custom-network-access-manager.h 4<br>
Error C1083 Cannot open include file: 'QtSql/QSqlDatabase': No such file or directory grabber C:\Users\sin\Downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\lib\src\commands\sql-worker.cpp 1<br>
Error C1083 Cannot open include file: 'QString': No such file or directory grabber c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\lib\src\commands\commands.h 4<br>
Error C1083 Cannot open include file: 'QtGui': No such file or directory grabber c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\gui\src\viewer\zoomwindow.h 4<br>
.</p>
<p>output</p>
<p>1>------ Build started: Project: grabber, Configuration: Debug Win32 ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(387,5): warning MSB8028: The intermediate directory (Debug) contains files shared from another project (ll.vcxproj). This can lead to incorrect clean and rebuild behavior.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(937,5): warning MSB8027: Two or more files with the name of main.cpp will produce outputs to the same location. This can lead to an incorrect build result. The files involved are cli\src\main.cpp, crashreporter\main.cpp, gui\src\main\main.cpp, tests\src\main.cpp.
1>updater-test.cpp
1>tests\src\updater\updater-test.cpp(1): fatal error C1083: Cannot open include file: 'QtTest': No such file or directory
1>source-updater-test.cpp
1>tests\src\updater\source-updater-test.cpp(1): fatal error C1083: Cannot open include file: 'QtTest': No such file or directory
1>test-suite.cpp
1>c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\tests\src\test-suite.h(4): fatal error C1083: Cannot open include file: 'QtTest': No such file or directory
1>tag-test.cpp
file: 'QSettings': No such file or directory
1>update-dialog.cpp
1>c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\gui\src\updater\update-dialog.h(4): fatal error C1083: Cannot open include file: 'QDialog': No such file or directory
1>verticalscrollarea.cpp
1>c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\gui\src\ui\verticalscrollarea.h(4): fatal error C1083: Cannot open include file: 'QScrollArea': No such file or directory
1>textedit.cpp
1>c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\gui\src\ui\textedit.h(4): fatal error C1083: Cannot open include file: 'QTextEdit': No such file or directory
1>qclosabletabwidget.cpp
1>c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\gui\src\ui\qclosabletabwidget.h(4): fatal error C1083: Cannot open include file: 'QTabWidget': No such file or directory
1>QBouton.cpp
1>c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\gui\src\ui\QBouton.h(4): fatal error C1083: Cannot open include file: 'QPushButton': No such file or directory
1>QAffiche.cpp
1>c:\users\sin\downloads\imgbrd-grabber-5.5.0\imgbrd-grabber-5.5.0\gui\src\ui\QAffiche.h(4): fatal error C1083: Cannot open include file: 'QLabel': No such file or directory
1>fixed-size-grid-layout.cpp
...
1>main.cpp
1>cli\src\main.cpp(1): fatal error C1083: Cannot open include file: 'QCoreApplication': No such file or directory
1>Generating Code...
1>Done building project "grabber.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========`</p>
<p>what should i do?</p>
| 0debug |
static void scsi_dma_restart_cb(void *opaque, int running, int reason)
{
SCSIDeviceState *s = opaque;
SCSIRequest *r = s->requests;
if (!running)
return;
while (r) {
if (r->status & SCSI_REQ_STATUS_RETRY) {
r->status &= ~SCSI_REQ_STATUS_RETRY;
scsi_write_request(r);
}
r = r->next;
}
}
| 1threat |
Node.js Spawn vs. Execute : <p>In an online training video I am watching to learn Node, the narrator says that "spawn is better for longer processes involving large amounts of data, whereas execute is better for short bits of data."</p>
<p>Why is this? <em>What is the difference between the child_process spawn and execute functions in Node.js, and when do I know which one to use?</em></p>
| 0debug |
command_loop(void)
{
int c, i, j = 0, done = 0;
char *input;
char **v;
const cmdinfo_t *ct;
for (i = 0; !done && i < ncmdline; i++) {
input = strdup(cmdline[i]);
if (!input) {
fprintf(stderr,
_("cannot strdup command '%s': %s\n"),
cmdline[i], strerror(errno));
exit(1);
}
v = breakline(input, &c);
if (c) {
ct = find_command(v[0]);
if (ct) {
if (ct->flags & CMD_FLAG_GLOBAL)
done = command(ct, c, v);
else {
j = 0;
while (!done && (j = args_command(j)))
done = command(ct, c, v);
}
} else
fprintf(stderr, _("command \"%s\" not found\n"),
v[0]);
}
doneline(input, v);
}
if (cmdline) {
free(cmdline);
return;
}
while (!done) {
if ((input = fetchline()) == NULL)
break;
v = breakline(input, &c);
if (c) {
ct = find_command(v[0]);
if (ct)
done = command(ct, c, v);
else
fprintf(stderr, _("command \"%s\" not found\n"),
v[0]);
}
doneline(input, v);
}
}
| 1threat |
How to average every 3rd row in excel using VBA : <p>I have column I with "item score". I would like to average every third row and return the value in Column A, which I have labeled "Overall Survey Score".</p>
<p>So the average of I2:I4 would be displayed in A2. The average of I5:I7 would be displayes in A5 and so on until the last row of data available.</p>
<p>I would like stay away from a formula in a cell and do this using VBA. Any help would be greatly appreciated. </p>
| 0debug |
Download large data stream (> 1Gb) using javascript : <p>I was wondering if it was possible to stream data <strong>from javascript to the browser's downloads manager</strong>.</p>
<p>Using webrtc, I stream data (from files > 1Gb) from a browser to the other. On the receiver side, I store into memory all this data (as arraybuffer ... so the data is essentially still chunks), and I would like the user to be able to download it.</p>
<p><strong>Problem :</strong> Blob objects have a maximum size of about 600 Mb (depending on the browser) so I can't re-create the file from the chunks. Is there a way to stream these chunks so that the browser downloads them directly ?</p>
| 0debug |
AVFilterContext *ff_filter_alloc(const AVFilter *filter, const char *inst_name)
{
AVFilterContext *ret;
if (!filter)
return NULL;
ret = av_mallocz(sizeof(AVFilterContext));
if (!ret)
return NULL;
ret->av_class = &avfilter_class;
ret->filter = filter;
ret->name = inst_name ? av_strdup(inst_name) : NULL;
if (filter->priv_size) {
ret->priv = av_mallocz(filter->priv_size);
if (!ret->priv)
goto err;
}
if (filter->priv_class) {
*(const AVClass**)ret->priv = filter->priv_class;
av_opt_set_defaults(ret->priv);
}
ret->nb_inputs = pad_count(filter->inputs);
if (ret->nb_inputs ) {
ret->input_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_inputs);
if (!ret->input_pads)
goto err;
memcpy(ret->input_pads, filter->inputs, sizeof(AVFilterPad) * ret->nb_inputs);
ret->inputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_inputs);
if (!ret->inputs)
goto err;
}
ret->nb_outputs = pad_count(filter->outputs);
if (ret->nb_outputs) {
ret->output_pads = av_malloc(sizeof(AVFilterPad) * ret->nb_outputs);
if (!ret->output_pads)
goto err;
memcpy(ret->output_pads, filter->outputs, sizeof(AVFilterPad) * ret->nb_outputs);
ret->outputs = av_mallocz(sizeof(AVFilterLink*) * ret->nb_outputs);
if (!ret->outputs)
goto err;
}
#if FF_API_FOO_COUNT
ret->output_count = ret->nb_outputs;
ret->input_count = ret->nb_inputs;
#endif
return ret;
err:
av_freep(&ret->inputs);
av_freep(&ret->input_pads);
ret->nb_inputs = 0;
av_freep(&ret->outputs);
av_freep(&ret->output_pads);
ret->nb_outputs = 0;
av_freep(&ret->priv);
av_free(ret);
return NULL;
}
| 1threat |
I am not able to replace duplicate numbers with a character "a" : <pre><code> for (int i=0; i<n-1; i++) {
for (int j=0; j<n-1; j++) {
if (arr[i]==arr[j]) {
arr[j]=a;
}
}
}
</code></pre>
<p>Why I can't replace duplicate number with a character "a"</p>
| 0debug |
I wrote a small web code using Flask and I entered http://127.0.0.1:5000/ in the browser but it is running some other code How to solve this? : <p>I wrote a small code for web page using Flask and I entered <a href="http://127.0.0.1:5000/" rel="nofollow noreferrer">http://127.0.0.1:5000/</a> in the browser but it is running some other code but not mine How to solve this?</p>
| 0debug |
Cannot kill Postgres process : <p>I keep trying to kill a PostgreSQL process that is running on port 5432 to no avail. Whenever I type <code>sudo lsof -i :5432</code>, I see something like the below: </p>
<pre><code>COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
postgres 587 postgres 4u IPv6 0x218f97e9af5d0303 0t0 TCP *:postgresql (LISTEN)
postgres 587 postgres 5u IPv4 0x218f97e9ae0f6c63 0t0 TCP *:postgresql (LISTEN)
</code></pre>
<p>I then try to kill the process 587 in this example with <code>sudo kill -9 587</code>, but then another process automatically restarts on the same port! I have tried killing it on activity monitor as well to no avail. Please help?</p>
<p>Thanks,
Laura</p>
| 0debug |
instead of images blob is showing in oracle : <p>i have created a table containing name blob_demo</p>
<pre><code>rank(int) photo(BLOB)
</code></pre>
<p>i have inserted data into it and when i try to get the data using "select * from blob_demo" it is showing int in place of int but in place of blob it is not showing image it is just showing (blob).</p>
<pre><code> 1 (BLOB)
2 (BLOB)
3 (BLOB)
</code></pre>
<p>can you please help me to show image in oracle 11g</p>
| 0debug |
Android binding adapter passing multiple arguments cause error : <p>I am quite new in <code>Android Data Binding</code>. I am following this tutorial: <a href="https://developer.android.com/topic/libraries/data-binding/index.html" rel="noreferrer">Data Binding Library</a>.
I am trying to do an adapter that receive multiple parameters. This is my code:</p>
<p><strong>XML</strong></p>
<pre><code> <ImageView
android:layout_width="@dimen/place_holder_size"
android:layout_height="@dimen/place_holder_size"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_centerVertical="true"
app:url="@{image.imageUrl}"
app:size="@{@dimen/place_holder_size}"
/>
</code></pre>
<p><strong>BINDING ADAPTER CLASS</strong></p>
<pre><code>public class ViewBindingAdapters extends BaseObservable {
@BindingAdapter({"bind:url", "bind:size"})
public static void loadImage(ImageView imageView, String url, int size) {
if (!Strings.isNullOrEmpty(url)) {
Picasso.with(imageView.getContext()).load(url).resize(size, size).centerCrop().into(imageView);
}
}
....
}
</code></pre>
<p>But I am getting this error:</p>
<blockquote>
<p>java.lang.RuntimeException: Found data binding errors.
****/ data binding error ****msg:Cannot find the setter for attribute 'app:url' with parameter type java.lang.String on android.widget.ImageView.
file:... li_image_item.xml
loc:30:27 - 30:40
****\ data binding error ****</p>
</blockquote>
<p>Does anybody know why??</p>
<p>Thanks in advance!</p>
| 0debug |
static uint32_t syborg_virtio_readl(void *opaque, target_phys_addr_t offset)
{
SyborgVirtIOProxy *s = opaque;
VirtIODevice *vdev = s->vdev;
uint32_t ret;
DPRINTF("readl 0x%x\n", (int)offset);
if (offset >= SYBORG_VIRTIO_CONFIG) {
return virtio_config_readl(vdev, offset - SYBORG_VIRTIO_CONFIG);
}
switch(offset >> 2) {
case SYBORG_VIRTIO_ID:
ret = SYBORG_ID_VIRTIO;
break;
case SYBORG_VIRTIO_DEVTYPE:
ret = s->id;
break;
case SYBORG_VIRTIO_HOST_FEATURES:
ret = vdev->get_features(vdev);
ret |= (1 << VIRTIO_F_NOTIFY_ON_EMPTY);
break;
case SYBORG_VIRTIO_GUEST_FEATURES:
ret = vdev->features;
break;
case SYBORG_VIRTIO_QUEUE_BASE:
ret = virtio_queue_get_addr(vdev, vdev->queue_sel);
break;
case SYBORG_VIRTIO_QUEUE_NUM:
ret = virtio_queue_get_num(vdev, vdev->queue_sel);
break;
case SYBORG_VIRTIO_QUEUE_SEL:
ret = vdev->queue_sel;
break;
case SYBORG_VIRTIO_STATUS:
ret = vdev->status;
break;
case SYBORG_VIRTIO_INT_ENABLE:
ret = s->int_enable;
break;
case SYBORG_VIRTIO_INT_STATUS:
ret = vdev->isr;
break;
default:
BADF("Bad read offset 0x%x\n", (int)offset);
return 0;
}
return ret;
}
| 1threat |
Mount Qnap NFS Share on Linux OS : <p>I am trying to mount a NFS share from my Qnap to my laptop which runs Manjaro (Arch Linux) but I keep getting access denied by the server and i can't figure out what the problem is!</p>
<pre><code>$ sudo mount 10.0.2.6:/backup /mnt/nas/backup
mount.nfs: access denied by server while mounting 10.0.2.6:/backup
</code></pre>
<p>Mount points :</p>
<pre><code>$ showmount -e 10.0.2.6
Export list for 10.0.2.6:
/backup
/Web
/Recordings
/Public
/Multimedia
/Download
/Containers
</code></pre>
<p><a href="https://i.stack.imgur.com/58p6t.png" rel="noreferrer"><img src="https://i.stack.imgur.com/58p6t.png" alt="Qnap folder permissions"></a></p>
| 0debug |
Cancelling previous async action using redux-thunk : <p>I am building a React/Redux app using the redux-thunk middleware to create and handle Ajax requests. I have a particular thunk that is fired pretty often, and I would like to cancel any previously started Ajax requests before firing a new one. Is this possible?</p>
| 0debug |
def specified_element(nums, N):
result = [i[N] for i in nums]
return result | 0debug |
static void iscsi_allocationmap_clear(IscsiLun *iscsilun, int64_t sector_num,
int nb_sectors)
{
int64_t cluster_num, nb_clusters;
if (iscsilun->allocationmap == NULL) {
return;
}
cluster_num = DIV_ROUND_UP(sector_num, iscsilun->cluster_sectors);
nb_clusters = (sector_num + nb_sectors) / iscsilun->cluster_sectors
- cluster_num;
if (nb_clusters > 0) {
bitmap_clear(iscsilun->allocationmap, cluster_num, nb_clusters);
}
}
| 1threat |
void virtio_scsi_handle_cmd_vq(VirtIOSCSI *s, VirtQueue *vq)
{
VirtIOSCSIReq *req, *next;
QTAILQ_HEAD(, VirtIOSCSIReq) reqs = QTAILQ_HEAD_INITIALIZER(reqs);
while ((req = virtio_scsi_pop_req(s, vq))) {
if (virtio_scsi_handle_cmd_req_prepare(s, req)) {
QTAILQ_INSERT_TAIL(&reqs, req, next);
}
}
QTAILQ_FOREACH_SAFE(req, &reqs, next, next) {
virtio_scsi_handle_cmd_req_submit(s, req);
}
}
| 1threat |
a mismatch between CENTOS 7 and Red Hat Enterprise Linux Server release 6.7 : I have a bash script , it works on CENTOS fine ,but when I want to
run the script on Red Hat Enterprise Linux , I got the following error.
line 56: -2: substring expression < 0
help please, it is urgent :(
all your comments are appreciated | 0debug |
static void lag_pred_line(LagarithContext *l, uint8_t *buf,
int width, int stride, int line)
{
int L, TL;
L = buf[width - stride - 1];
if (!line) {
L = l->dsp.add_hfyu_left_prediction(buf + 1, buf + 1,
width - 1, buf[0]);
return;
} else if (line == 1) {
TL = l->avctx->pix_fmt == PIX_FMT_YUV420P ? buf[-stride] : L;
} else {
TL = buf[width - (2 * stride) - 1];
}
add_lag_median_prediction(buf, buf - stride, buf,
width, &L, &TL);
}
| 1threat |
Change Gitlab CI Runner user : <p>Currently when I start a build in GitlabCI it is running under gitlab-runner user. I want to change it the company's internal user. I didn't find any parameter to the /etc/gitlab-runner/config.toml which is solve that.</p>
<p>My current configuration: </p>
<pre><code>concurrent = 1
[[runners]]
name = "deploy"
url = ""
token = ""
executor = "shell"
</code></pre>
| 0debug |
AND operation in WHERE clause if IF condition satisfy : <p>Suppose I have a variable <code>@hasAge</code> which can have value either <code>1</code> or <code>0</code>.</p>
<p>I want to write a SELECT query with where clause in which I want to check certain condition if <code>@var</code> is 1 otherwise I don't want to check that condition.
Something like this:</p>
<pre><code>SELECT * FROM My_Table mt
WHERE mt.name = 'abcd'
AND
IF(@hasAge)
mt.age > 10
</code></pre>
<p>So I want to compare my.age > 10 only if <code>@hasAge</code> is <code>1</code></p>
<p>I dont want to have 2 different select statement like this:</p>
<pre><code>if(@hasAge)
BEGIN
SELECT * FROM My_Table mt
WHERE mt.name = 'abcd'
AND
mt.age > 10
ELSE
BEGIN
SELECT * FROM My_Table mt
WHERE mt.name = 'abcd'
END
</code></pre>
| 0debug |
Taking the frequency of three different columns : <p>I have a dataframe like this:</p>
<pre><code>df <- structure(list(col1 = structure(c(1L, 1L, 2L, 3L, 1L, 3L, 1L,
3L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 4L), .Label = c("stock1",
"stock2", "stock3", "stock4"), class = "factor"), col2 = structure(c(4L,
5L, 7L, 6L, 5L, 5L, 5L, 6L, 6L, 8L, 8L, 4L, 3L, 3L, 1L, 2L, 3L
), .Label = c("comapny1", "comapny1+comapny4", "comapny4", "company1",
"company2", "company2+company1", "company3", "company4"), class = "factor"),
col3 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 2L), .Label = c("predictor1", "predictor2"
), class = "factor")), .Names = c("col1", "col2", "col3"), class = "data.frame", row.names = c(NA,
-17L))
</code></pre>
<p>I would like to take the frequency from the three columns.</p>
<p>Expected output</p>
<pre><code>df2 <- structure(list(col1 = structure(c(1L, 1L, 1L, 2L, 4L, 1L, 1L,
3L, 3L, 1L, 2L, 1L), .Label = c("stock1", "stock2", "stock3",
"stock4"), class = "factor"), col2 = structure(c(1L, 2L, 3L,
3L, 3L, 4L, 5L, 5L, 6L, 6L, 7L, 8L), .Label = c("comapany1",
"comapany1+comapany4", "comapany4", "company1", "company2", "company2+company1",
"company3", "company4"), class = "factor"), col3 = structure(c(2L,
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("predictor1",
"predictor2"), class = "factor"), frequency = c(1L, 1L, 1L, 1L,
1L, 2L, 3L, 1L, 2L, 1L, 1L, 2L)), .Names = c("col1", "col2",
"col3", "frequency"), class = "data.frame", row.names = c(NA,
-12L))
</code></pre>
<p>How is it possible to make it?</p>
| 0debug |
Is Qlikview is ETL testing tool or development tool? : As I am a manual tester wanted to know "Is Qlikview is ETL testing tool or development tool?"
Is there any advantage of this tool in Automation of ETL testing?
| 0debug |
C++ Phising code : Hi I need some help with my c++ phising code. I got it to work but not as what i intended. When I run the code it scans my text file i inputted and only output one of the words in the text file that match the array in my code and when i add other words to the text file that is in the array it gives me a error.
#include <fstream>
#include <iostream>
#include <cmath>
#include <iomanip>
#define SIZE 30
using namespace std;
const char *Phish[SIZE] ={"Amazon","official","bank","security",
"urgent","Alert","important","inform ation", "ebay", "password", "credit", "verify",
"confirm", "account","bill", "immediately", "address", "telephone","SSN", "charity",
"check", "secure", "personal", "confidential",
"ATM", "warning","fraud","Citibank","IRS", "paypal"};
int point[SIZE] = {2,2,1,1,1,1,2,2,3,3,3,1,1,1,1,1,2,2,3,2,1,1,1,1,2,2,2,2,2,1};
int totalPoints[SIZE];
void outputResults();
int main(void)
{
FILE *cPtr;
char filename[100];
char message[5000];
char *temp[100];
int i;
int counter=0;
int words=0;
char *tokenPtr;
cout << "Enter the name of the file to be read: \n";
cin >> filename;
if ( (cPtr = fopen(filename,"rb")) == NULL)
{
cout <<"File cannot be opened.\n";
}
else
{
fgets(message, 5000, cPtr);
tokenPtr = strtok(message, " ");
temp[0] = tokenPtr;
while (tokenPtr!=NULL)
{
for(i=0; i< SIZE; i++)
{
if(strncmp(temp[0], Phish[i], strlen(Phish[i]))==0)
{
totalPoints[i]++;
break;
}
tokenPtr =strtok(NULL, " ");
temp[0] = tokenPtr;
words++;
}
outputResults();
cout << "\n";
return 0;
}
}
}
void outputResults()
{
int i;
int count =0;
int a;
cout<<left<<setw(5) << "WORD "<< setw(7)<<"# OF OCCURRENCE "<< setw(15)<<"POINT TOTAL";
for(i=0; i<SIZE; i++)
{
if(totalPoints[i] !=0)
{
cout<<"\n"<<left << setw(10)<< Phish[i] << setw(11)<< totalPoints[i]<< setw(13)<< point[i]*totalPoints[i];
count += point[i] * totalPoints[i];
}
}
cout<< "\nPoint total for entire file: \n"<< count;
} | 0debug |
static int net_vhost_user_init(NetClientState *peer, const char *device,
const char *name, CharDriverState *chr)
{
NetClientState *nc;
VhostUserState *s;
nc = qemu_new_net_client(&net_vhost_user_info, peer, device, name);
snprintf(nc->info_str, sizeof(nc->info_str), "vhost-user to %s",
chr->label);
s = DO_UPCAST(VhostUserState, nc, nc);
s->nc.receive_disabled = 1;
s->chr = chr;
qemu_chr_add_handlers(s->chr, NULL, NULL, net_vhost_user_event, s);
return 0;
}
| 1threat |
Drop all data in a pandas dataframe : <p>I would like to drop all data in a pandas dataframe, but am getting <code>TypeError: drop() takes at least 2 arguments (3 given)</code>. I essentially want a blank dataframe with just my columns headers.</p>
<pre><code>import pandas as pd
web_stats = {'Day': [1, 2, 3, 4, 2, 6],
'Visitors': [43, 43, 34, 23, 43, 23],
'Bounce_Rate': [3, 2, 4, 3, 5, 5]}
df = pd.DataFrame(web_stats)
df.drop(axis=0, inplace=True)
print df
</code></pre>
| 0debug |
Ruby : Generate Random number in a range less one element : <p>Folks, </p>
<p>I'm trying to generate a random number between (0..10) less, say, 5. </p>
<pre><code>new_index = rand(0..(old_index - 1)) || new_index = rand((old_index + 1)..10)
</code></pre>
<p>Can anyone shed any light?</p>
| 0debug |
Looking for a Python program that will read a text file with Base n input, and convert it to Hex (and eventually ascii) : I'm very new to Python and I'm looking for help creating a program that will execute the following algorithm. It's purposely simple, and it should be noted that the data is in a stream, so I can't (or at least, I don't think I can) just open the text file and convert it using a single function. I'm cranking away at it to learn the language and options, but would like to see how some experts would tackle this problem. Doesn't need to be user friendly and I'd like files output at each step so I can see the output at each step.
Here's the algorithm I'm recommending:
Open file "base-n.txt"
For each line in file
Remove carriage returns
Write line to "Clean File" *#to create a single stream of characters#*
Open file "Clean File"
For each line in file
Read the first x characters *#I presume x depends on n in base n#*
Convert the characters from base n to base 16
Write the characters to "Output file"
Open file Output File
For each line in file
Convert line to ASCII
Print ASCII line
End
The files are not large... usually just a few hundred lines of base n information. For example, the below is an example of the base-5 text.
0322040104130344042104140401011204310421011203430342043004010112020301130020
0301042104240401041401120410042204300432041401120400042104130421042401120430
0410043101120342041404010431013401120344042104200430040103440431040104310432
0424011203420400041004220410043003440410042004030112040104130410043101410112
0233043204100430011203440421042004030432040101120413041003430401042404210020
0430040104140134011204200421042001120344042104200433034204130413041004300112
0411043204300431042101120413034203440410042004100342011203420141011203130432
0430042204010420040004100430043004010112042304320410043001120413034203440432
0430011204200421042001120413041004030432041303420112040003420422041003430432
0430002004210424042003420424040101410112031004240421041004200112040003420422
Thanks in advance for the help. I'm looking forward to getting much better at Python, but have an real need for this algorithm in the short term.
| 0debug |
Handling out of order events in CQRS read side : <p>I've read this nice post from Jonathan Oliver about handling out of order events.</p>
<p><a href="http://blog.jonathanoliver.com/cqrs-out-of-sequence-messages-and-read-models/" rel="noreferrer">http://blog.jonathanoliver.com/cqrs-out-of-sequence-messages-and-read-models/</a></p>
<blockquote>
<p>The solution that we use is to dequeue a message and to place it in a “holding table” until all messages with a previous sequence are
received. When all previous messages have been received we take all
messages out of the holding table and run them in sequence through the
appropriate handlers. Once all handlers have been executed
successfully, we remove the messages from the holding table and commit
the updates to the read models.</p>
<p>This works for us because the domain publishes events and marks them
with the appropriate sequence number. Without this, the solution
below would be much more difficult—if not impossible.</p>
<p>This solution is using a relational database as a persistence storage
mechanism, but we’re not using any of the relational aspects of the
storage engine. At the same time, there’s a caveat in all of this.
If message 2, 3, and 4 arrive but message 1 never does, we don’t apply
any of them. The scenario should only happen if there’s an error
processing message 1 or if message 1 somehow gets lost. Fortunately,
it’s easy enough to correct any errors in our message handlers and
re-run the messages. Or, in the case of a lost message, to re-build
the read models from the event store directly.</p>
</blockquote>
<p>Got a few questions particularly about how he says we can always ask the event store for missing events.</p>
<ol>
<li>Does the write side of CQRS have to expose a service for the read
side to "demand" replaying of events? For example if event 1 was not
received but but 2, 4, 3 have can we ask the eventstore through a
service to republish events back starting from 1? </li>
<li>Is this service the responsibility of the write side of CQRS?</li>
<li><strong>How do we re-build the read model using this?</strong></li>
</ol>
| 0debug |
vb.net :: Why does "Settings.Save" needs admin permissions? : I'm using Visual Studio 2013 and Windows 7. I'm saving windows position when user close a form, and the program breaks in exception because I didn't run it whit admin permissions.
Thanks. | 0debug |
static int compile_kernel_file(GPUEnv *gpu_env, const char *build_options)
{
cl_int status;
char *temp, *source_str = NULL;
size_t source_str_len = 0;
int i, ret = 0;
for (i = 0; i < gpu_env->kernel_code_count; i++) {
if (!gpu_env->kernel_code[i].is_compiled)
source_str_len += strlen(gpu_env->kernel_code[i].kernel_string);
}
if (!source_str_len) {
return 0;
}
source_str = av_mallocz(source_str_len + 1);
if (!source_str) {
return AVERROR(ENOMEM);
}
temp = source_str;
for (i = 0; i < gpu_env->kernel_code_count; i++) {
if (!gpu_env->kernel_code[i].is_compiled) {
memcpy(temp, gpu_env->kernel_code[i].kernel_string,
strlen(gpu_env->kernel_code[i].kernel_string));
gpu_env->kernel_code[i].is_compiled = 1;
temp += strlen(gpu_env->kernel_code[i].kernel_string);
}
}
gpu_env->programs[gpu_env->program_count] = clCreateProgramWithSource(gpu_env->context,
1, (const char **)(&source_str),
&source_str_len, &status);
if(status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not create OpenCL program with source code: %s\n",
opencl_errstr(status));
ret = AVERROR_EXTERNAL;
goto end;
}
if (!gpu_env->programs[gpu_env->program_count]) {
av_log(&openclutils, AV_LOG_ERROR, "Created program is NULL\n");
ret = AVERROR_EXTERNAL;
goto end;
}
i = 0;
if (gpu_env->usr_spec_dev_info.dev_idx >= 0)
i = gpu_env->usr_spec_dev_info.dev_idx;
if (!gpu_env->is_user_created)
status = clBuildProgram(gpu_env->programs[gpu_env->program_count], 1, &gpu_env->device_ids[i],
build_options, NULL, NULL);
else
status = clBuildProgram(gpu_env->programs[gpu_env->program_count], 1, &(gpu_env->device_id),
build_options, NULL, NULL);
if (status != CL_SUCCESS) {
av_log(&openclutils, AV_LOG_ERROR, "Could not compile OpenCL kernel: %s\n", opencl_errstr(status));
ret = AVERROR_EXTERNAL;
goto end;
}
gpu_env->program_count++;
end:
av_free(source_str);
return ret;
}
| 1threat |
Multipeer Connectivity Not Connecting Programmatically : <p>I am creating an iOS/macOS app that uses remote control functionality via the Multipeer Connectivity Framework. Since the device to be remotely monitored and controlled will run over an extended period of time, it's not viable to use the automatic view controller methods since the monitoring device may be locked or go to sleep and then disconnect the connection. So I'm using the programatic approach so that when the monitoring devices lose connection, they will automatically pair up when they are unlocked/woken up and the app is started again. My connection works fine using the ViewController method but not the programatic delegate approach. The advertising, browsing and inviting works fine, but when the invitation is accepted on the remote side I get several errors and then a failed connection. What's weird is that several of the errors are GCKSession errors. </p>
<p>So why is it trying to use the GameCenter framework? And why is it failing after accepting the invitation? Could it just be a bug in the Xcode 8 / Swift 3 /iOS 10 / macOS Sierra Beta SDKs?</p>
<pre><code>[ViceroyTrace] [ICE][ERROR] ICEStopConnectivityCheck() found no ICE check with call id (2008493930)
[GCKSession] Wrong connection data. Participant ID from remote connection data = 6FBBAE66, local participant ID = 3A4C626C
[MCSession] GCKSessionEstablishConnection failed (FFFFFFFF801A0020)
Peer Changing
Failed
[GCKSession] Not in connected state, so giving up for participant [77B72F6A] on channel [0]
</code></pre>
<p>Here is the code from my connection class</p>
<pre><code>func startAdvertisingWithoutUI () {
if advertiserService == nil {
advertiserService = MCNearbyServiceAdvertiser (peer: LMConnectivity.peerID, discoveryInfo: nil, serviceType: "mlm-timers")
advertiserService?.delegate = self
session.delegate = self
}
advertiserService?.startAdvertisingPeer()
}
func browserForNearbyDevices () {
if browserService == nil {
browserService = MCNearbyServiceBrowser (peer: LMConnectivity.peerID, serviceType: "mlm-timers")
browserService?.delegate = self
session.delegate = self
}
browserService?.startBrowsingForPeers()
}
func sendInvitation(to peer: MCPeerID) {
browserService?.invitePeer(peer, to: session, withContext: nil, timeout: 60)
}
func advertiser(_ advertiser: MCNearbyServiceAdvertiser, didReceiveInvitationFromPeer peerID: MCPeerID, withContext context: Data?, invitationHandler: (Bool, MCSession?) -> Void) {
let trustedNames = GetPreferences.trustedRemoteDevices
for name in trustedNames {
if name == peerID.displayName {
invitationHandler(true,session)
return
}
}
invitationHandler (false, session)
}
</code></pre>
| 0debug |
static int stellaris_enet_init(SysBusDevice *sbd)
{
DeviceState *dev = DEVICE(sbd);
stellaris_enet_state *s = STELLARIS_ENET(dev);
memory_region_init_io(&s->mmio, OBJECT(s), &stellaris_enet_ops, s,
"stellaris_enet", 0x1000);
sysbus_init_mmio(sbd, &s->mmio);
sysbus_init_irq(sbd, &s->irq);
qemu_macaddr_default_if_unset(&s->conf.macaddr);
s->nic = qemu_new_nic(&net_stellaris_enet_info, &s->conf,
object_get_typename(OBJECT(dev)), dev->id, s);
qemu_format_nic_info_str(qemu_get_queue(s->nic), s->conf.macaddr.a);
stellaris_enet_reset(s);
register_savevm(dev, "stellaris_enet", -1, 1,
stellaris_enet_save, stellaris_enet_load, s);
return 0;
}
| 1threat |
Invariant Violation: The navigation prop is missing for this navigator : <p>I am receiving this message when I tried starting my react native app. Usually this kind of format works on other multi screen navigation yet somehow does not work in this case.</p>
<p>Here is the error:</p>
<pre><code>Invariant Violation: The navigation prop is missing for this navigator. In
react-navigation 3 you must set up your app container directly. More info:
https://reactnavigation.org/docs/en/app-containers.html
</code></pre>
<p>Here is my app format:</p>
<pre><code>import React, {Component} from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { createStackNavigator } from 'react-navigation';
import Login from './view/login.js'
import SignUp from './view/signup.js'
const RootStack = createStackNavigator(
{
Home: {
screen: Login
},
Signup: {
screen: SignUp
}
},
{
initialRouteName: 'Home'
}
);
export default class App extends React.Component {
render() {
return <RootStack />;
}
}
</code></pre>
| 0debug |
int avfilter_default_query_formats(AVFilterContext *ctx)
{
enum AVMediaType type = ctx->inputs [0] ? ctx->inputs [0]->type :
ctx->outputs[0] ? ctx->outputs[0]->type :
AVMEDIA_TYPE_VIDEO;
avfilter_set_common_formats(ctx, avfilter_all_formats(type));
return 0;
}
| 1threat |
Running Program on Server : <p>I want to build a system where users can upload their own Python code. The code will then be run and marked for correctness. The result should be outputted to the user.</p>
<p>I have very limited knowledge of servers and can't find the right place to start. What would be the easiest way to approach this problem and where should I start?</p>
| 0debug |
Cross-site resource at <URL> was set without the `SameSite` attribute .NET : <p>How to solve <code>SameSite</code> attribute?</p>
<p>:1 A cookie associated with a cross-site resource at <a href="http://doubleclick.net/" rel="noreferrer">http://doubleclick.net/</a> was set without the <code>SameSite</code> attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with <code>SameSite=None</code> and <code>Secure</code>. You can review cookies in developer tools under Application>Storage>Cookies and see more details at <a href="https://www.chromestatus.com/feature/5088147346030592" rel="noreferrer">https://www.chromestatus.com/feature/5088147346030592</a> and <a href="https://www.chromestatus.com/feature/5633521622188032" rel="noreferrer">https://www.chromestatus.com/feature/5633521622188032</a>.</p>
<p>same for google.com, linkedin, facebook.com, twitter.com. etc</p>
<p>Unable to add 'Samesite' attributes. What will be the best way to get this solve?</p>
| 0debug |
What is the function to find the fames in webpage from the chrome console? : I want to search the frames inside the webpage. What should be the appropriate function.
I am trying to find out the input type checkbox with follwing.
"Top level frame"
"Top level frame"
$("#input") | 0debug |
Python Most Common values in a List : <p>I need a function that returns the most common values from a list. If there is more than one most common value, return all of them. </p>
<pre><code>l = [1, 1, 2, 2, 4]
def most_common(l):
#some code
return common
</code></pre>
<p>This should return:</p>
<pre><code>[1, 2]
</code></pre>
<p>Since they both appear twice. </p>
<p>I am surprised there is no simple function for this. I have tried collections but can't seem to figure this out. </p>
| 0debug |
connection.query('SELECT * FROM users WHERE username = ' + input_string) | 1threat |
Sending an email via VB script in excel based on cell value : I've borrowed some script from Ron De Bruin to email a selection from a worksheet to an email recipient. in the code Ron has built you specify the address it sends too but I want to specify the address from a cell in the worksheet, which is chosen by the data inputer (which is a vlookup from another sheet). I've tried various different methods for setting the variable but I just cant get it to work. The original script as done by Ron is below, if anyone knows how to substitute the "to = "email address" to call from a cell in the active sheet I'd really appreciate your help;
Sub Mail_Selection()
' Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, Outlook 2010.
Dim Source As Range
Dim Dest As Workbook
Dim wb As Workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim OutApp As Object
Dim OutMail As Object
Dim Recip As String
Set Source = Nothing
On Error Resume Next
Set Source = Selection.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Source Is Nothing Then
MsgBox "The source is not a range or the sheet is protected. " & _
"Please correct and try again.", vbOKOnly
Exit Sub
End If
If ActiveWindow.SelectedSheets.Count > 1 Or _
Selection.Cells.Count = 1 Or _
Selection.Areas.Count > 1 Then
MsgBox "An Error occurred :" & vbNewLine & vbNewLine & _
"You selected more than one sheet." & vbNewLine & _
"You selected only one cell." & vbNewLine & _
"You selected more than one area." & vbNewLine & vbNewLine & _
"Please correct and try again.", vbOKOnly
Exit Sub
End If
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Set wb = ActiveWorkbook
Set Dest = Workbooks.Add(xlWBATWorksheet)
Source.Copy
With Dest.Sheets(1)
.Cells(1).PasteSpecial Paste:=8
.Cells(1).PasteSpecial Paste:=xlPasteValues
.Cells(1).PasteSpecial Paste:=xlPasteFormats
.Cells(1).Select
Application.CutCopyMode = False
End With
TempFilePath = Environ$("temp") & "\"
TempFileName = "Selection of " & wb.Name & " " _
& Format(Now, "dd-mmm-yy h-mm-ss")
If Val(Application.Version) < 12 Then
' You are using Excel 2000, Excel 2002, Excel 2003, Excel 2007, or Excel 2010.
FileExtStr = ".xls": FileFormatNum = -4143
Else
' You are using Excel 2000, Excel 2002, Excel 2003, Excel 2007, or Excel 2010.
FileExtStr = ".xlsx": FileFormatNum = 51
End If
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
With Dest
.SaveAs TempFilePath & TempFileName & FileExtStr, _
FileFormat:=FileFormatNum
On Error Resume Next
With OutMail
.to = "email.address.com"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add Dest.FullName
' You can add other files by uncommenting the following statement.
'.Attachments.Add ("C:\test.txt")
' In place of the following statement, you can use ".Display" to
' display the e-mail message.
.Send
End With
On Error GoTo 0
.Close SaveChanges:=False
End With
Kill TempFilePath & TempFileName & FileExtStr
Set OutMail = Nothing
Set OutApp = Nothing
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End Sub | 0debug |
static void sclp_execute(SCCB *sccb, uint64_t code)
{
S390SCLPDevice *sdev = get_event_facility();
switch (code & SCLP_CMD_CODE_MASK) {
case SCLP_CMDW_READ_SCP_INFO:
case SCLP_CMDW_READ_SCP_INFO_FORCED:
read_SCP_info(sccb);
break;
case SCLP_CMDW_READ_CPU_INFO:
sclp_read_cpu_info(sccb);
break;
default:
sdev->sclp_command_handler(sdev->ef, sccb, code);
break;
}
}
| 1threat |
The command "npm run build -- --prod" exited with code 1 error : <p>I'm developing an Asp.Net Core 2 and Angular 5 project in visual studio 2017. </p>
<p>When I'm going to publish my project then the error '<strong>The command "npm run build -- --prod" exited with code 1</strong>' show in error list window.<br>
I created the project with <a href="https://stackoverflow.com/a/48972840/7487135">Angular CLI in ASP.NET Core 2 Angular template
</a> link and everything was fine and the project run and publish correctly.<br>
After a while, I don't know what exactly happens that cause the project doesn't publish. </p>
<p>In the npm-debug.log file </p>
<pre><code>0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build',
1 verbose cli '--',
1 verbose cli '--prod' ]
2 info using npm@3.10.10
3 info using node@v6.10.3
4 verbose stack Error: ENOENT: no such file or directory, open 'C:\Project\JWS\JWSApplication\package.json'
4 verbose stack at Error (native)
5 verbose cwd C:\Project\JWS\JWSApplication
6 error Windows_NT 10.0.15063
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build" "--" "--prod"
8 error node v6.10.3
9 error npm v3.10.10
10 error path C:\Project\JWS\JWSApplication\package.json
11 error code ENOENT
12 error errno -4058
13 error syscall open
14 error enoent ENOENT: no such file or directory, open 'C:\Project\JWS\JWSApplication\package.json'
15 error enoent ENOENT: no such file or directory, open 'C:\Project\JWS\JWSApplication\package.json'
15 error enoent This is most likely not a problem with npm itself
15 error enoent and is related to npm not being able to find a file.
16 verbose exit [ -4058, true ]
</code></pre>
| 0debug |
Can't find RecyclerView visible item position inside NestedScrollView : <p>How do I get the first/ last completely visible item in a recyclerview if it is inside a NestedScrollView and the recycler has <code>nestedScrollingEnabled="false"</code> for smooth scrolling with other views above the RecyclerView.</p>
<p>All these functions</p>
<p><code>int findFirstVisibleItemPosition();
int findFirstCompletelyVisibleItemPosition();
int findLastVisibleItemPosition();
int findLastCompletelyVisibleItemPosition();</code></p>
<p>either return the first/last item created in the recyclerView.</p>
<p>I want to find the current visible item because I want to make the RecyclerView scroll infinitely and I should fetch data if only a few items are left to scroll.</p>
<p>Thanks</p>
| 0debug |
List of lists to dictionary conversion : <p>I have a list of lists:</p>
<pre><code>L = [['Bob'],['5', '0', '0', '0', '0'],['Jack'],['3', '0', '0', '1', '-3'],['Larry'],['1', '-3', '1', '-5', '0'], ...]
</code></pre>
<p>I want to convert this list of lists into a dictionary with the names as keys and the numbers as values so that it returns:</p>
<pre><code>{'Bob':[5, 0, 0, 0, 0], 'Jack':[3, 0, 0, 1, -3], 'Larry':[1, -3, 1, -5, 0], ...}
</code></pre>
<p>So I want a dictionary with strings as keys and an array of integers as values for each string, however, I can't figure out how to go about doing this.</p>
<p>The major thing here that troubles me is how to make it so the dictionary takes every other entry of the list as the values, while at the same time convert the strings into integers.</p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.