problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Spring boot Unsupported Media Type with @RequestBody : <p>I checked in several different ways, also downloaded a new project to see what to check where is bug but I still do not know the answer.</p>
<p>That is my RestController</p>
<pre><code>@RestController
@RequestMapping(value = "/message")
public class MessageController {
@RequestMapping(value = "/", method = RequestMethod.POST)
public void createMessage(@RequestBody Message message){
System.out.println(message);
}
}
</code></pre>
<p>That is my Model</p>
<pre><code>@Data
@Entity
public class Message {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String sender;
private String telephone;
private String message;
}
</code></pre>
<p>Gradle dependencies if necessary</p>
<pre><code>dependencies {
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.9.0.pr3'
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('com.h2database:h2')
runtime('org.postgresql:postgresql')
compileOnly('org.projectlombok:lombok')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
</code></pre>
<p>and in postman i'm getting that error</p>
<blockquote>
<p>{ "timestamp": 1495992553884, "status": 415, "error":
"Unsupported Media Type", "exception":
"org.springframework.web.HttpMediaTypeNotSupportedException",<br>
"message": "Content type
'application/x-www-form-urlencoded;charset=UTF-8' not supported",<br>
"path": "/message/" }</p>
</blockquote>
<p>It is simplest way for rest but where I make a mistake?</p>
| 0debug |
Is it possible when comparing two strings with '==' returns true but return false with '.equals' in java : <p>I'm bit confused about the difference between == and .equals, I been searching for answers but still not quite clear. So, I'm wondering is there an example code can demonstrate that when comparing two strings, == and .equals return different results.</p>
| 0debug |
static void kvm_apic_mem_write(void *opaque, target_phys_addr_t addr,
uint64_t data, unsigned size)
{
MSIMessage msg = { .address = addr, .data = data };
int ret;
ret = kvm_irqchip_send_msi(kvm_state, msg);
if (ret < 0) {
fprintf(stderr, "KVM: injection failed, MSI lost (%s)\n",
strerror(-ret));
}
}
| 1threat |
Ansible: SSH Error: unix_listener: too long for Unix domain socket : <p>This is a known issue and I found a solution but it's not working for me.</p>
<p>First I had:</p>
<pre><code>fatal: [openshift-node-compute-e50xx] => SSH Error: ControlPath too long
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
</code></pre>
<p>So I created a <code>~/.ansible.cfg</code>. The content of it:</p>
<pre><code>[ssh_connection]
control_path=%(directory)s/%%h‐%%r
</code></pre>
<p>But after rerunning my ansible I stil have an error about 'too long'.</p>
<pre><code>fatal: [openshift-master-32axx] => SSH Error: unix_listener: "/Users/myuser/.ansible/cp/ec2-xx-xx-xx-xx.eu-central-1.compute.amazonaws.com-centos.AAZFTHkT5xXXXXXX" too long for Unix domain socket
while connecting to 52.xx.xx.xx:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
</code></pre>
<p>Why is it still too long?</p>
| 0debug |
SQL between-statement : <p>In SQL I want to call all prices between 3 and 4. I entered the next code that doesn't work. What do I need to do to make it work?</p>
<p>code </p>
<pre><code>SELECT * FROM `album` WHERE `prijs` BETWEEN 3 en AND 4
</code></pre>
| 0debug |
void process_pending_signals(CPUArchState *cpu_env)
{
CPUState *cpu = ENV_GET_CPU(cpu_env);
int sig;
abi_ulong handler;
sigset_t set, old_set;
target_sigset_t target_old_set;
struct emulated_sigtable *k;
struct target_sigaction *sa;
struct sigqueue *q;
TaskState *ts = cpu->opaque;
if (!ts->signal_pending)
return;
k = ts->sigtab;
for(sig = 1; sig <= TARGET_NSIG; sig++) {
if (k->pending)
goto handle_signal;
k++;
}
ts->signal_pending = 0;
return;
handle_signal:
#ifdef DEBUG_SIGNAL
fprintf(stderr, "qemu: process signal %d\n", sig);
#endif
q = k->first;
k->first = q->next;
if (!k->first)
k->pending = 0;
sig = gdb_handlesig(cpu, sig);
if (!sig) {
sa = NULL;
handler = TARGET_SIG_IGN;
} else {
sa = &sigact_table[sig - 1];
handler = sa->_sa_handler;
}
if (handler == TARGET_SIG_DFL) {
if (sig == TARGET_SIGTSTP || sig == TARGET_SIGTTIN || sig == TARGET_SIGTTOU) {
kill(getpid(),SIGSTOP);
} else if (sig != TARGET_SIGCHLD &&
sig != TARGET_SIGURG &&
sig != TARGET_SIGWINCH &&
sig != TARGET_SIGCONT) {
force_sig(sig);
}
} else if (handler == TARGET_SIG_IGN) {
} else if (handler == TARGET_SIG_ERR) {
force_sig(sig);
} else {
target_to_host_sigset(&set, &sa->sa_mask);
if (!(sa->sa_flags & TARGET_SA_NODEFER))
sigaddset(&set, target_to_host_signal(sig));
sigprocmask(SIG_BLOCK, &set, &old_set);
host_to_target_sigset_internal(&target_old_set, &old_set);
#if defined(TARGET_I386) && !defined(TARGET_X86_64)
{
CPUX86State *env = cpu_env;
if (env->eflags & VM_MASK)
save_v86_state(env);
}
#endif
#if defined(TARGET_ABI_MIPSN32) || defined(TARGET_ABI_MIPSN64)
setup_rt_frame(sig, sa, &q->info, &target_old_set, cpu_env);
#else
if (sa->sa_flags & TARGET_SA_SIGINFO)
setup_rt_frame(sig, sa, &q->info, &target_old_set, cpu_env);
else
setup_frame(sig, sa, &target_old_set, cpu_env);
#endif
if (sa->sa_flags & TARGET_SA_RESETHAND)
sa->_sa_handler = TARGET_SIG_DFL;
}
if (q != &k->info)
free_sigqueue(cpu_env, q);
}
| 1threat |
UNIQID alternative : <p>I'm looking to generate a UNIQUE random code.</p>
<p>When you use uniqid(), result is based on time, example:
if user created ID yesterday at 12:12:35 and another user create a new ID today at same time, ID are identical because based on 24 hour loop time.</p>
<p>I'm tinking about using microtime in this way</p>
<pre><code>// create random based on unix epoch
$random = round(microtime(true) * 1000);
</code></pre>
<p>In this way can I grant uniqueless of generated IDs?</p>
| 0debug |
How can I remove the BOM from a UTF-8 file? : <p>I have a file in UTF-8 encoding with BOM and want to remove the BOM. Are there any linux command-line tools to remove the BOM from the file?</p>
<pre><code>$ file test.xml
test.xml: XML 1.0 document, UTF-8 Unicode (with BOM) text, with very long lines
</code></pre>
| 0debug |
ui-router 1.x.x change $transition$.params() during resolve : <p>Trying to migrate an angularjs application to use the new version of <code>angular-ui-router</code> 1.0.14 and stumbled upon a problem when trying to change <code>$stateParams</code> in the resolve of a state.</p>
<p>For example, previously (when using <code>angular-ui-router</code> 0.3.2) modifying <code>$stateParams</code> worked like this:</p>
<pre><code> $stateProvider.state('myState', {
parent: 'baseState',
url: '/calendar?firstAvailableDate',
template: 'calendar.html',
controller: 'CalendarController',
controllerAs: 'calendarCtrl',
resolve: {
availableDates: ['CalendarService', '$stateParams', function(CalendarService, $stateParams) {
return CalendarService.getAvailableDates().then(function(response){
$stateParams.firstAvailableDate = response[0];
return response;
});
}]
}
})
</code></pre>
<p>The problem is <code>firstAvailableDate</code> is populated after a resolve and I do not know how to update <code>$transition$.params()</code> during a resolve when usign the new version of <code>angular-ui-router</code> 1.0.14.</p>
<p>I have tried, and managed to update the url parameter with</p>
<ol>
<li><p>firing a <code>$state.go('myState', {firstAvailableDate : response[0]})</code> but this reloads the state, so the screen flickers</p></li>
<li><p>modified <code>$transition$.treeChanges().to[$transition$.treeChanges().length-1].paramValues.firstAvailableDate = response[0];</code> to actually override the parameters. I have done this after looking through the implementation on <code>params()</code> for <code>$transition$</code>.</p></li>
</ol>
<p>Although both those options work, they seem to be hacks rather than by the book implementations.</p>
<p>What is the correct approach to use when trying to modify parameters inside a resolve?</p>
| 0debug |
static inline int vfp_exceptbits_from_host(int host_bits)
{
int target_bits = 0;
if (host_bits & float_flag_invalid)
target_bits |= 1;
if (host_bits & float_flag_divbyzero)
target_bits |= 2;
if (host_bits & float_flag_overflow)
target_bits |= 4;
if (host_bits & float_flag_underflow)
target_bits |= 8;
if (host_bits & float_flag_inexact)
target_bits |= 0x10;
if (host_bits & float_flag_input_denormal)
target_bits |= 0x80;
return target_bits;
}
| 1threat |
How to import data saved in word.doc into R-studio : <p>I've just received a dataset saved in word.doc. The owner of the data did not work with R. I would like to import this data into R-studio. I am familiar with Excel data but never work with word.doc. Is it possible to import this data automatically into R-studio?</p>
| 0debug |
Where is the default output folder for dotnet restore? : <p>I tried to create a simple .net core using commandline </p>
<pre><code>dotnew new
</code></pre>
<p>in a certain folder called netcoreExample and I could see that there are two files created which are program.cs and project.json. Then I add Microsoft.EntityFrameworkCore to dependencies entry in project.json</p>
<p>When I try to run the command</p>
<pre><code>dotnet restore
</code></pre>
<p>it shows the package is restores successfully. However, when I inspect the folder where I run dotnet restore from, I didn't see the "packages" folder which is usually created when with the old C# projects running Nuget restore.</p>
<p>I wonder where the dotnet restore output all of the dependencies to.</p>
| 0debug |
Using for loop in javascript for 50k time without hanging of browser : <p>I have to run a loop for 50,000 times, but it is hanging browser. what could be the best way to do it.</p>
<p>sample :</p>
<pre><code>for(var i=0;i<50000;i++)
{
// Here I am calculating 50 different values.
}
</code></pre>
<p>I can't use php because values are displayed directly in html page.</p>
<p>what I can do for it?</p>
<p>thanks</p>
| 0debug |
MVC Razor - If condition shows up in html render : <p>In below code(the first Div) I need to Put if condition based on which different buttons will be visible. I did this but it results in below issue (see pic below). We can't put if conditions in DIV ? Please suggest a way to do this. Thanks!</p>
<p><a href="https://i.stack.imgur.com/oNcbi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oNcbi.png" alt="enter image description here"></a></p>
<pre><code><td style="text-align:center; vertical-align:middle">
<div class="editDelGLCode">
if(@Model.Tables["PM_GLCode"].Rows[0]["InfoRefID"].ToString().Trim().Length == 0)
{
<button type="button" class="btn OOrange" onclick="editGLCode(this);">
<i class="fas fa-plus-circle"></i> Add New
</button>
}
else
{
<a href="#" title="Edit" onclick="editGLCode(this);"><i class="fas fa-edit"></i></a>
&nbsp;&nbsp;
}
</div>
<div class="saveCanGLCode" style="display:none">
<span id="UpdateOSaveGLCode"> <a href="#" title="Save" onclick="addOrUpdateOGlcode(this);"><i class="fas fa-save"></i></a></span>
<span>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;</span>
<span><a href="#" title="Cancel" onclick="cancelRowGLCode();"><i class="fas fa-times"></i></a></span>
</div>
<div class="hdnPM_GLCode" style="display:none;">
@if (Model.Tables["PM_GLCode"].Rows.Count > 0)
{ @Model.Tables["PM_GLCode"].Rows[0]["BSAInfoRefID"]}
</div>
</td>
</code></pre>
| 0debug |
How do I install Jupyter notebook on an Android device? : <p>Is there a way to install a functional instance of Jupyter notebook on an Android device? Specifically, I want to use Jupyter to run a Python notebook.</p>
| 0debug |
Compairing two strings excluding number in sql : I have two strings stored in two different tables:
1.) Error code=1 on A team.
2.) Error code=2 on A team.
I want two compare these two strings in sql in such a way that numbers should be ignore i.e. when I compare these string I should get output of the condition as true. How can i do this? | 0debug |
static void tco_timer_expired(void *opaque)
{
TCOIORegs *tr = opaque;
ICH9LPCPMRegs *pm = container_of(tr, ICH9LPCPMRegs, tco_regs);
ICH9LPCState *lpc = container_of(pm, ICH9LPCState, pm);
uint32_t gcs = pci_get_long(lpc->chip_config + ICH9_CC_GCS);
tr->tco.rld = 0;
tr->tco.sts1 |= TCO_TIMEOUT;
if (++tr->timeouts_no == 2) {
tr->tco.sts2 |= TCO_SECOND_TO_STS;
tr->tco.sts2 |= TCO_BOOT_STS;
tr->timeouts_no = 0;
if (!(gcs & ICH9_CC_GCS_NO_REBOOT)) {
watchdog_perform_action();
tco_timer_stop(tr);
return;
}
}
if (pm->smi_en & ICH9_PMIO_SMI_EN_TCO_EN) {
ich9_generate_smi();
} else {
ich9_generate_nmi();
}
tr->tco.rld = tr->tco.tmr;
tco_timer_reload(tr);
}
| 1threat |
static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
{
AVStream *st = s->streams[stream_index];
avio_seek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET);
return 0;
}
| 1threat |
About safe operations involving unique pointers : <p>Consider the following code:</p>
<pre><code>#include <memory>
struct Foo { std::unique_ptr<Foo> next; };
void f(Foo &foo) { foo = std::move(*foo.next); }
int main() {
Foo foo{};
foo.next = std::make_unique<Foo>();
foo.next->next = std::make_unique<Foo>();
f(foo);
}
</code></pre>
<p>By doing <code>foo = std::move(*foo.next);</code>, <code>foo.next.next</code> is moved to <code>foo.next</code>.<br>
If <code>foo.next</code> is invalidated as a first step, the object to which it points could be deleted immediately. This would lead to the deletion of <code>foo.next.next</code>, that is the object that I'm trying to move to <code>foo.next</code>.<br>
I'm pretty sure I'm missing something in my reasoning, but I can't figure out what's wrong.<br>
Is it a safe operation? Where does the standard reassure me about that?</p>
| 0debug |
[Vue.js2]How to use debounce in deep watch in Vue : <p>I want to use <code>debounce</code> in <code>depp watch</code> but it does not work! And I know it could work in <code>watch</code> which without <code>depp: true</code>.
Thx!</p>
| 0debug |
Writting Custom FPrintF : I have to make my own fprintf method in c++, but by comparing the execution time of my method with the standard one, mine is almost 3 times slower. What have I done wrong?
`void FPrintF(const char *aFormat, ...) { va_list ap; const char *p; int count = 0; char buf[16]; std::string tbuf; va_start(ap, aFormat); for (p = aFormat; *p; p++) { if (*p != '%') { continue; } switch (*++p) { case 'd': sprintf(buf, "%d", va_arg(ap, int32)); break; case 'f': sprintf(buf, "%.5f", va_arg(ap, double)); break; case 's': sprintf(buf, "%s", va_arg(ap, const char*)); break; } *p++; const uint32 Length = (uint32)strlen(buf); buf[Length] = (char)*p; buf[Length + 1] = '\0'; tbuf += buf; } va_end(ap); Write((char*)tbuf.c_str(), tbuf.size()); }`
| 0debug |
g_malloc0(size_t n_bytes)
{
void *mem;
__coverity_negative_sink__(n_bytes);
mem = calloc(1, n_bytes == 0 ? 1 : n_bytes);
if (!mem) __coverity_panic__();
return mem;
}
| 1threat |
How to get other pages followers count number in Instagram? : <p>is there possibility to get other pages follower count number in Instagram?
I can get only my profile followers count number, but I want to get other followers too? (for example in php)</p>
<p>Any ideas?</p>
| 0debug |
static int proxy_fsync(FsContext *ctx, int fid_type,
V9fsFidOpenState *fs, int datasync)
{
int fd;
if (fid_type == P9_FID_DIR) {
fd = dirfd(fs->dir);
} else {
fd = fs->fd;
}
if (datasync) {
return qemu_fdatasync(fd);
} else {
return fsync(fd);
}
}
| 1threat |
create-react-app Typescript 3.5, Path Alias : <p>I am trying to setup Path alias in my project by adding these values to tsconfig.json:</p>
<pre><code> "compilerOptions": {
"baseUrl": "src",
"paths": {
"@store/*": ["store/*"]
},
</code></pre>
<p>And if I create an import, neither IntelliJ or VSCode bother me:</p>
<pre><code>import { AppState } from '@store/index';
</code></pre>
<p>But when I compile the application I get this warning:</p>
<pre><code>The following changes are being made to your tsconfig.json file:
- compilerOptions.paths must not be set (aliased imports are not supported)
</code></pre>
<p>And it bombs saying it cannot find the reference:</p>
<pre><code>TypeScript error in C:/xyz.tsx(2,26):
Cannot find module '/store'. TS2307
</code></pre>
<p>Is there any workaround or it is not supported by <code>create-react-app --typescript</code>?</p>
| 0debug |
how to disable scroll bar on fullscreen slider : Hello i am sonu anyone tell me about that how to disable scroll bar on full screen slider. There is scroll down button at each slider when click on this button go to just below slider and show scroll bar, otherwise don't show scrollbar.
Please tell me anyone example code | 0debug |
static gboolean io_watch_poll_prepare(GSource *source, gint *timeout_)
{
IOWatchPoll *iwp = io_watch_poll_from_source(source);
bool now_active = iwp->fd_can_read(iwp->opaque) > 0;
bool was_active = g_source_get_context(iwp->src) != NULL;
if (was_active == now_active) {
return FALSE;
}
if (now_active) {
g_source_attach(iwp->src, NULL);
} else {
g_source_remove(g_source_get_id(iwp->src));
}
return FALSE;
}
| 1threat |
ERROR ITMS-90596: "Invalid Bundle. The asset catalog at Payload" : <p>I am Using xCode 8.0 and build an ipa for my project and uploading it using Application Loader but i am getting an error please see below screen shot:</p>
<p><a href="https://i.stack.imgur.com/YGo9v.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YGo9v.png" alt="enter image description here"></a></p>
<p>I have successfully uploaded one of prior version of same application few minutes before but now i am getting the above error without any changes.</p>
<p>Thanks in Advance...!!</p>
| 0debug |
Update kubernetes secrets doesn't update running container env vars : <p>Currenly when updating a kubernetes secrets file, in order to apply the changes, I need to run <code>kubectl apply -f my-secrets.yaml</code>. If there was a running container, it would still be using the old secrets. In order to apply the new secrets on the running container, I currently run the command <code>kubectl replace -f my-pod.yaml</code> .
I was wondering if this is the best way to update a running container secret, or am I missing something.</p>
<p>Thanks.</p>
| 0debug |
static void disas_fp_2src(DisasContext *s, uint32_t insn)
{
unsupported_encoding(s, insn);
}
| 1threat |
Why the value of i is showing at the out of the loop is 5, but in the loop the last value of i is 4? : <pre><code>#include<stdio.h>
int main()
{
int i,n=5;
for(i=0;i<n;i++)
{
printf("in of loop the value of i is %d\n",i);
}
printf("out of loop the value of i is %d",i);
}
</code></pre>
<p>I can not understand why the value of i is showing at the out of the loop is 5, but in the loop the last value of i is 4.</p>
| 0debug |
How to multiple role user registration in wordpress : How to register user with separte roles in wordpress.
for example:register as doctor,register as patient.
And login to their dashboard | 0debug |
Installation failed to finalize session... Signatures are inconsistent - Android : <p>I am trying to run my project but I get this error:</p>
<blockquote>
<p>Installation failed with message Failed to finalize session :
INSTALL_FAILED_INVALID_APK: /data/app/vmdl1841863905.tmp/11_app-debug
signatures are inconsistent. It is possible that this issue is
resolved by uninstalling an existing version of the apk if it is
present, and then re-installing.</p>
<p>WARNING: Uninstalling will remove the application data!</p>
<p>Do you want to uninstall the existing application?</p>
</blockquote>
<p>If I press yes, after some seconds it just shows the same error. I tried to manually delete the application but the application is already deleted from my phone.</p>
| 0debug |
GoLang Sending Requests to Https site : Essentially, through goLang I'm trying to send a request on a https site to check if an item is on the site.
I have tried to attempt a request to the main site, but keep getting access denied and need a way to tackle this, I'm trying to get the info from the body to separate it and find the correct ids to check if something is on the site.
package main
import ("fmt"
"net/http"
"io/ioutil")
func main() {
url := "https://www.game.co.uk/"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(string(body))
}
| 0debug |
Create File with Google Drive Api v3 (javascript) : <p>I want to create a file with content using Google Drive API v3. I have authenticated via OAuth and have the Drive API loaded. Statements like the following work (but produce a file without content):</p>
<pre><code>gapi.client.drive.files.create({
"name": "settings",
}).execute();
</code></pre>
<p>Unfortunately I cannot figure out how to create a file that has a content. I cannot find a JavaScript example using Drive API v3. Are there some special parameters that I need to pass?</p>
<p>For simplicity, assume that I have a String like '{"name":"test"}' that is in JSON format that should be the content of the created file.</p>
| 0debug |
Trouble setting up sample table. "Could not find matching row model for rowModelType clientSide" : <p>I've been going through the "Getting Started" tutorial for the ag-grid on the fresh project. Completed all the steps but got an error saying</p>
<pre><code>ag-Grid: could not find matching row model for rowModelType clientSide
ag-Grid: Row Model "Client Side" not found. Please ensure the ClientSideRowModelModule is loaded using: import '@ag-grid-community/client-side-row-model';
</code></pre>
<p>Compared all my code with examples provided in the tutorial and some plunker examples, and didn't notice any differences. Tried importing ClientSideRowModelModule to the app.module but interfaces did not match with what angular requested, so it didn't work. I'm out of ideas and failed to find any info on how to fix it.</p>
<p>app.module.ts:</p>
<pre><code> ... imports: [
BrowserModule,
AppRoutingModule,
AgGridModule.withComponents([])
],...
</code></pre>
<p>app.cpmponent.html:</p>
<pre><code><ag-grid-angular
style="width: 500px; height: 500px;"
class="ag-theme-balham"
[rowData]="rowData"
[columnDefs]="columnDefs"
>
</ag-grid-angular>
</code></pre>
<p>app.component.ts:</p>
<pre><code> ...columnDefs = [
{headerName: 'Make', field: 'make' },
{headerName: 'Model', field: 'model' },
{headerName: 'Price', field: 'price'}
];
rowData = [
{ make: 'Toyota', model: 'Celica', price: 35000 },
{ make: 'Ford', model: 'Mondeo', price: 32000 },
{ make: 'Porsche', model: 'Boxter', price: 72000 }
];...
</code></pre>
<p>I'm using Angular: 8.2.10, Angular CLI: 8.2.2, npm: 6.9.0</p>
| 0debug |
static void mipsnet_receive(void *opaque, const uint8_t *buf, size_t size)
{
MIPSnetState *s = opaque;
#ifdef DEBUG_MIPSNET_RECEIVE
printf("mipsnet: receiving len=%d\n", size);
#endif
if (!mipsnet_can_receive(opaque))
return;
s->busy = 1;
memcpy(s->rx_buffer, buf, size);
s->rx_count = size;
s->rx_read = 0;
s->intctl |= MIPSNET_INTCTL_RXDONE;
mipsnet_update_irq(s);
}
| 1threat |
static struct vm_area_struct *vma_next(struct vm_area_struct *vma)
{
return (TAILQ_NEXT(vma, vma_link));
}
| 1threat |
ngModel property not working in my sub html component : <p>I guys, I am new in angular. I created an angular app and in it I have 3 other generated components to test angular navigation. Here is what I need help with, in the "index.html" when I use "[(ngModel)]" in the an input element, it flags no error but if I try to use <strong>"[(ngModel)]"</strong> in any of the 3 created components html file, it gives my error. I have imported "FormsModule" in the app.module.ts.</p>
<p>Please I do I make the ngModel property available in my sub html components?</p>
<p>It will be appreciated if you answer with examples.</p>
<p>Cheers</p>
| 0debug |
int MPV_common_init(MpegEncContext *s)
{
int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y, threads;
s->mb_height = (s->height + 15) / 16;
if(s->avctx->thread_count > MAX_THREADS || (s->avctx->thread_count > s->mb_height && s->mb_height)){
av_log(s->avctx, AV_LOG_ERROR, "too many threads\n");
return -1;
}
if((s->width || s->height) && avcodec_check_dimensions(s->avctx, s->width, s->height))
return -1;
dsputil_init(&s->dsp, s->avctx);
ff_dct_common_init(s);
s->flags= s->avctx->flags;
s->flags2= s->avctx->flags2;
s->mb_width = (s->width + 15) / 16;
s->mb_stride = s->mb_width + 1;
s->b8_stride = s->mb_width*2 + 1;
s->b4_stride = s->mb_width*4 + 1;
mb_array_size= s->mb_height * s->mb_stride;
mv_table_size= (s->mb_height+2) * s->mb_stride + 1;
avcodec_get_chroma_sub_sample(s->avctx->pix_fmt,&(s->chroma_x_shift),
&(s->chroma_y_shift) );
s->h_edge_pos= s->mb_width*16;
s->v_edge_pos= s->mb_height*16;
s->mb_num = s->mb_width * s->mb_height;
s->block_wrap[0]=
s->block_wrap[1]=
s->block_wrap[2]=
s->block_wrap[3]= s->b8_stride;
s->block_wrap[4]=
s->block_wrap[5]= s->mb_stride;
y_size = s->b8_stride * (2 * s->mb_height + 1);
c_size = s->mb_stride * (s->mb_height + 1);
yc_size = y_size + 2 * c_size;
s->codec_tag= toupper( s->avctx->codec_tag &0xFF)
+ (toupper((s->avctx->codec_tag>>8 )&0xFF)<<8 )
+ (toupper((s->avctx->codec_tag>>16)&0xFF)<<16)
+ (toupper((s->avctx->codec_tag>>24)&0xFF)<<24);
s->stream_codec_tag= toupper( s->avctx->stream_codec_tag &0xFF)
+ (toupper((s->avctx->stream_codec_tag>>8 )&0xFF)<<8 )
+ (toupper((s->avctx->stream_codec_tag>>16)&0xFF)<<16)
+ (toupper((s->avctx->stream_codec_tag>>24)&0xFF)<<24);
s->avctx->coded_frame= (AVFrame*)&s->current_picture;
CHECKED_ALLOCZ(s->mb_index2xy, (s->mb_num+1)*sizeof(int))
for(y=0; y<s->mb_height; y++){
for(x=0; x<s->mb_width; x++){
s->mb_index2xy[ x + y*s->mb_width ] = x + y*s->mb_stride;
}
}
s->mb_index2xy[ s->mb_height*s->mb_width ] = (s->mb_height-1)*s->mb_stride + s->mb_width;
if (s->encoding) {
CHECKED_ALLOCZ(s->p_mv_table_base , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_bidir_forw_mv_table_base , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_bidir_back_mv_table_base , mv_table_size * 2 * sizeof(int16_t))
CHECKED_ALLOCZ(s->b_direct_mv_table_base , mv_table_size * 2 * sizeof(int16_t))
s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1;
s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1;
s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1;
s->b_bidir_forw_mv_table= s->b_bidir_forw_mv_table_base + s->mb_stride + 1;
s->b_bidir_back_mv_table= s->b_bidir_back_mv_table_base + s->mb_stride + 1;
s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1;
if(s->msmpeg4_version){
CHECKED_ALLOCZ(s->ac_stats, 2*2*(MAX_LEVEL+1)*(MAX_RUN+1)*2*sizeof(int));
}
CHECKED_ALLOCZ(s->avctx->stats_out, 256);
CHECKED_ALLOCZ(s->mb_type , mb_array_size * sizeof(uint16_t))
CHECKED_ALLOCZ(s->lambda_table, mb_array_size * sizeof(int))
CHECKED_ALLOCZ(s->q_intra_matrix, 64*32 * sizeof(int))
CHECKED_ALLOCZ(s->q_inter_matrix, 64*32 * sizeof(int))
CHECKED_ALLOCZ(s->q_intra_matrix16, 64*32*2 * sizeof(uint16_t))
CHECKED_ALLOCZ(s->q_inter_matrix16, 64*32*2 * sizeof(uint16_t))
CHECKED_ALLOCZ(s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture*))
CHECKED_ALLOCZ(s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture*))
if(s->avctx->noise_reduction){
CHECKED_ALLOCZ(s->dct_offset, 2 * 64 * sizeof(uint16_t))
}
}
CHECKED_ALLOCZ(s->picture, MAX_PICTURE_COUNT * sizeof(Picture))
CHECKED_ALLOCZ(s->error_status_table, mb_array_size*sizeof(uint8_t))
if(s->codec_id==CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)){
for(i=0; i<2; i++){
int j, k;
for(j=0; j<2; j++){
for(k=0; k<2; k++){
CHECKED_ALLOCZ(s->b_field_mv_table_base[i][j][k] , mv_table_size * 2 * sizeof(int16_t))
s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1;
}
CHECKED_ALLOCZ(s->b_field_select_table[i][j] , mb_array_size * 2 * sizeof(uint8_t))
CHECKED_ALLOCZ(s->p_field_mv_table_base[i][j] , mv_table_size * 2 * sizeof(int16_t))
s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1;
}
CHECKED_ALLOCZ(s->p_field_select_table[i] , mb_array_size * 2 * sizeof(uint8_t))
}
}
if (s->out_format == FMT_H263) {
CHECKED_ALLOCZ(s->ac_val_base, yc_size * sizeof(int16_t) * 16);
s->ac_val[0] = s->ac_val_base + s->b8_stride + 1;
s->ac_val[1] = s->ac_val_base + y_size + s->mb_stride + 1;
s->ac_val[2] = s->ac_val[1] + c_size;
CHECKED_ALLOCZ(s->coded_block_base, y_size);
s->coded_block= s->coded_block_base + s->b8_stride + 1;
CHECKED_ALLOCZ(s->cbp_table , mb_array_size * sizeof(uint8_t))
CHECKED_ALLOCZ(s->pred_dir_table, mb_array_size * sizeof(uint8_t))
}
if (s->h263_pred || s->h263_plus || !s->encoding) {
CHECKED_ALLOCZ(s->dc_val_base, yc_size * sizeof(int16_t));
s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
s->dc_val[2] = s->dc_val[1] + c_size;
for(i=0;i<yc_size;i++)
s->dc_val_base[i] = 1024;
}
CHECKED_ALLOCZ(s->mbintra_table, mb_array_size);
memset(s->mbintra_table, 1, mb_array_size);
CHECKED_ALLOCZ(s->mbskip_table, mb_array_size+2);
CHECKED_ALLOCZ(s->prev_pict_types, PREV_PICT_TYPES_BUFFER_SIZE);
s->parse_context.state= -1;
if((s->avctx->debug&(FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE)) || (s->avctx->debug_mv)){
s->visualization_buffer[0] = av_malloc((s->mb_width*16 + 2*EDGE_WIDTH) * s->mb_height*16 + 2*EDGE_WIDTH);
s->visualization_buffer[1] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH);
s->visualization_buffer[2] = av_malloc((s->mb_width*8 + EDGE_WIDTH) * s->mb_height*8 + EDGE_WIDTH);
}
s->context_initialized = 1;
s->thread_context[0]= s;
threads = s->codec_id == CODEC_ID_H264 ? 1 : s->avctx->thread_count;
for(i=1; i<threads; i++){
s->thread_context[i]= av_malloc(sizeof(MpegEncContext));
memcpy(s->thread_context[i], s, sizeof(MpegEncContext));
}
for(i=0; i<threads; i++){
if(init_duplicate_context(s->thread_context[i], s) < 0)
goto fail;
s->thread_context[i]->start_mb_y= (s->mb_height*(i ) + s->avctx->thread_count/2) / s->avctx->thread_count;
s->thread_context[i]->end_mb_y = (s->mb_height*(i+1) + s->avctx->thread_count/2) / s->avctx->thread_count;
}
return 0;
fail:
MPV_common_end(s);
return -1;
}
| 1threat |
Git commit locally then push later. : I am working on a project where I am using Github. I am now working offline and so I cannot push the commits to Github.
Is there a way how I can still create commits locally (on the same branch) and then push all of the commits at a later date when I’m back online? | 0debug |
How to copy fakepath using php with filename only. Is't posible? : I'm using javascript to get the file path but it returns C:\fakepat\ **fileName**, then I replace the fakepath to get fileName only. Then ajax to php. And execute this line;
___
copy(***filename***, $targetPath);
___
it returns this error no directory or file. Please help me on this otherwise have another way. :) Thanks! | 0debug |
int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size,
const AVFrame *pict)
{
AVPacket pkt;
int ret, got_packet = 0;
if (buf_size < FF_MIN_BUFFER_SIZE) {
av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n");
return -1;
}
av_init_packet(&pkt);
pkt.data = buf;
pkt.size = buf_size;
ret = avcodec_encode_video2(avctx, &pkt, pict, &got_packet);
if (!ret && got_packet && avctx->coded_frame) {
avctx->coded_frame->pts = pkt.pts;
avctx->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY);
}
if (pkt.side_data_elems > 0) {
int i;
for (i = 0; i < pkt.side_data_elems; i++)
av_free(pkt.side_data[i].data);
av_freep(&pkt.side_data);
pkt.side_data_elems = 0;
}
return ret ? ret : pkt.size;
} | 1threat |
Enabling brand icon in `cardNumber` type element in Stripe : <p>When using <a href="https://stripe.com/docs/elements" rel="noreferrer">Stripe elements</a>, is there a way to <em>not</em> use the <code>card</code> element, but still get the auto brand icon show up somewhere (preferably in the <code>cardNumber</code> input field)?</p>
| 0debug |
Sql Azure : How to add server level triggers : I am new to sql azure and wants to add server level trigger as in normal sql server. Please help. | 0debug |
should images be sent from server to client or stay on client : <p>i'm making a blackjack game in java,
and i'm not sure whether i should send the images of the cards from the server to the client every time or just put all the images files in the client and just use their names.</p>
<p>on the one hand sending the images might make the programming a bit messier and make the program run a little slower,
but on the other hand i don't want to let the client be able to mess up things from his side.
this code isn't for production but it's important for me to put emphasis on security and stability.</p>
<p>i'll be glad to hear your opinions, thanks :)</p>
| 0debug |
How can I remove tokens with non_-alphabetic characters ? python : There is the specific requirement:
remove tokens with non-alphabetic characters in one sentence.
For example:
Input: I like python@ pretty muc*h.
Output: I like pretty | 0debug |
Continue inside multi thread throws error : I am threading a time consuming for-loop and executing them inside N number of threads. A continue statement is throwing error
Getting the error "Continue cannot be used outside of a loop"
for (final Message m : messagelistholder.getMessage()) {
Callable<Void> tasksToExecute=new Callable<Void>() {
public Void call() {
if (guidanceonly1 == true && !QuoteUtil.isECPQuote(list.get(0))) {
String msg = "Message From " + m.getSource() + " when retrieving Guidance values: "
+ m.getDescription();
String lcladdStatusMessages = CommonUtil.getLoclizedMsg(
"PRCE_LNE_ITM_MSG_FRM_WHN_RETRVNG_GUIDNCE_VAL",
new String[] { m.getSource(), m.getDescription() }, msg);
list.get(0).addStatusMessages("Info", lcladdStatusMessages);
}
else if ("Error".equalsIgnoreCase(m.getSeverity())) {
if (m.getCode().indexOf("_NF") > 0) {
continue; // price not found due to private sku
}
if ("Eclipse".equalsIgnoreCase(m.getSource())) {
String msg1 = "Please check Sold To customer data. ";
String lcladdStatusMessages1 = CommonUtil
.getLoclizedMsg("PRCE_LNE_ITM_PLS_CHK_SLDTO_CUST_DTA", null, msg1);
String msg2 = "Discount information may not be returned from Optimus due to "
+ m.getSeverity() + " From " + m.getSource() + " " + m.getDescription();
String lcladdStatusMessages2 = CommonUtil.getLoclizedMsg(
"PRCE_LNE_ITM_DSCNT_INFO_MNT_RTRND_FRM_OPTMS_DUETO_FRM",
new String[] { m.getSeverity(), m.getSource(), m.getDescription() }, msg2);
list.get(0).addStatusMessages(m.getSeverity(),
(m.getDescription().contains("MDCP") ? lcladdStatusMessages1 : "")
+ lcladdStatusMessages2);
} else {
if (response1.getItems() == null) {
String lcladdStatusMessages = CommonUtil.getLoclizedMsg("PRCE_LNE_ITM_OPTMS_ERR",
new String[] { m.getSource(), m.getDescription() }, m.getDescription());
list.get(0).addStatusMessages("Error", lcladdStatusMessages);
list.get(0).setOptimusError(true);
} else {
if(!QuoteUtil.isECPQuote(list.get(0))){
String lcladdStatusMessages = CommonUtil.getLoclizedMsg(
"PRCE_LNE_ITM_MSG_FRM_WHN_RETRVNG_GUIDNCE_VAL",
new String[] { m.getSource(), m.getDescription() },
"Message From " + m.getSource() + " " + m.getDescription());
list.get(0).addStatusMessages("Info", lcladdStatusMessages);
list.get(0).setOptimusError(true);
}
}
}
}
if (list.get(0).getFlags().get(QtFlagType.ESCALATIONFORPARTNER) != null) {
list.get(0).getFlags().get(QtFlagType.ESCALATIONFORPARTNER).setFlgVl(null);
}
if (m.getCode() != null) {
String pricingServiceMsgCode = m.getCode();
String pricingServiceSeverity = m.getSeverity();
Map<Integer, AutoEscalationScenario> categoryMap;
if (StringUtils.equals("ERROR", pricingServiceSeverity)) {
categoryMap = getScenario("SEVERITY", globalAccount1, null, true, null);
if (categoryMap.size() != 0) {
finalCategorylist.get(0).putAll(categoryMap);
}
}
if(partnerExclusivityAutoEscalation1){
categoryMap = getScenario(pricingServiceMsgCode, globalAccount1, null, true, null);
if (categoryMap != null && categoryMap.size() != 0) {
finalCategorylist.get(0).putAll(categoryMap);
}
}
}
return null;
}
};
runnableTasks.add(tasksToExecute);
}
Can someone help me to skip the particular loop for the speicified condition but without using continue statement since it throws error. | 0debug |
float64 float64_round_to_int( float64 a STATUS_PARAM )
{
flag aSign;
int16 aExp;
bits64 lastBitMask, roundBitsMask;
int8 roundingMode;
float64 z;
aExp = extractFloat64Exp( a );
if ( 0x433 <= aExp ) {
if ( ( aExp == 0x7FF ) && extractFloat64Frac( a ) ) {
return propagateFloat64NaN( a, a STATUS_VAR );
}
return a;
}
if ( aExp < 0x3FF ) {
if ( (bits64) ( a<<1 ) == 0 ) return a;
STATUS(float_exception_flags) |= float_flag_inexact;
aSign = extractFloat64Sign( a );
switch ( STATUS(float_rounding_mode) ) {
case float_round_nearest_even:
if ( ( aExp == 0x3FE ) && extractFloat64Frac( a ) ) {
return packFloat64( aSign, 0x3FF, 0 );
}
break;
case float_round_down:
return aSign ? LIT64( 0xBFF0000000000000 ) : 0;
case float_round_up:
return
aSign ? LIT64( 0x8000000000000000 ) : LIT64( 0x3FF0000000000000 );
}
return packFloat64( aSign, 0, 0 );
}
lastBitMask = 1;
lastBitMask <<= 0x433 - aExp;
roundBitsMask = lastBitMask - 1;
z = a;
roundingMode = STATUS(float_rounding_mode);
if ( roundingMode == float_round_nearest_even ) {
z += lastBitMask>>1;
if ( ( z & roundBitsMask ) == 0 ) z &= ~ lastBitMask;
}
else if ( roundingMode != float_round_to_zero ) {
if ( extractFloat64Sign( z ) ^ ( roundingMode == float_round_up ) ) {
z += roundBitsMask;
}
}
z &= ~ roundBitsMask;
if ( z != a ) STATUS(float_exception_flags) |= float_flag_inexact;
return z;
}
| 1threat |
Advice on html/javascript coding : <!DOCTYPE HTML>
<html>
<head><meta charset="utf-8">
<title>TaxDay</title>
<script type="text/javascript">
<!-- Hide from old browsers
function scrollColor() {
styleObject=document.getElementsByTagName('html')[0].style
styleObject.scrollbarFaceColor="#857040"
styleObject.scrollbarTrackColor="#f4efe9"
}
function countDown() {
var today = new Date()
var day of week = today.toLocaleString()
dayLocate = dayofweek.indexOf(" ")
weekDay = dayofweek.substring(0, dayLocate)
newDay = dayofweek.substring(dayLocate)
dateLocate = newday.indexOf(",")
monthDate = newDay.substring(0, dateLocate+1)}
yearLocate = dayofweek.indexOf("2016")
year = dayofweek.substr(yearLocate, 4)
var taxDate = new Date ("April 16, 2017")
var daysToGo = taxDate.getTime()-today.getTime()
var daysToTaxDate = Math.ceil(daysToGo/(1000*60*60*24))
function taxmessage() {
var lastModDate = document.lastModified
var lastModDate = lastModDate.substring(0,10)
taxDay.innerHTML = "<p style='font-size:12pt; font-
family:helvetica;'>Today is "+weekDay+" "+monthDate+" "+year+".
You have "+daysToTaxDate+" days to file your taxes.</p>"
}
}
//-->
</script>
the <div> id is taxDay if its relevant.
the body onLoad event handler are "scrollColor(); countDown(); and taxmessage()"
The website suppose to display a message counting down to the tax day. I can't seem to get anything to display on the page. the scrollbar doesn't even show up with the color even though i put in the write code. Some advice please. Thank you. | 0debug |
def gcd(p,q):
while q != 0:
p, q = q,p%q
return p
def is_coprime(x,y):
return gcd(x,y) == 1 | 0debug |
int ff_h264_decode_seq_parameter_set(H264Context *h){
MpegEncContext * const s = &h->s;
int profile_idc, level_idc, constraint_set_flags = 0;
unsigned int sps_id;
int i, log2_max_frame_num_minus4;
SPS *sps;
profile_idc= get_bits(&s->gb, 8);
constraint_set_flags |= get_bits1(&s->gb) << 0;
constraint_set_flags |= get_bits1(&s->gb) << 1;
constraint_set_flags |= get_bits1(&s->gb) << 2;
constraint_set_flags |= get_bits1(&s->gb) << 3;
get_bits(&s->gb, 4);
level_idc= get_bits(&s->gb, 8);
sps_id= get_ue_golomb_31(&s->gb);
if(sps_id >= MAX_SPS_COUNT) {
av_log(h->s.avctx, AV_LOG_ERROR, "sps_id (%d) out of range\n", sps_id);
return -1;
}
sps= av_mallocz(sizeof(SPS));
if(sps == NULL)
return -1;
sps->time_offset_length = 24;
sps->profile_idc= profile_idc;
sps->constraint_set_flags = constraint_set_flags;
sps->level_idc= level_idc;
memset(sps->scaling_matrix4, 16, sizeof(sps->scaling_matrix4));
memset(sps->scaling_matrix8, 16, sizeof(sps->scaling_matrix8));
sps->scaling_matrix_present = 0;
if(sps->profile_idc >= 100){
sps->chroma_format_idc= get_ue_golomb_31(&s->gb);
if(sps->chroma_format_idc > 3) {
av_log(h->s.avctx, AV_LOG_ERROR, "chroma_format_idc (%u) out of range\n", sps->chroma_format_idc);
goto fail;
} else if(sps->chroma_format_idc == 3) {
sps->residual_color_transform_flag = get_bits1(&s->gb);
}
sps->bit_depth_luma = get_ue_golomb(&s->gb) + 8;
sps->bit_depth_chroma = get_ue_golomb(&s->gb) + 8;
sps->transform_bypass = get_bits1(&s->gb);
decode_scaling_matrices(h, sps, NULL, 1, sps->scaling_matrix4, sps->scaling_matrix8);
}else{
sps->chroma_format_idc= 1;
sps->bit_depth_luma = 8;
sps->bit_depth_chroma = 8;
}
log2_max_frame_num_minus4 = get_ue_golomb(&s->gb);
if (log2_max_frame_num_minus4 < MIN_LOG2_MAX_FRAME_NUM - 4 ||
log2_max_frame_num_minus4 > MAX_LOG2_MAX_FRAME_NUM - 4) {
av_log(h->s.avctx, AV_LOG_ERROR,
"log2_max_frame_num_minus4 out of range (0-12): %d\n",
log2_max_frame_num_minus4);
return AVERROR_INVALIDDATA;
}
sps->log2_max_frame_num = log2_max_frame_num_minus4 + 4;
sps->poc_type= get_ue_golomb_31(&s->gb);
if(sps->poc_type == 0){
sps->log2_max_poc_lsb= get_ue_golomb(&s->gb) + 4;
} else if(sps->poc_type == 1){
sps->delta_pic_order_always_zero_flag= get_bits1(&s->gb);
sps->offset_for_non_ref_pic= get_se_golomb(&s->gb);
sps->offset_for_top_to_bottom_field= get_se_golomb(&s->gb);
sps->poc_cycle_length = get_ue_golomb(&s->gb);
if((unsigned)sps->poc_cycle_length >= FF_ARRAY_ELEMS(sps->offset_for_ref_frame)){
av_log(h->s.avctx, AV_LOG_ERROR, "poc_cycle_length overflow %u\n", sps->poc_cycle_length);
goto fail;
}
for(i=0; i<sps->poc_cycle_length; i++)
sps->offset_for_ref_frame[i]= get_se_golomb(&s->gb);
}else if(sps->poc_type != 2){
av_log(h->s.avctx, AV_LOG_ERROR, "illegal POC type %d\n", sps->poc_type);
goto fail;
}
sps->ref_frame_count= get_ue_golomb_31(&s->gb);
if(sps->ref_frame_count > MAX_PICTURE_COUNT-2 || sps->ref_frame_count >= 32U){
av_log(h->s.avctx, AV_LOG_ERROR, "too many reference frames\n");
goto fail;
}
sps->gaps_in_frame_num_allowed_flag= get_bits1(&s->gb);
sps->mb_width = get_ue_golomb(&s->gb) + 1;
sps->mb_height= get_ue_golomb(&s->gb) + 1;
if((unsigned)sps->mb_width >= INT_MAX/16 || (unsigned)sps->mb_height >= INT_MAX/16 ||
av_image_check_size(16*sps->mb_width, 16*sps->mb_height, 0, h->s.avctx)){
av_log(h->s.avctx, AV_LOG_ERROR, "mb_width/height overflow\n");
goto fail;
}
sps->frame_mbs_only_flag= get_bits1(&s->gb);
if(!sps->frame_mbs_only_flag)
sps->mb_aff= get_bits1(&s->gb);
else
sps->mb_aff= 0;
sps->direct_8x8_inference_flag= get_bits1(&s->gb);
if(!sps->frame_mbs_only_flag && !sps->direct_8x8_inference_flag){
av_log(h->s.avctx, AV_LOG_ERROR, "This stream was generated by a broken encoder, invalid 8x8 inference\n");
goto fail;
}
#ifndef ALLOW_INTERLACE
if(sps->mb_aff)
av_log(h->s.avctx, AV_LOG_ERROR, "MBAFF support not included; enable it at compile-time.\n");
#endif
sps->crop= get_bits1(&s->gb);
if(sps->crop){
int crop_vertical_limit = sps->chroma_format_idc & 2 ? 16 : 8;
int crop_horizontal_limit = sps->chroma_format_idc == 3 ? 16 : 8;
sps->crop_left = get_ue_golomb(&s->gb);
sps->crop_right = get_ue_golomb(&s->gb);
sps->crop_top = get_ue_golomb(&s->gb);
sps->crop_bottom= get_ue_golomb(&s->gb);
if(sps->crop_left || sps->crop_top){
av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n");
}
if(sps->crop_right >= crop_horizontal_limit || sps->crop_bottom >= crop_vertical_limit){
av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n");
}
}else{
sps->crop_left =
sps->crop_right =
sps->crop_top =
sps->crop_bottom= 0;
}
sps->vui_parameters_present_flag= get_bits1(&s->gb);
if( sps->vui_parameters_present_flag )
if (decode_vui_parameters(h, sps) < 0)
goto fail;
if(!sps->sar.den)
sps->sar.den= 1;
if(s->avctx->debug&FF_DEBUG_PICT_INFO){
static const char csp[4][5] = { "Gray", "420", "422", "444" };
av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d\n",
sps_id, sps->profile_idc, sps->level_idc,
sps->poc_type,
sps->ref_frame_count,
sps->mb_width, sps->mb_height,
sps->frame_mbs_only_flag ? "FRM" : (sps->mb_aff ? "MB-AFF" : "PIC-AFF"),
sps->direct_8x8_inference_flag ? "8B8" : "",
sps->crop_left, sps->crop_right,
sps->crop_top, sps->crop_bottom,
sps->vui_parameters_present_flag ? "VUI" : "",
csp[sps->chroma_format_idc],
sps->timing_info_present_flag ? sps->num_units_in_tick : 0,
sps->timing_info_present_flag ? sps->time_scale : 0
);
}
av_free(h->sps_buffers[sps_id]);
h->sps_buffers[sps_id]= sps;
h->sps = *sps;
return 0;
fail:
av_free(sps);
return -1;
}
| 1threat |
static void dec_misc(DisasContext *dc, uint32_t insn)
{
uint32_t op0, op1;
uint32_t ra, rb, rd;
uint32_t L6, K5, K16, K5_11;
int32_t I16, I5_11, N26;
TCGMemOp mop;
TCGv t0;
op0 = extract32(insn, 26, 6);
op1 = extract32(insn, 24, 2);
ra = extract32(insn, 16, 5);
rb = extract32(insn, 11, 5);
rd = extract32(insn, 21, 5);
L6 = extract32(insn, 5, 6);
K5 = extract32(insn, 0, 5);
K16 = extract32(insn, 0, 16);
I16 = (int16_t)K16;
N26 = sextract32(insn, 0, 26);
K5_11 = (extract32(insn, 21, 5) << 11) | extract32(insn, 0, 11);
I5_11 = (int16_t)K5_11;
switch (op0) {
case 0x00:
LOG_DIS("l.j %d\n", N26);
gen_jump(dc, N26, 0, op0);
break;
case 0x01:
LOG_DIS("l.jal %d\n", N26);
gen_jump(dc, N26, 0, op0);
break;
case 0x03:
LOG_DIS("l.bnf %d\n", N26);
gen_jump(dc, N26, 0, op0);
break;
case 0x04:
LOG_DIS("l.bf %d\n", N26);
gen_jump(dc, N26, 0, op0);
break;
case 0x05:
switch (op1) {
case 0x01:
LOG_DIS("l.nop %d\n", I16);
break;
default:
gen_illegal_exception(dc);
break;
}
break;
case 0x11:
LOG_DIS("l.jr r%d\n", rb);
gen_jump(dc, 0, rb, op0);
break;
case 0x12:
LOG_DIS("l.jalr r%d\n", rb);
gen_jump(dc, 0, rb, op0);
break;
case 0x13:
LOG_DIS("l.maci r%d, %d\n", ra, I16);
t0 = tcg_const_tl(I16);
gen_mac(dc, cpu_R[ra], t0);
tcg_temp_free(t0);
break;
case 0x09:
LOG_DIS("l.rfe\n");
{
#if defined(CONFIG_USER_ONLY)
return;
#else
if (dc->mem_idx == MMU_USER_IDX) {
gen_illegal_exception(dc);
return;
}
gen_helper_rfe(cpu_env);
dc->is_jmp = DISAS_UPDATE;
#endif
}
break;
case 0x1b:
LOG_DIS("l.lwa r%d, r%d, %d\n", rd, ra, I16);
gen_lwa(dc, cpu_R[rd], cpu_R[ra], I16);
break;
case 0x1c:
LOG_DIS("l.cust1\n");
break;
case 0x1d:
LOG_DIS("l.cust2\n");
break;
case 0x1e:
LOG_DIS("l.cust3\n");
break;
case 0x1f:
LOG_DIS("l.cust4\n");
break;
case 0x3c:
LOG_DIS("l.cust5 r%d, r%d, r%d, %d, %d\n", rd, ra, rb, L6, K5);
break;
case 0x3d:
LOG_DIS("l.cust6\n");
break;
case 0x3e:
LOG_DIS("l.cust7\n");
break;
case 0x3f:
LOG_DIS("l.cust8\n");
break;
case 0x21:
LOG_DIS("l.lwz r%d, r%d, %d\n", rd, ra, I16);
mop = MO_TEUL;
goto do_load;
case 0x22:
LOG_DIS("l.lws r%d, r%d, %d\n", rd, ra, I16);
mop = MO_TESL;
goto do_load;
case 0x23:
LOG_DIS("l.lbz r%d, r%d, %d\n", rd, ra, I16);
mop = MO_UB;
goto do_load;
case 0x24:
LOG_DIS("l.lbs r%d, r%d, %d\n", rd, ra, I16);
mop = MO_SB;
goto do_load;
case 0x25:
LOG_DIS("l.lhz r%d, r%d, %d\n", rd, ra, I16);
mop = MO_TEUW;
goto do_load;
case 0x26:
LOG_DIS("l.lhs r%d, r%d, %d\n", rd, ra, I16);
mop = MO_TESW;
goto do_load;
do_load:
{
TCGv t0 = tcg_temp_new();
tcg_gen_addi_tl(t0, cpu_R[ra], I16);
tcg_gen_qemu_ld_tl(cpu_R[rd], t0, dc->mem_idx, mop);
tcg_temp_free(t0);
}
break;
case 0x27:
LOG_DIS("l.addi r%d, r%d, %d\n", rd, ra, I16);
t0 = tcg_const_tl(I16);
gen_add(dc, cpu_R[rd], cpu_R[ra], t0);
tcg_temp_free(t0);
break;
case 0x28:
LOG_DIS("l.addic r%d, r%d, %d\n", rd, ra, I16);
t0 = tcg_const_tl(I16);
gen_addc(dc, cpu_R[rd], cpu_R[ra], t0);
tcg_temp_free(t0);
break;
case 0x29:
LOG_DIS("l.andi r%d, r%d, %d\n", rd, ra, K16);
tcg_gen_andi_tl(cpu_R[rd], cpu_R[ra], K16);
break;
case 0x2a:
LOG_DIS("l.ori r%d, r%d, %d\n", rd, ra, K16);
tcg_gen_ori_tl(cpu_R[rd], cpu_R[ra], K16);
break;
case 0x2b:
LOG_DIS("l.xori r%d, r%d, %d\n", rd, ra, I16);
tcg_gen_xori_tl(cpu_R[rd], cpu_R[ra], I16);
break;
case 0x2c:
LOG_DIS("l.muli r%d, r%d, %d\n", rd, ra, I16);
t0 = tcg_const_tl(I16);
gen_mul(dc, cpu_R[rd], cpu_R[ra], t0);
tcg_temp_free(t0);
break;
case 0x2d:
LOG_DIS("l.mfspr r%d, r%d, %d\n", rd, ra, K16);
{
#if defined(CONFIG_USER_ONLY)
return;
#else
TCGv_i32 ti = tcg_const_i32(K16);
if (dc->mem_idx == MMU_USER_IDX) {
gen_illegal_exception(dc);
return;
}
gen_helper_mfspr(cpu_R[rd], cpu_env, cpu_R[rd], cpu_R[ra], ti);
tcg_temp_free_i32(ti);
#endif
}
break;
case 0x30:
LOG_DIS("l.mtspr r%d, r%d, %d\n", ra, rb, K5_11);
{
#if defined(CONFIG_USER_ONLY)
return;
#else
TCGv_i32 im = tcg_const_i32(K5_11);
if (dc->mem_idx == MMU_USER_IDX) {
gen_illegal_exception(dc);
return;
}
gen_helper_mtspr(cpu_env, cpu_R[ra], cpu_R[rb], im);
tcg_temp_free_i32(im);
#endif
}
break;
case 0x33:
LOG_DIS("l.swa r%d, r%d, %d\n", ra, rb, I5_11);
gen_swa(dc, cpu_R[rb], cpu_R[ra], I5_11);
break;
case 0x35:
LOG_DIS("l.sw r%d, r%d, %d\n", ra, rb, I5_11);
mop = MO_TEUL;
goto do_store;
case 0x36:
LOG_DIS("l.sb r%d, r%d, %d\n", ra, rb, I5_11);
mop = MO_UB;
goto do_store;
case 0x37:
LOG_DIS("l.sh r%d, r%d, %d\n", ra, rb, I5_11);
mop = MO_TEUW;
goto do_store;
do_store:
{
TCGv t0 = tcg_temp_new();
tcg_gen_addi_tl(t0, cpu_R[ra], I5_11);
tcg_gen_qemu_st_tl(cpu_R[rb], t0, dc->mem_idx, mop);
tcg_temp_free(t0);
}
break;
default:
gen_illegal_exception(dc);
break;
}
}
| 1threat |
CharDriverState *qemu_chr_open_eventfd(int eventfd)
{
CharDriverState *chr = qemu_chr_open_fd(eventfd, eventfd);
if (chr) {
chr->avail_connections = 1;
}
return chr;
}
| 1threat |
static int set_string_number(void *obj, const AVOption *o, const char *val, void *dst)
{
int ret = 0, notfirst = 0;
for (;;) {
int i, den = 1;
char buf[256];
int cmd = 0;
double d, num = 1;
int64_t intnum = 1;
if (*val == '+' || *val == '-')
cmd = *(val++);
for (i = 0; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++)
buf[i] = val[i];
buf[i] = 0;
{
const AVOption *o_named = av_opt_find(obj, buf, o->unit, 0, 0);
if (o_named && o_named->type == AV_OPT_TYPE_CONST)
d = DEFAULT_NUMVAL(o_named);
else if (!strcmp(buf, "default")) d = DEFAULT_NUMVAL(o);
else if (!strcmp(buf, "max" )) d = o->max;
else if (!strcmp(buf, "min" )) d = o->min;
else if (!strcmp(buf, "none" )) d = 0;
else if (!strcmp(buf, "all" )) d = ~0;
else {
int res = av_expr_parse_and_eval(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj);
if (res < 0) {
av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val);
return res;
}
}
}
if (o->type == AV_OPT_TYPE_FLAGS) {
read_number(o, dst, NULL, NULL, &intnum);
if (cmd == '+') d = intnum | (int64_t)d;
else if (cmd == '-') d = intnum &~(int64_t)d;
} else {
read_number(o, dst, &num, &den, &intnum);
if (cmd == '+') d = notfirst*num*intnum/den + d;
else if (cmd == '-') d = notfirst*num*intnum/den - d;
}
if ((ret = write_number(obj, o, dst, d, 1, 1)) < 0)
return ret;
val += i;
if (!*val)
return 0;
notfirst = 1;
}
return 0;
}
| 1threat |
Safari losing hash params on http redirection : <blockquote>
<p>I am facing an issue wherein the url fragments are not getting
preserved on redirect in Safari as they should be according to the
http specifications.</p>
</blockquote>
<hr>
<p><strong>Setting</strong> -</p>
<pre><code>`/url1` redirects to `/url2#hash`
`/url2` redirects to `/url3`
</code></pre>
<p><strong>Expected behaviour</strong> - </p>
<pre><code>Hitting `/url1` should redirect to `/url3#hash`
</code></pre>
<p><strong>Observed behaviour</strong> - </p>
<pre><code>Chrome/FF - Hitting `/url1` redirects to `/url3#hash`
Safari(11+) - Hitting `/url1` redirects to `/url3`
</code></pre>
<hr>
<p>I did read the <a href="https://bugs.webkit.org/show_bug.cgi?id=24175" rel="noreferrer">issue</a> reported for earlier versions of Safari. I also tried the <a href="https://stackoverflow.com/questions/18663410/safari-ignoring-removing-hashatags-when-clicking-hyperlinks">solutions</a> posted in other SO threads in vain.</p>
<p>Any help is appreciated.</p>
| 0debug |
static int tosa_dac_recv(I2CSlave *s)
{
printf("%s: recv not supported!!!\n", __FUNCTION__);
return -1;
}
| 1threat |
declare constants in golang using os.Getenv results in 'const initializer in os.Getenv("MY_SECRET") is not a constant' : <p>If I declare constants as the following I get the error 'const initializer in os.Getenv("MY_SECRET") is not a constant'. Why is this?</p>
<p>New to Go and I see the return type of Getenv is a string, but I don't understand why this wouldn't work as a constant. </p>
<pre><code>const (
secret = os.Getenv("MY_SECRET")
key = os.Getenv("MY_KEY")
)
</code></pre>
| 0debug |
Is there a way for other classes to recongnize a public variable in another class? : I am very new to this language and i am not too sure how to effectively use it.The coding language i am using is AS3 with flash Devlop. What i am trying to do is to allow the class Chapter to access a public variable in the class Main Menu. The variable is named YesNo and when i try to access it in the class Chapter it doesn't work. I had downloaded something called Flashpunk that came with presets for multiple different classes that helps with making games,i will show my Code below.
Main Menu
package
{
import net.flashpunk.Entity;
import net.flashpunk.graphics.Image;
import net.flashpunk.utils.Input;
import net.flashpunk.utils.Key;
import net.flashpunk.FP;
public class MainMenu extends Entity
{
[Embed(source = "net/MainScreen.png")]
private const SPRITE1:Class;
private var sprite1:Image = new Image(SPRITE1);
public var YesNo:int = 0
public function MainMenu()
{
graphic = sprite1;
sprite1.centerOrigin();
x = 200
y = 150
layer = 150
}
override public function update():void
{
if (Input.pressed(Key.DIGIT_1))
{
YesNo = YesNo + 1
}
if (Input.pressed(Key.DIGIT_2))
{
YesNo = YesNo + 2
}
}
}
}
Chapter
package
{
import net.flashpunk.Entity;
import net.flashpunk.World;
public class Chapter extends World
{
public function Chapter()
{
add(new MainMenu())
}
}
}
| 0debug |
void dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx)
{
if (mm_flags & FF_MM_MMX) {
const int dct_algo = avctx->dct_algo;
if(dct_algo==FF_DCT_AUTO || dct_algo==FF_DCT_MMX){
if(mm_flags & FF_MM_SSE2){
c->fdct = ff_fdct_sse2;
}else if(mm_flags & FF_MM_MMX2){
c->fdct = ff_fdct_mmx2;
}else{
c->fdct = ff_fdct_mmx;
}
}
c->get_pixels = get_pixels_mmx;
c->diff_pixels = diff_pixels_mmx;
c->pix_sum = pix_sum16_mmx;
c->diff_bytes= diff_bytes_mmx;
c->sum_abs_dctelem= sum_abs_dctelem_mmx;
c->hadamard8_diff[0]= hadamard8_diff16_mmx;
c->hadamard8_diff[1]= hadamard8_diff_mmx;
c->pix_norm1 = pix_norm1_mmx;
c->sse[0] = (mm_flags & FF_MM_SSE2) ? sse16_sse2 : sse16_mmx;
c->sse[1] = sse8_mmx;
c->vsad[4]= vsad_intra16_mmx;
c->nsse[0] = nsse16_mmx;
c->nsse[1] = nsse8_mmx;
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->vsad[0] = vsad16_mmx;
}
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->try_8x8basis= try_8x8basis_mmx;
}
c->add_8x8basis= add_8x8basis_mmx;
c->ssd_int8_vs_int16 = ssd_int8_vs_int16_mmx;
if (mm_flags & FF_MM_MMX2) {
c->sum_abs_dctelem= sum_abs_dctelem_mmx2;
c->hadamard8_diff[0]= hadamard8_diff16_mmx2;
c->hadamard8_diff[1]= hadamard8_diff_mmx2;
c->vsad[4]= vsad_intra16_mmx2;
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->vsad[0] = vsad16_mmx2;
}
c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_mmx2;
}
if(mm_flags & FF_MM_SSE2){
c->get_pixels = get_pixels_sse2;
c->sum_abs_dctelem= sum_abs_dctelem_sse2;
c->hadamard8_diff[0]= hadamard8_diff16_sse2;
c->hadamard8_diff[1]= hadamard8_diff_sse2;
#if CONFIG_LPC
c->lpc_compute_autocorr = ff_lpc_compute_autocorr_sse2;
#endif
}
#if HAVE_SSSE3
if(mm_flags & FF_MM_SSSE3){
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->try_8x8basis= try_8x8basis_ssse3;
}
c->add_8x8basis= add_8x8basis_ssse3;
c->sum_abs_dctelem= sum_abs_dctelem_ssse3;
c->hadamard8_diff[0]= hadamard8_diff16_ssse3;
c->hadamard8_diff[1]= hadamard8_diff_ssse3;
}
#endif
if(mm_flags & FF_MM_3DNOW){
if(!(avctx->flags & CODEC_FLAG_BITEXACT)){
c->try_8x8basis= try_8x8basis_3dnow;
}
c->add_8x8basis= add_8x8basis_3dnow;
}
}
dsputil_init_pix_mmx(c, avctx);
}
| 1threat |
how to add hyperlink in jquery replace : Hi i have the following script and i want to replace barbel with a href
<script>
$(".text_div ,p").text(function() {
return $(this).text().replace("barbel", "mpara");
});
$(".text_div").text(function() {
return $(this).text().replace("some", "red");
});
</script> | 0debug |
why has JVM been given the name so? Is it because it acts as hardware like CPU? : <p>1.Does JVM execute certain instructions without taking any help of CPU or it take help of CPU for all the instruction? </p>
<p>2.Is it like when JVM use JIT compiler then only it uses CPU for execution otherwise it executes the instruction itself when it uses interpreter?</p>
<ol start="3">
<li>If JVM executes some instruction without CPU then give example of such kind of instruction and also instruction which can be executed by CPU only.
Please explain the process of execution when JVM use interpreter and when it uses JIT compiler?</li>
</ol>
| 0debug |
Why promise.then() behaves asynchronously? : <p>In the below code why <code>promise.then()</code> behaves asynchronously. In other words , why browser is not waiting for the code written inside <code>promise.then()</code> method to be executed?.What tell the browser engine so that <code>promise.then()</code> makes an asynchronous call? </p>
<pre><code>const money = 500;
let promise = new Promise(function(resolve,reject){
if(money > 400){
resolve('You have a car!');
}else{
reject('Yo do not have enough money to buy the Car!');
}
});
console.log('Before');
promise.then(function(data){
console.log('Success '+data);
});
console.log('After');
</code></pre>
<p>The above code prints the output in the below order, which means promise.then() works asynchronously.</p>
<ul>
<li>Before</li>
<li>After</li>
<li>Success You have a car!</li>
</ul>
| 0debug |
I tell me who you are. Unable to auto detect email address :
*** please tell me who you are
Run
git config _ _global user.email"you@example.com"
git config _ _global user.email"you@example.com"
to set. your accounts default identity.
Omit _ _ global to set the identity only in this repository.
| 0debug |
Order of reducer and saga : <p>When dispatching an action is the order when it arrives to a reducer and a saga guaranteed?</p>
<p>Can I rely on that it </p>
<ol>
<li>first enters the reducer</li>
<li>then the saga?</li>
</ol>
<p>Reducer:</p>
<pre><code> function reducer(state, action) {
switch (action.type) {
case 'MY_ACTION':
// decorate action so that an epic doesn't have to take data from store
action.ports = state.itemsModified;
return state;
}
}
</code></pre>
<p>Saga:</p>
<pre><code>export function* sagaUpdatePorts() {
yield* ReduxSaga.takeEvery(actions.GRID_PORTS_ASYNC_UPDATE_PORTS, updatePorts);
}
function* updatePorts(action) {
const {response, error} = yield SagaEffects.call(portsService.updatePorts, action.ports);
}
</code></pre>
| 0debug |
static void mem_info_pae32(Monitor *mon, CPUState *env)
{
unsigned int l1, l2, l3;
int prot, last_prot;
uint64_t pdpe, pde, pte;
uint64_t pdp_addr, pd_addr, pt_addr;
target_phys_addr_t start, end;
pdp_addr = env->cr[3] & ~0x1f;
last_prot = 0;
start = -1;
for (l1 = 0; l1 < 4; l1++) {
cpu_physical_memory_read(pdp_addr + l1 * 8, &pdpe, 8);
pdpe = le64_to_cpu(pdpe);
end = l1 << 30;
if (pdpe & PG_PRESENT_MASK) {
pd_addr = pdpe & 0x3fffffffff000ULL;
for (l2 = 0; l2 < 512; l2++) {
cpu_physical_memory_read(pd_addr + l2 * 8, &pde, 8);
pde = le64_to_cpu(pde);
end = (l1 << 30) + (l2 << 21);
if (pde & PG_PRESENT_MASK) {
if (pde & PG_PSE_MASK) {
prot = pde & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK);
mem_print(mon, &start, &last_prot, end, prot);
} else {
pt_addr = pde & 0x3fffffffff000ULL;
for (l3 = 0; l3 < 512; l3++) {
cpu_physical_memory_read(pt_addr + l3 * 8, &pte, 8);
pte = le64_to_cpu(pte);
end = (l1 << 30) + (l2 << 21) + (l3 << 12);
if (pte & PG_PRESENT_MASK) {
prot = pte & (PG_USER_MASK | PG_RW_MASK |
PG_PRESENT_MASK);
} else {
prot = 0;
}
mem_print(mon, &start, &last_prot, end, prot);
}
}
} else {
prot = 0;
mem_print(mon, &start, &last_prot, end, prot);
}
}
} else {
prot = 0;
mem_print(mon, &start, &last_prot, end, prot);
}
}
mem_print(mon, &start, &last_prot, (target_phys_addr_t)1 << 32, 0);
}
| 1threat |
Intellij git bash terminal tilde key : <p>I set git-bash for windows as default terminal in Intellij IDEA. It works but I am unable to write tilde (<code>~</code>) character there (<code>Shift</code>+<code>~</code>). Tried changing different options in settings but without any luck.</p>
<p>versions:
Windows 10<br>
Intellij IDEA 2017.2.5<br>
git version 2.14.2.windows.3<br>
path to shell: <code>"C:\Program Files (x86)\Git\bin\sh.exe" --login -i</code></p>
<p>Does anyone had similar problem and know the solution?</p>
<p>It is really annoying when I have to copy this character or work in seperate terminal in situation where direct view on code is preferable.</p>
| 0debug |
why return statement does not return float? : <p>I am new to programming and learning C from schildt's teach yourself C. I am trying to make a function that returns square. but when I input numbers with decimals it outputs as whole number. why does it do that?
my program :</p>
<pre><code> #include <stdio.h>
int get_sqr(void);
void main()
{
float x;
x = get_sqr();
printf("square : %f",x);
return 0;
}
int get_sqr(void)
{
float y;
printf("enter a number : ");
scanf("%f",&y);
return y*y; /*returning the square result to assignment argument */
}
</code></pre>
| 0debug |
How to write generic function with two inputs? : <p>I am a newbee in programming, and I run into an issue with R about generic function: how to write it when there are multiple inputs?</p>
<p>For an easy example, for dataset and function</p>
<pre class="lang-r prettyprint-override"><code>z <- c(2,3,4,5,8)
calc.simp <- function(a,x){a*x+8}
# Test the function:
calc.simp(x=z,a=3)
[1] 14 17 20 23 32
</code></pre>
<p>Now I change the class of z:
class(z) <- 'simp'
How should I write the generic function 'calc' as there are two inputs?
My attempts and errors are below:</p>
<pre class="lang-r prettyprint-override"><code>calc <- function(x) UseMethod('calc',x)
calc(x=z)
Error in calc.simp(x = z) : argument "a" is missing, with no default
</code></pre>
<p>And</p>
<pre class="lang-r prettyprint-override"><code>calc <- function(x,y) UseMethod('calc',x,y)
Error in UseMethod("calc", x, y) : unused argument (y)
</code></pre>
<p>My confusion might be a fundamental one as I am just a beginner. Please help! Thank you very much!</p>
| 0debug |
static int gif_image_write_header(uint8_t **bytestream,
int width, int height, int loop_count,
uint32_t *palette)
{
int i;
unsigned int v;
bytestream_put_buffer(bytestream, "GIF", 3);
bytestream_put_buffer(bytestream, "89a", 3);
bytestream_put_le16(bytestream, width);
bytestream_put_le16(bytestream, height);
bytestream_put_byte(bytestream, 0xf7);
bytestream_put_byte(bytestream, 0x1f);
bytestream_put_byte(bytestream, 0);
if (!palette) {
bytestream_put_buffer(bytestream, (const unsigned char *)gif_clut, 216*3);
for(i=0;i<((256-216)*3);i++)
bytestream_put_byte(bytestream, 0);
} else {
for(i=0;i<256;i++) {
v = palette[i];
bytestream_put_be24(bytestream, v);
}
}
#ifdef GIF_ADD_APP_HEADER
if (loop_count >= 0 && loop_count <= 65535) {
bytestream_put_byte(bytestream, 0x21);
bytestream_put_byte(bytestream, 0xff);
bytestream_put_byte(bytestream, 0x0b);
bytestream_put_buffer(bytestream, "NETSCAPE2.0", 11);
bytestream_put_byte(bytestream, 0x03);
bytestream_put_byte(bytestream, 0x01);
bytestream_put_le16(bytestream, (uint16_t)loop_count);
bytestream_put_byte(bytestream, 0x00);
}
#endif
return 0;
}
| 1threat |
static int http_parse_request(HTTPContext *c)
{
const char *p;
char *p1;
enum RedirType redir_type;
char cmd[32];
char info[1024], filename[1024];
char url[1024], *q;
char protocol[32];
char msg[1024];
const char *mime_type;
FFServerStream *stream;
int i;
char ratebuf[32];
const char *useragent = 0;
p = c->buffer;
get_word(cmd, sizeof(cmd), &p);
av_strlcpy(c->method, cmd, sizeof(c->method));
if (!strcmp(cmd, "GET"))
c->post = 0;
else if (!strcmp(cmd, "POST"))
c->post = 1;
else
return -1;
get_word(url, sizeof(url), &p);
av_strlcpy(c->url, url, sizeof(c->url));
get_word(protocol, sizeof(protocol), (const char **)&p);
if (strcmp(protocol, "HTTP/1.0") && strcmp(protocol, "HTTP/1.1"))
return -1;
av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
if (config.debug)
http_log("%s - - New connection: %s %s\n", inet_ntoa(c->from_addr.sin_addr), cmd, url);
p1 = strchr(url, '?');
if (p1) {
av_strlcpy(info, p1, sizeof(info));
*p1 = '\0';
} else
info[0] = '\0';
av_strlcpy(filename, url + ((*url == '/') ? 1 : 0), sizeof(filename)-1);
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (av_strncasecmp(p, "User-Agent:", 11) == 0) {
useragent = p + 11;
if (*useragent && *useragent != '\n' && av_isspace(*useragent))
useragent++;
break;
}
p = strchr(p, '\n');
if (!p)
break;
p++;
}
redir_type = REDIR_NONE;
if (av_match_ext(filename, "asx")) {
redir_type = REDIR_ASX;
filename[strlen(filename)-1] = 'f';
} else if (av_match_ext(filename, "asf") &&
(!useragent || av_strncasecmp(useragent, "NSPlayer", 8) != 0)) {
redir_type = REDIR_ASF;
} else if (av_match_ext(filename, "rpm,ram")) {
redir_type = REDIR_RAM;
strcpy(filename + strlen(filename)-2, "m");
} else if (av_match_ext(filename, "rtsp")) {
redir_type = REDIR_RTSP;
compute_real_filename(filename, sizeof(filename) - 1);
} else if (av_match_ext(filename, "sdp")) {
redir_type = REDIR_SDP;
compute_real_filename(filename, sizeof(filename) - 1);
}
if (!strlen(filename))
av_strlcpy(filename, "index.html", sizeof(filename) - 1);
stream = config.first_stream;
while (stream) {
if (!strcmp(stream->filename, filename) && validate_acl(stream, c))
break;
stream = stream->next;
}
if (!stream) {
snprintf(msg, sizeof(msg), "File '%s' not found", url);
http_log("File '%s' not found\n", url);
goto send_error;
}
c->stream = stream;
memcpy(c->feed_streams, stream->feed_streams, sizeof(c->feed_streams));
memset(c->switch_feed_streams, -1, sizeof(c->switch_feed_streams));
if (stream->stream_type == STREAM_TYPE_REDIRECT) {
c->http_error = 301;
q = c->buffer;
snprintf(q, c->buffer_size,
"HTTP/1.0 301 Moved\r\n"
"Location: %s\r\n"
"Content-type: text/html\r\n"
"\r\n"
"<html><head><title>Moved</title></head><body>\r\n"
"You should be <a href=\"%s\">redirected</a>.\r\n"
"</body></html>\r\n", stream->feed_filename, stream->feed_filename);
q += strlen(q);
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
if (extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
if (modify_current_stream(c, ratebuf)) {
for (i = 0; i < FF_ARRAY_ELEMS(c->feed_streams); i++) {
if (c->switch_feed_streams[i] >= 0)
c->switch_feed_streams[i] = -1;
}
}
}
if (c->post == 0 && stream->stream_type == STREAM_TYPE_LIVE)
current_bandwidth += stream->bandwidth;
if (stream->feed_opened) {
snprintf(msg, sizeof(msg), "This feed is already being received.");
http_log("Feed '%s' already being received\n", stream->feed_filename);
goto send_error;
}
if (c->post == 0 && config.max_bandwidth < current_bandwidth) {
c->http_error = 503;
q = c->buffer;
snprintf(q, c->buffer_size,
"HTTP/1.0 503 Server too busy\r\n"
"Content-type: text/html\r\n"
"\r\n"
"<html><head><title>Too busy</title></head><body>\r\n"
"<p>The server is too busy to serve your request at this time.</p>\r\n"
"<p>The bandwidth being served (including your stream) is %"PRIu64"kbit/sec, "
"and this exceeds the limit of %"PRIu64"kbit/sec.</p>\r\n"
"</body></html>\r\n", current_bandwidth, config.max_bandwidth);
q += strlen(q);
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
if (redir_type != REDIR_NONE) {
const char *hostinfo = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (av_strncasecmp(p, "Host:", 5) == 0) {
hostinfo = p + 5;
break;
}
p = strchr(p, '\n');
if (!p)
break;
p++;
}
if (hostinfo) {
char *eoh;
char hostbuf[260];
while (av_isspace(*hostinfo))
hostinfo++;
eoh = strchr(hostinfo, '\n');
if (eoh) {
if (eoh[-1] == '\r')
eoh--;
if (eoh - hostinfo < sizeof(hostbuf) - 1) {
memcpy(hostbuf, hostinfo, eoh - hostinfo);
hostbuf[eoh - hostinfo] = 0;
c->http_error = 200;
q = c->buffer;
switch(redir_type) {
case REDIR_ASX:
snprintf(q, c->buffer_size,
"HTTP/1.0 200 ASX Follows\r\n"
"Content-type: video/x-ms-asf\r\n"
"\r\n"
"<ASX Version=\"3\">\r\n"
"<ENTRY><REF HREF=\"http:
"</ASX>\r\n", hostbuf, filename, info);
q += strlen(q);
break;
case REDIR_RAM:
snprintf(q, c->buffer_size,
"HTTP/1.0 200 RAM Follows\r\n"
"Content-type: audio/x-pn-realaudio\r\n"
"\r\n"
"# Autogenerated by ffserver\r\n"
"http:
q += strlen(q);
break;
case REDIR_ASF:
snprintf(q, c->buffer_size,
"HTTP/1.0 200 ASF Redirect follows\r\n"
"Content-type: video/x-ms-asf\r\n"
"\r\n"
"[Reference]\r\n"
"Ref1=http:
q += strlen(q);
break;
case REDIR_RTSP:
{
char hostname[256], *p;
av_strlcpy(hostname, hostbuf, sizeof(hostname));
p = strrchr(hostname, ':');
if (p)
*p = '\0';
snprintf(q, c->buffer_size,
"HTTP/1.0 200 RTSP Redirect follows\r\n"
"Content-type: application/x-rtsp\r\n"
"\r\n"
"rtsp:
q += strlen(q);
}
break;
case REDIR_SDP:
{
uint8_t *sdp_data;
int sdp_data_size;
socklen_t len;
struct sockaddr_in my_addr;
snprintf(q, c->buffer_size,
"HTTP/1.0 200 OK\r\n"
"Content-type: application/sdp\r\n"
"\r\n");
q += strlen(q);
len = sizeof(my_addr);
if (getsockname(c->fd, (struct sockaddr *)&my_addr, &len))
http_log("getsockname() failed\n");
sdp_data_size = prepare_sdp_description(stream,
&sdp_data,
my_addr.sin_addr);
if (sdp_data_size > 0) {
memcpy(q, sdp_data, sdp_data_size);
q += sdp_data_size;
*q = '\0';
av_free(sdp_data);
}
}
break;
default:
abort();
break;
}
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
}
}
snprintf(msg, sizeof(msg), "ASX/RAM file not handled");
goto send_error;
}
stream->conns_served++;
if (c->post) {
if (!stream->is_feed) {
const char *logline = 0;
int client_id = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (av_strncasecmp(p, "Pragma: log-line=", 17) == 0) {
logline = p;
break;
}
if (av_strncasecmp(p, "Pragma: client-id=", 18) == 0)
client_id = strtol(p + 18, 0, 10);
p = strchr(p, '\n');
if (!p)
break;
p++;
}
if (logline) {
char *eol = strchr(logline, '\n');
logline += 17;
if (eol) {
if (eol[-1] == '\r')
eol--;
http_log("%.*s\n", (int) (eol - logline), logline);
c->suppress_log = 1;
}
}
#ifdef DEBUG
http_log("\nGot request:\n%s\n", c->buffer);
#endif
if (client_id && extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
HTTPContext *wmpc;
for (wmpc = first_http_ctx; wmpc; wmpc = wmpc->next) {
if (wmpc->wmp_client_id == client_id)
break;
}
if (wmpc && modify_current_stream(wmpc, ratebuf))
wmpc->switch_pending = 1;
}
snprintf(msg, sizeof(msg), "POST command not handled");
c->stream = 0;
goto send_error;
}
if (http_start_receive_data(c) < 0) {
snprintf(msg, sizeof(msg), "could not open feed");
goto send_error;
}
c->http_error = 0;
c->state = HTTPSTATE_RECEIVE_DATA;
return 0;
}
#ifdef DEBUG
if (strcmp(stream->filename + strlen(stream->filename) - 4, ".asf") == 0)
http_log("\nGot request:\n%s\n", c->buffer);
#endif
if (c->stream->stream_type == STREAM_TYPE_STATUS)
goto send_status;
if (open_input_stream(c, info) < 0) {
snprintf(msg, sizeof(msg), "Input stream corresponding to '%s' not found", url);
goto send_error;
}
c->buffer[0] = 0;
av_strlcatf(c->buffer, c->buffer_size, "HTTP/1.0 200 OK\r\n");
mime_type = c->stream->fmt->mime_type;
if (!mime_type)
mime_type = "application/x-octet-stream";
av_strlcatf(c->buffer, c->buffer_size, "Pragma: no-cache\r\n");
if (!strcmp(c->stream->fmt->name,"asf_stream")) {
c->wmp_client_id = av_lfg_get(&random_state);
av_strlcatf(c->buffer, c->buffer_size, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=%d\r\nPragma: features=\"broadcast\"\r\n", c->wmp_client_id);
}
av_strlcatf(c->buffer, c->buffer_size, "Content-Type: %s\r\n", mime_type);
av_strlcatf(c->buffer, c->buffer_size, "\r\n");
q = c->buffer + strlen(c->buffer);
c->http_error = 0;
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
send_error:
c->http_error = 404;
q = c->buffer;
htmlstrip(msg);
snprintf(q, c->buffer_size,
"HTTP/1.0 404 Not Found\r\n"
"Content-type: text/html\r\n"
"\r\n"
"<html>\n"
"<head><title>404 Not Found</title></head>\n"
"<body>%s</body>\n"
"</html>\n", msg);
q += strlen(q);
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
send_status:
compute_status(c);
c->http_error = 200;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
| 1threat |
Is there a way to inform classifiers in R of the relative costs of misclassification? : <p>This is a general question. Are there classifiers in R -- functions that perform classification implementing classification algorithms-- that accept as input argument the relative cost of misclassification. E.g. if a misclassification of a positive to negative has cost 1 the opposite has cost 3.</p>
<p>If yes which are these functions?</p>
| 0debug |
static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
{
struct VirtIOSerialPort *port;
struct virtio_console_control cpkt, *gcpkt;
uint8_t *buffer;
size_t buffer_len;
gcpkt = buf;
if (len < sizeof(cpkt)) {
return;
}
cpkt.event = lduw_p(&gcpkt->event);
cpkt.value = lduw_p(&gcpkt->value);
port = find_port_by_id(vser, ldl_p(&gcpkt->id));
if (!port && cpkt.event != VIRTIO_CONSOLE_DEVICE_READY)
return;
switch(cpkt.event) {
case VIRTIO_CONSOLE_DEVICE_READY:
if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding device %s\n",
vser->bus->qbus.name);
break;
}
QTAILQ_FOREACH(port, &vser->ports, next) {
send_control_event(port, VIRTIO_CONSOLE_PORT_ADD, 1);
}
break;
case VIRTIO_CONSOLE_PORT_READY:
if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding port %u for device %s\n",
port->id, vser->bus->qbus.name);
break;
}
if (port->is_console) {
send_control_event(port, VIRTIO_CONSOLE_CONSOLE_PORT, 1);
}
if (port->name) {
stw_p(&cpkt.event, VIRTIO_CONSOLE_PORT_NAME);
stw_p(&cpkt.value, 1);
buffer_len = sizeof(cpkt) + strlen(port->name) + 1;
buffer = qemu_malloc(buffer_len);
memcpy(buffer, &cpkt, sizeof(cpkt));
memcpy(buffer + sizeof(cpkt), port->name, strlen(port->name));
buffer[buffer_len - 1] = 0;
send_control_msg(port, buffer, buffer_len);
qemu_free(buffer);
}
if (port->host_connected) {
send_control_event(port, VIRTIO_CONSOLE_PORT_OPEN, 1);
}
if (port->info->guest_ready) {
port->info->guest_ready(port);
}
break;
case VIRTIO_CONSOLE_PORT_OPEN:
port->guest_connected = cpkt.value;
if (cpkt.value && port->info->guest_open) {
port->info->guest_open(port);
}
if (!cpkt.value && port->info->guest_close) {
port->info->guest_close(port);
}
break;
}
}
| 1threat |
Multiple input smoothly : <p>I need a form that have such a row need to be repeated multiple times. Row consist of text field, radio, checkbox, select box all types of input field. After typing first input field, cursor should be shown on next field by pressing just enter. Add button should be added to add each row. After submitting form data should be saved in mysql DB.</p>
<p>check the screenshot below : -
<a href="http://i.stack.imgur.com/TtKRM.png" rel="nofollow">enter image description here</a></p>
| 0debug |
i get error of this code : create proc insertfactors_pf
(
@FactorID int,
@CustomersID int,
@Number int,
@TotalPrice decimal(18, 0),
@PaidPrice decimal(18, 0),
@Date Date,
@ProductID int,
@QTY int
)
AS
BEGIN TRANSACTION
SET IDENTITY_INSERT facetors on
INSERT INTO Factor VALUES (@FactorID, @CustomersID, @Number, @TotalPrice, @PaidPrice,@Date)
SET IDENTITY_INSERT factors off
IF @@ERROR <> 0
BEGIN
ROLLBACK
RETURN
END
SET IDENTITY_INSERT Product_Factor on
INSERT INTO Produc_Factor values(@FactorID,@ProductID,@QTY)
SET IDENTITY_INSERT Product_Factor off
IF @@ERROR <> 0
BEGIN
ROLLBACK
RETURN
END
COMMIT
i write this code but error Msg 8101, Level 16, State 1, Procedure insertfactors_pf, Line 20 [Batch Start Line 0] An explicit value for the identity column in table 'Factor' can only be specified when a column list is used and IDENTITY_INSERT is ON. | 0debug |
ORA-04079:INVALID INTEGER SPECIFICATION ....please resolve this : create or replace trigger fineCalc AFTER UPDATE ON book_issue for each row
when ((new.date_of_return-old.date_of_issue)>7)
declare
rcpt_no number;
s_id char(10);
begin
if :old.card_id in (select card_id from STUDENT_BOOK_ISSUE)
then
select max(receipt_no) into rcpt_no from fine;
select student_id into s_id from STUDENT_BOOK_ISSUE sbi where sbi.card_id=:old.card_id;
insert into fine values( rcpt_no+1,((:NEW.date_of_return-:OLD.date_of_issue-7)*5),s_id);
end if;
end; | 0debug |
import math
def lateralsurface_cone(r,h):
l = math.sqrt(r * r + h * h)
LSA = math.pi * r * l
return LSA | 0debug |
How to disable "just my code" setting in VSCode debugger? : <p>When starting my project in the debugger (C# .NET Core), it states it's debugging "just my code".</p>
<p>I want to also debug the libraries, and can't see a setting to disable this anywhere in VSCode.</p>
<p>Is it possible to disable?</p>
| 0debug |
def pancake_sort(nums):
arr_len = len(nums)
while arr_len > 1:
mi = nums.index(max(nums[0:arr_len]))
nums = nums[mi::-1] + nums[mi+1:len(nums)]
nums = nums[arr_len-1::-1] + nums[arr_len:len(nums)]
arr_len -= 1
return nums | 0debug |
How to properly specify jcenter repository in maven config? : <p>In Gradle, I need simply add:</p>
<pre><code> repositories {
jcenter()
}
</code></pre>
<p>What is the simplest and proper way to do the same in maven pom.xml or where can I get right url for jcenter repository.</p>
| 0debug |
Saving console output to string in javascript : Is there a way to save the output from my code that pulls up netstat through the command line into a string so I can use a printline for it? So that when I run it through np++ I can see the output there instead of through the command line?
class Netstat
{
public static void main(String[] args)
{
try
{
Runtime.getRuntime().exec("cmd /c start cmd.exe /K \"netstat\"");
}
catch (Exception e)
{
System.out.println("Something went wrong.");
e.printStackTrace();
}
}
}
| 0debug |
to replace the space with a comma : <p>I have a some txt file like this:</p>
<pre><code>a,b,c,d:
1 2 3 4
process:
1 2 3 4 5 6 7 8 9
</code></pre>
<p><strong>Do I fill in any spaces with a comma with python-pandas or python-file function?</strong></p>
| 0debug |
static int coroutine_fn iscsi_co_writev(BlockDriverState *bs,
int64_t sector_num, int nb_sectors,
QEMUIOVector *iov)
{
IscsiLun *iscsilun = bs->opaque;
struct IscsiTask iTask;
uint64_t lba;
uint32_t num_sectors;
uint8_t *data = NULL;
uint8_t *buf = NULL;
if (!is_request_lun_aligned(sector_num, nb_sectors, iscsilun)) {
return -EINVAL;
}
lba = sector_qemu2lun(sector_num, iscsilun);
num_sectors = sector_qemu2lun(nb_sectors, iscsilun);
#if !defined(LIBISCSI_FEATURE_IOVECTOR)
if (iov->niov == 1) {
data = iov->iov[0].iov_base;
} else {
size_t size = MIN(nb_sectors * BDRV_SECTOR_SIZE, iov->size);
buf = g_malloc(size);
qemu_iovec_to_buf(iov, 0, buf, size);
data = buf;
}
#endif
iscsi_co_init_iscsitask(iscsilun, &iTask);
retry:
if (iscsilun->use_16_for_rw) {
iTask.task = iscsi_write16_task(iscsilun->iscsi, iscsilun->lun, lba,
data, num_sectors * iscsilun->block_size,
iscsilun->block_size, 0, 0, 0, 0, 0,
iscsi_co_generic_cb, &iTask);
} else {
iTask.task = iscsi_write10_task(iscsilun->iscsi, iscsilun->lun, lba,
data, num_sectors * iscsilun->block_size,
iscsilun->block_size, 0, 0, 0, 0, 0,
iscsi_co_generic_cb, &iTask);
}
if (iTask.task == NULL) {
g_free(buf);
return -ENOMEM;
}
#if defined(LIBISCSI_FEATURE_IOVECTOR)
scsi_task_set_iov_out(iTask.task, (struct scsi_iovec *) iov->iov,
iov->niov);
#endif
while (!iTask.complete) {
iscsi_set_events(iscsilun);
qemu_coroutine_yield();
}
if (iTask.task != NULL) {
scsi_free_scsi_task(iTask.task);
iTask.task = NULL;
}
if (iTask.do_retry) {
iTask.complete = 0;
goto retry;
}
g_free(buf);
if (iTask.status != SCSI_STATUS_GOOD) {
return -EIO;
}
iscsi_allocationmap_set(iscsilun, sector_num, nb_sectors);
return 0;
}
| 1threat |
apple-mobile-web-app-status-bar-style in ios 10 : <p>I know this question has been asked previously, just want to know if this is still the case in ios 10 (and ios 9)...</p>
<p>According to the apple developer guidelines for web apps (<a href="https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html" rel="noreferrer">found here</a>), there are 3 choices for the status bar in a web app; <strong>default</strong>, <strong>black</strong> and <strong>black-translucent</strong>.</p>
<ol>
<li><strong>Default</strong> results in a white status bar with black text,</li>
<li><strong>Black</strong> results in a black status bar with white text, and</li>
<li><strong>Black-translucent</strong> results in a transparent background with white
text. Additionally, this status bar floats above your content,
meaning you have to push your content down 20px in order to not have
the content overlap with thte status bar text.</li>
</ol>
<p>I'd really like to use the black-translucent status bar (as I think it looks more native), but the background of my page is a light grey. This makes the white text on this status bar very hard to read.</p>
<p>Put simply, I'd just like a transparent background with black text (essentially, <strong>default-translucent</strong>). Is this possible?</p>
| 0debug |
static void start_ahci_device(AHCIQState *ahci)
{
ahci->hba_base = qpci_iomap(ahci->dev, 5, &ahci->barsize);
qpci_device_enable(ahci->dev);
}
| 1threat |
static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)
{
int e, b, k, n;
float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;
float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;
float (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21;
float (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22;
int8_t *opd_hist = ps->opd_hist;
int8_t *ipd_hist = ps->ipd_hist;
int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC];
int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf;
int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf;
int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf;
int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf;
const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20;
const float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB;
if (ps->num_env_old) {
memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0]));
memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0]));
memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0]));
memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0]));
memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0]));
memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0]));
memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0]));
memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0]));
}
if (is34) {
remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
if (ps->enable_ipdopd) {
remap34(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);
remap34(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);
}
if (!ps->is34bands_old) {
map_val_20_to_34(H11[0][0]);
map_val_20_to_34(H11[1][0]);
map_val_20_to_34(H12[0][0]);
map_val_20_to_34(H12[1][0]);
map_val_20_to_34(H21[0][0]);
map_val_20_to_34(H21[1][0]);
map_val_20_to_34(H22[0][0]);
map_val_20_to_34(H22[1][0]);
ipdopd_reset(ipd_hist, opd_hist);
}
} else {
remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1);
remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1);
if (ps->enable_ipdopd) {
remap20(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0);
remap20(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0);
}
if (ps->is34bands_old) {
map_val_34_to_20(H11[0][0]);
map_val_34_to_20(H11[1][0]);
map_val_34_to_20(H12[0][0]);
map_val_34_to_20(H12[1][0]);
map_val_34_to_20(H21[0][0]);
map_val_34_to_20(H21[1][0]);
map_val_34_to_20(H22[0][0]);
map_val_34_to_20(H22[1][0]);
ipdopd_reset(ipd_hist, opd_hist);
}
}
for (e = 0; e < ps->num_env; e++) {
for (b = 0; b < NR_PAR_BANDS[is34]; b++) {
float h11, h12, h21, h22;
h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][0];
h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1];
h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2];
h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3];
if (!PS_BASELINE && ps->enable_ipdopd && b < ps->nr_ipdopd_par) {
float h11i, h12i, h21i, h22i;
float ipd_adj_re, ipd_adj_im;
int opd_idx = opd_hist[b] * 8 + opd_mapped[e][b];
int ipd_idx = ipd_hist[b] * 8 + ipd_mapped[e][b];
float opd_re = pd_re_smooth[opd_idx];
float opd_im = pd_im_smooth[opd_idx];
float ipd_re = pd_re_smooth[ipd_idx];
float ipd_im = pd_im_smooth[ipd_idx];
opd_hist[b] = opd_idx & 0x3F;
ipd_hist[b] = ipd_idx & 0x3F;
ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im;
ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im;
h11i = h11 * opd_im;
h11 = h11 * opd_re;
h12i = h12 * ipd_adj_im;
h12 = h12 * ipd_adj_re;
h21i = h21 * opd_im;
h21 = h21 * opd_re;
h22i = h22 * ipd_adj_im;
h22 = h22 * ipd_adj_re;
H11[1][e+1][b] = h11i;
H12[1][e+1][b] = h12i;
H21[1][e+1][b] = h21i;
H22[1][e+1][b] = h22i;
}
H11[0][e+1][b] = h11;
H12[0][e+1][b] = h12;
H21[0][e+1][b] = h21;
H22[0][e+1][b] = h22;
}
for (k = 0; k < NR_BANDS[is34]; k++) {
float h11r, h12r, h21r, h22r;
float h11i, h12i, h21i, h22i;
float h11r_step, h12r_step, h21r_step, h22r_step;
float h11i_step, h12i_step, h21i_step, h22i_step;
int start = ps->border_position[e];
int stop = ps->border_position[e+1];
float width = 1.f / (stop - start);
b = k_to_i[k];
h11r = H11[0][e][b];
h12r = H12[0][e][b];
h21r = H21[0][e][b];
h22r = H22[0][e][b];
if (!PS_BASELINE && ps->enable_ipdopd) {
if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
h11i = -H11[1][e][b];
h12i = -H12[1][e][b];
h21i = -H21[1][e][b];
h22i = -H22[1][e][b];
} else {
h11i = H11[1][e][b];
h12i = H12[1][e][b];
h21i = H21[1][e][b];
h22i = H22[1][e][b];
}
}
h11r_step = (H11[0][e+1][b] - h11r) * width;
h12r_step = (H12[0][e+1][b] - h12r) * width;
h21r_step = (H21[0][e+1][b] - h21r) * width;
h22r_step = (H22[0][e+1][b] - h22r) * width;
if (!PS_BASELINE && ps->enable_ipdopd) {
h11i_step = (H11[1][e+1][b] - h11i) * width;
h12i_step = (H12[1][e+1][b] - h12i) * width;
h21i_step = (H21[1][e+1][b] - h21i) * width;
h22i_step = (H22[1][e+1][b] - h22i) * width;
}
for (n = start + 1; n <= stop; n++) {
float l_re = l[k][n][0];
float l_im = l[k][n][1];
float r_re = r[k][n][0];
float r_im = r[k][n][1];
h11r += h11r_step;
h12r += h12r_step;
h21r += h21r_step;
h22r += h22r_step;
if (!PS_BASELINE && ps->enable_ipdopd) {
h11i += h11i_step;
h12i += h12i_step;
h21i += h21i_step;
h22i += h22i_step;
l[k][n][0] = h11r*l_re + h21r*r_re - h11i*l_im - h21i*r_im;
l[k][n][1] = h11r*l_im + h21r*r_im + h11i*l_re + h21i*r_re;
r[k][n][0] = h12r*l_re + h22r*r_re - h12i*l_im - h22i*r_im;
r[k][n][1] = h12r*l_im + h22r*r_im + h12i*l_re + h22i*r_re;
} else {
l[k][n][0] = h11r*l_re + h21r*r_re;
l[k][n][1] = h11r*l_im + h21r*r_im;
r[k][n][0] = h12r*l_re + h22r*r_re;
r[k][n][1] = h12r*l_im + h22r*r_im;
}
}
}
}
}
| 1threat |
Is reverse proxy actually needed on ASP.NET core? : <p>We're wondering if reverse proxy is actually required for most use cases and would appreciate additional information.</p>
<p>The Kerstel/Nginx documentation claims:
"Kestrel is great for serving dynamic content from ASP.NET Core. However, the web serving capabilities aren't as feature rich as servers such as IIS, Apache, or Nginx. A reverse proxy server can offload work such as serving static content, caching requests, compressing requests, and HTTPS termination from the HTTP server. A reverse proxy server may reside on a dedicated machine or may be deployed alongside an HTTP server."
<a href="https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2" rel="noreferrer">https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/linux-nginx?view=aspnetcore-2.2</a></p>
<p>Could anyone please share some insights if this is actually relevant nowadays?</p>
<p>On our use case, we use Docker instances with external load balancing (AWS ALB).
Each docker instance has both Nginx and our ASP.NET Core application running.
We couldn't figure out the exact benefits of using Nginx.</p>
<ol>
<li><p>Serving static content
As we're using an external CRN (AWS CloudFront), I assume static caching doesn't really have any actual benefits, does it?</p></li>
<li><p>Caching requests
I believe this is the same as serving static content, as dynamic content isn't cached on most scenarios (on our use case - all scenarios).</p></li>
<li><p>Compressing requests
ASP.NET Core has a response compression middleware, however - it claims "The performance of the middleware probably won't match that of the server modules. HTTP.sys server server and Kestrel server don't currently offer built-in compression support.".
Perhaps some benchmarks could be created to validate this claim.
<a href="https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-2.2" rel="noreferrer">https://docs.microsoft.com/en-us/aspnet/core/performance/response-compression?view=aspnetcore-2.2</a></p></li>
<li><p>HTTPS termination from the HTTP server
I assume most clients having load balancers can skip this part, as HTTPS termination can be done on the load balancer if needed.</p></li>
</ol>
<p>Thanks!
Effy</p>
| 0debug |
SQL ORA-02063 - What the Heck am I supposed to do to fix this? : So I got this BS, and I'm not sure how to fix. I realize this is a shot in the dark, but I'm hoping someone who knows what they're talking about knows a thing or two about how to fix this.
"Oracle database error 904: ORA-00904: "A6"."mn:EVENT_TS:ok": invalid identifier ORA-02063: preceding line from BIQ_Z1PC"
SELECT "t0"."TEMP(Calculation_1012184020205" AS
"TEMP(Calculation_1012184020205",
"t3"."__measure__2" AS "TEMP(Calculation_1103944862926",
"t3"."__measure__4" AS "TEMP(Calculation_1103944862921",
"t0"."TEMP(Calculation_8523062336790" AS "TEMP(Calculation_8523062336790",
"t0"."mn:EVENT_TS:ok" AS "mn:EVENT_TS:ok",
"t0"."usr:Calculation_10121840202058" AS "usr:Calculation_10121840202058",
"t0"."usr:Calculation_85230623367908" AS "usr:Calculation_85230623367908"
FROM (
SELECT TO_NUMBER(TO_CHAR(TRUNC(CAST("AQE Source Data 5.30.2018"."EVENT_TS"
AS
DATE)),'MM')) AS "mn:EVENT_TS:ok",
COUNT(DISTINCT (CASE WHEN ("AQE Source Data 5.30.2018"."DISPO_CD" IS NULL
AND ("AQE Source Data 5.30.2018"."CUZ_AREA_ID" <> '0_DEFECTS') AND (NOT
(SUBSTR("AQE Source Data 5.30.2018"."EVENT_DESC", 1, LENGTH('0')) = '0'))
AND ("AQE Source Data 5.30.2018"."QUALITY_VELOCITY" = 'Q') AND (INSTR("AQE
Source Data 5.30.2018"."DISC_AREA_DESC",'PDI') > 0)) THEN "AQE Source Data
5.30.2018"."EVENT_NO" ELSE NULL END)) AS "TEMP(Calculation_1012184020205",
COUNT(DISTINCT (CASE WHEN (("400 Machines"."MIN(DISC_AREA_ID)" = '400') OR
("400 Machines"."MIN(DISC_AREA_ID)" = '450')) THEN "400 Machines"."SER_NO"
ELSE NULL END)) AS "TEMP(Calculation_8523062336790",
COUNT(DISTINCT (CASE WHEN ("AQE Source Data 5.30.2018"."DISPO_CD" IS NULL
AND ("AQE Source Data 5.30.2018"."CUZ_AREA_ID" <> '0_DEFECTS') AND (NOT
(SUBSTR("AQE Source Data 5.30.2018"."EVENT_DESC", 1, LENGTH('0')) = '0'))
AND ("AQE Source Data 5.30.2018"."QUALITY_VELOCITY" = 'Q') AND (INSTR("AQE
Source Data 5.30.2018"."DISC_AREA_DESC",'PDI') > 0)) THEN "AQE Source Data
5.30.2018"."EVENT_NO" ELSE NULL END)) AS "usr:Calculation_10121840202058",
COUNT(DISTINCT (CASE WHEN (("400 Machines"."MIN(DISC_AREA_ID)" = '400') OR
("400 Machines"."MIN(DISC_AREA_ID)" = '450')) THEN "400 Machines"."SER_NO"
ELSE NULL END)) AS "usr:Calculation_85230623367908"
FROM (
SELECT EVENT_TS,
EVENT_NO,FAC_PROD_FAM_CD,SER_PFX,SER_NO,CUZ_AREA_ID,CUZ_AREA_DESC,
DISC_AREA_ID,
DISC_AREA_DESC,EVENT_DESC,QUALITY_VELOCITY,ASGN_TO,FIXER_1,PD_ID,
EVENT_CAT_ID_NO,EVENT_CID_DESC_TXT,CMPNT_SERIAL_NO,NEW_FOUND_MISSED,
MISSED_AREA_ID,RPR_MIN,WAIT_TIME,DISPO_CD,PROTOTYPE_IND,EXT_CPY_STAT,
CLSE_STAT,CLSE_TS,CAUSE_SHIFT,DEF_WELD_ INC,WELD_SEAM_ID
FROM
ABUS_DW.V_BIQ_R8_QWB_EVENTS
WHERE
(FAC_PROD_FAM_CD='ACOM' OR FAC_PROD_FAM_CD='SCOM' OR FAC_PROD_FAM_CD='LAP'
OR FAC_PROD_FAM_CD='RM' OR FAC_PROD_FAM_CD='SCRD')
AND (DISC_AREA_ID<>'501' AND DISC_AREA_ID<>'525' AND DISC_AREA_ID<>'600' AND
DISC_AREA_ID<>'700' AND DISC_AREA_ID<>'701' AND DISC_AREA_ID<>'702' AND
DISC_AREA_ID<>'703' AND DISC_AREA_ID<>'704' AND
DISC_AREA_ID<>'705' AND DISC_AREA_ID<>'706' AND DISC_AREA_ID<>'707' AND
DISC_AREA_ID<>'800' AND DISC_AREA_ID<>'900')
AND PROTOTYPE_IND<>'Y' AND EXT_CPY_STAT<>'D' AND
EVENT_TS>=TO_DATE('2015-10-01', 'YYYY-MM-DD')
) "AQE Source Data 5.30.2018"
LEFT JOIN (
SELECT DISTINCT
MIN(EVENT_TS), MIN(EVENT_NO), MIN(DISC_AREA_ID), MIN(DISC_AREA_DESC),
MIN(EVENT_DESC), MIN(EXT_CPY_STAT), MIN(FAC_PROD_FAM_CD), SER_NO,
PROTOTYPE_IND
FROM ABUS_DW.V_BIQ_R8_QWB_EVENTS
WHERE
(FAC_PROD_FAM_CD='ACOM' OR FAC_PROD_FAM_CD='SCOM' OR FAC_PROD_FAM_CD='LAP'
OR FAC_PROD_FAM_CD='RM' OR FAC_PROD_FAM_CD='SCRD')
AND (DISC_AREA_ID='400' OR DISC_AREA_ID='450')
AND PROTOTYPE_IND<>'Y' AND EXT_CPY_STAT<>'D' AND EVENT_TS>=TO_DATE('2015-10-
01', 'YYYY-MM-DD')
GROUP BY
SER_NO, PROTOTYPE_IND
) "400 Machines" ON ("AQE Source Data 5.30.2018"."EVENT_NO" = "400
Machines"."MIN(EVENT_NO)")
WHERE (TO_NUMBER(TO_CHAR(TRUNC(CAST("AQE Source Data 5.30.2018"."EVENT_TS"
AS DATE)),'YYYY')) = 2018)
GROUP BY TO_NUMBER(TO_CHAR(TRUNC(CAST("AQE Source Data 5.30.2018"."EVENT_TS"
AS DATE)),'MM'))
) "t0"
INNER JOIN (
SELECT "t1"."mn:EVENT_TS:ok" AS "mn:EVENT_TS:ok",
SUM("t2"."__measure__1") AS "__measure__2",
SUM((CASE WHEN ("t2"."__measure__3" > 0) THEN 1 ELSE 0 END)) AS
"__measure__4"
FROM (
SELECT "400 Machines"."SER_NO" AS "SER_NO (Custom SQL Query)",
TO_NUMBER(TO_CHAR(TRUNC(CAST("AQE Source Data 5.30.2018"."EVENT_TS" AS
DATE)),'MM')) AS "mn:EVENT_TS:ok"
FROM (
SELECT
EVENT_TS,EVENT_NO,FAC_PROD_FAM_CD,SER_PFX,SER_NO,CUZ_AREA_ID,
CUZ_AREA_DESC,DISC_AREA_ID,DISC_AREA_DESC,EVENT_DESC,QUALITY_VELOCITY,
ASGN_TO,FIXER_1,PD_ID,EVENT_CAT_ID_NO,
EVENT_CID_DESC_TXT,CMPNT_SERIAL_NO,NEW_FOUND_MISSED,MISSED_AREA_ID,
RPR_MIN,WAIT_TIME,DISPO_CD,PROTOTYPE_IND,EXT_CPY_STAT,CLSE_STAT,CLSE_TS,
CAUSE_SHIFT,DEF_WELD_INC,WELD_SEAM_ID
FROM
ABUS_DW.V_BIQ_R8_QWB_EVENTS
WHERE
(FAC_PROD_FAM_CD='ACOM' OR FAC_PROD_FAM_CD='SCOM' OR FAC_PROD_FAM_CD='LAP'
OR FAC_PROD_FAM_CD='RM' OR FAC_PROD_FAM_CD='SCRD')
AND (DISC_AREA_ID<>'501' AND DISC_AREA_ID<>'525' AND DISC_AREA_ID<>'600' AND
DISC_AREA_ID<>'700' AND DISC_AREA_ID<>'701' AND DISC_AREA_ID<>'702' AND
DISC_AREA_ID<>'703' AND DISC_AREA_ID<>'704' AND
DISC_AREA_ID<>'705' AND DISC_AREA_ID<>'706' AND DISC_AREA_ID<>'707' AND
DISC_AREA_ID<>'800' AND DISC_AREA_ID<>'900')
AND PROTOTYPE_IND<>'Y' AND EXT_CPY_STAT<>'D' AND
EVENT_TS>=TO_DATE('2015-10-01', 'YYYY-MM-DD')
) "AQE Source Data 5.30.2018"
LEFT JOIN (
SELECT DISTINCT
MIN(EVENT_TS), MIN(EVENT_NO), MIN(DISC_AREA_ID), MIN(DISC_AREA_DESC),
MIN(EVENT_DESC), MIN(EXT_CPY_STAT), MIN(FAC_PROD_FAM_CD), SER_NO,
PROTOTYPE_IND
FROM ABUS_DW.V_BIQ_R8_QWB_EVENTS
WHERE
(FAC_PROD_FAM_CD='ACOM' OR FAC_PROD_FAM_CD='SCOM' OR FAC_PROD_FAM_CD='LAP'
OR FAC_PROD_FAM_CD='RM' OR FAC_PROD_FAM_CD='SCRD')
AND (DISC_AREA_ID='400' OR DISC_AREA_ID='450')
AND PROTOTYPE_IND<>'Y' AND EXT_CPY_STAT<>'D' AND EVENT_TS>=TO_DATE('2015-10-
01', 'YYYY-MM-DD')
GROUP BY
SER_NO, PROTOTYPE_IND
) "400 Machines" ON ("AQE Source Data 5.30.2018"."EVENT_NO" = "400
Machines"."MIN(EVENT_NO)")
WHERE (TO_NUMBER(TO_CHAR(TRUNC(CAST("AQE Source Data 5.30.2018"."EVENT_TS"
AS DATE)),'YYYY')) = 2018)
GROUP BY "400 Machines"."SER_NO",
TO_NUMBER(TO_CHAR(TRUNC(CAST("AQE Source Data 5.30.2018"."EVENT_TS" AS
DATE)),'MM'))
) "t1"
INNER JOIN (
SELECT "400 Machines"."SER_NO" AS "SER_NO (Custom SQL Query)",
COUNT(DISTINCT (CASE WHEN ((CASE WHEN (INSTR("AQE Source Data
5.30.2018"."DISC_AREA_DESC",'PDI') > 0) THEN 1 WHEN (("AQE Source Data
5.30.2018"."DISC_AREA_ID" = '500') AND ("AQE Source Data
5.30.2018"."QUALITY_VELOCITY" = 'Q')) THEN 2 ELSE NULL END) = 1) THEN "AQE
Source Data 5.30.2018"."SER_NO" WHEN NOT ((CASE WHEN (INSTR("AQE Source Data
5.30.2018"."DISC_AREA_DESC",'PDI') > 0) THEN 1 WHEN (("AQE Source Data
5.30.2018"."DISC_AREA_ID" = '500') AND ("AQE Source Data
5.30.2018"."QUALITY_VELOCITY" = 'Q')) THEN 2 ELSE NULL END) = 1) THEN NULL
ELSE NULL END)) AS "__measure__1",
COUNT(DISTINCT (CASE WHEN ("AQE Source Data 5.30.2018"."DISPO_CD" IS NULL
AND ("AQE Source Data 5.30.2018"."CUZ_AREA_ID" <> '0_DEFECTS') AND (NOT
(SUBSTR("AQE Source Data 5.30.2018"."EVENT_DESC", 1, LENGTH('0')) = '0'))
AND ("AQE Source Data 5.30.2018"."DISC_AREA_ID" = '400')) THEN "AQE Source
Data 5.30.2018"."EVENT_NO" ELSE NULL END)) AS "__measure__3"
FROM (
SELECT
EVENT_TS,EVENT_NO,FAC_PROD_FAM_CD,SER_PFX,SER_NO,CUZ_AREA_ID,
CUZ_AREA_DESC,DISC_AREA_ID,DISC_AREA_DESC,EVENT_DESC,QUALITY_VELOCITY,
ASGN_TO,FIXER_1,PD_ID,EVENT_CAT_ID_NO,
EVENT_CID_DESC_TXT,CMPNT_SERIAL_NO,NEW_FOUND_MISSED,MISSED_AREA_ID,
RPR_MIN,WAIT_TIME,DISPO_CD,PROTOTYPE_IND,EXT_CPY_STAT,CLSE_STAT,CLSE_TS,
CAUSE_SHIFT,DEF_WELD_INC,WELD_SEAM_ID
FROM
ABUS_DW.V_BIQ_R8_QWB_EVENTS
WHERE
(FAC_PROD_FAM_CD='ACOM' OR FAC_PROD_FAM_CD='SCOM' OR FAC_PROD_FAM_CD='LAP'
OR FAC_PROD_FAM_CD='RM' OR FAC_PROD_FAM_CD='SCRD')
AND (DISC_AREA_ID<>'501' AND DISC_AREA_ID<>'525' AND DISC_AREA_ID<>'600'
AND DISC_AREA_ID<>'700' AND DISC_AREA_ID<>'701' AND DISC_AREA_ID<>'702' AND
DISC_AREA_ID<>'703' AND DISC_AREA_ID<>'704' AND
DISC_AREA_ID<>'705' AND DISC_AREA_ID<>'706' AND DISC_AREA_ID<>'707' AND
DISC_AREA_ID<>'800' AND DISC_AREA_ID<>'900')
AND PROTOTYPE_IND<>'Y' AND EXT_CPY_STAT<>'D' AND
EVENT_TS>=TO_DATE('2015-10-01', 'YYYY-MM-DD')
) "AQE Source Data 5.30.2018"
LEFT JOIN (
SELECT DISTINCT
MIN(EVENT_TS), MIN(EVENT_NO), MIN(DISC_AREA_ID), MIN(DISC_AREA_DESC),
MIN(EVENT_DESC), MIN(EXT_CPY_STAT), MIN(FAC_PROD_FAM_CD), SER_NO,
PROTOTYPE_IND
FROM ABUS_DW.V_BIQ_R8_QWB_EVENTS
WHERE
(FAC_PROD_FAM_CD='ACOM' OR FAC_PROD_FAM_CD='SCOM' OR FAC_PROD_FAM_CD='LAP'
OR FAC_PROD_FAM_CD='RM' OR FAC_PROD_FAM_CD='SCRD')
AND (DISC_AREA_ID='400' OR DISC_AREA_ID='450')
AND PROTOTYPE_IND<>'Y' AND EXT_CPY_STAT<>'D' AND EVENT_TS>=TO_DATE(
'2015-10- 01', 'YYYY-MM-DD')
GROUP BY
SER_NO, PROTOTYPE_IND
) "400 Machines" ON ("AQE Source Data 5.30.2018"."EVENT_NO" = "400
Machines"."MIN(EVENT_NO)")
GROUP BY "400 Machines"."SER_NO"
) "t2" ON (("t1"."SER_NO (Custom SQL Query)" = "t2"."SER_NO (Custom SQL
Query)") OR (("t1"."SER_NO (Custom SQL Query)" IS NULL) AND ("t2"."SER_NO
(Custom SQL Query)" IS NULL)))
GROUP BY "t1"."mn:EVENT_TS:ok"
) "t3" ON (("t0"."mn:EVENT_TS:ok" = "t3"."mn:EVENT_TS:ok") OR
(("t0"."mn:EVENT_TS:ok" IS NULL) AND ("t3"."mn:EVENT_TS:ok" IS NULL))) | 0debug |
How to access the $container within middleware class in Slim v3? : <p>I've been reading that in Slim v2, $app was bound to the middleware class. I'm finding this not to be the case in v3? Below is my middleware class, but I'm just getting undefined:</p>
<pre><code><?php
namespace CrSrc\Middleware;
class Auth
{
/**
* Example middleware invokable class
*
* @param \Psr\Http\Message\ServerRequestInterface $request PSR7 request
* @param \Psr\Http\Message\ResponseInterface $response PSR7 response
* @param callable $next Next middleware
*
* @return \Psr\Http\Message\ResponseInterface
*/
public function __invoke($request, $response, $next)
{
// before
var_dump($this->getContainer()); // method undefined
var_dump($this->auth); exit; // method undefined
if (! $this->get('auth')->isAuthenticated()) {
// Not authenticated and must be authenticated to access this resource
return $response->withStatus(401);
}
// pass onto the next callable
$response = $next($request, $response);
// after
return $response;
}
}
</code></pre>
<p>What's the correct way to access the DI container within middleware? I'm guessing there ought to be a way?</p>
| 0debug |
Binary operator '%' cannot be applied to operands of type 'UInt32' and 'UInt' : <p>I am new to programming in Swift and I am trying to develop a simple game in the hopes that it will increase my exposure to the language syntax and logic. Currently I have a problem in Swift which is stating "Binary operator '%' cannot be applied to operands of type 'UInt32' and 'UInt'" and I do not know how to approach this problem as I am a newbie to the language. Can someone show me how to approach this problem and why is the problem being caused in the first place? </p>
<p>For reference purposes I have included a method that causes the problem and the problem name.</p>
<pre><code> func randomFloatBetween(_ smallNumber: CGFloat, and bigNumber: CGFloat) -> CGFloat {
let diff: CGFloat = bigNumber - smallNumber
return ((CGFloat(arc4random() % (UInt(RAND_MAX) + 1)) / RAND_MAX) * diff) + smallNumber
}
</code></pre>
| 0debug |
PostgreSQL Database encryption at rest : <p>How can I encrypt the PostgreSQL database at rest. </p>
<p>I could not find a good documentation on how can I achieve this ?</p>
| 0debug |
static uint32_t pci_unin_config_readl (void *opaque,
target_phys_addr_t addr)
{
UNINState *s = opaque;
return s->config_reg;
}
| 1threat |
EDI edifabric x12 813 format in C# : Unable to switch Tax Information Amount and Form Group, it should be Form Group first before TIA.
Thanks in advance. | 0debug |
How to verify POST data is sent from Android app with correct SHA1 signature? : <p>Recently my game has been hacked and one user submitted an impossible score to the server. The score was submitted with a verified checksum, and correct data.</p>
<p>I'm convinced that the user must have reverse engineered my APK file to find the POST request.</p>
<p>Now I wonder what would be a good way to prevent this from happening again and I thought about verifying the SHA1 signature of the app. Maybe this way I can make sure that the app is signed by me, and is not a reverse engineered and changed version of the app.</p>
<p>Would this be possible? Or would there be a better solution to solve this?</p>
<p>I am using LibGDX by the way.</p>
| 0debug |
Calculate date of birth from age and event date : <p>I have two columns, one with age e.g. (34) and another column with date of the event e.g. (2019-04-26:01:20:51). I would like to create a new column that returns the date of birth based on the above two columns). Many thanks in advance for the help.</p>
| 0debug |
How to copy multiple input cells in Jupyter Notebook : <p>Basically I want to copy (Ctrl+C) only the code portions from multiple cells without also copying the output or the <code>In[1]:</code> and <code>Out[1]:</code></p>
<p>What is the easiest way to do so? </p>
| 0debug |
std::advance in c++ do not behave correctly : <p>while i was tweaking around with std::list in c++ i used std::advance to access elements randomly.but std::advance is not working as expected.the code is as given below.</p>
<pre><code>#include <list>
#include<iostream>
#include<iterator>
using namespace std;
int main()
{
list<int> i;
typename list<int>::iterator t=i.begin();
i.push_front(0);
i.push_back(1);
i.push_back(2);
i.push_back(3);
cout<<*t<<" ";
advance(t,1);
cout<<*t<<" ";
advance(t,2);
cout<<*t<<" ";
}
</code></pre>
<p>the output i got is 0 0 2
but shouldn't the output be 0 1 3</p>
| 0debug |
Date jquery function fails to work on table row : <p>The logic is first select a start date in each row, then click the button, a result date will show according to the skip day. For some reason, my code isn't working, any thought? Thanks</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(".add").on('click', function() {
var $row = $(this).closest('tr');
var start = $row.find('.date').val());
if (start) {
var set = new Date(start);
set.setDate(set.getDate() + Number($row.find(".day").val()));
$row.find(".result").val([set.getMonth() + 1, set.getDate(), set.getFullYear()].join('/'));
}
});</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<table id="one">
<th>Date</th>
<th>Skip days</th>
<th>Result</th>
<tbody>
<tr>
<td>
<input type="date" class="date"><button class="add" type="button">OK</button></td>
<td><input type="text" value="3" class="day"> </td>
<td><input type="text" class="result"> </td>
</tr>
<tr>
<td>
<input type="date" class="date"><button class="add" type="button">OK</button></td>
<td><input type="text" value="3" class="day"> </td>
<td><input type="text" class="result"> </td>
</tr>
</tbody>
</table></code></pre>
</div>
</div>
</p>
| 0debug |
c# Thread.Sleep(value in NumericUpDown) : I'm new here in Stack Overflow.
I've got a question. I've a `NumericUpDown` in my form.
And I want the value here: `Thread.Sleep(ValueInNumericUpDown)`
But I don't know how to do that. can someone help me?
Thanks in advance. | 0debug |
; or ) expected error in Android studio while calling a function in main class from DBHelper class : <p>I am trying to call a function updatebudget from my DBHelper class,if the condition is true,I am getting the error :- or ) expected in the line- after Integer,String in every parameters..</p>
<p>Main Class-</p>
<pre><code>> mydb.updateBudget(Integer idd,Integer phon, String bdat, String acc,
> String det, String with, String dep, String acc, String breco);
Main Class-
> public void subjour(View V)
> {
>
> String with=bwithdraw.getText().toString();
> String dep=bdeposit.getText().toString();
> String acc=baccountname.getText().toString();
> String bdat=bdate.getText().toString();
> Bundle extras = getIntent().getExtras();
> String det=bdetails.getText().toString();
> String breco=brec.getText().toString();
> String phon=phone.getText().toString();
> int idd=0;
>
>
> if( (with.equals(""))&&(dep.equals(""))) {
> Toast.makeText(getApplicationContext(), "Please enter the deposit or withdrawl amount",
> Toast.LENGTH_SHORT).show();
> }
> else if (!validateFirstName(acc)) {
>
> baccountname.setError("Please enter valid name");
> }
>
>
>
>
> else if(mydb.insertBudget(bdate.getText().toString(), >bdetails.getText().toString(),
> >bwithdraw.getText().toString(),bdeposit.getText().toString(),baccountname.getTe>xt().toString(),brec.getText().toString()
> )){
> mydb.updateBudget(Integer idd,Integer phon, String bdat, String acc, String det, String with, String dep, String acc, String
> breco);
> Toast.makeText(getApplicationContext(), "journal created",
> Toast.LENGTH_SHORT).show();
> } else{
> Toast.makeText(getApplicationContext(), "not created",
> Toast.LENGTH_SHORT).show();
> }
>
> }
> }
</code></pre>
<p>DBHelper class-</p>
<pre><code>> public boolean updateBudget(int idd,int phone, String bdate, String
> baccountname, String bdetails, Integer bwithdrawl, Integer bdeposit,
> String baccount, String brec) {
> SQLiteDatabase db = this.getWritableDatabase();
> ContentValues contentValues = new ContentValues();
> contentValues.put("bdate", bdate);
> contentValues.put("bdetails", bdetails);
> contentValues.put("bwithdrawl", bwithdrawl);
> contentValues.put("bdeposit", bdeposit);
> contentValues.put("baccountname",baccountname);
> contentValues.put("brec", brec);
> String selectQuery = "select id, phone from " + CONTACTS_TABLE_NAME;
> //Cursor res = db.rawQuery("select * from budget where idd=" + idd + "", null);
> Cursor cursor = db.rawQuery(selectQuery, null);
>
> if (cursor.moveToFirst()) {
> phone= Integer.parseInt(cursor.getString(1));
>
> }
>
> phone +=bdeposit;
> phone =phone - bwithdrawl;
>
> cursor.close();
> db.close();
>
>
> //Your Update to SQLite
> db = this.getReadableDatabase();
> ContentValues values = new ContentValues();
> values.put(String.valueOf(phone), phone);
> db.update("budget", contentValues, "idd = ? ", new String[]{Integer.toString(idd)});
> db.update(CONTACTS_COLUMN_PHONE , values, idd + " = ?", new String[] { String.valueOf(phone) });
> db.close();
> return true;
> }
</code></pre>
<p>Please let me know where I am wrong-
Thanks in advance..</p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.