problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
How to get month and day from the timestamp in java : <p>How to get <code>month</code> and <code>day</code> from the timestamp in Java</p>
<p><strong>FORMAT:</strong> <code>2019-01-21T05:56:46.000Z</code></p>
<ul>
<li>21</li>
<li>JAN</li>
</ul>
| 0debug |
webpack - remove "webpackBootstrap" code : <p>I am using WebPack to concat js files and output to a dist folder. All this seems to work, however my problem is that I want to concat all the js files without extra webpack boostrap code </p>
<pre><code>/******/ (function(modules) { // (/******/ (function(modules) { // webpackBootstrap)......
</code></pre>
<p>Is there anyway to prevent webpack from adding that code rather just take the plain js files and concat them (like gulp-concat). </p>
| 0debug |
All Angular2's template syntax is broken when I open the page through my hashed router : <p>I have a hashed router that is routing from my main page just fine. The problem comes when a new page opens, all the template syntax is broken. That is all data bindings, ngFors, and even [routerLink]. So the pages open without the angular logic but if I refresh the browser while on these hashed pages they work just fine.</p>
<p><code>app bootstrap file</code></p>
<pre><code>import { enableProdMode } from '@angular/core';
import { disableDeprecatedForms, provideForms } from '@angular/forms';
import { HTTP_PROVIDERS } from '@angular/http';
import { bootstrap } from '@angular/platform-browser-dynamic';
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import { APP_ROUTER_PROVIDERS } from './path-to-the-router-file';
import { ServerGetService } from './path-to-a-service';
import { AppComponent } from './app/app.component';
// depending on the env mode, enable prod mode or add debugging modules
if (process.env.ENV === 'build') {
enableProdMode();
}
bootstrap(AppComponent, [
HTTP_PROVIDERS,
APP_ROUTER_PROVIDERS,
{
provide: LocationStrategy,
useClass: HashLocationStrategy
},
ServerGetService,
disableDeprecatedForms(),
provideForms()
]).catch((err: any) => console.error(err));
</code></pre>
<p><code>routes file</code></p>
<pre><code>import {provideRouter, RouterConfig} from '@angular/router';
import {SecondPopUpComponent} from './path-to-the-file';
import {firstPopUpComponent} from './path-to-the-file';
import {Component} from '@angular/core';
@Component({
selector: 'mx-empty',
template: '<div></div>'
})
class EmptyComponent {}
export const routes: RouterConfig =
<RouterConfig>[
{
path: 'second-popup',
component: SecondPopUpComponent
}, {
path: 'first-popup',
component: FirstPopUpComponent
}, {
path: '',
component: EmptyComponent
}
];
export const APP_ROUTER_PROVIDERS = [
provideRouter(routes)
];
</code></pre>
<p><code>one of my popup screens (with the problem)</code></p>
<pre><code>import {Component} from '@angular/core';
import {TradePurposeProperty} from './trade-purpose.objects';
import {Router, ROUTER_DIRECTIVES} from '@angular/router';
import {GlobalSettingsData} from '../../services/global-settings-data.service';
@Component({
selector: 'my-popup',
templateUrl: './popup.page.html',
directives: [ROUTER_DIRECTIVES]
})
export class TradePurposePageComponent {
localData: customData[] = [];
constructor(private router: Router, private data: GlobalData) {
if (data.myData) {
this.localData= data.myData;
}
}
onSubmit() {
this.data.myData= this.localData;
this.router.navigate(['']);
}
}
</code></pre>
<p><code>popup.page.html</code></p>
<pre><code><div class="form-popup">
<div class="form-popup__overlay"></div>
<div class="form-popup__content">
<form #dataForm="ngForm" (ngSubmit)="onSubmit()">
<fieldset>
<legend>Properties</legend>
<table>
<thead>
<tr>
<th>first column</th>
<th>secondcolumn</th>
<th>third column</th>
</tr>
</thead>
<tbody>
<tr *ngFor='let data of localData'>
<td>{{data.attr1}}</td>
<td>{{data.attr2}}</td>
<td>
<label>
<input type='checkbox' [(ngModel)]='localData.isSet' [ngModelOptions]="{standalone: true}">
</label>
</td>
</tr>
</tbody>
</table>
<div>
<button type="submit">OK</button>
<a [routerLink]="['']" >Cancel</a>
</div>
</fieldset>
</form>
</div>
</div>
</code></pre>
<p>the only thing that works in the popup file is the onSubmit(), and it even routes but the rest of the bindings do not, and when I click on the <code>cancel</code> so the <code>[routerLink]="['']"</code> should be executed, I get that error
<code>VM55939:84 ORIGINAL EXCEPTION: TypeError: Cannot read property 'startsWith' of undefined</code></p>
<p>any ideas what to do?</p>
| 0debug |
how to inject API_BASE_URL (a string) in an angular service : <p>this autogenerated service (by NSwagStudio) needs an API_BASE_URL (InjectionToken) value in order to perform http requests
how and where i can inject it?</p>
<pre><code>/* tslint:disable */
//----------------------
// <auto-generated>
// Generated using the NSwag toolchain v11.12.16.0 (NJsonSchema v9.10.19.0 (Newtonsoft.Json v9.0.0.0)) (http://NSwag.org)
// </auto-generated>
//----------------------
// ReSharper disable InconsistentNaming
import 'rxjs/add/observable/fromPromise';
import 'rxjs/add/observable/of';
import 'rxjs/add/observable/throw';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/toPromise';
import 'rxjs/add/operator/mergeMap';
import 'rxjs/add/operator/catch';
import { Observable } from 'rxjs/Observable';
import { Injectable, Inject, Optional, InjectionToken } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams, HttpResponse, HttpResponseBase, HttpErrorResponse } from '@angular/common/http';
export const API_BASE_URL = new InjectionToken<string>('API_BASE_URL');
@Injectable()
export class DocumentService {
private http: HttpClient;
private baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(@Inject(HttpClient) http: HttpClient, @Optional() @Inject(API_BASE_URL) baseUrl?: string) {
this.http = http;
this.baseUrl = baseUrl ? baseUrl : "";
}
getAll(): Observable<string[] | null> {
let url_ = this.baseUrl + "/api/Document";
url_ = url_.replace(/[?&]$/, "");
let options_ : any = {
observe: "response",
responseType: "blob",
headers: new HttpHeaders({
"Content-Type": "application/json",
"Accept": "application/json"
})
};
return this.http.request("get", url_, options_).flatMap((response_ : any) => {
return this.processGetAll(response_);
}).catch((response_: any) => {
if (response_ instanceof HttpResponseBase) {
try {
return this.processGetAll(<any>response_);
} catch (e) {
return <Observable<string[] | null>><any>Observable.throw(e);
}
} else
return <Observable<string[] | null>><any>Observable.throw(response_);
});
}
protected processGetAll(response: HttpResponseBase): Observable<string[] | null> {
...........code
........
....
}
}
</code></pre>
<p>may someone give me some super quick tips about how InjectioToken works and how inject it into this service?</p>
<p>Angular5 - Nswag</p>
| 0debug |
Python - Different results from different order : I have these two versions to the same question: "Make a new list that has all the elements less than 5 from this list in it and print out this new list." They are the same but only different in the order of the line *"new_a = [ ]"*, which delivers different results. How come? Thanks in advance!
#Ver1
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
new_a = []
for element in a:
if element < 5:
new_a.append(element)
print(new_a)
#Ver2
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for element in a:
if element < 5:
new_a = []
new_a.append(element)
print(new_a) | 0debug |
Take the formatting of another cell : I have following table in Google Sheets with conditional formatting in the 2nd row - Color scale. I would like to make the first row colored the same way as the second one.
[![enter image description here][1]][1]
Is there any option how to dynamically "copy" format of another cell?
I just do not want to do it manually all the time - like 5 conditional formatting for cells A1:L1 where will be =IF(A2<350) then use color1. If A2<300 use the color2. And so on...
[1]: https://i.stack.imgur.com/jE8il.png | 0debug |
Can anyone please tell me what are the differences between pika and kombu messaging library in python? : <p>I want to use messaging library in my application to interact with rabbitmq. Can anyone please explain the differences between pika and kombu library? </p>
| 0debug |
Spring boot: How to add interceptors to static resources? : <p>I have several folders in <code>/static/img/**</code> and I need to add interceptors to some of them to check user permissions. I've used interceptors earlier and added them this way:</p>
<pre><code>@SpringBootApplication
@EnableTransactionManagement
public class Application extends WebMvcConfigurerAdapter {
...
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/static/**")
.addResourceLocations("classpath:/static/");
}
@Bean
public AuthHeaderInterceptor authHeaderInterceptor() {
return new AuthHeaderInterceptor();
}
@Bean
public AuthCookieInterceptor authCookieInterceptor() {
return new AuthCookieInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry
.addInterceptor(authHeaderInterceptor())
.addPathPatterns(REST_URL)
.excludePathPatterns(
new String[] {
REST_SECURITY_URL,
REST_SETTINGS_URL,
REST_REPORTS_URL
}
);
registry
.addInterceptor(authCookieInterceptor())
.addPathPatterns(REST_REPORTS_URL);
}
}
</code></pre>
<p>All works fine for rest controllers and their URLs, but now I need to secure some static resources and I added this:</p>
<pre><code>@SpringBootApplication
@EnableTransactionManagement
public class Application extends WebMvcConfigurerAdapter {
...
@Bean
public RoleAdminInterceptor roleAdminInterceptor() {
return new RoleAdminInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry
.addInterceptor(authHeaderInterceptor())
.addPathPatterns(REST_URL)
.excludePathPatterns(
new String[] {
REST_SECURITY_URL,
REST_SETTINGS_URL,
REST_REPORTS_URL
}
);
//THIS NOT WORK
registry
.addInterceptor(roleAdminInterceptor())
.addPathPatterns("/static/img/admin/**");
registry
.addInterceptor(authCookieInterceptor())
.addPathPatterns(REST_REPORTS_URL);
}
}
</code></pre>
<p>Commented line doesn't work. When I send request to <code>/static/img/admin/test.png</code> <code>RoleAdminInterceptor</code> is never called.</p>
<p>What I'm doing wrong?</p>
| 0debug |
Ansible - print gathered facts for debugging purposes : <p>Is there exists some way to print on console gathered facts ?<br>
I mean gatering facts using <code>setup</code> module. I would like to print gathered facts. Is it possible ? If it is possible can someone show example?</p>
| 0debug |
how to save html code in sql server database for correct display : My website is just like Stackoverflow and under developement. I am using plain textarea to take text input as I do not have any WMD editor like Stackoverflow's. When I take html code as input and store it in database table in a text or nvarchar(max) column, it is stored successfully. But when I call that data for display, it displays the corresponding html page instead of that html code on screen. I am not able to resolve it. For better understanding I'm putting here input page and output page images of my website. First is
[This is image of input page][1]
[1]: http://i.stack.imgur.com/n1b9O.png
and second is
[This is the image of output page][2]
[2]: http://i.stack.imgur.com/wrHCV.png
What is going wrong here ? | 0debug |
Should go.sum file be checked in to the git repository? : <p>I have a program with source code hosted on GitHub that uses Go Modules introduced in go 1.11.</p>
<p><code>go.mod</code> file describes my dependencies, but <code>go.sum</code> file seems to be a lockfile. Should I be adding <code>go.sum</code> to my repository or should I gitignore it?</p>
| 0debug |
int ff_get_cpu_flags_ppc(void)
{
#if HAVE_ALTIVEC
#ifdef __AMIGAOS4__
ULONG result = 0;
extern struct ExecIFace *IExec;
IExec->GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);
if (result == VECTORTYPE_ALTIVEC)
return AV_CPU_FLAG_ALTIVEC;
return 0;
#elif defined(__APPLE__) || defined(__OpenBSD__)
#ifdef __OpenBSD__
int sels[2] = {CTL_MACHDEP, CPU_ALTIVEC};
#else
int sels[2] = {CTL_HW, HW_VECTORUNIT};
#endif
int has_vu = 0;
size_t len = sizeof(has_vu);
int err;
err = sysctl(sels, 2, &has_vu, &len, NULL, 0);
if (err == 0)
return has_vu ? AV_CPU_FLAG_ALTIVEC : 0;
return 0;
#elif defined(__linux__)
int i, ret = 0;
int fd = open("/proc/self/auxv", O_RDONLY);
unsigned long buf[64] = { 0 };
ssize_t count;
if (fd < 0)
return 0;
while ((count = read(fd, buf, sizeof(buf))) > 0) {
for (i = 0; i < count / sizeof(*buf); i += 2) {
if (buf[i] == AT_NULL)
goto out;
if (buf[i] == AT_HWCAP) {
if (buf[i + 1] & PPC_FEATURE_HAS_ALTIVEC)
ret = AV_CPU_FLAG_ALTIVEC;
goto out;
}
}
}
out:
close(fd);
return ret;
#elif CONFIG_RUNTIME_CPUDETECT
int proc_ver;
__asm__ volatile("mfspr %0, 287" : "=r" (proc_ver));
proc_ver >>= 16;
if (proc_ver & 0x8000 ||
proc_ver == 0x000c ||
proc_ver == 0x0039 || proc_ver == 0x003c ||
proc_ver == 0x0044 || proc_ver == 0x0045 ||
proc_ver == 0x0070)
return AV_CPU_FLAG_ALTIVEC;
return 0;
#else
return AV_CPU_FLAG_ALTIVEC;
#endif
#endif
return 0;
}
| 1threat |
static void arm_cpu_initfn(Object *obj)
{
CPUState *cs = CPU(obj);
ARMCPU *cpu = ARM_CPU(obj);
static bool inited;
uint32_t Aff1, Aff0;
cs->env_ptr = &cpu->env;
cpu_exec_init(cs, &error_abort);
cpu->cp_regs = g_hash_table_new_full(g_int_hash, g_int_equal,
g_free, g_free);
Aff1 = cs->cpu_index / ARM_CPUS_PER_CLUSTER;
Aff0 = cs->cpu_index % ARM_CPUS_PER_CLUSTER;
cpu->mp_affinity = (Aff1 << ARM_AFF1_SHIFT) | Aff0;
#ifndef CONFIG_USER_ONLY
if (kvm_enabled()) {
qdev_init_gpio_in(DEVICE(cpu), arm_cpu_kvm_set_irq, 4);
} else {
qdev_init_gpio_in(DEVICE(cpu), arm_cpu_set_irq, 4);
}
cpu->gt_timer[GTIMER_PHYS] = timer_new(QEMU_CLOCK_VIRTUAL, GTIMER_SCALE,
arm_gt_ptimer_cb, cpu);
cpu->gt_timer[GTIMER_VIRT] = timer_new(QEMU_CLOCK_VIRTUAL, GTIMER_SCALE,
arm_gt_vtimer_cb, cpu);
cpu->gt_timer[GTIMER_HYP] = timer_new(QEMU_CLOCK_VIRTUAL, GTIMER_SCALE,
arm_gt_htimer_cb, cpu);
cpu->gt_timer[GTIMER_SEC] = timer_new(QEMU_CLOCK_VIRTUAL, GTIMER_SCALE,
arm_gt_stimer_cb, cpu);
qdev_init_gpio_out(DEVICE(cpu), cpu->gt_timer_outputs,
ARRAY_SIZE(cpu->gt_timer_outputs));
#endif
cpu->dtb_compatible = "qemu,unknown";
cpu->psci_version = 1;
cpu->kvm_target = QEMU_KVM_ARM_TARGET_NONE;
if (tcg_enabled()) {
cpu->psci_version = 2;
if (!inited) {
inited = true;
arm_translate_init();
}
}
}
| 1threat |
Downgrade Gradle from 3.3 to 2.14.1 : <p>Long story short: My android phone keeps disconnecting from ADB. I was told to update android studio, did that. I open my project in Intellij and try to run on android and I get an error: </p>
<pre><code>BUILD FAILED
Total time: 48.986 secs
Error: /Users/me/Desktop/comp/Development/comp-ionic/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> java.lang.NullPointerException (no error message)
</code></pre>
<p>My first thought is that my gradle is the wrong version. For this specific app, I need to use gradle version <code>2.14.1</code>. </p>
<p>When I type <code>gradle -v</code> I'm getting version 3.3.</p>
<p>Is there a way to delete/downgrade gradle from 3.3 to 2.14.1?</p>
<p>Or is this another problem?</p>
| 0debug |
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pict, int *got_packet)
{
TiffEncoderContext *s = avctx->priv_data;
const AVFrame *const p = pict;
int i;
uint8_t *ptr;
uint8_t *offset;
uint32_t strips;
uint32_t *strip_sizes = NULL;
uint32_t *strip_offsets = NULL;
int bytes_per_row;
uint32_t res[2] = { 72, 1 };
uint16_t bpp_tab[] = { 8, 8, 8, 8 };
int ret = 0;
int is_yuv = 0;
uint8_t *yuv_line = NULL;
int shift_h, shift_v;
int packet_size;
const AVPixFmtDescriptor *pfd;
s->avctx = avctx;
s->width = avctx->width;
s->height = avctx->height;
s->subsampling[0] = 1;
s->subsampling[1] = 1;
switch (avctx->pix_fmt) {
case AV_PIX_FMT_RGB48LE:
case AV_PIX_FMT_GRAY16LE:
case AV_PIX_FMT_RGBA:
case AV_PIX_FMT_RGB24:
case AV_PIX_FMT_GRAY8:
case AV_PIX_FMT_PAL8:
pfd = av_pix_fmt_desc_get(avctx->pix_fmt);
s->bpp = av_get_bits_per_pixel(pfd);
if (pfd->flags & AV_PIX_FMT_FLAG_PAL)
s->photometric_interpretation = TIFF_PHOTOMETRIC_PALETTE;
else if (pfd->flags & AV_PIX_FMT_FLAG_RGB)
s->photometric_interpretation = TIFF_PHOTOMETRIC_RGB;
else
s->photometric_interpretation = TIFF_PHOTOMETRIC_BLACK_IS_ZERO;
s->bpp_tab_size = pfd->nb_components;
for (i = 0; i < s->bpp_tab_size; i++)
bpp_tab[i] = s->bpp / s->bpp_tab_size;
break;
case AV_PIX_FMT_MONOBLACK:
s->bpp = 1;
s->photometric_interpretation = TIFF_PHOTOMETRIC_BLACK_IS_ZERO;
s->bpp_tab_size = 0;
break;
case AV_PIX_FMT_MONOWHITE:
s->bpp = 1;
s->photometric_interpretation = TIFF_PHOTOMETRIC_WHITE_IS_ZERO;
s->bpp_tab_size = 0;
break;
case AV_PIX_FMT_YUV420P:
case AV_PIX_FMT_YUV422P:
case AV_PIX_FMT_YUV444P:
case AV_PIX_FMT_YUV410P:
case AV_PIX_FMT_YUV411P:
av_pix_fmt_get_chroma_sub_sample(avctx->pix_fmt, &shift_h, &shift_v);
s->photometric_interpretation = TIFF_PHOTOMETRIC_YCBCR;
s->bpp = 8 + (16 >> (shift_h + shift_v));
s->subsampling[0] = 1 << shift_h;
s->subsampling[1] = 1 << shift_v;
s->bpp_tab_size = 3;
is_yuv = 1;
break;
default:
av_log(s->avctx, AV_LOG_ERROR,
"This colors format is not supported\n");
return -1;
}
if (s->compr == TIFF_DEFLATE ||
s->compr == TIFF_ADOBE_DEFLATE ||
s->compr == TIFF_LZW)
s->rps = s->height;
else
s->rps = FFMAX(8192 / (((s->width * s->bpp) >> 3) + 1), 1);
s->rps = ((s->rps - 1) / s->subsampling[1] + 1) * s->subsampling[1];
strips = (s->height - 1) / s->rps + 1;
packet_size = avctx->height * ((avctx->width * s->bpp + 7) >> 3) * 2 +
avctx->height * 4 + FF_MIN_BUFFER_SIZE;
if (!pkt->data &&
(ret = av_new_packet(pkt, packet_size)) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
return ret;
}
ptr = pkt->data;
s->buf_start = pkt->data;
s->buf = &ptr;
s->buf_size = pkt->size;
if (check_size(s, 8))
goto fail;
bytestream_put_le16(&ptr, 0x4949);
bytestream_put_le16(&ptr, 42);
offset = ptr;
bytestream_put_le32(&ptr, 0);
strip_sizes = av_mallocz_array(strips, sizeof(*strip_sizes));
strip_offsets = av_mallocz_array(strips, sizeof(*strip_offsets));
if (!strip_sizes || !strip_offsets) {
ret = AVERROR(ENOMEM);
goto fail;
}
bytes_per_row = (((s->width - 1) / s->subsampling[0] + 1) * s->bpp *
s->subsampling[0] * s->subsampling[1] + 7) >> 3;
if (is_yuv) {
yuv_line = av_malloc(bytes_per_row);
if (!yuv_line) {
av_log(s->avctx, AV_LOG_ERROR, "Not enough memory\n");
ret = AVERROR(ENOMEM);
goto fail;
}
}
#if CONFIG_ZLIB
if (s->compr == TIFF_DEFLATE || s->compr == TIFF_ADOBE_DEFLATE) {
uint8_t *zbuf;
int zlen, zn;
int j;
zlen = bytes_per_row * s->rps;
zbuf = av_malloc(zlen);
if (!zbuf) {
ret = AVERROR(ENOMEM);
goto fail;
}
strip_offsets[0] = ptr - pkt->data;
zn = 0;
for (j = 0; j < s->rps; j++) {
if (is_yuv) {
pack_yuv(s, p, yuv_line, j);
memcpy(zbuf + zn, yuv_line, bytes_per_row);
j += s->subsampling[1] - 1;
} else
memcpy(zbuf + j * bytes_per_row,
p->data[0] + j * p->linesize[0], bytes_per_row);
zn += bytes_per_row;
}
ret = encode_strip(s, zbuf, ptr, zn, s->compr);
av_free(zbuf);
if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Encode strip failed\n");
goto fail;
}
ptr += ret;
strip_sizes[0] = ptr - pkt->data - strip_offsets[0];
} else
#endif
if (s->compr == TIFF_LZW) {
s->lzws = av_malloc(ff_lzw_encode_state_size);
if (!s->lzws) {
ret = AVERROR(ENOMEM);
goto fail;
}
}
for (i = 0; i < s->height; i++) {
if (strip_sizes[i / s->rps] == 0) {
if (s->compr == TIFF_LZW) {
ff_lzw_encode_init(s->lzws, ptr,
s->buf_size - (*s->buf - s->buf_start),
12, FF_LZW_TIFF, put_bits);
}
strip_offsets[i / s->rps] = ptr - pkt->data;
}
if (is_yuv) {
pack_yuv(s, p, yuv_line, i);
ret = encode_strip(s, yuv_line, ptr, bytes_per_row, s->compr);
i += s->subsampling[1] - 1;
} else
ret = encode_strip(s, p->data[0] + i * p->linesize[0],
ptr, bytes_per_row, s->compr);
if (ret < 0) {
av_log(s->avctx, AV_LOG_ERROR, "Encode strip failed\n");
goto fail;
}
strip_sizes[i / s->rps] += ret;
ptr += ret;
if (s->compr == TIFF_LZW &&
(i == s->height - 1 || i % s->rps == s->rps - 1)) {
ret = ff_lzw_encode_flush(s->lzws, flush_put_bits);
strip_sizes[(i / s->rps)] += ret;
ptr += ret;
}
}
if (s->compr == TIFF_LZW)
av_free(s->lzws);
s->num_entries = 0;
ADD_ENTRY1(s, TIFF_SUBFILE, TIFF_LONG, 0);
ADD_ENTRY1(s, TIFF_WIDTH, TIFF_LONG, s->width);
ADD_ENTRY1(s, TIFF_HEIGHT, TIFF_LONG, s->height);
if (s->bpp_tab_size)
ADD_ENTRY(s, TIFF_BPP, TIFF_SHORT, s->bpp_tab_size, bpp_tab);
ADD_ENTRY1(s, TIFF_COMPR, TIFF_SHORT, s->compr);
ADD_ENTRY1(s, TIFF_PHOTOMETRIC, TIFF_SHORT, s->photometric_interpretation);
ADD_ENTRY(s, TIFF_STRIP_OFFS, TIFF_LONG, strips, strip_offsets);
if (s->bpp_tab_size)
ADD_ENTRY1(s, TIFF_SAMPLES_PER_PIXEL, TIFF_SHORT, s->bpp_tab_size);
ADD_ENTRY1(s, TIFF_ROWSPERSTRIP, TIFF_LONG, s->rps);
ADD_ENTRY(s, TIFF_STRIP_SIZE, TIFF_LONG, strips, strip_sizes);
ADD_ENTRY(s, TIFF_XRES, TIFF_RATIONAL, 1, res);
ADD_ENTRY(s, TIFF_YRES, TIFF_RATIONAL, 1, res);
ADD_ENTRY1(s, TIFF_RES_UNIT, TIFF_SHORT, 2);
if (!(avctx->flags & CODEC_FLAG_BITEXACT))
ADD_ENTRY(s, TIFF_SOFTWARE_NAME, TIFF_STRING,
strlen(LIBAVCODEC_IDENT) + 1, LIBAVCODEC_IDENT);
if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
uint16_t pal[256 * 3];
for (i = 0; i < 256; i++) {
uint32_t rgb = *(uint32_t *) (p->data[1] + i * 4);
pal[i] = ((rgb >> 16) & 0xff) * 257;
pal[i + 256] = ((rgb >> 8) & 0xff) * 257;
pal[i + 512] = (rgb & 0xff) * 257;
}
ADD_ENTRY(s, TIFF_PAL, TIFF_SHORT, 256 * 3, pal);
}
if (is_yuv) {
uint32_t refbw[12] = { 15, 1, 235, 1, 128, 1, 240, 1, 128, 1, 240, 1 };
ADD_ENTRY(s, TIFF_YCBCR_SUBSAMPLING, TIFF_SHORT, 2, s->subsampling);
ADD_ENTRY(s, TIFF_REFERENCE_BW, TIFF_RATIONAL, 6, refbw);
}
bytestream_put_le32(&offset, ptr - pkt->data);
if (check_size(s, 6 + s->num_entries * 12)) {
ret = AVERROR(EINVAL);
goto fail;
}
bytestream_put_le16(&ptr, s->num_entries);
bytestream_put_buffer(&ptr, s->entries, s->num_entries * 12);
bytestream_put_le32(&ptr, 0);
pkt->size = ptr - pkt->data;
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
fail:
av_free(strip_sizes);
av_free(strip_offsets);
av_free(yuv_line);
return ret;
}
| 1threat |
whats the correct way of inserting label in an Ionic FAB list : <p>i want to insert a label so that matches every FAB icon on the Fab list whats the correct way of doing it. the way i did it it doesn't work</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><ion-fab left middle>
<button ion-fab color="dark">
<ion-icon name="arrow-dropup"></ion-icon>
<ion-label>here</ion-label>
</button>
<ion-fab-list side="top">
<button ion-fab>
<ion-icon name="logo-facebook"></ion-icon>
<ion-label>here</ion-label>
</button>
<button ion-fab>
<ion-icon name="logo-twitter"></ion-icon>
</button>
<button ion-fab>
<ion-icon name="logo-vimeo"></ion-icon>
</button>
<button ion-fab>
<ion-icon name="logo-googleplus"></ion-icon>
</button>
</ion-fab-list>
</ion-fab></code></pre>
</div>
</div>
</p>
| 0debug |
int ppc_find_by_name (const unsigned char *name, ppc_def_t **def)
{
int i, ret;
ret = -1;
*def = NULL;
for (i = 0; strcmp(ppc_defs[i].name, "default") != 0; i++) {
if (strcasecmp(name, ppc_defs[i].name) == 0) {
*def = &ppc_defs[i];
ret = 0;
break;
}
}
return ret;
}
| 1threat |
static int cdxa_probe(AVProbeData *p)
{
if (p->buf[0] == 'R' && p->buf[1] == 'I' &&
p->buf[2] == 'F' && p->buf[3] == 'F' &&
p->buf[8] == 'C' && p->buf[9] == 'D' &&
p->buf[10] == 'X' && p->buf[11] == 'A')
return AVPROBE_SCORE_MAX;
else
return 0;
}
| 1threat |
How can this instance seemingly outlive its own parameter lifetime? : <p>Before I stumbled upon the code below, I was convinced that a lifetime in a type's lifetime parameter would always outlive its own instances. In other words, given a <code>foo: Foo<'a></code>, then <code>'a</code> would always outlive <code>foo</code>. Then I was introduced to this counter-argument code by @Luc Danton (<a href="https://play.rust-lang.org/?gist=77356b872435d476359ec1e0602cc54c&version=stable&backtrace=0" rel="noreferrer">Playground</a>):</p>
<pre><code>#[derive(Debug)]
struct Foo<'a>(std::marker::PhantomData<fn(&'a ())>);
fn hint<'a, Arg>(_: &'a Arg) -> Foo<'a> {
Foo(std::marker::PhantomData)
}
fn check<'a>(_: &Foo<'a>, _: &'a ()) {}
fn main() {
let outlived = ();
let foo;
{
let shortlived = ();
foo = hint(&shortlived);
// error: `shortlived` does not live long enough
//check(&foo, &shortlived);
}
check(&foo, &outlived);
}
</code></pre>
<p>Even though the <code>foo</code> created by <code>hint</code> appears to consider a lifetime that does not live for as long as itself, and a reference to it is passed to a function in a wider scope, the code compiles exactly as it is. Uncommenting the line stated in the code triggers a compilation error. Alternatively, changing <code>Foo</code> to the struct tuple <code>(PhantomData<&'a ()>)</code> also makes the code no longer compile with the same kind of error (<a href="https://play.rust-lang.org/?gist=9ad22db8a7d7bd0f764602098ffae9f3&version=stable&backtrace=0" rel="noreferrer">Playground</a>).</p>
<p>How is it valid Rust code? What is the reasoning of the compiler here?</p>
| 0debug |
static int decode_hq_slice(DiracContext *s, DiracSlice *slice, uint8_t *tmp_buf)
{
int i, level, orientation, quant_idx;
int qfactor[MAX_DWT_LEVELS][4], qoffset[MAX_DWT_LEVELS][4];
GetBitContext *gb = &slice->gb;
SliceCoeffs coeffs_num[MAX_DWT_LEVELS];
skip_bits_long(gb, 8*s->highquality.prefix_bytes);
quant_idx = get_bits(gb, 8);
if (quant_idx > DIRAC_MAX_QUANT_INDEX) {
av_log(s->avctx, AV_LOG_ERROR, "Invalid quantization index - %i\n", quant_idx);
return AVERROR_INVALIDDATA;
}
for (level = 0; level < s->wavelet_depth; level++) {
for (orientation = !!level; orientation < 4; orientation++) {
const int quant = FFMAX(quant_idx - s->lowdelay.quant[level][orientation], 0);
qfactor[level][orientation] = ff_dirac_qscale_tab[quant];
qoffset[level][orientation] = ff_dirac_qoffset_intra_tab[quant] + 2;
}
}
for (i = 0; i < 3; i++) {
int coef_num, coef_par, off = 0;
int64_t length = s->highquality.size_scaler*get_bits(gb, 8);
int64_t bits_end = get_bits_count(gb) + 8*length;
const uint8_t *addr = align_get_bits(gb);
if (length*8 > get_bits_left(gb)) {
av_log(s->avctx, AV_LOG_ERROR, "end too far away\n");
return AVERROR_INVALIDDATA;
}
coef_num = subband_coeffs(s, slice->slice_x, slice->slice_y, i, coeffs_num);
if (s->pshift)
coef_par = ff_dirac_golomb_read_32bit(s->reader_ctx, addr,
length, tmp_buf, coef_num);
else
coef_par = ff_dirac_golomb_read_16bit(s->reader_ctx, addr,
length, tmp_buf, coef_num);
if (coef_num > coef_par) {
const int start_b = coef_par * (1 << (s->pshift + 1));
const int end_b = coef_num * (1 << (s->pshift + 1));
memset(&tmp_buf[start_b], 0, end_b - start_b);
}
for (level = 0; level < s->wavelet_depth; level++) {
const SliceCoeffs *c = &coeffs_num[level];
for (orientation = !!level; orientation < 4; orientation++) {
const SubBand *b1 = &s->plane[i].band[level][orientation];
uint8_t *buf = b1->ibuf + c->top * b1->stride + (c->left << (s->pshift + 1));
const int qfunc = s->pshift + 2*(c->tot_h <= 2);
s->diracdsp.dequant_subband[qfunc](&tmp_buf[off], buf, b1->stride,
qfactor[level][orientation],
qoffset[level][orientation],
c->tot_v, c->tot_h);
off += c->tot << (s->pshift + 1);
}
}
skip_bits_long(gb, bits_end - get_bits_count(gb));
}
return 0;
}
| 1threat |
swift difference between final var and non-final var | final let and non-final let : <p>What's difference between final variables and non-final variables :</p>
<pre><code>var someVar = 5
final var someFinalVar = 5
</code></pre>
<p>and</p>
<pre><code>let someLet = 5
final let someFinalLet = 5
</code></pre>
| 0debug |
void cpu_loop(CPUARMState *env)
{
int trapnr;
unsigned int n, insn;
target_siginfo_t info;
uint32_t addr;
for(;;) {
cpu_exec_start(env);
trapnr = cpu_arm_exec(env);
cpu_exec_end(env);
switch(trapnr) {
case EXCP_UDEF:
{
TaskState *ts = env->opaque;
uint32_t opcode;
int rc;
get_user_u32(opcode, env->regs[15]);
rc = EmulateAll(opcode, &ts->fpa, env);
if (rc == 0) {
info.si_signo = SIGILL;
info.si_errno = 0;
info.si_code = TARGET_ILL_ILLOPN;
info._sifields._sigfault._addr = env->regs[15];
queue_signal(env, info.si_signo, &info);
} else if (rc < 0) {
int arm_fpe=0;
if (-rc & float_flag_invalid)
arm_fpe |= BIT_IOC;
if (-rc & float_flag_divbyzero)
arm_fpe |= BIT_DZC;
if (-rc & float_flag_overflow)
arm_fpe |= BIT_OFC;
if (-rc & float_flag_underflow)
arm_fpe |= BIT_UFC;
if (-rc & float_flag_inexact)
arm_fpe |= BIT_IXC;
FPSR fpsr = ts->fpa.fpsr;
if (fpsr & (arm_fpe << 16)) {
info.si_signo = SIGFPE;
info.si_errno = 0;
if (arm_fpe & BIT_IXC) info.si_code = TARGET_FPE_FLTRES;
if (arm_fpe & BIT_UFC) info.si_code = TARGET_FPE_FLTUND;
if (arm_fpe & BIT_OFC) info.si_code = TARGET_FPE_FLTOVF;
if (arm_fpe & BIT_DZC) info.si_code = TARGET_FPE_FLTDIV;
if (arm_fpe & BIT_IOC) info.si_code = TARGET_FPE_FLTINV;
info._sifields._sigfault._addr = env->regs[15];
queue_signal(env, info.si_signo, &info);
} else {
env->regs[15] += 4;
}
if ((!(fpsr & BIT_IXE)) && (arm_fpe & BIT_IXC))
fpsr |= BIT_IXC;
if ((!(fpsr & BIT_UFE)) && (arm_fpe & BIT_UFC))
fpsr |= BIT_UFC;
if ((!(fpsr & BIT_OFE)) && (arm_fpe & BIT_OFC))
fpsr |= BIT_OFC;
if ((!(fpsr & BIT_DZE)) && (arm_fpe & BIT_DZC))
fpsr |= BIT_DZC;
if ((!(fpsr & BIT_IOE)) && (arm_fpe & BIT_IOC))
fpsr |= BIT_IOC;
ts->fpa.fpsr=fpsr;
} else {
env->regs[15] += 4;
}
}
break;
case EXCP_SWI:
case EXCP_BKPT:
{
env->eabi = 1;
if (trapnr == EXCP_BKPT) {
if (env->thumb) {
get_user_u16(insn, env->regs[15]);
n = insn & 0xff;
env->regs[15] += 2;
} else {
get_user_u32(insn, env->regs[15]);
n = (insn & 0xf) | ((insn >> 4) & 0xff0);
env->regs[15] += 4;
}
} else {
if (env->thumb) {
get_user_u16(insn, env->regs[15] - 2);
n = insn & 0xff;
} else {
get_user_u32(insn, env->regs[15] - 4);
n = insn & 0xffffff;
}
}
if (n == ARM_NR_cacheflush) {
} else if (n == ARM_NR_semihosting
|| n == ARM_NR_thumb_semihosting) {
env->regs[0] = do_arm_semihosting (env);
} else if (n == 0 || n >= ARM_SYSCALL_BASE
|| (env->thumb && n == ARM_THUMB_SYSCALL)) {
if (env->thumb || n == 0) {
n = env->regs[7];
} else {
n -= ARM_SYSCALL_BASE;
env->eabi = 0;
}
if ( n > ARM_NR_BASE) {
switch (n) {
case ARM_NR_cacheflush:
break;
case ARM_NR_set_tls:
cpu_set_tls(env, env->regs[0]);
env->regs[0] = 0;
break;
default:
gemu_log("qemu: Unsupported ARM syscall: 0x%x\n",
n);
env->regs[0] = -TARGET_ENOSYS;
break;
}
} else {
env->regs[0] = do_syscall(env,
n,
env->regs[0],
env->regs[1],
env->regs[2],
env->regs[3],
env->regs[4],
env->regs[5],
0, 0);
}
} else {
goto error;
}
}
break;
case EXCP_INTERRUPT:
break;
case EXCP_PREFETCH_ABORT:
addr = env->cp15.c6_insn;
goto do_segv;
case EXCP_DATA_ABORT:
addr = env->cp15.c6_data;
do_segv:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = addr;
queue_signal(env, info.si_signo, &info);
}
break;
case EXCP_DEBUG:
{
int sig;
sig = gdb_handlesig (env, TARGET_SIGTRAP);
if (sig)
{
info.si_signo = sig;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(env, info.si_signo, &info);
}
}
break;
case EXCP_KERNEL_TRAP:
if (do_kernel_trap(env))
goto error;
break;
case EXCP_STREX:
if (do_strex(env)) {
addr = env->cp15.c6_data;
goto do_segv;
}
break;
default:
error:
fprintf(stderr, "qemu: unhandled CPU exception 0x%x - aborting\n",
trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
abort();
}
process_pending_signals(env);
}
}
| 1threat |
QInt *qint_from_int(int64_t value)
{
QInt *qi;
qi = g_malloc(sizeof(*qi));
qi->value = value;
QOBJECT_INIT(qi, &qint_type);
return qi;
}
| 1threat |
void smbios_entry_add(QemuOpts *opts)
{
Error *local_err = NULL;
const char *val;
assert(!smbios_immutable);
val = qemu_opt_get(opts, "file");
if (val) {
struct smbios_structure_header *header;
struct smbios_table *table;
int size;
qemu_opts_validate(opts, qemu_smbios_file_opts, &local_err);
if (local_err) {
error_report("%s", error_get_pretty(local_err));
exit(1);
}
size = get_image_size(val);
if (size == -1 || size < sizeof(struct smbios_structure_header)) {
error_report("Cannot read SMBIOS file %s", val);
exit(1);
}
if (!smbios_entries) {
smbios_entries_len = sizeof(uint16_t);
smbios_entries = g_malloc0(smbios_entries_len);
}
smbios_entries = g_realloc(smbios_entries, smbios_entries_len +
sizeof(*table) + size);
table = (struct smbios_table *)(smbios_entries + smbios_entries_len);
table->header.type = SMBIOS_TABLE_ENTRY;
table->header.length = cpu_to_le16(sizeof(*table) + size);
if (load_image(val, table->data) != size) {
error_report("Failed to load SMBIOS file %s", val);
exit(1);
}
header = (struct smbios_structure_header *)(table->data);
if (test_bit(header->type, have_fields_bitmap)) {
error_report("can't load type %d struct, fields already specified!",
header->type);
exit(1);
}
set_bit(header->type, have_binfile_bitmap);
if (header->type == 4) {
smbios_type4_count++;
}
smbios_entries_len += sizeof(*table) + size;
(*(uint16_t *)smbios_entries) =
cpu_to_le16(le16_to_cpu(*(uint16_t *)smbios_entries) + 1);
return;
}
val = qemu_opt_get(opts, "type");
if (val) {
unsigned long type = strtoul(val, NULL, 0);
if (type > SMBIOS_MAX_TYPE) {
error_report("out of range!");
exit(1);
}
if (test_bit(type, have_binfile_bitmap)) {
error_report("can't add fields, binary file already loaded!");
exit(1);
}
set_bit(type, have_fields_bitmap);
switch (type) {
case 0:
qemu_opts_validate(opts, qemu_smbios_type0_opts, &local_err);
if (local_err) {
error_report("%s", error_get_pretty(local_err));
exit(1);
}
save_opt(&type0.vendor, opts, "vendor");
save_opt(&type0.version, opts, "version");
save_opt(&type0.date, opts, "date");
val = qemu_opt_get(opts, "release");
if (val) {
if (sscanf(val, "%hhu.%hhu", &type0.major, &type0.minor) != 2) {
error_report("Invalid release");
exit(1);
}
type0.have_major_minor = true;
}
return;
case 1:
qemu_opts_validate(opts, qemu_smbios_type1_opts, &local_err);
if (local_err) {
error_report("%s", error_get_pretty(local_err));
exit(1);
}
save_opt(&type1.manufacturer, opts, "manufacturer");
save_opt(&type1.product, opts, "product");
save_opt(&type1.version, opts, "version");
save_opt(&type1.serial, opts, "serial");
save_opt(&type1.sku, opts, "sku");
save_opt(&type1.family, opts, "family");
val = qemu_opt_get(opts, "uuid");
if (val) {
if (qemu_uuid_parse(val, qemu_uuid) != 0) {
error_report("Invalid UUID");
exit(1);
}
qemu_uuid_set = true;
}
return;
default:
error_report("Don't know how to build fields for SMBIOS type %ld",
type);
exit(1);
}
}
error_report("Must specify type= or file=");
exit(1);
}
| 1threat |
image is being used by stopped container : <p>I am trying to delete a docker container by this command:</p>
<pre><code>docker rmi <Image-Id>
</code></pre>
<p>Obviously, I have replaced the Image-Id by the Id I get using:</p>
<pre><code>docker images
</code></pre>
<p>But I see the error below:</p>
<pre><code>Error response from daemon: conflict: unable to delete <Image-ID> (must be forced) - image is being used by stopped container xxxxxxxxxxx
</code></pre>
| 0debug |
I want input is allow only numeric char : I want input is allow only numeric (0-9) and "+","(",")" and space.
I will mobile number format input.
Allow special chars = + ( ) space
Example: +00 (000) 000 0000
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
$(this).val('');
}else { | 0debug |
Can someone help break down this line of code for me? : <p>I just don't really understand what's going on here(The constructing a new vector part). It's code from a book I am using to learn C++. I can't seem to find that sort of construction anywhere on the web.</p>
<pre><code>class Vector
{
public:
Vector(int s):elem{new double[s]}, sz{ s }{} //constructs a new vector
double& operator[](int i) { return elem[i]; } //elements access: subscripting
int size() { return sz; }
private:
double* elem; //pointer to the elements
int sz; // number of elements
};
</code></pre>
| 0debug |
static ssize_t test_block_write_func(QCryptoBlock *block,
size_t offset,
const uint8_t *buf,
size_t buflen,
Error **errp,
void *opaque)
{
Buffer *header = opaque;
g_assert_cmpint(buflen + offset, <=, header->capacity);
memcpy(header->buffer + offset, buf, buflen);
header->offset = offset + buflen;
return buflen;
}
| 1threat |
How do I run PhantomJS on AWS Lambda with NodeJS : <p><em>After not finding a working answer anywhere else on the internet, I am submitting this ask-and-answer-myself tutorial</em></p>
<p>How can I get a simple <code>PhantomJS</code> process running from a <code>NodeJS</code> script on <code>AWS Lambda</code>? My code works fine on my local machine, but I run into different problems trying to run it on Lambda.</p>
| 0debug |
Remotely connect Mysql database through mysql workbench : [HostName: my domain name
Username: my database user
password: my database password
my database is hosted on godaddy
Kindly provide help ][1]
[1]: https://i.stack.imgur.com/j2IG3.png | 0debug |
static int theora_decode_tables(AVCodecContext *avctx, GetBitContext *gb)
{
Vp3DecodeContext *s = avctx->priv_data;
int i, n, matrices, inter, plane;
if (s->theora >= 0x030200) {
n = get_bits(gb, 3);
if (n) {
for (i = 0; i < 64; i++) {
s->filter_limit_values[i] = get_bits(gb, n);
if (s->filter_limit_values[i] > 127) {
av_log(avctx, AV_LOG_ERROR, "filter limit value too large (%i > 127), clamping\n", s->filter_limit_values[i]);
s->filter_limit_values[i] = 127;
if (s->theora >= 0x030200)
n = get_bits(gb, 4) + 1;
else
n = 16;
for (i = 0; i < 64; i++)
s->coded_ac_scale_factor[i] = get_bits(gb, n);
if (s->theora >= 0x030200)
n = get_bits(gb, 4) + 1;
else
n = 16;
for (i = 0; i < 64; i++)
s->coded_dc_scale_factor[i] = get_bits(gb, n);
if (s->theora >= 0x030200)
matrices = get_bits(gb, 9) + 1;
else
matrices = 3;
if(matrices > 384){
av_log(avctx, AV_LOG_ERROR, "invalid number of base matrixes\n");
return -1;
for(n=0; n<matrices; n++){
for (i = 0; i < 64; i++)
s->base_matrix[n][i]= get_bits(gb, 8);
for (inter = 0; inter <= 1; inter++) {
for (plane = 0; plane <= 2; plane++) {
int newqr= 1;
if (inter || plane > 0)
newqr = get_bits1(gb);
if (!newqr) {
int qtj, plj;
if(inter && get_bits1(gb)){
qtj = 0;
plj = plane;
}else{
qtj= (3*inter + plane - 1) / 3;
plj= (plane + 2) % 3;
s->qr_count[inter][plane]= s->qr_count[qtj][plj];
memcpy(s->qr_size[inter][plane], s->qr_size[qtj][plj], sizeof(s->qr_size[0][0]));
memcpy(s->qr_base[inter][plane], s->qr_base[qtj][plj], sizeof(s->qr_base[0][0]));
} else {
int qri= 0;
int qi = 0;
for(;;){
i= get_bits(gb, av_log2(matrices-1)+1);
if(i>= matrices){
av_log(avctx, AV_LOG_ERROR, "invalid base matrix index\n");
return -1;
s->qr_base[inter][plane][qri]= i;
if(qi >= 63)
break;
i = get_bits(gb, av_log2(63-qi)+1) + 1;
s->qr_size[inter][plane][qri++]= i;
qi += i;
if (qi > 63) {
av_log(avctx, AV_LOG_ERROR, "invalid qi %d > 63\n", qi);
return -1;
s->qr_count[inter][plane]= qri;
for (s->hti = 0; s->hti < 80; s->hti++) {
s->entries = 0;
s->huff_code_size = 1;
if (!get_bits1(gb)) {
s->hbits = 0;
if(read_huffman_tree(avctx, gb))
return -1;
s->hbits = 1;
if(read_huffman_tree(avctx, gb))
return -1;
s->theora_tables = 1;
return 0;
| 1threat |
jQuery intellisense in VS Code : <p>I have tried this:</p>
<p><a href="https://stackoverflow.com/questions/33902077/jquery-intellisense-in-visual-studio-code">JQuery intellisense in Visual Studio Code</a></p>
<p>and this:</p>
<p><a href="http://shrekshao.github.io/2016/06/20/vscode-01/" rel="noreferrer">http://shrekshao.github.io/2016/06/20/vscode-01/</a></p>
<p>But it does nothing, VS Code just won't add jquery intellisense, I've been trying to solve this for hours but it just won't work</p>
| 0debug |
static ssize_t nbd_receive_request(QIOChannel *ioc, NBDRequest *request)
{
uint8_t buf[NBD_REQUEST_SIZE];
uint32_t magic;
ssize_t ret;
ret = read_sync(ioc, buf, sizeof(buf), NULL);
if (ret < 0) {
return ret;
}
magic = ldl_be_p(buf);
request->flags = lduw_be_p(buf + 4);
request->type = lduw_be_p(buf + 6);
request->handle = ldq_be_p(buf + 8);
request->from = ldq_be_p(buf + 16);
request->len = ldl_be_p(buf + 24);
TRACE("Got request: { magic = 0x%" PRIx32 ", .flags = %" PRIx16
", .type = %" PRIx16 ", from = %" PRIu64 ", len = %" PRIu32 " }",
magic, request->flags, request->type, request->from, request->len);
if (magic != NBD_REQUEST_MAGIC) {
LOG("invalid magic (got 0x%" PRIx32 ")", magic);
return -EINVAL;
}
return 0;
}
| 1threat |
Leverage browser caching for external files : <p>i'm trying to get my google page speed insights rating to be decent, but there are some external files that i would want to be cached aswell, anyone knows what would be the best way to deal with this?</p>
<pre><code>https://s.swiftypecdn.com/cc.js (5 minutes)
https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js (60 minutes)
https://pagead2.googlesyndication.com/pagead/osd.js (60 minutes)
https://www.google-analytics.com/plugins/ua/linkid.js (60 minutes)
https://hey.hellobar.com/…d5837892514411fd16abbb3f71f0d400607f8f0b (2 hours)
https://www.google-analytics.com/analytics.js (2 hours)
</code></pre>
| 0debug |
Redux and Design Patterns : <p>I've been using Redux for several months and have a good feel for the unidirectional data flow. However, I'm not trained in OOP and Design Patterns. After listening to a <a href="https://www.youtube.com/watch?v=ImUcJctyUQ0&t=1377s" rel="noreferrer">talk by Ralph E Johnson</a> my first reaction was that the Observable Pattern is very similar to Redux/Flux flow, is that correct? Where does that analogy break down?</p>
<p>He talks about the Interfaces required to implement Observable Patterns - is this the sort of thinking that the authors of Redux/Flux architecture have in mind when designing these libraries/architectures?</p>
| 0debug |
Search column name in csv file using c# : <p>I need open the csv file and search if in this file I have the column named <strong>fileName</strong></p>
<p>I have tried on Google but without success.</p>
<p>Can anybody help me?</p>
<p>Thanks in advance</p>
| 0debug |
How to add gradients to text using JavaScript : <p>Currently I'm working on a little project and want to know how to add gradient to text using <strong>JavaScript</strong> like in CSS.</p>
| 0debug |
static int add_doubles_metadata(int count,
const char *name, const char *sep,
TiffContext *s)
{
char *ap;
int i;
double *dp;
if (count >= INT_MAX / sizeof(int64_t) || count <= 0)
return AVERROR_INVALIDDATA;
if (bytestream2_get_bytes_left(&s->gb) < count * sizeof(int64_t))
return AVERROR_INVALIDDATA;
dp = av_malloc(count * sizeof(double));
if (!dp)
return AVERROR(ENOMEM);
for (i = 0; i < count; i++)
dp[i] = tget_double(&s->gb, s->le);
ap = doubles2str(dp, count, sep);
av_freep(&dp);
if (!ap)
return AVERROR(ENOMEM);
av_dict_set(avpriv_frame_get_metadatap(&s->picture), name, ap, AV_DICT_DONT_STRDUP_VAL);
return 0;
}
| 1threat |
'How to define 'p' with ROOT' using Python and Flask : I am trying to launch a full stack web application using Python and Flask and inside my server interface/top layer file the ROOT line with 'p' is saying that it is not defined. Is there another set of variables I can assign to it in the same file to solve the problem when attempting to launch in terminal?
I have already tried launching with different versions of Python in terminal and assigning p to path in the code but then it says user isn't defined.
import sqlite3 as sql
from os import path
ROOT = path.dirname(p/Users/matthewdeyn/Coffea/app.pyath.relpath((__file__)))
def create_post(name, content):
con = sql.connect(path.join(ROOT, 'database.db'))
cur = con.cursor()
cur.execute('insert into posts (name, content) values(?, ?)', (name, content))
con.commit()
con.close()
def get_posts():
con = sql.connect(path.join(ROOT, 'database.db'))
cur = con.cursor()
cur.execute('select * from posts')
posts = cur.fetchall()
return posts
Expected results are that the app.py file will load in terminal and I will know where to find it in the browser.
| 0debug |
fire after update trigger if the updated column value is equal to 'APPROVED' : <p>i had two table named test and test_audit.i had a status column in test table
if i updated the status column in test table with value 'APPROVED' then only the after update trigger will be fired.i want query to create trigger
(if i update status except 'APPROVED' the trigger will not fire)</p>
| 0debug |
Why Lambda Expression in java is called as "lambda"? : <p>Why Lambda Expression is named as "Lambda" and not as "theta" or "gamma" or etc.?</p>
| 0debug |
Jquery : find text field value on click : I have to find the value of qty when I click on the plus or minus icon. following is my code for php
<div class='col-md-2 col-xs-2'>
<img src='<?=base_url()?>assets/img/Plus.png' class='img-responsive carticons pull-right '>
</div>
<div class="col-md-4 col-xs-6">
<div class="form-group" style="padding-top: 5px;">
<input type="number" value="<?=$qty?>" class="qty pull-right" min="<?=$qty?> "name="qty" >
</div>
<div class='col-md-2 col-xs-2' style='padding-left:0; '>
<img src='<?=base_url()?>assets/img/Minus.png' class='img-responsive carticons pull-left'>
</div>
<input type='hidden' data-qty='<?=$qty;?>' class='minqty' value='<?=$value->qty;?>' />
**JQuery code**
$('.carticons').on('click',function(){
var quantity = $(this).find('input[name=qty]').val();
alert(quantity);
})
But in alert it gives me undefined in the alert .
please help me how can i find this | 0debug |
Making a Lottery in python and it seems Like i cant win : This is my code buy no matter how many times i run it all i get is you lost. Whats wrong with the code?
import random
# Creates a number to count the amount of plays
count = 1;
# Creates a variable to store the amount of starting money
money = 10;
# Creates a variable telling you how much money you start with
startingCash = "You start with $" + str(money) + "!";
while (count < 101):
# Variables for the lottery numbers
lottery1 = random.randint(1,9);
lottery2 = random.randint(1,9);
lottery3 = random.randint(1,9);
lottery4 = random.randint(1,9);
# Lottery variables in one single variable
lotteryTotal = (lottery1, lottery2, lottery3, lottery4);
# Variables for the drawn ticket
drawn1 = random.randint(1,9);
drawn2 = random.randint(1,9);
drawn3 = random.randint(1,9);
drawn4 = random.randint(1,9);
# Variable for the drawn ticket in one single variable
drawnTotal = (drawn1, drawn2, drawn3, drawn4);
# Variable that changes the money variable so the player has 2 less dollars
money = money - 2;
it seems like the == sign gets ignored or acts differently. I wanted it to do the "if" if they are equal to eachother.
if( drawnTotal == lotteryTotal):
count = count + 1;
money = money + 5;
print ("Lottery Numbers: " + str(lotteryTotal));
print ("Your Numbers: " + str(drawnTotal));
print ("You Won $5!");
input("Press Enter to continue")
else:
print ("Lottery Numbers: " + str(lotteryTotal));
print ("Your Numbers: " + str(drawnTotal));
print ("You Lost!");
input("Press Enter to continue");
| 0debug |
static int vhdx_create_new_metadata(BlockDriverState *bs,
uint64_t image_size,
uint32_t block_size,
uint32_t sector_size,
uint64_t metadata_offset,
VHDXImageType type)
{
int ret = 0;
uint32_t offset = 0;
void *buffer = NULL;
void *entry_buffer;
VHDXMetadataTableHeader *md_table;
VHDXMetadataTableEntry *md_table_entry;
VHDXFileParameters *mt_file_params;
VHDXVirtualDiskSize *mt_virtual_size;
VHDXPage83Data *mt_page83;
VHDXVirtualDiskLogicalSectorSize *mt_log_sector_size;
VHDXVirtualDiskPhysicalSectorSize *mt_phys_sector_size;
entry_buffer = g_malloc0(VHDX_METADATA_ENTRY_BUFFER_SIZE);
mt_file_params = entry_buffer;
offset += sizeof(VHDXFileParameters);
mt_virtual_size = entry_buffer + offset;
offset += sizeof(VHDXVirtualDiskSize);
mt_page83 = entry_buffer + offset;
offset += sizeof(VHDXPage83Data);
mt_log_sector_size = entry_buffer + offset;
offset += sizeof(VHDXVirtualDiskLogicalSectorSize);
mt_phys_sector_size = entry_buffer + offset;
mt_file_params->block_size = cpu_to_le32(block_size);
if (type == VHDX_TYPE_FIXED) {
mt_file_params->data_bits |= VHDX_PARAMS_LEAVE_BLOCKS_ALLOCED;
cpu_to_le32s(&mt_file_params->data_bits);
}
vhdx_guid_generate(&mt_page83->page_83_data);
cpu_to_leguids(&mt_page83->page_83_data);
mt_virtual_size->virtual_disk_size = cpu_to_le64(image_size);
mt_log_sector_size->logical_sector_size = cpu_to_le32(sector_size);
mt_phys_sector_size->physical_sector_size = cpu_to_le32(sector_size);
buffer = g_malloc0(VHDX_HEADER_BLOCK_SIZE);
md_table = buffer;
md_table->signature = VHDX_METADATA_SIGNATURE;
md_table->entry_count = 5;
vhdx_metadata_header_le_export(md_table);
offset = 64 * KiB;
md_table_entry = buffer + sizeof(VHDXMetadataTableHeader);
md_table_entry[0].item_id = file_param_guid;
md_table_entry[0].offset = offset;
md_table_entry[0].length = sizeof(VHDXFileParameters);
md_table_entry[0].data_bits |= VHDX_META_FLAGS_IS_REQUIRED;
offset += md_table_entry[0].length;
vhdx_metadata_entry_le_export(&md_table_entry[0]);
md_table_entry[1].item_id = virtual_size_guid;
md_table_entry[1].offset = offset;
md_table_entry[1].length = sizeof(VHDXVirtualDiskSize);
md_table_entry[1].data_bits |= VHDX_META_FLAGS_IS_REQUIRED |
VHDX_META_FLAGS_IS_VIRTUAL_DISK;
offset += md_table_entry[1].length;
vhdx_metadata_entry_le_export(&md_table_entry[1]);
md_table_entry[2].item_id = page83_guid;
md_table_entry[2].offset = offset;
md_table_entry[2].length = sizeof(VHDXPage83Data);
md_table_entry[2].data_bits |= VHDX_META_FLAGS_IS_REQUIRED |
VHDX_META_FLAGS_IS_VIRTUAL_DISK;
offset += md_table_entry[2].length;
vhdx_metadata_entry_le_export(&md_table_entry[2]);
md_table_entry[3].item_id = logical_sector_guid;
md_table_entry[3].offset = offset;
md_table_entry[3].length = sizeof(VHDXVirtualDiskLogicalSectorSize);
md_table_entry[3].data_bits |= VHDX_META_FLAGS_IS_REQUIRED |
VHDX_META_FLAGS_IS_VIRTUAL_DISK;
offset += md_table_entry[3].length;
vhdx_metadata_entry_le_export(&md_table_entry[3]);
md_table_entry[4].item_id = phys_sector_guid;
md_table_entry[4].offset = offset;
md_table_entry[4].length = sizeof(VHDXVirtualDiskPhysicalSectorSize);
md_table_entry[4].data_bits |= VHDX_META_FLAGS_IS_REQUIRED |
VHDX_META_FLAGS_IS_VIRTUAL_DISK;
vhdx_metadata_entry_le_export(&md_table_entry[4]);
ret = bdrv_pwrite(bs, metadata_offset, buffer, VHDX_HEADER_BLOCK_SIZE);
if (ret < 0) {
goto exit;
}
ret = bdrv_pwrite(bs, metadata_offset + (64 * KiB), entry_buffer,
VHDX_METADATA_ENTRY_BUFFER_SIZE);
if (ret < 0) {
goto exit;
}
exit:
g_free(buffer);
g_free(entry_buffer);
return ret;
}
| 1threat |
static inline int gsm_mult(int a, int b)
{
return (a * b + (1 << 14)) >> 15;
}
| 1threat |
static ram_addr_t get_start_block(DumpState *s)
{
RAMBlock *block;
if (!s->has_filter) {
s->block = QTAILQ_FIRST(&ram_list.blocks);
return 0;
}
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (block->offset >= s->begin + s->length ||
block->offset + block->length <= s->begin) {
continue;
}
s->block = block;
if (s->begin > block->offset) {
s->start = s->begin - block->offset;
} else {
s->start = 0;
}
return s->start;
}
return -1;
}
| 1threat |
I'm new to python, why is the colon an invalid syntax? : <p>I'm very new to python, and am trying to build a heads or tails system. But whenever I add the colon to the end of the if statement, it states it as invalid syntax. Though, when I remove the colon, it states invalid syntax for the next line.</p>
<pre><code>import random
def coinToss (
coinFlip = random.choice([1, 2])
if coinFlip == 1:
print("You got Heads!")
else
print("You got Tails!")
):
usrFlip = input("Press Enter to Flip a Coin")
if usrFlip == str:
coinToss():
</code></pre>
| 0debug |
gcloud components update permission denied : <p>All of a sudden I started getting "Permission Denied" issues when trying to run any gcloud commands such as <code>gcloud components update</code> -- the issue was avoided if I ran <code>sudo gcloud components update</code> but it's not clear to my why the sudo command is suddenly required? I have actually been trying to run a GCMLE experiment and it had the same error/warning, so I tried updating components and still ran into this issue. I have been travelling for a couple days and did not make any changes since these same commands worked a few days ago. Further, I did not changed my OS (Mac High Sierra 10.13.3) -- were there any changes on the Google side that might explain this change in behavior? What is the best course of action to permanently get around this warning?</p>
<pre><code>(conda-env) MacBook-Pro:user$ gcloud components update
WARNING: Could not setup log file in /Users/$USERNAME/.config/gcloud/logs, (IOError: [Errno 13] Permission denied: u'/Users/$USERNAME/.config/gcloud/logs/2018.03.10/XX.XX.XX.XXXXXX.log')
</code></pre>
<p>after <code>sudo gcloud components update</code> I was able to kick off a GCMLE experiment, but I also get the same warning (though my job now submits successfully).</p>
<pre><code>WARNING: Could not setup log file in /Users/#USERNAME/.config/gcloud/logs, (IOError: [Errno 13] Permission denied: u'/Users/$USERNAME/.config/gcloud/logs/2018.03.10/XX.XX.XX.XXXXXX.log')
</code></pre>
| 0debug |
Why do i get permision denied? : from ipaddress import *
from socket import *
x = str(IPv4Address('125.67.8.0'))
s = socket()
s.bind((x,456))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: [Errno 99] Cannot assign requested address
even after calling the ipaddress constructor to construct a new ip address, why can't i not bind, i ran the program on superuser mode, what is wrong with my method? | 0debug |
how and using which library can i use knn imputation for missing value analysis : <p>I am trying to to impute the missing values using knn but i couldnt able to use the
code:
from fancyimpute import KNN<br>
is there any other library for knn imputation ?</p>
| 0debug |
How to embed whole angularjs app into existing app which is separately deployed : <p>I have application with logic similar to google's app switcher, let me call it <code>Wrapper</code>. This application take place across all google services and has consistent UI everywhere. </p>
<p>I am looking for solution to inject into my <code>Wrapper</code> application several finished different apps with their own styles, views and JS. They are written with different technologies like React and Angular. </p>
<p>How can I implement such architecture? Are Web-components a solution for this, if yes - please provide me some examples. (The aim is to deploy wrapper separately and all content applications too, so they will have consistent UI and logic from wrapper).</p>
<p>Please do not mention the <code>iframe</code>!</p>
| 0debug |
I use White Action Bar and i want to use black color icons to Open Navigation drawer and more options button? : I tried using a White Action Bar but i end up getting all the icons or the buttons to be invisible in the Action bar since they are also in white color.
Kindly suggest how can i set color to the Action bar elements, as of now i want to display black icons on the Action bar with shadow. | 0debug |
Custom frontmatter variables with Markdown Remark in Gatsby.js : <p>I am building a website using Gatsbyjs and NetlifyCMS. I've started using this starter <a href="https://github.com/AustinGreen/gatsby-starter-netlify-cms" rel="noreferrer">https://github.com/AustinGreen/gatsby-starter-netlify-cms</a>, and I am trying to customise it now.</p>
<p>I want to use custom variables in the frontmatter of a markdown file like this:</p>
<pre><code>---
templateKey: mirror
nazev: Černobílá
title: Black and White
cena: '2700'
price: '108'
thumbnail: /img/img_1659.jpeg
---
</code></pre>
<p>I want to acess this data with GraphQL. I use gatsby-source-filesystem and gatsby-transform-remark. This is my query:</p>
<pre><code> {
allMarkdownRemark {
edges {
node {
frontmatter {
templateKey
nazev
title
cena
price
}
}
}
}
}
</code></pre>
<p>I can't get the GraphQL to read my own variables, it recognises only <code>title</code> and <code>templateKey</code> (those, that were already used in the starter). I get this error:</p>
<pre><code>{
"errors": [
{
"message": "Cannot query field \"nazev\" on type \"frontmatter_2\".",
"locations": [
{
"line": 7,
"column": 11
}
]
},
{
"message": "Cannot query field \"cena\" on type \"frontmatter_2\".",
"locations": [
{
"line": 9,
"column": 11
}
]
},
{
"message": "Cannot query field \"price\" on type \"frontmatter_2\". Did you mean \"pricing\"?",
"locations": [
{
"line": 10,
"column": 11
}
]
}
]
}
</code></pre>
<p>I've searched for days, but found nothing. Would someone help me please?</p>
| 0debug |
c# read block of lines in text file : I am writing a program to read a log file. each entry starts with a time-stamp, except when there is an error, which in this case, I would have multiple lines for the error message and without time-stamp.
the file looks like this:
20190207 14:23:10.123 info Read input
20190207 14:23:11.001 info connecting to database
20190207 14:23:17.101 error truncating the table customer. Error code XXXX
the file was blocked.
I would like to store every entry with its time-stamp, event type, and message in a table that has three columns, one column for the time-stamp (datetime) and another column for the evens(info/warning/error), and a column for the text (data type text).
how do I iterate through the file and read all the entries including the error message which sometimes be in multiple lines? | 0debug |
Java JWindow Inject in Desktop : Can anyone show example on how to make a JWindow always on Desktop?
I cannot set the "AlwaysOnTop" since I do not want it to be on top of other applications, but I want it to stay on Desktop.
Whenever I click the show Desktop button or Windows Key + M to minimize all, it disappears also. When i return to any window, it will be visible again.
I wanted to inject the JWindow in the Desktop.
Thanks in advance~ | 0debug |
def ascii_value(k):
ch=k
return ord(ch) | 0debug |
static void x86_cpu_initfn(Object *obj)
{
CPUState *cs = CPU(obj);
X86CPU *cpu = X86_CPU(obj);
X86CPUClass *xcc = X86_CPU_GET_CLASS(obj);
CPUX86State *env = &cpu->env;
FeatureWord w;
cs->env_ptr = env;
cpu_exec_init(cs, &error_abort);
object_property_add(obj, "family", "int",
x86_cpuid_version_get_family,
x86_cpuid_version_set_family, NULL, NULL, NULL);
object_property_add(obj, "model", "int",
x86_cpuid_version_get_model,
x86_cpuid_version_set_model, NULL, NULL, NULL);
object_property_add(obj, "stepping", "int",
x86_cpuid_version_get_stepping,
x86_cpuid_version_set_stepping, NULL, NULL, NULL);
object_property_add_str(obj, "vendor",
x86_cpuid_get_vendor,
x86_cpuid_set_vendor, NULL);
object_property_add_str(obj, "model-id",
x86_cpuid_get_model_id,
x86_cpuid_set_model_id, NULL);
object_property_add(obj, "tsc-frequency", "int",
x86_cpuid_get_tsc_freq,
x86_cpuid_set_tsc_freq, NULL, NULL, NULL);
object_property_add(obj, "apic-id", "int",
x86_cpuid_get_apic_id,
x86_cpuid_set_apic_id, NULL, NULL, NULL);
object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)env->features, NULL);
object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
x86_cpu_get_feature_words,
NULL, NULL, (void *)cpu->filtered_features, NULL);
cpu->hyperv_spinlock_attempts = HYPERV_SPINLOCK_NEVER_RETRY;
#ifndef CONFIG_USER_ONLY
cpu->apic_id = -1;
#endif
for (w = 0; w < FEATURE_WORDS; w++) {
int bitnr;
for (bitnr = 0; bitnr < 32; bitnr++) {
x86_cpu_register_feature_bit_props(cpu, w, bitnr);
}
}
x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort);
}
| 1threat |
I am trying to convert String date in long in android studio : I AM CONVERTING STRING DATE INTO LONG BUT I AM NOT UNDERSTANDING HOW TO RETURN THE LONG VALUE
and how to convert a string into long and store in room database
```
package com.example.mybugetssimple;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateConverter {
public static long dateCon(String string_date){
string_date = "12-December-2012";
SimpleDateFormat f = new SimpleDateFormat("dd-MMM-yyyy");
try {
Date d = f.parse(string_date);
long milliseconds = d.getTime();
return milliseconds;
} catch (ParseException e) {
e.printStackTrace();
}
return 1;
}
}
``` | 0debug |
Reference netstandard 2.0 types in ASP.NET MVC 5 razor views in .NET 4.7.1 : <p>.NET 4.7.1 was supposed to solve problems we had in referencing <code>netstandard 2.0</code> libraries from the full framework. It sort of did, despite some continuing and painful dll conflict warnings and related problems, and the need to manually update to PackageReferences (<a href="https://marketplace.visualstudio.com/items?itemName=CloudNimble.NuGetPackageReferenceUpgrader" rel="noreferrer">see this wondeful extension</a>). Nonetheless, one can get it working, though see note 1 below, and if I may say: it is unfortunate to say the least that there has been no VStudio help or much guidance on this and related issues, till now one has to find such help on back channels on github. This very problem itself ideally would have been messaged: ASP.NET MVC 5 does NOT yet support netstandard in razor ... wish they would just have messaged us that if true! Would save <em>endless</em> wasted hours! But is that the case? Or is there a fix?</p>
<p>Here then is the problem with ASP.NET MVC 5 projects (even those targeting 4.7.1). Although plain .cs code works, including in controllers, this is <em>not</em> true for any code within razor views (<code>.cshtml</code> files). Any types referenced within razor views that came from a <code>netstandard</code> library completely fail. </p>
<p>To reproduce this problem and make sure it wasn't just my own code, I reproduced this <a href="https://github.com/copernicus365/AspMvc5NetstandardCompatibility" rel="noreferrer">by making a bran new ASP.NET MVC 5 project (on github)</a> in the newest version of VStudio 2017 (even the Preview version, 15.7.0 Preview 4.0), then making a new <code>netstandard</code> project with just a couple of types in it, so I could practice referencing those types in the MVC 5 view pages. And sure enough, it still fails. For instance, this simple type from the netstandard project:</p>
<pre><code>public enum AnimalType { Cat, Dog, Zebra, Alligator }
</code></pre>
<p>If you make that enum a type within your view model passed into the page, if you ever reference that property in the razor page, you will get compile time errors and also at runtime, saying:</p>
<blockquote>
<p>The type 'Enum' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. AspMvc5WebApp471</p>
</blockquote>
<p>As also detailed in that repo, I even tried to recompile my own version of <code>Microsoft.CodeDom.Providers.DotNetCompilerPlatform</code> to reference it within the <code>web.config</code>, but that didn't solve the problem.</p>
<p>So it would be lovely to hear from the ASP.NET team or anyone else that might know how to fix this problem, what that fix might entail. Or if ASP.NET MVC 5 simply is not yet workable with <code>netstandard</code>, it would be nice to know if that is the message, and if support for <code>netstandard</code> might be coming to ASP.NET MVC 5 in the near future, or if it is on a roadmap somewhere? And perhaps what exactly is the thing causing this failure? Of course, it would be happiest to hear if there is a fix that can be applied right away, but either way, we need to know, otherwise <code>netstandard</code> is basically useless for those of us who can't just dump ASP.NET MVC 5 in a day (as much as we would like to, in the real world...) Much appreciated.</p>
<p>(Note 1: Net Framework 4.7.1 was eagerly looked forward to by myself and many others when it was said for some time it would solve many of the pain points, but unfortunately it has introduced its own set of <a href="https://github.com/dotnet/sdk/issues/1647" rel="noreferrer">endless dll hell like problems</a>, or see <a href="https://github.com/dotnet/standard/issues/514" rel="noreferrer">here</a>, <a href="https://github.com/dotnet/standard/issues/391" rel="noreferrer">or here</a>, <a href="https://github.com/dotnet/corefx/issues/28833" rel="noreferrer">or here</a>. See for instance the discussions on <code>System.Net.Http</code> (and binding redirects do not just remove all of the conflict warnings, they often bring up their own, highly painful stuff). Now some have been hoping 4.7.2 would solve all these problems, though it didn't solve these ASP.NET MVC 5 problems for me)</p>
| 0debug |
void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
{
int i;
if (s->portnr > NB_PORTS) {
error_setg(errp, "Too many ports! Max. port number is %d.",
NB_PORTS);
usb_bus_new(&s->bus, sizeof(s->bus), s->companion_enable ?
&ehci_bus_ops_companion : &ehci_bus_ops_standalone, dev);
for (i = 0; i < s->portnr; i++) {
usb_register_port(&s->bus, &s->ports[i], s, i, &ehci_port_ops,
USB_SPEED_MASK_HIGH);
s->ports[i].dev = 0;
s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s);
s->async_bh = qemu_bh_new(ehci_work_bh, s);
s->device = dev;
s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
| 1threat |
Creating an emulator for Galaxy S8? - Android Studio : <p>I create a new hardware profile in an attempt to make and emulator for the Galaxy S8/S8+. I set the screen size to 5.8/6.2 inches (depending on whether S8 or S8+, despite the fact this doesn't appear to affect emulator anyway), and the screen resolution to 1440 x 2960, like the device. The emulator appears nothing like it does on the real device. Testing my app on a real S8+ shows it to be laid out poorly, but on the emulator it appear to be relatively organised, and I noticed it uses the dimens for my Nexus 6 emulator (xxxhdpi). Now the dimens values used isn't a big deal, because I'm happy to phase out the Nexus 6 considering it's no longer in production.</p>
<p>So I add some code to my launcher Java class that that gets me the dimensions of the emulator, here is what I get from my S8 emulator: <code>{density=3.5, width=1440, height=2792, scaledDensity=3.5, xdpi=560.0, ydpi=560.0}</code>
Besides the fact the height says 2792 instead of 2960 (I assume this is meant to happen), I believe I see the issue - the density is 3.5. As suspected, this is the same density as the Nexus 6. So the emulator I'm creating is not for the Galaxy S8, and this is evident in my comparison to a real S8+ which displayed my app in a distorted manner. As far as I'm aware, the Galaxy S8 has a density of 4, not 3.5. The IDE says the device has 560dpi. Now I need to be able to create an emulator with a density of 4, and the same specs I've already put down. How can I do this? How can I test for the Galaxy S8 without using the real thing? There isn't a preconfigured emulator for this device provided by the IDE.</p>
<p>Many thanks in advance.</p>
| 0debug |
int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags)
{
int64_t target_sectors, ret, nb_sectors, sector_num = 0;
int n;
target_sectors = bdrv_nb_sectors(bs);
if (target_sectors < 0) {
return target_sectors;
}
for (;;) {
nb_sectors = target_sectors - sector_num;
if (nb_sectors <= 0) {
return 0;
}
if (nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) {
nb_sectors = INT_MAX / BDRV_SECTOR_SIZE;
}
ret = bdrv_get_block_status(bs, sector_num, nb_sectors, &n);
if (ret < 0) {
error_report("error getting block status at sector %" PRId64 ": %s",
sector_num, strerror(-ret));
return ret;
}
if (ret & BDRV_BLOCK_ZERO) {
sector_num += n;
continue;
}
ret = bdrv_write_zeroes(bs, sector_num, n, flags);
if (ret < 0) {
error_report("error writing zeroes at sector %" PRId64 ": %s",
sector_num, strerror(-ret));
return ret;
}
sector_num += n;
}
}
| 1threat |
C: When a user does not provide an input I'm getting "Segmentation fault: 11". It works fine when a user does provide an input. How can I fix this? : Its a while (1) loop continuously asks user for input until terminated.
I want it to ask the user for an input and if no input is given upon pressing enter it should ask for the input again.
I've initialized input as char input[100]; I also tried doing "char *input = (char *)malloc(10*sizeof(char));" but it does not help.
| 0debug |
How to use Includes fucntionality in SQL? : I require following functionality, How can I frame it in a query?
Select * from table where column 4 includes column3
Example:
Please find attachment for table screenshot. [Table structure][1]. I want to extract all the rows where column 4 includes column 3.
[1]: https://i.stack.imgur.com/LIJGF.png | 0debug |
convert any string like "10", "-0.129894", "12.02102" to number without adding or loosing anything : <p>As you can see from the title I have various cases for strings that can contain numbers in them. I found out that using <code>parseInt()</code> and <code>parseFloat()</code> didn't work for me as parseInt will convert number like 10.28 to just 10, but parseFloat will make number like 10 into 10.0, I want to somehow convert string into number so it stays exactly like it was in the string without anything removed or added.</p>
| 0debug |
Error loading project in Android Studio: cannot load modules : <p>When I Checkout a project form Google Cloud, Android Studio sais: "2 modules cannot be loaded. You can remove them from the project" and I cannot see the project. The error is in the iml files app.iml and ProjectName.iml.</p>
<p>Thanks!</p>
| 0debug |
ISO8601DateFormatter doesn't parse ISO date string : <p>I'm trying to parse this </p>
<blockquote>
<p>2017-01-23T10:12:31.484Z</p>
</blockquote>
<p>using native <code>ISO8601DateFormatter</code> class provided by <code>iOS 10</code> but always fails.
If the string not contains milliseconds, the <code>Date</code> object is created without problems.</p>
<p>I'm tried this and many <code>options</code> combination but always fails...</p>
<pre><code>let formatter = ISO8601DateFormatter()
formatter.timeZone = TimeZone(secondsFromGMT: 0)
formatter.formatOptions = [.withInternetDateTime, .withDashSeparatorInDate, .withColonSeparatorInTime, .withColonSeparatorInTimeZone, .withFullTime]
</code></pre>
<p>Any idea?
Thanks!</p>
| 0debug |
How to create reusable button component with vanilla js and sass? : <p>I have to make a reusable button component with vanilla js and scss, but I haven't done it yet. Can somebody explain how could I do it ?
I am new at this so I don't know where to look for it.</p>
<p>Update: Do I have to use javascript or can I use only HTML and SCSS/CSS for it?</p>
| 0debug |
void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size)
{
const uint16_t *end;
uint8_t *d = (uint8_t *)dst;
const uint16_t *s = (uint16_t *)src;
end = s + src_size/2;
while(s < end)
{
register uint16_t bgr;
bgr = *s++;
#ifdef WORDS_BIGENDIAN
*d++ = 0;
*d++ = (bgr&0x1F)<<3;
*d++ = (bgr&0x7E0)>>3;
*d++ = (bgr&0xF800)>>8;
#else
*d++ = (bgr&0xF800)>>8;
*d++ = (bgr&0x7E0)>>3;
*d++ = (bgr&0x1F)<<3;
*d++ = 0;
#endif
}
}
| 1threat |
Java System Independent Root Directory Paths : <p>In a Windows system my path would be like this:</p>
<pre><code>C:/example/
</code></pre>
<p>And in a Linux system my path would be like this:</p>
<pre><code>/example/
</code></pre>
<p>Is there some utility function to have a single string work in both systems? </p>
| 0debug |
Nested URL in Golang : I'm totally new to Golang I started like tomorrow. So What I want to achieve is routes like
`user/profile`
`user/cart`
`user/products`
Currently, I'm doing this
```
r.HandleFunc("user/signup", signupHandler).Methods("POST")
r.HandleFunc("user/signin", signinHandler).Methods("POST")
r.HandleFunc("user/profile", profileHandler).Methods("GET")
r.HandleFunc("user/cart", cartHandler).Methods("POST")
r.HandleFunc("user/products", productsHandler).Methods("GET")
```
As you can see these routes starts with `user` so can how can I know it's a `user` routes so I can send handle it in a different file.
I want something like
```
r.HandleFunc("user/", handlerWhichHandelAllTheRequestFromUser)
```
It should handle all the URL which starts from `users`.
P.S I'm using mux | 0debug |
window.scrollTo with options not working on Microsoft Edge : <p>I have a strange issue which I can only replicate on Microsoft browsers (Edge and IE11 tested).</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><style>
body {
height: 5000px;
width: 5000px;
}
</style>
<p>Click the button to scroll the document window to 1000 pixels.</p>
<button onclick="scrollWin()">Click me to scroll!</button>
<script>
function scrollWin() {
window.scrollTo({
left: 1000,
top: 1000,
behavior:"smooth"
});
}
</script></code></pre>
</div>
</div>
</p>
<p>This code correctly scrolls the window 1000px to the left and down, with a smooth behaviour in Chrome and Firefox. However, on Edge and IE, it does not move at all.</p>
| 0debug |
static void FUNCC(pred16x16_horizontal_add)(uint8_t *pix,
const int *block_offset,
const int16_t *block,
ptrdiff_t stride)
{
int i;
for(i=0; i<16; i++)
FUNCC(pred4x4_horizontal_add)(pix + block_offset[i], block + i*16*sizeof(pixel), stride);
}
| 1threat |
Admob banner, how to show only on home : <p>Im successfully showing the smart banner on footer and then dispose it. My problem is that is showing on all pages of the app. </p>
<p>My question is: How to show only on one page?</p>
<pre><code>@override
void initState() {
super.initState();
myBanner
..load().then((loaded) {
if (loaded && this.mounted) {
myBanner..show();
}
});
}
</code></pre>
| 0debug |
static int mpeg_decode_frame(AVCodecContext *avctx, void *data,
int *got_output, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
Mpeg1Context *s = avctx->priv_data;
AVFrame *picture = data;
MpegEncContext *s2 = &s->mpeg_enc_ctx;
av_dlog(avctx, "fill_buffer\n");
if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == SEQ_END_CODE)) {
if (s2->low_delay == 0 && s2->next_picture_ptr) {
int ret = av_frame_ref(picture, &s2->next_picture_ptr->f);
if (ret < 0)
return ret;
s2->next_picture_ptr = NULL;
*got_output = 1;
}
return buf_size;
}
if (s2->flags & CODEC_FLAG_TRUNCATED) {
int next = ff_mpeg1_find_frame_end(&s2->parse_context, buf,
buf_size, NULL);
if (ff_combine_frame(&s2->parse_context, next,
(const uint8_t **) &buf, &buf_size) < 0)
return buf_size;
}
if (s->mpeg_enc_ctx_allocated == 0 && avctx->codec_tag == AV_RL32("VCR2"))
vcr2_init_sequence(avctx);
s->slice_count = 0;
if (avctx->extradata && !s->extradata_decoded) {
int ret = decode_chunks(avctx, picture, got_output,
avctx->extradata, avctx->extradata_size);
s->extradata_decoded = 1;
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
return ret;
}
return decode_chunks(avctx, picture, got_output, buf, buf_size);
}
| 1threat |
static char *sdp_media_attributes(char *buff, int size, AVCodecContext *c, int payload_type)
{
char *config = NULL;
switch (c->codec_id) {
case CODEC_ID_MPEG4:
if (c->flags & CODEC_FLAG_GLOBAL_HEADER) {
config = extradata2config(c->extradata, c->extradata_size);
}
av_strlcatf(buff, size, "a=rtpmap:%d MP4V-ES/90000\r\n"
"a=fmtp:%d profile-level-id=1%s\r\n",
payload_type,
payload_type, config ? config : "");
break;
case CODEC_ID_AAC:
if (c->flags & CODEC_FLAG_GLOBAL_HEADER) {
config = extradata2config(c->extradata, c->extradata_size);
} else {
av_log(NULL, AV_LOG_ERROR, "AAC with no global headers is currently not supported\n");
return NULL;
}
if (config == NULL) {
return NULL;
}
av_strlcatf(buff, size, "a=rtpmap:%d MPEG4-GENERIC/%d/%d\r\n"
"a=fmtp:%d profile-level-id=1;"
"mode=AAC-hbr;sizelength=13;indexlength=3;"
"indexdeltalength=3%s\r\n",
payload_type, c->sample_rate, c->channels,
payload_type, config);
break;
default:
break;
}
av_free(config);
return buff;
}
| 1threat |
I am getting Problem with nmp any Command same error : **I am getting Problem with nmp any Comma[enter image description here][1]nd same error.**
[1]: https://i.stack.imgur.com/68rlF.png | 0debug |
tcg_target_ulong tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
{
tcg_target_ulong next_tb = 0;
tci_reg[TCG_AREG0] = (tcg_target_ulong)env;
assert(tb_ptr);
for (;;) {
#if defined(GETPC)
tci_tb_ptr = (uintptr_t)tb_ptr;
#endif
TCGOpcode opc = tb_ptr[0];
#if !defined(NDEBUG)
uint8_t op_size = tb_ptr[1];
uint8_t *old_code_ptr = tb_ptr;
#endif
tcg_target_ulong t0;
tcg_target_ulong t1;
tcg_target_ulong t2;
tcg_target_ulong label;
TCGCond condition;
target_ulong taddr;
#ifndef CONFIG_SOFTMMU
tcg_target_ulong host_addr;
#endif
uint8_t tmp8;
uint16_t tmp16;
uint32_t tmp32;
uint64_t tmp64;
#if TCG_TARGET_REG_BITS == 32
uint64_t v64;
#endif
tb_ptr += 2;
switch (opc) {
case INDEX_op_end:
case INDEX_op_nop:
break;
case INDEX_op_nop1:
case INDEX_op_nop2:
case INDEX_op_nop3:
case INDEX_op_nopn:
case INDEX_op_discard:
TODO();
break;
case INDEX_op_set_label:
TODO();
break;
case INDEX_op_call:
t0 = tci_read_ri(&tb_ptr);
#if TCG_TARGET_REG_BITS == 32
tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
tci_read_reg(TCG_REG_R1),
tci_read_reg(TCG_REG_R2),
tci_read_reg(TCG_REG_R3),
tci_read_reg(TCG_REG_R5),
tci_read_reg(TCG_REG_R6),
tci_read_reg(TCG_REG_R7),
tci_read_reg(TCG_REG_R8),
tci_read_reg(TCG_REG_R9),
tci_read_reg(TCG_REG_R10));
tci_write_reg(TCG_REG_R0, tmp64);
tci_write_reg(TCG_REG_R1, tmp64 >> 32);
#else
tmp64 = ((helper_function)t0)(tci_read_reg(TCG_REG_R0),
tci_read_reg(TCG_REG_R1),
tci_read_reg(TCG_REG_R2),
tci_read_reg(TCG_REG_R3),
tci_read_reg(TCG_REG_R5));
tci_write_reg(TCG_REG_R0, tmp64);
#endif
break;
case INDEX_op_br:
label = tci_read_label(&tb_ptr);
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
case INDEX_op_setcond_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg32(t0, tci_compare32(t1, t2, condition));
break;
#if TCG_TARGET_REG_BITS == 32
case INDEX_op_setcond2_i32:
t0 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
v64 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg32(t0, tci_compare64(tmp64, v64, condition));
break;
#elif TCG_TARGET_REG_BITS == 64
case INDEX_op_setcond_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
tci_write_reg64(t0, tci_compare64(t1, t2, condition));
break;
#endif
case INDEX_op_mov_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, t1);
break;
case INDEX_op_movi_i32:
t0 = *tb_ptr++;
t1 = tci_read_i32(&tb_ptr);
tci_write_reg32(t0, t1);
break;
case INDEX_op_ld8u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg8(t0, *(uint8_t *)(t1 + t2));
break;
case INDEX_op_ld8s_i32:
case INDEX_op_ld16u_i32:
TODO();
break;
case INDEX_op_ld16s_i32:
TODO();
break;
case INDEX_op_ld_i32:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32(t0, *(uint32_t *)(t1 + t2));
break;
case INDEX_op_st8_i32:
t0 = tci_read_r8(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint8_t *)(t1 + t2) = t0;
break;
case INDEX_op_st16_i32:
t0 = tci_read_r16(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint16_t *)(t1 + t2) = t0;
break;
case INDEX_op_st_i32:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint32_t *)(t1 + t2) = t0;
break;
case INDEX_op_add_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 + t2);
break;
case INDEX_op_sub_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 - t2);
break;
case INDEX_op_mul_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 * t2);
break;
#if TCG_TARGET_HAS_div_i32
case INDEX_op_div_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (int32_t)t1 / (int32_t)t2);
break;
case INDEX_op_divu_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 / t2);
break;
case INDEX_op_rem_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (int32_t)t1 % (int32_t)t2);
break;
case INDEX_op_remu_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 % t2);
break;
#elif TCG_TARGET_HAS_div2_i32
case INDEX_op_div2_i32:
case INDEX_op_divu2_i32:
TODO();
break;
#endif
case INDEX_op_and_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 & t2);
break;
case INDEX_op_or_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 | t2);
break;
case INDEX_op_xor_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 ^ t2);
break;
case INDEX_op_shl_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 << t2);
break;
case INDEX_op_shr_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, t1 >> t2);
break;
case INDEX_op_sar_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, ((int32_t)t1 >> t2));
break;
#if TCG_TARGET_HAS_rot_i32
case INDEX_op_rotl_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (t1 << t2) | (t1 >> (32 - t2)));
break;
case INDEX_op_rotr_i32:
t0 = *tb_ptr++;
t1 = tci_read_ri32(&tb_ptr);
t2 = tci_read_ri32(&tb_ptr);
tci_write_reg32(t0, (t1 >> t2) | (t1 << (32 - t2)));
break;
#endif
#if TCG_TARGET_HAS_deposit_i32
case INDEX_op_deposit_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
t2 = tci_read_r32(&tb_ptr);
tmp16 = *tb_ptr++;
tmp8 = *tb_ptr++;
tmp32 = (((1 << tmp8) - 1) << tmp16);
tci_write_reg32(t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32));
break;
#endif
case INDEX_op_brcond_i32:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_ri32(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare32(t0, t1, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
#if TCG_TARGET_REG_BITS == 32
case INDEX_op_add2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
tmp64 += tci_read_r64(&tb_ptr);
tci_write_reg64(t1, t0, tmp64);
break;
case INDEX_op_sub2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
tmp64 = tci_read_r64(&tb_ptr);
tmp64 -= tci_read_r64(&tb_ptr);
tci_write_reg64(t1, t0, tmp64);
break;
case INDEX_op_brcond2_i32:
tmp64 = tci_read_r64(&tb_ptr);
v64 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare64(tmp64, v64, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
case INDEX_op_mulu2_i32:
t0 = *tb_ptr++;
t1 = *tb_ptr++;
t2 = tci_read_r32(&tb_ptr);
tmp64 = tci_read_r32(&tb_ptr);
tci_write_reg64(t1, t0, t2 * tmp64);
break;
#endif
#if TCG_TARGET_HAS_ext8s_i32
case INDEX_op_ext8s_i32:
t0 = *tb_ptr++;
t1 = tci_read_r8s(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16s_i32
case INDEX_op_ext16s_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16s(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext8u_i32
case INDEX_op_ext8u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r8(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16u_i32
case INDEX_op_ext16u_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg32(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_bswap16_i32
case INDEX_op_bswap16_i32:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg32(t0, bswap16(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap32_i32
case INDEX_op_bswap32_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, bswap32(t1));
break;
#endif
#if TCG_TARGET_HAS_not_i32
case INDEX_op_not_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, ~t1);
break;
#endif
#if TCG_TARGET_HAS_neg_i32
case INDEX_op_neg_i32:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg32(t0, -t1);
break;
#endif
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_mov_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, t1);
break;
case INDEX_op_movi_i64:
t0 = *tb_ptr++;
t1 = tci_read_i64(&tb_ptr);
tci_write_reg64(t0, t1);
break;
case INDEX_op_ld8u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg8(t0, *(uint8_t *)(t1 + t2));
break;
case INDEX_op_ld8s_i64:
case INDEX_op_ld16u_i64:
case INDEX_op_ld16s_i64:
TODO();
break;
case INDEX_op_ld32u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32(t0, *(uint32_t *)(t1 + t2));
break;
case INDEX_op_ld32s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg32s(t0, *(int32_t *)(t1 + t2));
break;
case INDEX_op_ld_i64:
t0 = *tb_ptr++;
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
tci_write_reg64(t0, *(uint64_t *)(t1 + t2));
break;
case INDEX_op_st8_i64:
t0 = tci_read_r8(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint8_t *)(t1 + t2) = t0;
break;
case INDEX_op_st16_i64:
t0 = tci_read_r16(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint16_t *)(t1 + t2) = t0;
break;
case INDEX_op_st32_i64:
t0 = tci_read_r32(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint32_t *)(t1 + t2) = t0;
break;
case INDEX_op_st_i64:
t0 = tci_read_r64(&tb_ptr);
t1 = tci_read_r(&tb_ptr);
t2 = tci_read_s32(&tb_ptr);
*(uint64_t *)(t1 + t2) = t0;
break;
case INDEX_op_add_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 + t2);
break;
case INDEX_op_sub_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 - t2);
break;
case INDEX_op_mul_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 * t2);
break;
#if TCG_TARGET_HAS_div_i64
case INDEX_op_div_i64:
case INDEX_op_divu_i64:
case INDEX_op_rem_i64:
case INDEX_op_remu_i64:
TODO();
break;
#elif TCG_TARGET_HAS_div2_i64
case INDEX_op_div2_i64:
case INDEX_op_divu2_i64:
TODO();
break;
#endif
case INDEX_op_and_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 & t2);
break;
case INDEX_op_or_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 | t2);
break;
case INDEX_op_xor_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 ^ t2);
break;
case INDEX_op_shl_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 << t2);
break;
case INDEX_op_shr_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, t1 >> t2);
break;
case INDEX_op_sar_i64:
t0 = *tb_ptr++;
t1 = tci_read_ri64(&tb_ptr);
t2 = tci_read_ri64(&tb_ptr);
tci_write_reg64(t0, ((int64_t)t1 >> t2));
break;
#if TCG_TARGET_HAS_rot_i64
case INDEX_op_rotl_i64:
case INDEX_op_rotr_i64:
TODO();
break;
#endif
#if TCG_TARGET_HAS_deposit_i64
case INDEX_op_deposit_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
t2 = tci_read_r64(&tb_ptr);
tmp16 = *tb_ptr++;
tmp8 = *tb_ptr++;
tmp64 = (((1ULL << tmp8) - 1) << tmp16);
tci_write_reg64(t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64));
break;
#endif
case INDEX_op_brcond_i64:
t0 = tci_read_r64(&tb_ptr);
t1 = tci_read_ri64(&tb_ptr);
condition = *tb_ptr++;
label = tci_read_label(&tb_ptr);
if (tci_compare64(t0, t1, condition)) {
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr = (uint8_t *)label;
continue;
}
break;
#if TCG_TARGET_HAS_ext8u_i64
case INDEX_op_ext8u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r8(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext8s_i64
case INDEX_op_ext8s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r8s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16s_i64
case INDEX_op_ext16s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r16s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext16u_i64
case INDEX_op_ext16u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext32s_i64
case INDEX_op_ext32s_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32s(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_ext32u_i64
case INDEX_op_ext32u_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg64(t0, t1);
break;
#endif
#if TCG_TARGET_HAS_bswap16_i64
case INDEX_op_bswap16_i64:
TODO();
t0 = *tb_ptr++;
t1 = tci_read_r16(&tb_ptr);
tci_write_reg64(t0, bswap16(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap32_i64
case INDEX_op_bswap32_i64:
t0 = *tb_ptr++;
t1 = tci_read_r32(&tb_ptr);
tci_write_reg64(t0, bswap32(t1));
break;
#endif
#if TCG_TARGET_HAS_bswap64_i64
case INDEX_op_bswap64_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, bswap64(t1));
break;
#endif
#if TCG_TARGET_HAS_not_i64
case INDEX_op_not_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, ~t1);
break;
#endif
#if TCG_TARGET_HAS_neg_i64
case INDEX_op_neg_i64:
t0 = *tb_ptr++;
t1 = tci_read_r64(&tb_ptr);
tci_write_reg64(t0, -t1);
break;
#endif
#endif
#if TARGET_LONG_BITS > TCG_TARGET_REG_BITS
case INDEX_op_debug_insn_start:
TODO();
break;
#else
case INDEX_op_debug_insn_start:
TODO();
break;
#endif
case INDEX_op_exit_tb:
next_tb = *(uint64_t *)tb_ptr;
goto exit;
break;
case INDEX_op_goto_tb:
t0 = tci_read_i32(&tb_ptr);
assert(tb_ptr == old_code_ptr + op_size);
tb_ptr += (int32_t)t0;
continue;
case INDEX_op_qemu_ld8u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);
#endif
tci_write_reg8(t0, tmp8);
break;
case INDEX_op_qemu_ld8s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp8 = helper_ldb_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
tmp8 = *(uint8_t *)(host_addr + GUEST_BASE);
#endif
tci_write_reg8s(t0, tmp8);
break;
case INDEX_op_qemu_ld16u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg16(t0, tmp16);
break;
case INDEX_op_qemu_ld16s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp16 = helper_ldw_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
tmp16 = tswap16(*(uint16_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg16s(t0, tmp16);
break;
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_qemu_ld32u:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32(t0, tmp32);
break;
case INDEX_op_qemu_ld32s:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32s(t0, tmp32);
break;
#endif
case INDEX_op_qemu_ld32:
t0 = *tb_ptr++;
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp32 = helper_ldl_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
tmp32 = tswap32(*(uint32_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg32(t0, tmp32);
break;
case INDEX_op_qemu_ld64:
t0 = *tb_ptr++;
#if TCG_TARGET_REG_BITS == 32
t1 = *tb_ptr++;
#endif
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
tmp64 = helper_ldq_mmu(env, taddr, tci_read_i(&tb_ptr));
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
tmp64 = tswap64(*(uint64_t *)(host_addr + GUEST_BASE));
#endif
tci_write_reg(t0, tmp64);
#if TCG_TARGET_REG_BITS == 32
tci_write_reg(t1, tmp64 >> 32);
#endif
break;
case INDEX_op_qemu_st8:
t0 = tci_read_r8(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stb_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
*(uint8_t *)(host_addr + GUEST_BASE) = t0;
#endif
break;
case INDEX_op_qemu_st16:
t0 = tci_read_r16(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stw_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
*(uint16_t *)(host_addr + GUEST_BASE) = tswap16(t0);
#endif
break;
case INDEX_op_qemu_st32:
t0 = tci_read_r32(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stl_mmu(env, taddr, t0, t2);
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
*(uint32_t *)(host_addr + GUEST_BASE) = tswap32(t0);
#endif
break;
case INDEX_op_qemu_st64:
tmp64 = tci_read_r64(&tb_ptr);
taddr = tci_read_ulong(&tb_ptr);
#ifdef CONFIG_SOFTMMU
t2 = tci_read_i(&tb_ptr);
helper_stq_mmu(env, taddr, tmp64, t2);
#else
host_addr = (tcg_target_ulong)taddr;
assert(taddr == host_addr);
*(uint64_t *)(host_addr + GUEST_BASE) = tswap64(tmp64);
#endif
break;
default:
TODO();
break;
}
assert(tb_ptr == old_code_ptr + op_size);
}
exit:
return next_tb;
}
| 1threat |
i need assistance in fixing this bug in node : i'm new to node and i keep getting this error everytime i try to access a file from the command line.
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'C:\Users\USER\Desktop\ngs\1-getting-started1-
executing-scripts1-hello-world.js'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) | 0debug |
Exception Handling regarding nesting of try : <p>This was the objective type question which was asked me in one of my interview that .. Can we have try inside the try block? I think the answer is no. But I have to confirm the answer. So please tell me the correct answer. </p>
| 0debug |
Docker: Set container name inside Dockerfile : <p>Is there a way that I can set what the containers name will be from inside the Dockerfile? Basically I want to always have the same name so I won't have to run "$docker ps" after building and running an image to get its name.</p>
| 0debug |
static int xmv_read_close(AVFormatContext *s)
{
XMVDemuxContext *xmv = s->priv_data;
av_free(xmv->audio);
av_free(xmv->audio_tracks);
return 0;
}
| 1threat |
static void do_hybrid_window(int order, int n, int non_rec, const float *in,
float *out, float *hist, float *out2,
const float *window)
{
int i;
float buffer1[order + 1];
float buffer2[order + 1];
float work[order + n + non_rec];
memmove(hist, hist + n, (order + non_rec)*sizeof(*hist));
for (i=0; i < n; i++)
hist[order + non_rec + i] = in[n-i-1];
colmult(work, window, hist, order + n + non_rec);
convolve(buffer1, work + order , n , order);
convolve(buffer2, work + order + n, non_rec, order);
for (i=0; i <= order; i++) {
out2[i] = out2[i] * 0.5625 + buffer1[i];
out [i] = out2[i] + buffer2[i];
}
*out *= 257./256.;
}
| 1threat |
Getting missing postional argument self error : Why do i get the error missing 1 required positional argument self when I call inp() on the object.
process=[]
class Process:
def __init__(self):
self.no=no
self.at=at
self.bt=bt
def inp(self):
ar=int(input('Enter arrival time'))
bt=int(input('Enter burst time'))
x=int(input('Enter the no. of processes'))
for i in range(x):
process.append(Process)
q.no=i
for x in process:
x.inp()
| 0debug |
Is it possible to make a string such as "G" equal a specific number like 50? : <p>For example if I had the letter "B" in a array and want to count how many there are,could I make "B"=1 so I can easily count the number of b's.I do not think this is typecasting since I am do not want to make "B" itself = int B</p>
| 0debug |
Hide certain posts on tumblr home : <p>I would like to hide certain posts on my tumblr homepage that have the a specific tag (#journal). I've already tried some codes, but it didn't work.</p>
<p>Here is my actual HTML code:</p>
<p><strong>pastebin.com/JT4KtyVz</strong></p>
<p>My tumblr:
<a href="http://heynotspecial.tumblr.com/" rel="nofollow noreferrer">http://heynotspecial.tumblr.com/</a></p>
<p>Do you guys know how to do that?</p>
<p>Sorry, not used to post code here :(</p>
| 0debug |
static const uint8_t *read_huffman_tables(FourXContext *f, const uint8_t * const buf){
int frequency[512];
uint8_t flag[512];
int up[512];
uint8_t len_tab[257];
int bits_tab[257];
int start, end;
const uint8_t *ptr= buf;
int j;
memset(frequency, 0, sizeof(frequency));
memset(up, -1, sizeof(up));
start= *ptr++;
end= *ptr++;
for(;;){
int i;
for(i=start; i<=end; i++){
frequency[i]= *ptr++;
}
start= *ptr++;
if(start==0) break;
end= *ptr++;
}
frequency[256]=1;
while((ptr - buf)&3) ptr++;
for(j=257; j<512; j++){
int min_freq[2]= {256*256, 256*256};
int smallest[2]= {0, 0};
int i;
for(i=0; i<j; i++){
if(frequency[i] == 0) continue;
if(frequency[i] < min_freq[1]){
if(frequency[i] < min_freq[0]){
min_freq[1]= min_freq[0]; smallest[1]= smallest[0];
min_freq[0]= frequency[i];smallest[0]= i;
}else{
min_freq[1]= frequency[i];smallest[1]= i;
}
}
}
if(min_freq[1] == 256*256) break;
frequency[j]= min_freq[0] + min_freq[1];
flag[ smallest[0] ]= 0;
flag[ smallest[1] ]= 1;
up[ smallest[0] ]=
up[ smallest[1] ]= j;
frequency[ smallest[0] ]= frequency[ smallest[1] ]= 0;
}
for(j=0; j<257; j++){
int node;
int len=0;
int bits=0;
for(node= j; up[node] != -1; node= up[node]){
bits += flag[node]<<len;
len++;
if(len > 31) av_log(f->avctx, AV_LOG_ERROR, "vlc length overflow\n");
}
bits_tab[j]= bits;
len_tab[j]= len;
}
init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257,
len_tab , 1, 1,
bits_tab, 4, 4, 0);
return ptr;
}
| 1threat |
Deploy a self-contained .NET Core application with Azure DevOps App Service Deploy task : <p>From a local machine I can publish a .NET Core application to Azure Web Service as a self-hosted application by defining <code><SelfContained>true</SelfContained></code> in publish profile.</p>
<p><strong>App Service Deploy</strong> task in Azure DevOps pipeline publishes it to IIS by default.
How configure it to publish as self-hosted?</p>
| 0debug |
int s390_cpu_handle_mmu_fault(CPUState *cs, vaddr orig_vaddr,
int rw, int mmu_idx)
{
S390CPU *cpu = S390_CPU(cs);
CPUS390XState *env = &cpu->env;
uint64_t asc = cpu_mmu_idx_to_asc(mmu_idx);
target_ulong vaddr, raddr;
int prot;
DPRINTF("%s: address 0x%" VADDR_PRIx " rw %d mmu_idx %d\n",
__func__, orig_vaddr, rw, mmu_idx);
orig_vaddr &= TARGET_PAGE_MASK;
vaddr = orig_vaddr;
if (!(env->psw.mask & PSW_MASK_64)) {
vaddr &= 0x7fffffff;
}
if (mmu_translate(env, vaddr, rw, asc, &raddr, &prot, true)) {
return 1;
}
if (raddr > ram_size) {
DPRINTF("%s: raddr %" PRIx64 " > ram_size %" PRIx64 "\n", __func__,
(uint64_t)raddr, (uint64_t)ram_size);
trigger_pgm_exception(env, PGM_ADDRESSING, ILEN_AUTO);
return 1;
}
qemu_log_mask(CPU_LOG_MMU, "%s: set tlb %" PRIx64 " -> %" PRIx64 " (%x)\n",
__func__, (uint64_t)vaddr, (uint64_t)raddr, prot);
tlb_set_page(cs, orig_vaddr, raddr, prot,
mmu_idx, TARGET_PAGE_SIZE);
return 0;
}
| 1threat |
Kotlin DSL for creating json objects (without creating garbage) : <p>I am trying to create a DSL for creating JSONObjects. Here is a builder class and a sample usage:</p>
<pre><code>import org.json.JSONObject
fun json(build: JsonObjectBuilder.() -> Unit): JSONObject {
val builder = JsonObjectBuilder()
builder.build()
return builder.json
}
class JsonObjectBuilder {
val json = JSONObject()
infix fun <T> String.To(value: T) {
json.put(this, value)
}
}
fun main(args: Array<String>) {
val jsonObject =
json {
"name" To "ilkin"
"age" To 37
"male" To true
"contact" To json {
"city" To "istanbul"
"email" To "xxx@yyy.com"
}
}
println(jsonObject)
}
</code></pre>
<p>The output of the above code is :</p>
<pre><code>{"contact":{"city":"istanbul","email":"xxx@yyy.com"},"name":"ilkin","age":37,"male":true}
</code></pre>
<p>It works as expected. But it creates an additional JsonObjectBuilder instance every time it creates a json object. Is it possible to write a DSL for creating json objects without extra garbage?</p>
| 0debug |
how to handle with GeoLocation columns in dataset : I am a beginner in machine learning, I am doing predicting adduction probability drug. I have some problem with GeoLocation column and also I don't know how to handle with GeoLocation, please help how to do.
my column like this :
train['GeoLocation'].head(8)
0 (29.760427, -95.369803)
1 (29.760427, -95.369803)
2 (39.493240390000494, -117.07184056399967)
3 (40.79373015200048, -77.86070029399963)
4 (37.77493, -122.419416)
5 (39.952584, -75.165222)
6 (32.715738, -117.161084)
7 (39.360700171000474, -111.58713063499971)
Name: GeoLocation, dtype: object
| 0debug |
Understanding Simple For Loop Code in C : <p>I'm beginner in C programming (just started) and i need help from you to understand the output of this very simple code:</p>
<pre><code>int main()
{
int x=1;
for (;x<=10;x++);
printf("%d\n",x);
return 0;
}
</code></pre>
<p>output is:
11</p>
<p>the same output if x value is <=11
and if x value is 12 or more, it prints the exact value of x (ex: if int x=12; the output is 12).</p>
<p>how did the computer understand this code?</p>
| 0debug |
void ff_vp3_idct_put_c(uint8_t *dest, int line_size, DCTELEM *block){
idct(dest, line_size, block, 1);
}
| 1threat |
CMake march hardware : <p>What is the CMake way to enable the equivalent of GCC's <code>-march=</code>, particularly <code>-march=native</code>? Is there really nothing better than <code>CHECK_CXX_COMPILER_FLAG</code>, such as:</p>
<pre><code>include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
</code></pre>
| 0debug |
static void put_fid(V9fsPDU *pdu, V9fsFidState *fidp)
{
BUG_ON(!fidp->ref);
fidp->ref--;
if (!fidp->ref && fidp->clunked) {
if (fidp->fid == pdu->s->root_fid) {
if (pdu->s->migration_blocker) {
migrate_del_blocker(pdu->s->migration_blocker);
error_free(pdu->s->migration_blocker);
pdu->s->migration_blocker = NULL;
}
}
free_fid(pdu, fidp);
}
}
| 1threat |
void do_blockdev_backup(BlockdevBackup *backup, BlockJobTxn *txn, Error **errp)
{
BlockDriverState *bs;
BlockDriverState *target_bs;
Error *local_err = NULL;
AioContext *aio_context;
if (!backup->has_speed) {
backup->speed = 0;
}
if (!backup->has_on_source_error) {
backup->on_source_error = BLOCKDEV_ON_ERROR_REPORT;
}
if (!backup->has_on_target_error) {
backup->on_target_error = BLOCKDEV_ON_ERROR_REPORT;
}
if (!backup->has_job_id) {
backup->job_id = NULL;
}
if (!backup->has_compress) {
backup->compress = false;
}
bs = qmp_get_root_bs(backup->device, errp);
if (!bs) {
return;
}
aio_context = bdrv_get_aio_context(bs);
aio_context_acquire(aio_context);
target_bs = bdrv_lookup_bs(backup->target, backup->target, errp);
if (!target_bs) {
goto out;
}
if (bdrv_get_aio_context(target_bs) != aio_context) {
if (!bdrv_has_blk(target_bs)) {
bdrv_set_aio_context(target_bs, aio_context);
} else {
error_setg(errp, "Target is attached to a different thread from "
"source.");
goto out;
}
}
backup_start(backup->job_id, bs, target_bs, backup->speed, backup->sync,
NULL, backup->compress, backup->on_source_error,
backup->on_target_error, BLOCK_JOB_DEFAULT,
NULL, NULL, txn, &local_err);
if (local_err != NULL) {
error_propagate(errp, local_err);
}
out:
aio_context_release(aio_context);
}
| 1threat |
I'm Beginner in Java, I have a error message with .gradle and Soursets with main. How can I solve this problem? : I'm beginner in Java and Android-Studio.
From the first step, i got a big problem.
When I typed my first Java code in And-Stu and I ran the code, but I got this error message...
---------------------------------------------------------
FAILURE: Build failed with an exception.
* Where:
Initialization script 'C:\Users\forma\AppData\Local\Temp\asdb_main__.gradle' line: 20
* What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:asdb.main()'.
> SourceSet with name 'main' not found.
---------------------------------------------------------
So, I looked for the .gradle file, but I don't know what the problem is.
How can I solve this problem?
i ran this code but i got the error message.
package com.example.myapplication;
public class asdb {
public static void main(String[] args) {
int a;
a=10;
System.out.println(a);
}
}
and this is .gralde code including line 20.
def gradlePath = ':app'
def runAppTaskName = 'asdb.main()'
def mainClass = 'com.example.myapplication.asdb'
def javaExePath = 'C:/Program Files/Android/Android Studio/jre/bin/java.exe'
def _workingDir = 'C:/Users/forma/Desktop/practice/java2'
def sourceSetName = 'main'
def javaModuleName = null
allprojects {
afterEvaluate { project ->
if(project.path == gradlePath && project?.convention?.findPlugin(JavaPluginConvention)) {
project.tasks.create(name: runAppTaskName, overwrite: true, type: JavaExec) {
if (javaExePath) executable = javaExePath
classpath = project.sourceSets[sourceSetName].runtimeClasspath
main = mainClass | 0debug |
TypeError: Firebase is not a function : <p>I am trying to follow the firebase Node tutorial:
<a href="https://www.firebase.com/docs/web/quickstart.html">https://www.firebase.com/docs/web/quickstart.html</a></p>
<p>My node.js app is crashing with a "TypeError: Firebase is not a function" error. My index.js file:</p>
<pre><code>var Firebase = require("firebase");
var firebaseRef = new Firebase("https://word-word-number.firebaseio.com/");
</code></pre>
<p>Line two is where the crash happens.</p>
<p>In my package.json I have:</p>
<pre><code>"firebase": "^3.0.2",
</code></pre>
<p>and </p>
<pre><code>"node": "5.11.0"
</code></pre>
| 0debug |
MVC, C# - Not All Code Paths Return A Value : <p>I'm creating a basic MVC Copy File App and am returning a Not All Code Paths Return a Value error in my GetSource method. I've researched the issue and have tried a few things, but the error still generates. I believe the error is in the foreach loop somewhere, but I tried returning a null afterwards, which just threw up a different error. Any help is appreciated as I am a beginner. Thanks!</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
namespace April24
{
public class Andrew
{
public string Copy()
{
return "Done Copying";
}
public string GetSource() //Error is here
{
copyFiles(10);
}
public static string production = @"C:\Users\test\Desktop\Production";
public static string renameFolder = @"C:\Users\test\Desktop\RenameFolder\";
static private void copyFiles(int numberOfFiles)
{
List<string> files = System.IO.Directory.GetFiles(production, "*").ToList();
IEnumerable<string> filesToCopy = files.Where(file => file.Contains("Test_Name")).Take(10);
foreach (string file in filesToCopy)
{
string destfile = renameFolder + System.IO.Path.GetFileName(file);
System.IO.File.Copy(file, destfile, true);
};
/*tried return null; here but still threw error*/
}
}
}
</code></pre>
| 0debug |
My python code wont work : Struggling to work out why python complaining at line 4:
import sys
import re
problem = input("What is wrong with your mobile device?").lower
water = re.search(r'water', problem)
screen = re.search(r'screen', problem)+ re.search(r'smashed',problem)or re.search(r'cracked',problem)+ re.search(r'display',problem)
software=re.search(r'software',problem)+ re.search(r'program',problem)
keypad=re.search(r'keypad',problem)+ re.search(r'keyboard',problem)+ re.search(r'text',problem)
speakers=re.search(r'sound',problem)+ re.search(r"can't here",problem)+ re.search(r'cant hear',problem)
microphone=re.search(r'microphone',problem)+ re.search(r'cant hear me',problem)+ re.search(r"can't hear me",problem)
battery=re.search(r'battery',problem)+ re.search(r'swollen',problem)
charger=re.search(r'Charger',problem)+ re.search(r'charge',problem)+ re.search(r'charging',problem)
if water:
print("If your phone has suffered water dammage there is not much you can do, it is recomended that you buy a new phone")
sys.exit
elif screen:
print("If your screen is cracked then it is recomended that you get it repaired this is not too expensive.")
sys.exit
elif software:
print("If you have a software issue then contact the product manurfacture, they are the only ones qualified to fix this.")
sys.exit
elif keypad:
print("Clean your keypad with a wetwipe, do not get the charger port or jack port wet.")
sys.exit
elif microphone:
print("Your microphone hole may be blocked, please clean this with a soft dry tooth brush, if this does not work then please retern the hand held device to its manufactures.")
sys.exit
elif battery:
print("If your battery is enlarged/swollen you have probbaly over charged it it is recomended that you buy a ned battery.")
sys.exit
elif speakers:
print("The speaker on most phone is located on the side or back or the device if this is blocked then please attemt to clean this with a dry, soft toothbrush, if this does not work please contact the product manurfacture.")
sys.exit
elif charger:
print("If you have not tryed buying a new charger then try that. If a new charger does not work, please send your mobile device to the product manurfacture.")
sys.exit
else:
print("please write your problem again, attempt to use keywords that relate to your problem.")
sys.exit
END
If someone could tell me how to correct this or correct this themselves it would be much appreciated. | 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.