problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static void pc_cpu_plug(HotplugHandler *hotplug_dev,
DeviceState *dev, Error **errp)
{
CPUArchId *found_cpu;
HotplugHandlerClass *hhc;
Error *local_err = NULL;
PCMachineState *pcms = PC_MACHINE(hotplug_dev);
if (pcms->acpi_dev) {
hhc = HOTPLUG_HANDLER_GET_CLASS(pcms->acpi_dev);
hhc->plug(HOTPLUG_HANDLER(pcms->acpi_dev), dev, &local_err);
if (local_err) {
goto out;
}
}
pcms->boot_cpus++;
if (dev->hotplugged) {
rtc_set_cpus_count(pcms->rtc, pcms->boot_cpus);
fw_cfg_modify_i16(pcms->fw_cfg, FW_CFG_NB_CPUS, pcms->boot_cpus);
}
found_cpu = pc_find_cpu_slot(pcms, CPU(dev), NULL);
found_cpu->cpu = CPU(dev);
out:
error_propagate(errp, local_err);
}
| 1threat |
visual studio - blank screen as output : '2.exe' (Win32): Loaded 'F:\cg project\2\Debug\2.exe'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ddraw.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dciman32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glut32.dll'. Module was built without symbols.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Symbols loaded.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ig7icd32.dll'. Cannot find or open the PDB file.
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Symbols loaded.
'2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll'
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'2.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll'
'2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. Symbols loaded.
The program '[7212] 2.exe' has exited with code 0 (0x0). | 0debug |
static void omap_inth_sir_update(struct omap_intr_handler_s *s, int is_fiq)
{
int i, j, sir_intr, p_intr, p, f;
uint32_t level;
sir_intr = 0;
p_intr = 255;
for (j = 0; j < s->nbanks; ++j) {
level = s->bank[j].irqs & ~s->bank[j].mask &
(is_fiq ? s->bank[j].fiq : ~s->bank[j].fiq);
for (f = ffs(level), i = f - 1, level >>= f - 1; f; i += f,
level >>= f) {
p = s->bank[j].priority[i];
if (p <= p_intr) {
p_intr = p;
sir_intr = 32 * j + i;
}
f = ffs(level >> 1);
}
}
s->sir_intr[is_fiq] = sir_intr;
}
| 1threat |
How to implemt C macro with assert : I work on a C project, it implements a kind of polymorphism , using macros
void method1Instrumentation(void*);
bool method1Instrumentation(void*);
bool method1Instrumentation(void*);
#define method1(arg) method1Instrumentation(arg)
#define method2(arg) method2Instrumentation(arg)
#define method3(arg) method32Instrumentation(arg)
For each of `method1Instrumentation, method2Instrumentation, method3Instrumentation` there are several implementations. Based on internal configuration , compiler "chooses" the appropriate function.
I (probably) can\`t change the given design.
But I need to add `asserts` to `method*`.
is works fine
#define method1(arg) assert(arg == null) method1Instrumentation(arg)
doesn`t work (compilation problems)
#define method2(arg) assert(arg == null) method2Instrumentation(arg)
The problem occurs since the original code has following calls
if(method2(arg))
{
}
How should I add an `assets` following the limitations I have?
| 0debug |
React Javascript displaying/decoding unicode characters : <p>I have a string in unicode that i need to convert. I need to render the string with \u00f3 to ó. This is an example, it should happen with all other types of characters, á, í, ú...</p>
<p>I have the following basic code:
<a href="https://jsfiddle.net/dddf7o70/" rel="noreferrer">https://jsfiddle.net/dddf7o70/</a></p>
<p>I need to convert </p>
<pre><code><Hello name="Informaci\u00f3n" />
</code></pre>
<p>into </p>
<pre><code>Información
</code></pre>
| 0debug |
Vanilla Rails 6.0: "error Command "webpack" not found" : <h2>System:</h2>
<p>Ruby: 2.6.3p62 (rvm)<br>
Rails: 6.0<br>
OS: macOS 10.14.6</p>
<h2>Setup</h2>
<p>A fresh Rails 6.0 application:</p>
<pre><code>$ rails new testshop2
$ cd testshop2
$ rails g controller Page index
$ rails s
=> Booting Puma
=> Rails 6.0.0 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.3-p62), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
</code></pre>
<p>When I browse to `<a href="http://localhost:3000/page/index" rel="noreferrer">http://localhost:3000/page/index</a>' the system throughs this error:</p>
<pre><code>Started GET "/page/index" for ::1 at 2019-09-23 17:06:12 +0200
(0.4ms) SELECT sqlite_version(*)
Processing by PageController#index as HTML
Rendering page/index.html.erb within layouts/application
Rendered page/index.html.erb within layouts/application (Duration: 1.8ms | Allocations: 206)
[Webpacker] Compiling…
[Webpacker] Compilation failed:
error Command "webpack" not found.
Completed 500 Internal Server Error in 2021ms (ActiveRecord: 0.0ms | Allocations: 640080)
ActionView::Template::Error (Webpacker can't find application in /Users/stefan/Github/sandbox/testshop2/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}
):
6: <%= csp_meta_tag %>
7:
8: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9: <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
10: </head>
11:
12: <body>
app/views/layouts/application.html.erb:9
</code></pre>
<p>How can I fix this? It says <code>error Command "webpack" not found.</code> but shouldn't Rails install everything needed automatically?</p>
| 0debug |
What is a multi-headed model? And what exactly is a 'head' in a model? : <p>What is a multi-headed model in deep learning?</p>
<p>The only explanation I found so far is this: <em>Every model might be thought of as a backbone plus a head, and if you pre-train backbone and put a random head, you can fine tune it and it is a good idea</em><br>
Can someone please provide a more detailed explanation.</p>
| 0debug |
static av_cold int vaapi_encode_mjpeg_init_internal(AVCodecContext *avctx)
{
static const VAConfigAttrib default_config_attributes[] = {
{ .type = VAConfigAttribRTFormat,
.value = VA_RT_FORMAT_YUV420 },
{ .type = VAConfigAttribEncPackedHeaders,
.value = VA_ENC_PACKED_HEADER_SEQUENCE },
};
VAAPIEncodeContext *ctx = avctx->priv_data;
VAAPIEncodeMJPEGContext *priv = ctx->priv_data;
int i;
ctx->va_profile = VAProfileJPEGBaseline;
ctx->va_entrypoint = VAEntrypointEncPicture;
ctx->input_width = avctx->width;
ctx->input_height = avctx->height;
ctx->aligned_width = FFALIGN(ctx->input_width, 8);
ctx->aligned_height = FFALIGN(ctx->input_height, 8);
for (i = 0; i < FF_ARRAY_ELEMS(default_config_attributes); i++) {
ctx->config_attributes[ctx->nb_config_attributes++] =
default_config_attributes[i];
}
priv->quality = avctx->global_quality;
if (priv->quality < 1 || priv->quality > 100) {
av_log(avctx, AV_LOG_ERROR, "Invalid quality value %d "
"(must be 1-100).\n", priv->quality);
return AVERROR(EINVAL);
}
vaapi_encode_mjpeg_init_tables(avctx);
return 0;
}
| 1threat |
awk with multiple action with begin end : In AWK can i set up multiple delimiter in action , like below example
BEGIN { Actions}
{ACTION-1} # here delimiter will be comma ","
{ACTION-2} # here delimiter will be colon":"
{ACTION-1} # here delimiter will be space " "
END { Actions }
Please give me example. | 0debug |
Angular2 Unexpected value in Service. Please add annotation : <p>In my Angular2 app am getting the following error <strong>Error: (SystemJS) Unexpected value 'ReleasesService' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation.</strong></p>
<p>My <strong>AppModule</strong>:</p>
<pre><code>import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { routing } from './app.routes';
import { HttpModule } from '@angular/http';
import { SearchFilter } from '../app/search-filter.pipe';
import { ReleasesService } from '../app/releases/releases.service';
import { AppComponent } from './app.component';
import { HomeComponent } from '../app/home/home.component';
import { ReleasesComponent } from '../app/releases/releases.component';
import { DistroComponent } from '../app/distro/distro.component';
import { ContactComponent } from '../app/contact/contact.component';
@NgModule({
imports: [ BrowserModule, HttpModule, routing ],
declarations: [ AppComponent,
SearchFilter,
HomeComponent,
ReleasesComponent,
ReleasesService,
DistroComponent,
ContactComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
</code></pre>
<p>My <strong>ReleasesService</strong>:</p>
<pre><code>import { Injectable } from '@angular/core';
import { Http, Response } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { IRelease } from './release';
import 'rxjs/add/operator/map';
@Injectable()
export class ReleasesService {
getReleases() {
return IRelease;
}
}
</code></pre>
<p>How to fix it? I reinstalled the <em>Quickstarter</em> (the base for my App), and having the same error when try to create the service.</p>
| 0debug |
how to start youtube video with autoplay after 10 sec of page loads? : <p>Hello I want to start youtube video with autoplay after 10 seconds when the page load is completed. Is there any way to do this jQuery or javascript. I want to do this in a wordpress website.
the development site link:-</p>
<p><a href="http://www.mediationadvantage.com/" rel="nofollow">http://www.mediationadvantage.com/</a> (the video on left side need to be started)</p>
<p>Please give some idea or show some example on jsfiddle.</p>
<p>Thanks</p>
| 0debug |
What value for @SuppressWarnings do I use to suppress the "Can be private" warning? : <p>I keep getting annoyed by the "Can be private" warning, however my <code>FirebaseRecyclerAdapter</code> will not work in that case. So, is there a <code>@SuppressWarnings</code> for that?</p>
<p><strong>What I've tried:</strong></p>
<p><code>@SuppressWarnings("all")</code> but that's not what I want.</p>
<p><strong>Note:</strong> I am using Android Studio</p>
| 0debug |
Getting UTC UNIX timestamp in Lua : <p>An API returns a timestamp as UNIX timestamp at UTC and I would like to know if this timestamp was more than <code>x</code> seconds ago. As expected, this works fine with <code>os.time() - x > timestamp</code> in UTC, but blows up in other timezones.</p>
<p>Unfortunately I can't find a good way solve this in lua.</p>
<p><code>os.date</code> helpfully has the <code>!</code> prefix (e.g. <code>os.date("!%H:%M:%S")</code>) to return time at UTC, but it seems that despite the documentation stating it supports all <code>strftime</code> options, this does not support the <code>%s</code> option. I have heard people mention that this is caused by Lua compile time options for a similar issue, but changing these is not possible as the interpreter is provided by the user.</p>
| 0debug |
static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, int64_t max_pos, int depth) {
AVCodecContext *acodec, *vcodec;
ByteIOContext *ioc;
AMFDataType amf_type;
char str_val[256];
double num_val;
num_val = 0;
ioc = s->pb;
amf_type = get_byte(ioc);
switch(amf_type) {
case AMF_DATA_TYPE_NUMBER:
num_val = av_int2dbl(get_be64(ioc)); break;
case AMF_DATA_TYPE_BOOL:
num_val = get_byte(ioc); break;
case AMF_DATA_TYPE_STRING:
if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0)
return -1;
break;
case AMF_DATA_TYPE_OBJECT: {
unsigned int keylen;
while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) {
url_fskip(ioc, keylen);
if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
return -1;
}
if(get_byte(ioc) != AMF_END_OF_OBJECT)
return -1;
}
break;
case AMF_DATA_TYPE_NULL:
case AMF_DATA_TYPE_UNDEFINED:
case AMF_DATA_TYPE_UNSUPPORTED:
break;
case AMF_DATA_TYPE_MIXEDARRAY:
url_fskip(ioc, 4);
while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
return -1;
}
if(get_byte(ioc) != AMF_END_OF_OBJECT)
return -1;
break;
case AMF_DATA_TYPE_ARRAY: {
unsigned int arraylen, i;
arraylen = get_be32(ioc);
for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) {
if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
return -1;
}
}
break;
case AMF_DATA_TYPE_DATE:
url_fskip(ioc, 8 + 2);
break;
default:
return -1;
}
if(depth == 1 && key) {
acodec = astream ? astream->codec : NULL;
vcodec = vstream ? vstream->codec : NULL;
if(amf_type == AMF_DATA_TYPE_BOOL) {
} else if(amf_type == AMF_DATA_TYPE_NUMBER) {
if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE;
else if(!strcmp(key, "videodatarate") && vcodec && 0 <= (int)(num_val * 1024.0))
vcodec->bit_rate = num_val * 1024.0;
}
}
return 0;
}
| 1threat |
int gdbserver_start(const char *device)
{
GDBState *s;
char gdbstub_device_name[128];
CharDriverState *chr = NULL;
CharDriverState *mon_chr;
if (!device)
return -1;
if (strcmp(device, "none") != 0) {
if (strstart(device, "tcp:", NULL)) {
snprintf(gdbstub_device_name, sizeof(gdbstub_device_name),
"%s,nowait,nodelay,server", device);
device = gdbstub_device_name;
}
#ifndef _WIN32
else if (strcmp(device, "stdio") == 0) {
struct sigaction act;
memset(&act, 0, sizeof(act));
act.sa_handler = gdb_sigterm_handler;
sigaction(SIGINT, &act, NULL);
}
#endif
chr = qemu_chr_new("gdb", device, NULL);
if (!chr)
return -1;
qemu_chr_add_handlers(chr, gdb_chr_can_receive, gdb_chr_receive,
gdb_chr_event, NULL);
}
s = gdbserver_state;
if (!s) {
s = g_malloc0(sizeof(GDBState));
gdbserver_state = s;
qemu_add_vm_change_state_handler(gdb_vm_state_change, NULL);
mon_chr = g_malloc0(sizeof(*mon_chr));
mon_chr->chr_write = gdb_monitor_write;
monitor_init(mon_chr, 0);
} else {
if (s->chr)
qemu_chr_delete(s->chr);
mon_chr = s->mon_chr;
memset(s, 0, sizeof(GDBState));
}
s->c_cpu = first_cpu;
s->g_cpu = first_cpu;
s->chr = chr;
s->state = chr ? RS_IDLE : RS_INACTIVE;
s->mon_chr = mon_chr;
s->current_syscall_cb = NULL;
return 0;
} | 1threat |
bdrv_driver_pwritev_compressed(BlockDriverState *bs, uint64_t offset,
uint64_t bytes, QEMUIOVector *qiov)
{
BlockDriver *drv = bs->drv;
if (!drv->bdrv_co_pwritev_compressed) {
return -ENOTSUP;
return drv->bdrv_co_pwritev_compressed(bs, offset, bytes, qiov); | 1threat |
How do I do a media query in the code calling external css? : <p>I have a sidebar designed in a standalone css file. I only want to apply a css file if not on my phone.</p>
| 0debug |
Faster way to compute index of half life value : I want to find the index of the half-life value of an array.
Is there a built-in function or faster way to compute the following?
x = np.array([67, 51, 42, 37, 21, 10, 2, 2, 1, 1, 1])
def half_life_idx(x):
middle = sum(x) / 2
for idx, val in enumerate(x):
middle = middle - val
if middle <= 0:
break
return idx
half_life_idx(x)
>> 1
| 0debug |
bool iommu_dma_memory_valid(DMAContext *dma, dma_addr_t addr, dma_addr_t len,
DMADirection dir)
{
target_phys_addr_t paddr, plen;
#ifdef DEBUG_IOMMU
fprintf(stderr, "dma_memory_check context=%p addr=0x" DMA_ADDR_FMT
" len=0x" DMA_ADDR_FMT " dir=%d\n", dma, addr, len, dir);
#endif
while (len) {
if (dma->translate(dma, addr, &paddr, &plen, dir) != 0) {
return false;
}
if (plen > len) {
plen = len;
}
len -= plen;
addr += plen;
}
return true;
}
| 1threat |
document.getElementById('input').innerHTML = user_input; | 1threat |
how to parse int json to textview without a list : <p>i'm tyring to get parse json in int to textview in xml but dont know how.</p>
<p><strong>this is the json</strong></p>
<pre><code>{
"sys":
{
"sunrise":1381107633,
"sunset":1381149604
}
}
</code></pre>
<p>i'm tyring to call the textview and change it to int but still didn't work.</p>
<pre><code>TextView asetBaik = (TextView) findViewById(R.id.asetangka);
</code></pre>
<p>and this is how i call the json</p>
<pre><code>@Override
protected String doInBackground(String... params) {
String link_url = "https://example.com/api/sun";
JSONParser jParser = new JSONParser();
JSONObject json = jParser.AmbilJson(link_url);
try {
JSONObject data = json.getJSONObject("sys");
baik = Integer.parseInt(asetBaik.getText().toString());
baik = data.getInt("sunrise");
asetBaik.setText(baik);
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(String s) {
pDialog.dismiss();
}
}
</code></pre>
<p>please help me how i can take the int value json and take it in Sting TextView</p>
| 0debug |
Difference between Cocoa Touch Framework and Cocoa Touch Static Library? : <p>What is the difference between Cocoa Touch Framework and Cocoa Touch Static Library?
In which scenario both can be used?</p>
| 0debug |
static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, unsigned int src_size)
{
unsigned i;
#ifdef HAVE_MMX
long mmx_size= 23 - src_size;
asm volatile (
"movq "MANGLE(mask24r)", %%mm5 \n\t"
"movq "MANGLE(mask24g)", %%mm6 \n\t"
"movq "MANGLE(mask24b)", %%mm7 \n\t"
".balign 16 \n\t"
"1: \n\t"
PREFETCH" 32(%1, %%"REG_a") \n\t"
"movq (%1, %%"REG_a"), %%mm0 \n\t"
"movq (%1, %%"REG_a"), %%mm1 \n\t"
"movq 2(%1, %%"REG_a"), %%mm2 \n\t"
"psllq $16, %%mm0 \n\t"
"pand %%mm5, %%mm0 \n\t"
"pand %%mm6, %%mm1 \n\t"
"pand %%mm7, %%mm2 \n\t"
"por %%mm0, %%mm1 \n\t"
"por %%mm2, %%mm1 \n\t"
"movq 6(%1, %%"REG_a"), %%mm0 \n\t"
MOVNTQ" %%mm1, (%2, %%"REG_a")\n\t"
"movq 8(%1, %%"REG_a"), %%mm1 \n\t"
"movq 10(%1, %%"REG_a"), %%mm2 \n\t"
"pand %%mm7, %%mm0 \n\t"
"pand %%mm5, %%mm1 \n\t"
"pand %%mm6, %%mm2 \n\t"
"por %%mm0, %%mm1 \n\t"
"por %%mm2, %%mm1 \n\t"
"movq 14(%1, %%"REG_a"), %%mm0 \n\t"
MOVNTQ" %%mm1, 8(%2, %%"REG_a")\n\t"
"movq 16(%1, %%"REG_a"), %%mm1 \n\t"
"movq 18(%1, %%"REG_a"), %%mm2 \n\t"
"pand %%mm6, %%mm0 \n\t"
"pand %%mm7, %%mm1 \n\t"
"pand %%mm5, %%mm2 \n\t"
"por %%mm0, %%mm1 \n\t"
"por %%mm2, %%mm1 \n\t"
MOVNTQ" %%mm1, 16(%2, %%"REG_a")\n\t"
"add $24, %%"REG_a" \n\t"
" js 1b \n\t"
: "+a" (mmx_size)
: "r" (src-mmx_size), "r"(dst-mmx_size)
);
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
if(mmx_size==23) return;
src+= src_size;
dst+= src_size;
src_size= 23-mmx_size;
src-= src_size;
dst-= src_size;
#endif
for(i=0; i<src_size; i+=3)
{
register uint8_t x;
x = src[i + 2];
dst[i + 1] = src[i + 1];
dst[i + 2] = src[i + 0];
dst[i + 0] = x;
}
}
| 1threat |
Instrumented tests failure with AndroidJUnitRunner 1.0.0 and AssertJ : <p>I'm trying to update my project to recently released Android Test Support library version <strong>1.0.0</strong>. But if I add <code>assertj-core</code> dependency Gradle instrumented test tasks start to fail with "No tests found" message. I can successfully run individual tests from IDE though.</p>
<p>It is easy to reproduce the problem: </p>
<ol>
<li>Create new project from Android Studio 3 with empty activity.</li>
<li>Add <code>assertj-core</code> dependency.</li>
<li>Run instrumentation tests from command line <code>./gradlew connectedDebugAndroidTest</code>.</li>
</ol>
<p>Gradle script.</p>
<pre><code>android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.0'
androidTestImplementation group: "org.assertj", name: "assertj-core", version: "2.8.0"
}
</code></pre>
<p>Console output.</p>
<pre><code>com.android.builder.testing.ConnectedDevice > No tests found.
[Nexus_4_API_25(AVD) - 7.1.1] FAILED
No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).
</code></pre>
<p>Tests successfully run if downgrade <code>com.android.support.test:runner</code> to previous version <strong>0.5</strong>.</p>
| 0debug |
i am getting error as Unparseable date: " " : I am taking the date as input from jsp and then I need to store in the database using hibernate.
my date format is also correct but still, it's not working.
Here is my code:
String dateStr = request.getParameter("receive_date");
DateFormat formatter = new SimpleDateFormat("E MMM dd HH:mm:ss Z yyyy");
Date date = (Date)formatter.parse(dateStr);
System.out.println(date);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
String formatedDate = cal.get(Calendar.DATE) + "/"+ (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.YEAR);
out.println("formatedDate : " + formatedDate);
| 0debug |
Why out variable in System class is "static"? : <p>Why is "out" variable in System class of java.lang package "static" in JAVA?
I Know that System is a static class and println() in PrintStream Class is not a static method. What is the relation in between these two?</p>
| 0debug |
void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
{
MigrationParameters *params;
params = qmp_query_migrate_parameters(NULL);
if (params) {
assert(params->has_compress_level);
monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_LEVEL),
params->compress_level);
assert(params->has_compress_threads);
monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_str(MIGRATION_PARAMETER_COMPRESS_THREADS),
params->compress_threads);
assert(params->has_decompress_threads);
monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_str(MIGRATION_PARAMETER_DECOMPRESS_THREADS),
params->decompress_threads);
assert(params->has_cpu_throttle_initial);
monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INITIAL),
params->cpu_throttle_initial);
assert(params->has_cpu_throttle_increment);
monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_str(MIGRATION_PARAMETER_CPU_THROTTLE_INCREMENT),
params->cpu_throttle_increment);
assert(params->has_tls_creds);
monitor_printf(mon, "%s: '%s'\n",
MigrationParameter_str(MIGRATION_PARAMETER_TLS_CREDS),
params->tls_creds);
assert(params->has_tls_hostname);
monitor_printf(mon, "%s: '%s'\n",
MigrationParameter_str(MIGRATION_PARAMETER_TLS_HOSTNAME),
params->tls_hostname);
assert(params->has_max_bandwidth);
monitor_printf(mon, "%s: %" PRId64 " bytes/second\n",
MigrationParameter_str(MIGRATION_PARAMETER_MAX_BANDWIDTH),
params->max_bandwidth);
assert(params->has_downtime_limit);
monitor_printf(mon, "%s: %" PRId64 " milliseconds\n",
MigrationParameter_str(MIGRATION_PARAMETER_DOWNTIME_LIMIT),
params->downtime_limit);
assert(params->has_x_checkpoint_delay);
monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_str(MIGRATION_PARAMETER_X_CHECKPOINT_DELAY),
params->x_checkpoint_delay);
assert(params->has_block_incremental);
monitor_printf(mon, "%s: %s\n",
MigrationParameter_str(MIGRATION_PARAMETER_BLOCK_INCREMENTAL),
params->block_incremental ? "on" : "off");
monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_str(MIGRATION_PARAMETER_X_MULTIFD_CHANNELS),
params->x_multifd_channels);
monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_str(MIGRATION_PARAMETER_X_MULTIFD_PAGE_COUNT),
params->x_multifd_page_count);
monitor_printf(mon, "%s: %" PRId64 "\n",
MigrationParameter_str(MIGRATION_PARAMETER_XBZRLE_CACHE_SIZE),
params->xbzrle_cache_size);
}
qapi_free_MigrationParameters(params);
}
| 1threat |
document.getElementById('input').innerHTML = user_input; | 1threat |
How is this type of input label accomplished? : <p>I'm trying to figure out how these HTML inputs are achieved:</p>
<p><a href="https://i.stack.imgur.com/9kDa3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9kDa3.png" alt="enter image description here"></a></p>
<p>Google uses these inputs where the placeholder transitions up into the corner and becomes the label once the input is clicked. I thought they were somehow using the <code><fieldset></code> with the <code><legend></code> to accomplish this, but inspecting the code shows they are using an input with a div.. Is there a native way to do this I haven't heard of, or does anyone know how this is accomplished? </p>
<p><a href="https://accounts.google.com/signin/v2/identifier?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin" rel="nofollow noreferrer">example link</a></p>
| 0debug |
How do you convert a character to its binary ASCII code in java? Also does the binary value have to be a String or a char? : <pre><code>1.char chCharacter = 'A';
2.int iBinaryCode;
</code></pre>
<ol>
<li>Storing the character in a char </li>
<li>Where I want to store the binary value</li>
</ol>
| 0debug |
Wake up the bot on a hi and should start with same functionality : Any one kindly can tell how to wake up the bot on Hi.Actually I am in a dialog named as product issue having a prompt of adaptive card , i just want after clicking on that adaptive card it go to main dialog show functionality with which my bot have began. | 0debug |
How to cast from Double to Int? : <p>Suppose I have a <code>Double</code> and I create an <code>Int</code> from the <code>Double</code>:</p>
<pre><code>var a : Double = 4.0
var b = Int(a)
</code></pre>
<p>In the past, the above code could result in <code>b=3</code> if <code>a</code> was internally represented as <code>3.999999999999999</code>. Do we not have to worry about this anymore in Swift? What is the correct way to cast a Double to an Int?</p>
| 0debug |
static int query_formats(AVFilterContext *ctx)
{
static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_GRAY8,
AV_PIX_FMT_YUV410P, AV_PIX_FMT_YUV411P,
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P,
AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P,
AV_PIX_FMT_YUVJ440P, AV_PIX_FMT_YUVJ444P,
AV_PIX_FMT_YUVJ411P,
AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA420P,
AV_PIX_FMT_NONE
};
AVFilterFormats *fmts_list = ff_make_format_list(pix_fmts);
if (!fmts_list)
return AVERROR(ENOMEM);
ff_set_common_formats(ctx, fmts_list);
return 0;
}
| 1threat |
How to call another function within the same object? : <pre><code>let role = {
test: (variable) => {
// How do I call toLog(variable) from here?
},
toLog: (variable) => {
console.log(variable);
}
};
</code></pre>
<p>I'd like to call the toLog() function within the test() function but I'm unaware how to.</p>
| 0debug |
void shpc_cleanup(PCIDevice *d, MemoryRegion *bar)
{
SHPCDevice *shpc = d->shpc;
d->cap_present &= ~QEMU_PCI_CAP_SHPC;
memory_region_del_subregion(bar, &shpc->mmio);
g_free(shpc->config);
g_free(shpc->cmask);
g_free(shpc->wmask);
g_free(shpc->w1cmask);
g_free(shpc);
} | 1threat |
How to format regex? : <p>I have this:
<a href="https://regexr.com/3jo8c" rel="nofollow noreferrer">https://regexr.com/3jo8c</a></p>
<p>what i want is to have valid only like this:</p>
<p>from 10,00- to 10,99
from 100,00 - to 100,99
from 1000,00 - to 1000,99</p>
<p>so to have always x,<strong>xx</strong></p>
<p>and so on.
Any suggestion?</p>
| 0debug |
Why I got x=0.15000000000000002 during adding 0.050 in each step using while lopp in python : <p>I run the below python code, </p>
<pre><code>x=0
while x<1:
x+=0.050
print(x)
</code></pre>
<p>and got the following result. Which I don't understand. </p>
<p>0.05
0.1
0.15000000000000002
0.2
0.25
0.3
0.35
0.39999999999999997
0.44999999999999996
0.49999999999999994
0.5499999999999999
0.6
0.65
0.7000000000000001
0.7500000000000001
0.8000000000000002
0.8500000000000002
0.9000000000000002
0.9500000000000003
1.0000000000000002</p>
| 0debug |
How to not let user select past date in input type date? : <p>I'm creating a website for doctor appointments, and in the form the user can select the date when he wants to go to the appointment. The problem is that the input type 'date' lets the user select past date, and still submit the form.</p>
<p>I want to not let the user be able to select past date, and being able to only select today date or future date (tomorrow or another date of the month).</p>
<p>How can I achieve that without plugins (datepicker and others)?</p>
| 0debug |
Subscribe to single property change in store in Redux : <p>In Redux I can easily subscribe to store changes with</p>
<pre><code>store.subscribe(() => my handler goes here)
</code></pre>
<p>But what if my store is full of different objects and in a particular place in my app I want to subscribe to changes made only in a specific object in the store?</p>
| 0debug |
How to draw a circle in Xcode for macOS app? : [Screenshot of layout of the app][1]
How can I draw a circle as a background of the VDOT score in Swift using XCode? (45.0 in the screenshot)
[So that it looks a bit like this][2]
[1]: https://i.stack.imgur.com/TB6pn.png
[2]: https://i.stack.imgur.com/Ka0ge.png | 0debug |
Swift 3 Load JSON in Tableview : <p>I'm currently working on an app and I would like to display the data I got from a JSON webpage in a TableView... My code to save the JSON-data in an array already works as I can print them every time in the console but the data doesn't load in the tableview and I tried almost everything: changing the cell identifier, using custom cells, etc... Anyone ideas on how to solve this problem?</p>
<pre><code>import UIKit
class TableViewController: UIViewController {
@IBOutlet weak var tableView: UITableView!
var names: [String] = []
var rating: [String] = []
override func viewDidLoad() {
super.viewDidLoad()
let url=URL(string:"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=51.0460761,3.7286716&radius=300&type=bar&key=AIzaSyCpHkY1s-qZjTOyTvDjMgD6hr5VTtEOgpU")
do {
let allContactsData = try Data(contentsOf: url!)
let allContacts = try JSONSerialization.jsonObject(with: allContactsData, options: JSONSerialization.ReadingOptions.allowFragments) as! [String : AnyObject]
if let arrJSON = allContacts["results"] {
for index in 0...arrJSON.count-1 {
let aObject = arrJSON[index] as! [String : AnyObject]
names.append(aObject["name"] as! String)
rating.append(aObject["id"] as! String)
}
}
print(names)
print(rating)
self.tableView.reloadData()
}
catch {
}
}
func tableView(_ tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
return names.count;
}
func tableView(_ tableView: UITableView!, didSelectRowAtIndexPath indexPath: IndexPath!) {
print("You selected name : "+names[indexPath.row])
}
func tableView(_ tableView: UITableView, cellForRowAtIndexPath indexPath: IndexPath) -> UITableViewCell{
var cell = tableView.dequeueReusableCell(withIdentifier: "cell")
if !(cell != nil) {
cell = UITableViewCell(style: .subtitle, reuseIdentifier: "cell")
}
cell?.textLabel?.text=self.names[indexPath.row]
cell?.detailTextLabel?.text = self.rating[indexPath.row]
return cell!
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
override func viewWillAppear(_ animated: Bool) {
// Hide the navigation bar on the this view controller
self.navigationController?.setNavigationBarHidden(true, animated: true)
}
override func viewWillDisappear(_ animated: Bool) {
// Show the navigation bar on other view controllers
self.navigationController?.setNavigationBarHidden(false, animated: true)
}
}
</code></pre>
<p><a href="https://i.stack.imgur.com/qQ4X2.png" rel="nofollow noreferrer">As you can see he gives me the 2 lists...</a></p>
| 0debug |
Compound literal lifetime and if blocks : <p>This is a theoretical question, I know how to do this unambiguously, but I got curious and dug into the standard and I need a second pair of standards lawyer eyes.</p>
<p>Let's start with two structs and one init function:</p>
<pre><code>struct foo {
int a;
};
struct bar {
struct foo *f;
};
struct bar *
init_bar(struct foo *f)
{
struct bar *b = malloc(sizeof *b);
if (!b)
return NULL;
b->f = f;
return b;
}
</code></pre>
<p>We now have a sloppy programmer who doesn't check return values:</p>
<pre><code>void
x(void)
{
struct bar *b;
b = init_bar(&((struct foo){ .a = 42 }));
b->f->a++;
free(b);
}
</code></pre>
<p>From my reading of the standard there's nothing wrong here other than potentially dereferencing a NULL pointer. Modifying <code>struct foo</code> through the pointer in <code>struct bar</code> should be legal because the lifetime of the compound literal sent into <code>init_bar</code> is the block where it's contained, which is the whole function <code>x</code>.</p>
<p>But now we have a more careful programmer:</p>
<pre><code>void
y(void)
{
struct bar *b;
if ((b = init_bar(&((struct foo){ .a = 42 }))) == NULL)
err(1, "couldn't allocate b");
b->f->a++;
free(b);
}
</code></pre>
<p>Code does the same thing, right? So it should work too. But more careful reading of the C11 standard is leading me to believe that this leads to undefined behavior. (emphasis in quotes mine)</p>
<blockquote>
<p>6.5.2.5 Compound literals</p>
<p>5 The value of the compound literal is that of an unnamed object initialized by the
initializer list. If the compound literal occurs outside the body of a function, the object
has static storage duration; otherwise, <em>it has automatic storage duration associated with
the enclosing block</em>.</p>
<p>6.8.4 Selection statements</p>
<p>3 <em>A selection statement is a block</em> whose scope is a strict subset of the scope of its
enclosing block. Each associated substatement is also a block whose scope is a strict
subset of the scope of the selection statement.</p>
</blockquote>
<p>Am I reading this right? Does the fact that the <code>if</code> is a block mean that the lifetime of the compound literal is just the if statement?</p>
<p>(In case anyone wonders about where this contrived example came from, in real code <code>init_bar</code> is actually <code>pthread_create</code> and the thread is joined before the function returns, but I didn't want to muddy the waters by involving threads).</p>
| 0debug |
Please explian me the below sql statements? : Please explain me the below example?
SELECT GROUP_CONCAT(COLUMN_NAME) FROM information_schema.`COLUMNS` C
WHERE table_name = 'table_name' AND COLUMN_NAME =('columns_name') INTO @COLUMNS;
SET @table = 'cycle_plan';
SET @s = CONCAT('SELECT ',@columns,' FROM ', @table);
PREPARE stmt FROM @s; | 0debug |
SQL COUNT() statement not working : <p>I am trying to return the total number of reserved seats in my flightbooking table using a flightID number.</p>
<pre><code>SELECT COUNT(flight.flightid) AS reservedseats FROM flightbooking
WHERE status=R
</code></pre>
<p>I get an error saying</p>
<blockquote>
<p>ERROR: missing FROM-clause entry for table "flight"
LINE 1: SELECT COUNT(flight.flightid) AS reservedseats FROM flightbo...</p>
</blockquote>
<p>What am i doing wrong?</p>
| 0debug |
static VirtIOBlockReq *virtio_blk_get_request(VirtIOBlock *s)
{
VirtIOBlockReq *req = virtio_blk_alloc_request(s);
if (!virtqueue_pop(s->vq, req->elem)) {
virtio_blk_free_request(req);
return NULL;
}
return req;
}
| 1threat |
AccessDeniedException: Unable to determine service/operation name to be authorized : <p>Using AWS CLI</p>
<pre><code>aws --version
aws-cli/1.11.21 Python/2.7.12 Darwin/15.3.0 botocore/1.4.78
</code></pre>
<p>Creating a POST method for API Gateway as explained at <a href="https://github.com/arun-gupta/serverless/tree/master/aws/microservice#post-method" rel="noreferrer">https://github.com/arun-gupta/serverless/tree/master/aws/microservice#post-method</a>. This method can be invoked successfully using <code>test-invoke-method</code> and AWS Console.</p>
<p>Creating a GET method using AWS CLI <a href="https://github.com/arun-gupta/serverless/tree/master/aws/microservice#get-method" rel="noreferrer">https://github.com/arun-gupta/serverless/tree/master/aws/microservice#get-method</a>. Invoking this method using <code>test-invoke-method</code> and AWS Console gives the following error:</p>
<pre><code>{
"status": 500,
"body": "{\"message\": \"Internal server error\"}",
"log": "Execution log for request test-request\nThu Dec 29 00:58:56 UTC 2016 : Starting execution for request: test-invoke-request\nThu Dec 29 00:58:56 UTC 2016 : HTTP Method: GET, Resource Path: /books\nThu Dec 29 00:58:56 UTC 2016 : Method request path: {}\nThu Dec 29 00:58:56 UTC 2016 : Method request query string: {}\nThu Dec 29 00:58:56 UTC 2016 : Method request headers: {}\nThu Dec 29 00:58:56 UTC 2016 : Method request body before transformations: \nThu Dec 29 00:58:56 UTC 2016 : Endpoint request URI: https://lambda.us-west-1.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-west-1:598307997273:function:MicroserviceGetAll/invocations\nThu Dec 29 00:58:56 UTC 2016 : Endpoint request headers: {x-amzn-lambda-integration-tag=test-request, Authorization=******************************************************************************************************************************************************************************************************************************************************************************************************482377, X-Amz-Date=20161229T005856Z, x-amzn-apigateway-api-id=sofl9ilki7, X-Amz-Source-Arn=arn:aws:execute-api:us-west-1:598307997273:sofl9ilki7/null/GET/books, Accept=application/json, User-Agent=AmazonAPIGateway_sofl9ilki7, Host=lambda.us-west-1.amazonaws.com, X-Amzn-Trace-Id=Root=1-58645fd0-7d733ae3c383f4378fcc0338}\nThu Dec 29 00:58:56 UTC 2016 : Endpoint request body after transformations: \nThu Dec 29 00:58:56 UTC 2016 : Endpoint response body before transformations: <AccessDeniedException>\n <Message>Unable to determine service/operation name to be authorized</Message>\n</AccessDeniedException>\n\nThu Dec 29 00:58:56 UTC 2016 : Endpoint response headers: {x-amzn-RequestId=f95a8659-cd61-11e6-80f6-ddd6ce5b7e8b, Connection=keep-alive, Content-Length=130, Date=Thu, 29 Dec 2016 00:58:56 GMT}\nThu Dec 29 00:58:56 UTC 2016 : Lambda invocation failed with status: 403\nThu Dec 29 00:58:56 UTC 2016 : Execution failed due to configuration error: \nThu Dec 29 00:58:56 UTC 2016 : Method completed with status: 500\n",
"latency": 39
}
</code></pre>
<p>The ARN identified in the error message is <code>arn:aws:execute-api:us-west-1:598307997273:sofl9ilki7/null/GET/books</code>. Wondering if <code>null</code> instead of <code>test</code> is causing this to fail?</p>
| 0debug |
Writing a small C# application for bachelor thesis - Should I use MVC-Pattern? : <p>I am currently writing my bachelor thesis about process optimization for creation of XML rendering Stylesheets for another application.
Therefore I am writing a very small and super basic software tool which displays XML structures in tree views. It enables the user to change those (add and delete nodes) and to do some simple application specific stuff.</p>
<p>For doing that, I use Windows Forms.</p>
<p>My question is <strong>if I should use a specific architecture</strong> or design pattern like MVC or if it would be sufficient to only stick to basic patterns like factory method, command, observer etc.
I am afraid that MVC would be overkill. But on the other hand I am afraid that I should make use of it as it is for a thesis...</p>
<p>The tool should only run on desktop. I don't think there will be any update after initial development.</p>
<p>Hoping for some toughs...</p>
| 0debug |
c++ nested structure initialization and accessing the members : <pre><code>struct Point
{
double x,y;
};
Point p;
struct Disk
{
Point center;
int radius;
};
Disk d;
int main()
{
d.center.x=1.2;
cout<<p.x;
}
</code></pre>
<p>Could someone please explain me the output of this code?
why am I not getting the value of x as 1.2 and 0 instead?</p>
| 0debug |
how to display all those users on map which are at particular distance away from the current user? : <p>I want to store user's current location when they log in and display only those users on map which are at a particular distance away from current_user(say 20km).</p>
| 0debug |
static void wav_destroy (void *opaque)
{
WAVState *wav = opaque;
uint8_t rlen[4];
uint8_t dlen[4];
uint32_t datalen = wav->bytes;
uint32_t rifflen = datalen + 36;
if (!wav->f) {
return;
}
le_store (rlen, rifflen, 4);
le_store (dlen, datalen, 4);
qemu_fseek (wav->f, 4, SEEK_SET);
qemu_put_buffer (wav->f, rlen, 4);
qemu_fseek (wav->f, 32, SEEK_CUR);
qemu_put_buffer (wav->f, dlen, 4);
qemu_fclose (wav->f);
if (wav->path) {
qemu_free (wav->path);
}
}
| 1threat |
static bool blit_is_unsafe(struct CirrusVGAState *s, bool dst_only)
{
assert(s->cirrus_blt_width > 0);
assert(s->cirrus_blt_height > 0);
if (s->cirrus_blt_width > CIRRUS_BLTBUFSIZE) {
return true;
}
if (blit_region_is_unsafe(s, s->cirrus_blt_dstpitch,
s->cirrus_blt_dstaddr & s->cirrus_addr_mask)) {
return true;
}
if (dst_only) {
return false;
}
if (blit_region_is_unsafe(s, s->cirrus_blt_srcpitch,
s->cirrus_blt_srcaddr & s->cirrus_addr_mask)) {
return true;
}
return false;
}
| 1threat |
static void qmp_input_start_alternate(Visitor *v, const char *name,
GenericAlternate **obj, size_t size,
bool promote_int, Error **errp)
{
QmpInputVisitor *qiv = to_qiv(v);
QObject *qobj = qmp_input_get_object(qiv, name, false, errp);
if (!qobj) {
*obj = NULL;
return;
}
*obj = g_malloc0(size);
(*obj)->type = qobject_type(qobj);
if (promote_int && (*obj)->type == QTYPE_QINT) {
(*obj)->type = QTYPE_QFLOAT;
}
}
| 1threat |
IE11 throwing "SCRIPT1014: invalid character" where all other browsers work : <p>Here's a new one, IE11 is throwing errors on code that works in every other browser. </p>
<p>Anyway, after a few hours of "fixing" code so that IE11 doesn't fall on its own face I have come across an error I just cannot seem to find a solution to. Here is the code in question:</p>
<pre><code>$('input[name="messageAccount"]').change(function () {
$aButton.show();
var addedIds = $("#hdnfield").val();
if (addedIds == null || addedIds === "") {
$("#hdnfield").val(this.value);
} else {
$("#hdnfield").val(`${addedIds}${this.value}`);
};
});
</code></pre>
<p>This is nested on the inside of the success call in an Ajax request. IE's debugger is saying the error is coming from the content of the <code>else</code> statement but it's also reading all the brackets wrong. For example the opening parenthesis on this function is being "closed" after the closing bracket for the Ajax request... (hopefully that made sense). </p>
<p>Has anyone else had a similar issue with IE before? I've got a number of other bugs to fix so if there are any replies I will post back as soon as I can. Thanks in advance.</p>
<p>EDIT: just for reference I am currently running this locally and is part of what will become an internally hosted web app.</p>
| 0debug |
Use of variables like %{buildDir} in QtCreator kit settings in Qt5 : <p>In <a href="http://doc.qt.io/qtcreator/creator-run-settings.html" rel="noreferrer">this documentation</a> (under section "Specifying a Custom Executable to Run") I noticed that there is mention of what looks like a variable <code>%{buildDir}</code> in the field "Working directory".</p>
<p><a href="https://i.stack.imgur.com/dShAh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/dShAh.png" alt="enter image description here"></a></p>
<p>I have struggled for a while now to find documentation for this feature. I would like to know first of all <strong>is there documentation for this somewhere?</strong>.</p>
<p>Secondary questions: </p>
<ul>
<li>What other variables are available?</li>
<li>In which fields can they be used?</li>
<li>Can I access variables that I created in my project's <code>.pro</code> file?</li>
<li>Are there any other eval features or is this mechanism limited to variables?</li>
</ul>
<p>Thanks!</p>
| 0debug |
What is an http request multiplexer? : <p>I've been studying golang and I noticed a lot of people create servers by using the <code>http.NewServeMux()</code> function and I don't really understand what it does.</p>
<p>I read this:</p>
<blockquote>
<p>In go ServeMux is an HTTP request multiplexer. It matches the URL of
each incoming request against a list of registered patterns and calls
the handler for the pattern that most closely matches the URL.</p>
</blockquote>
<p>How is that different than just doing something like:</p>
<pre><code>http.ListenAndServe(addr, nil)
http.Handle("/home", home)
http.Handle("/login", login)
</code></pre>
<p>What is the purpose of using multiplexing?</p>
| 0debug |
int ffurl_get_file_handle(URLContext *h)
{
if (!h->prot->url_get_file_handle)
return -1;
return h->prot->url_get_file_handle(h);
}
| 1threat |
How to toggle class when input lenght is not 0 : how to add class when input [type="email"] has lenght > 0 and remove class if input lenght = 0?
Im not so good in javascript. The solution can be in vue.js or pure javascript.
I tried a few examples from the Internet, but without success.
```
<div class="form-group">
<input type="email" name="email" required>
<label for="email">Email</label>
</div>
```
- add class if input lenght > 0
- remove class if input lenght = 0 | 0debug |
static int poll_filters(void)
{
AVFilterBufferRef *picref;
AVFrame *filtered_frame = NULL;
int i, ret, ret_all;
unsigned nb_success, nb_eof;
int64_t frame_pts;
while (1) {
for (i = 0; i < nb_output_streams; i++) {
OutputStream *ost = output_streams[i];
OutputFile *of = output_files[ost->file_index];
int ret = 0;
if (!ost->filter || ost->is_past_recording_time)
continue;
if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {
return AVERROR(ENOMEM);
} else
avcodec_get_frame_defaults(ost->filtered_frame);
filtered_frame = ost->filtered_frame;
while (1) {
AVRational ist_pts_tb = ost->filter->filter->inputs[0]->time_base;
if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
!(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
ret = av_buffersink_read_samples(ost->filter->filter, &picref,
ost->st->codec->frame_size);
else
#ifdef SINKA
ret = av_buffersink_read(ost->filter->filter, &picref);
#else
ret = av_buffersink_get_buffer_ref(ost->filter->filter, &picref,
AV_BUFFERSINK_FLAG_NO_REQUEST);
#endif
if (ret < 0) {
if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) {
char buf[256];
av_strerror(ret, buf, sizeof(buf));
av_log(NULL, AV_LOG_WARNING,
"Error in av_buffersink_get_buffer_ref(): %s\n", buf);
}
break;
}
if (ost->enc->type == AVMEDIA_TYPE_VIDEO)
filtered_frame->pts = frame_pts = av_rescale_q(picref->pts, ist_pts_tb, AV_TIME_BASE_Q);
else if (picref->pts != AV_NOPTS_VALUE)
filtered_frame->pts = frame_pts = av_rescale_q(picref->pts,
ost->filter->filter->inputs[0]->time_base,
ost->st->codec->time_base) -
av_rescale_q(of->start_time,
AV_TIME_BASE_Q,
ost->st->codec->time_base);
if (of->start_time && filtered_frame->pts < of->start_time) {
avfilter_unref_buffer(picref);
continue;
}
switch (ost->filter->filter->inputs[0]->type) {
case AVMEDIA_TYPE_VIDEO:
avfilter_fill_frame_from_video_buffer_ref(filtered_frame, picref);
filtered_frame->pts = frame_pts;
if (!ost->frame_aspect_ratio)
ost->st->codec->sample_aspect_ratio = picref->video->sample_aspect_ratio;
do_video_out(of->ctx, ost, filtered_frame,
same_quant ? ost->last_quality :
ost->st->codec->global_quality);
break;
case AVMEDIA_TYPE_AUDIO:
avfilter_copy_buf_props(filtered_frame, picref);
filtered_frame->pts = frame_pts;
do_audio_out(of->ctx, ost, filtered_frame);
break;
default:
av_assert0(0);
}
avfilter_unref_buffer(picref);
}
}
ret_all = nb_success = nb_eof = 0;
for (i = 0; i < nb_filtergraphs; i++) {
ret = avfilter_graph_request_oldest(filtergraphs[i]->graph);
if (!ret) {
nb_success++;
} else if (ret == AVERROR_EOF) {
nb_eof++;
} else if (ret != AVERROR(EAGAIN)) {
char buf[256];
av_strerror(ret, buf, sizeof(buf));
av_log(NULL, AV_LOG_WARNING,
"Error in request_frame(): %s\n", buf);
ret_all = ret;
}
}
if (!nb_success)
break;
}
return nb_eof == nb_filtergraphs ? AVERROR_EOF : ret_all;
} | 1threat |
How to rename a text file using an integer variable in Python? : <p>I want to rename a file xyz.txt to 1.txt. Consider 1 as an integer variable in 1.txt.</p>
<p>I have tried os.rename(old name, new name). But in the new name, I want to pass my integer variable + ".txt"</p>
| 0debug |
static unsigned tget_short(const uint8_t **p, int le)
{
unsigned v = le ? AV_RL16(*p) : AV_RB16(*p);
*p += 2;
return v;
}
| 1threat |
Select text following last $ in an expression? : <p>I am using a regular expression to extract the price on the right from the following HTML:</p>
<pre><code><p class="pricing ats-product-price"><em class="old_price">$99.99</em>$94.99</p>
</code></pre>
<p>Using preg match in PHP:</p>
<pre><code>preg_match_all('!<p class="pricing ats-product-price"><em class="old_price">.*?<\/em>(.*?)<\/p>!', $output, $prices);
</code></pre>
<p>Except, I noticed that sometimes the HTML doesn't include an old price. So sometimes the HTML looks like this:</p>
<pre><code><p class="pricing ats-product-price">$129.99</p>
</code></pre>
<p>It seems like my goal should be to extract the <em>last</em> price from the expression, or in other words the text that directly follows after the last question mark and before the <code></p></code>. This sort of expression is way out of my league though - hoping for some help here. Thanks.</p>
| 0debug |
Symfony: Parse Error: syntax error, unexpected 'security' (T_STRING), expecting ']' : <p>I am working with Symfony, and I am trying to include a service using services.yml, and I am getting this error:</p>
<p>Parse Error: syntax error, unexpected 'security' (T_STRING), expecting ']'</p>
<p>Everything seems fine. I checked the service I created, and there's nothing wrong with it. </p>
| 0debug |
CSS Selector not working - what could it be? : I am looking into changing all the download buttons from the website I manage...for that I downloaded the Easy Media Download plugin for Wordpress.
For custom styling, it allows you to add a Class.
So i have added the class "download" to it.
The download button which I am referring is the VIDEO one.
http://www.boardinggate.com.br/pt/recursos-trade/rt-beachcomber/rt-beachcomber-canonnier?vhp_flush_do=http%3A%2F%2Fwww.boardinggate.com.br%2Fpt%2Frecursos-trade%2Frt-beachcomber%2Frt-beachcomber-canonnier%2F&_wpnonce=226eac493a
When I try to edit - for example:
.download {
font-family: Qanelas, Arial !important;
text-align: left !important;
text-transform: uppercase !important;
}
or
.emd_dl_blue.download {
font-family: Qanelas, Arial !important;
text-align: left !important;
text-transform: uppercase !important;
}
IT DOESN'T work...can some help me on this?
Have already tried dozens of different class selectors to try do style that button... | 0debug |
void visit_start_list(Visitor *v, const char *name, GenericList **list,
size_t size, Error **errp)
{
Error *err = NULL;
assert(!list || size >= sizeof(GenericList));
v->start_list(v, name, list, size, &err);
if (list && v->type == VISITOR_INPUT) {
assert(!(err && *list));
}
error_propagate(errp, err);
}
| 1threat |
How to change the back ground color of an Acive link : How can i change the background color of an active link .I mean the current active link to have a change in color . | 0debug |
RegEx----What is mean "?!:"? : <p><a href="https://i.stack.imgur.com/QEI0r.png" rel="nofollow noreferrer">codes image</a>
If the question: Will the regular expression "?!:" What does that mean?</p>
| 0debug |
Adjust the height of individual jupyter notebook cells : <p>The <code>custom.css</code> works very well for adjusting the width of a <code>jupyter</code> notebook (and the <code>font size</code> while we are at it..):</p>
<pre><code>.container { width:100% !important; height: 200px; }
.CodeMirror pre {font-family: Monaco; font-size: 9pt;}
</code></pre>
<p>The cell <strong><em>height</em></strong> is trickier however since we do not want <em>all</em> cells to be made overly tall. </p>
<p>Here is an example of a cell "wanting" more vertical headroom:</p>
<p><a href="https://i.stack.imgur.com/s79qP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/s79qP.png" alt="enter image description here"></a></p>
<p>Is there a per-cell approach to achieve this? There are actually two parts to this question:</p>
<ul>
<li><p>How to do this for <code>python</code> kernels (probably the easiest):</p></li>
<li><p>How to change the cell height for other kernels: specifically we are interested in <code>R</code> and <code>Spark</code></p></li>
</ul>
| 0debug |
how to sort the table view from A-z : i am getting some data from one url and try to display in my table view,In that i have three button name which is used to sort.Here is my `button action ` method:
@IBAction func sortByAZBtnPress(sender: AnyObject)
{
}
@IBAction func sortByRatingBtnPress(sender: AnyObject)
{
}
@IBAction func sortByRecentBtnPress(sender: AnyObject)
{
}
And here is my `bussinesstype.swift` model class
import UIKit
class BusinessData {
var BusinessName: String?
var Address: String?
var Rating: Float?
var ContactNumber: String?
init(json: NSDictionary) {
self.BusinessName = json["business_name"] as? String
self.Address = json["location"] as? String
self.Rating = json["__v"] as? Float
self.ContactNumber = json["phone_no"] as? String
}
}
Here is my `viewcontroller.swift`
import UIKit
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
var isTapped:Bool? // cell tap checking bool
var selectedIndex:NSIndexPath?
@IBOutlet weak var RightMenu: UIView!
@IBOutlet weak var tableView: UITableView! // UITable view declaration
var arrDict = [BusinessData]() // array to store the value from json
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
self.jsonParsingFromURL() // call the json method
// nib for custom cell (table view)
let nib = UINib(nibName:"customCell", bundle: nil)
tableView.registerNib(nib, forCellReuseIdentifier: "cell")
indicator = UIActivityIndicatorView(frame: CGRectMake(0, 0, 90, 90))
indicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyle.Gray
indicator.center = self.view.center
indicator.color = UIColor .redColor()
self.view.addSubview(indicator)
}
override func viewWillAppear(animated: Bool) {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "searchMethod:", name: "search", object: nil);
NSNotificationCenter.defaultCenter().addObserver(self, selector: "endSearch", name: "endSearch", object: nil);
}
// web services method
func jsonParsingFromURL ()
{
let url:NSURL = NSURL(string: "http://sample url/Fes?current_location=toronto&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyIkX18")!
if let JSONData = NSData(contentsOfURL: url)
{
if let json = (try? NSJSONSerialization.JSONObjectWithData(JSONData, options: [])) as? NSDictionary
{
if let reposArray = json["data"] as? [NSDictionary]
{
for item in reposArray
{
let itemObj = item as? Dictionary<String,AnyObject>
let b_type = itemObj!["business_type"]?.valueForKey("type")
if (b_type as? String == "Taxis")
{
arrDict.append(BusinessData(json: item))
}
}
}
}
}
}
// number of rows
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int
{
return 1
}
// height for each cell
func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat
{
return cellSpacingHeight
}
// calling each cell based on tap and users ( premium / non premium )
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
{
let cell:customCell = self.tableView.dequeueReusableCellWithIdentifier("cell") as! customCell
cell.vendorName.text = arrDict[indexPath.section].BusinessName
cell.vendorAddress.text = arrDict[indexPath.section].Address
cell.VendorRating.rating = arrDict[indexPath.section].Rating!
return cell
}
// MARK:
// MARK: Sort Method
@IBAction func sortByRevBtnPress(sender: AnyObject)
{
self.indicator.startAnimating()
self.indicator.hidden = false
RightMenu.hidden = true
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (Int64)(1 * NSEC_PER_SEC)), dispatch_get_main_queue()){
self.indicator.stopAnimating()
self.indicator.hidden = true
};
self.tableView.reloadData()
}
@IBAction func sortByAZBtnPress(sender: AnyObject)
{
RightMenu.hidden = true
}
@IBAction func sortByRatingBtnPress(sender: AnyObject)
{
RightMenu.hidden = true
}
@IBAction func sortByRecentBtnPress(sender: AnyObject)
{
RightMenu.hidden = true
}
}
please help me out, how can i sort the value in my table view `business_name` | 0debug |
Version ranges in gradle : <p>What are the possible ways of specifying version ranges in gradle dependencies? I saw some 1.+ notation but I have not found a document which really says what is possible and what is not. Furthermore, I do not know whether the Maven ranges can be used as well.</p>
<p>Can somebody give me a short overview so that I can understand the rules?</p>
| 0debug |
PyCharm type hinting enum iteration : <p>Python's enum class supports iteration, but PyCharm has trouble figuring this out.</p>
<pre><code>from enum import Enum
class Color(Enum):
RED = 0
BLUE = 1
for color in Color:
# Warning: Expected 'collections.Iterable', got 'Type[Color]' instead
print(color)
</code></pre>
<p>Though the method <code>EnumMeta.__iter__</code> exists, PyCharm has trouble figuring this out.</p>
<p>I don't mind manually adding type hinting to work around the problem, I'm just not sure what and where.</p>
| 0debug |
static BlockAIOCB *bdrv_co_aio_prw_vector(BdrvChild *child,
int64_t offset,
QEMUIOVector *qiov,
BdrvRequestFlags flags,
BlockCompletionFunc *cb,
void *opaque,
bool is_write)
{
Coroutine *co;
BlockAIOCBCoroutine *acb;
bdrv_inc_in_flight(child->bs);
acb = qemu_aio_get(&bdrv_em_co_aiocb_info, child->bs, cb, opaque);
acb->child = child;
acb->need_bh = true;
acb->req.error = -EINPROGRESS;
acb->req.offset = offset;
acb->req.qiov = qiov;
acb->req.flags = flags;
acb->is_write = is_write;
co = qemu_coroutine_create(bdrv_co_do_rw, acb);
qemu_coroutine_enter(co);
bdrv_co_maybe_schedule_bh(acb);
return &acb->common;
}
| 1threat |
How to iterate formgroup with array in Angular2 : <p>I'm working on a model driven form and I can't get it to add items to a list being displayed with ngFor. I'm currently getting an error when trying to iterate my list.</p>
<p>Error:</p>
<pre><code>Error: Cannot find control with path: 'locations -> i'
at new BaseException (exceptions.ts:21)
at _throwError (shared.ts:80)
at Object.setUpFormContainer (shared.ts:66)
at FormGroupDirective.addFormGroup (form_group_directive.ts:74)
at FormGroupName.AbstractFormGroupDirective.ngOnInit (abstract_form_group_directive.ts:37)
at DebugAppView._View_PersonFormComponent4.detectChangesInternal (PersonFormComponent.ngfactory.js:3197)
at DebugAppView.AppView.detectChanges (view.ts:260)
at DebugAppView.detectChanges (view.ts:378)
at DebugAppView.AppView.detectContentChildrenChanges (view.ts:279)
at DebugAppView._View_PersonFormComponent2.detectChangesInternal (PersonFormComponent.ngfactory.js:1995)
Raw person-form-builder.service.ts
</code></pre>
<p>formBuilderService:</p>
<pre><code>import {Injectable} from "@angular/core";
import {Validators, FormBuilder} from '@angular/forms';
import {Person} from './../components/person/person';
@Injectable()
export class PersonFormBuilderService {
constructor(private fb: FormBuilder) {
}
getForm(person: Person) {
return this.fb.group({
_id: [person._id],
name: this.fb.group({
first: [person.name.first],
middle: [person.name.middle],
last: [person.name.last],
full: [person.name.full],
}),
locations: this.fb.array([
this.initLocation(),
]),
files: this.fb.array([
this.initFiles(),
]),
skills: this.fb.array([
this.initSkills(),
]),
});
}
initLocation() {
return this.fb.group({
isDefault: [false, Validators.required],
location: ['', Validators.required],
roles: ['', Validators.required],
isContact: [false, Validators.required],
contactPhone: ['', Validators.required],
contactPhoneExt: ['', Validators.required],
});
}
initFiles() {
return this.fb.group({
originalName: ['', Validators.required],
});
}
initSkills() {
return this.fb.group({
name: ['', Validators.required],
isrequired: [false, Validators.required],
expireDate: ['', Validators.required],
canOverride: [false, Validators.required],
});
}
addLocation(control) {
control.push(this.initLocation());
}
removeLocation(i: number, control) {
control.removeAt(i);
}
}
</code></pre>
<p>form:</p>
<pre><code><div formGroup="form">
<div formArrayName="locations">
<div *ngFor="let location of form.controls.locations.controls; let i=index">
<span>Location {{i + 1}}</span>
<div formGroupName="i">
<label class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect">
<input type="checkbox" class="mdl-checkbox__input"
formControlName="isDefault" [checked]="">
</label>
</div>
</div>
</div>
</div>
</code></pre>
<p>form-component.ts:</p>
<pre><code>import {Component} from '@angular/core';
import {FormGroup, FormArray} from '@angular/forms';
@Component({
moduleId: module.id,
selector: 'person-form-component',
templateUrl: 'person-form.component.html',
providers: [PersonService, PersonFormBuilderService]
})
export class PersonFormComponent {
getPerson(personId) {
this.personService.getPerson(this.personId).subscribe(res => {
this.person = res.data;
this.form = this.personFormBuilderService.getForm(this.person);
});
}
addLocation() {
let control = <FormArray> this.form.controls['locations'];
this.personFormBuilderService.addLocation(control);
}
}
</code></pre>
<p><a href="https://gist.github.com/jpstokes/11551ff5d8c76514005c6c9fd8a554dd">https://gist.github.com/jpstokes/11551ff5d8c76514005c6c9fd8a554dd</a></p>
| 0debug |
Javascript encryption that match with PHP decryption : <p>I have the php code as below, and I want to create a Javascript functions that work the same as the php code below. Also, the data that encrypted in Javascript can also decrypt in php.
`</p>
<pre><code><?php
class Security {
public static function encrypt($input, $key) {
$size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$input = Security::pkcs5_pad($input, $size);
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, '');
$iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
mcrypt_generic_init($td, $key, $iv);
$data = mcrypt_generic($td, $input);
mcrypt_generic_deinit($td);
mcrypt_module_close($td);
$data = base64_encode($data);
return $data;
}
private static function pkcs5_pad ($text, $blocksize) {
$pad = $blocksize - (strlen($text) % $blocksize);
return $text . str_repeat(chr($pad), $pad);
}
public static function decrypt($sStr, $sKey) {
$decrypted= mcrypt_decrypt(
MCRYPT_RIJNDAEL_128,
$sKey,
base64_decode($sStr),
MCRYPT_MODE_ECB
);
$dec_s = strlen($decrypted);
$padding = ord($decrypted[$dec_s-1]);
$decrypted = substr($decrypted, 0, -$padding);
return $decrypted;
}
}
?>
</code></pre>
<p>`</p>
| 0debug |
C# Visual Studio 2015: IWebProxy certificate validation : <p>I'm trying to create a C# proxy DLL that allow VS2015 Community, on my offline workstation, access to internet through a corporate HTTP proxy with authentication.</p>
<p>Following instruction of <a href="https://blogs.msdn.microsoft.com/rido/2010/05/06/how-to-connect-to-tfs-through-authenticated-web-proxy/" rel="noreferrer">this MSDN blog post</a> I'm able to connect VisualStudio to HTTP pages in this way:</p>
<pre><code>namespace VSProxy
{
public class AuthProxyModule : IWebProxy
{
ICredentials crendential = new NetworkCredential("user", "password");
public ICredentials Credentials
{
get
{
return crendential;
}
set
{
crendential = value;
}
}
public Uri GetProxy(Uri destination)
{
ServicePointManager.ServerCertificateValidationCallback = (Header, Cer, Claim, SslPolicyErrors) => true;
return new Uri("http://128.16.0.123:1234", UriKind.Absolute);
}
public bool IsBypassed(Uri host)
{
return host.IsLoopback;
}
}
}
</code></pre>
<p>But I'm not able to connect to the account authentication page for Visual Studio Community access.</p>
<p>So, I'm trying to validate Microsoft certificate using DLL.</p>
<p>There is any way can I accomplish HTTPS and certificate issue?</p>
<p>How can I validate the certificate in the webProxy DLL?</p>
| 0debug |
static void vc1_inv_trans_4x8_c(uint8_t *dest, int linesize, DCTELEM *block)
{
int i;
register int t1,t2,t3,t4,t5,t6,t7,t8;
DCTELEM *src, *dst;
const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
src = block;
dst = block;
for(i = 0; i < 8; i++){
t1 = 17 * (src[0] + src[2]) + 4;
t2 = 17 * (src[0] - src[2]) + 4;
t3 = 22 * src[1] + 10 * src[3];
t4 = 22 * src[3] - 10 * src[1];
dst[0] = (t1 + t3) >> 3;
dst[1] = (t2 - t4) >> 3;
dst[2] = (t2 + t4) >> 3;
dst[3] = (t1 - t3) >> 3;
src += 8;
dst += 8;
}
src = block;
for(i = 0; i < 4; i++){
t1 = 12 * (src[ 0] + src[32]) + 64;
t2 = 12 * (src[ 0] - src[32]) + 64;
t3 = 16 * src[16] + 6 * src[48];
t4 = 6 * src[16] - 16 * src[48];
t5 = t1 + t3;
t6 = t2 + t4;
t7 = t2 - t4;
t8 = t1 - t3;
t1 = 16 * src[ 8] + 15 * src[24] + 9 * src[40] + 4 * src[56];
t2 = 15 * src[ 8] - 4 * src[24] - 16 * src[40] - 9 * src[56];
t3 = 9 * src[ 8] - 16 * src[24] + 4 * src[40] + 15 * src[56];
t4 = 4 * src[ 8] - 9 * src[24] + 15 * src[40] - 16 * src[56];
dest[0*linesize] = cm[dest[0*linesize] + ((t5 + t1) >> 7)];
dest[1*linesize] = cm[dest[1*linesize] + ((t6 + t2) >> 7)];
dest[2*linesize] = cm[dest[2*linesize] + ((t7 + t3) >> 7)];
dest[3*linesize] = cm[dest[3*linesize] + ((t8 + t4) >> 7)];
dest[4*linesize] = cm[dest[4*linesize] + ((t8 - t4 + 1) >> 7)];
dest[5*linesize] = cm[dest[5*linesize] + ((t7 - t3 + 1) >> 7)];
dest[6*linesize] = cm[dest[6*linesize] + ((t6 - t2 + 1) >> 7)];
dest[7*linesize] = cm[dest[7*linesize] + ((t5 - t1 + 1) >> 7)];
src ++;
dest++;
}
}
| 1threat |
Python Pandas find all rows where all values are NaN : <p>So I have a dataframe with 5 columns. I would like to pull the indices where all of the columns are NaN. I was using this code:</p>
<pre><code>nan = pd.isnull(df.all)
</code></pre>
<p>but that is just returning false because it is logically saying no not all values in the dataframe are null. There are thousands of entries so I would prefer to not have to loop through and check each entry. Thanks!</p>
| 0debug |
static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx)
{
LibOpenJPEGContext *ctx = avctx->priv_data;
int err = 0;
opj_set_default_encoder_parameters(&ctx->enc_params);
#if HAVE_OPENJPEG_2_1_OPENJPEG_H
switch (ctx->cinema_mode) {
case OPJ_CINEMA2K_24:
ctx->enc_params.rsiz = OPJ_PROFILE_CINEMA_2K;
ctx->enc_params.max_cs_size = OPJ_CINEMA_24_CS;
ctx->enc_params.max_comp_size = OPJ_CINEMA_24_COMP;
break;
case OPJ_CINEMA2K_48:
ctx->enc_params.rsiz = OPJ_PROFILE_CINEMA_2K;
ctx->enc_params.max_cs_size = OPJ_CINEMA_48_CS;
ctx->enc_params.max_comp_size = OPJ_CINEMA_48_COMP;
break;
case OPJ_CINEMA4K_24:
ctx->enc_params.rsiz = OPJ_PROFILE_CINEMA_4K;
ctx->enc_params.max_cs_size = OPJ_CINEMA_24_CS;
ctx->enc_params.max_comp_size = OPJ_CINEMA_24_COMP;
break;
}
switch (ctx->profile) {
case OPJ_CINEMA2K:
if (ctx->enc_params.rsiz == OPJ_PROFILE_CINEMA_4K) {
err = AVERROR(EINVAL);
break;
}
ctx->enc_params.rsiz = OPJ_PROFILE_CINEMA_2K;
break;
case OPJ_CINEMA4K:
if (ctx->enc_params.rsiz == OPJ_PROFILE_CINEMA_2K) {
err = AVERROR(EINVAL);
break;
}
ctx->enc_params.rsiz = OPJ_PROFILE_CINEMA_4K;
break;
}
if (err) {
av_log(avctx, AV_LOG_ERROR,
"Invalid parameter pairing: cinema_mode and profile conflict.\n");
goto fail;
}
#else
ctx->enc_params.cp_rsiz = ctx->profile;
ctx->enc_params.cp_cinema = ctx->cinema_mode;
#endif
if (!ctx->numresolution) {
ctx->numresolution = 6;
while (FFMIN(avctx->width, avctx->height) >> ctx->numresolution < 1)
ctx->numresolution --;
}
ctx->enc_params.mode = !!avctx->global_quality;
ctx->enc_params.prog_order = ctx->prog_order;
ctx->enc_params.numresolution = ctx->numresolution;
ctx->enc_params.cp_disto_alloc = ctx->disto_alloc;
ctx->enc_params.cp_fixed_alloc = ctx->fixed_alloc;
ctx->enc_params.cp_fixed_quality = ctx->fixed_quality;
ctx->enc_params.tcp_numlayers = ctx->numlayers;
ctx->enc_params.tcp_rates[0] = FFMAX(avctx->compression_level, 0) * 2;
if (ctx->cinema_mode > 0) {
cinema_parameters(&ctx->enc_params);
}
#if OPENJPEG_MAJOR_VERSION == 1
ctx->image = mj2_create_image(avctx, &ctx->enc_params);
if (!ctx->image) {
av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n");
err = AVERROR(EINVAL);
goto fail;
}
#endif
return 0;
fail:
#if OPENJPEG_MAJOR_VERSION == 1
opj_image_destroy(ctx->image);
ctx->image = NULL;
#endif
return err;
}
| 1threat |
void *g_try_malloc0(size_t n_bytes)
{
__coverity_negative_sink__(n_bytes);
return calloc(1, n_bytes == 0 ? 1 : n_bytes);
}
| 1threat |
Finding data within a class : I am using this class:
class player
{
public string name;
public int rating;
{
and would like to access the 'name' due to the 'rating' that I have. Something along the lines of:
Get the name of the player that has the rating '4', or whatever the rating may be. There must be some sort of link between name and rating because they are in the same class, but im not sure how to exploit this. Also if there are class instances where two of them have the same rating, how would it effect this?
| 0debug |
import re
def remove_splchar(text):
pattern = re.compile('[\W_]+')
return (pattern.sub('', text)) | 0debug |
Prometheus - Convert cpu_user_seconds to CPU Usage %? : <p>Currently i'm monitoring docker containers via Prometheus.io. My problem is that i'm just getting "cpu_user_seconds_total" or "cpu_system_seconds_total". My question is how to convert this ever-increasing value to a CPU percentage?</p>
<p>Currently i'm querying: </p>
<pre><code>rate(container_cpu_user_seconds_total[30s])
</code></pre>
<p>But I don't think that it is quite correct (comparing to top).</p>
<p>How to convert cpu_user_seconds_total to CPU percentage? (Like in top)</p>
| 0debug |
static void vc1_decode_b_mb_intfi(VC1Context *v)
{
MpegEncContext *s = &v->s;
GetBitContext *gb = &s->gb;
int i, j;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
int cbp = 0;
int mqdiff, mquant;
int ttmb = v->ttfrm;
int mb_has_coeffs = 0;
int val;
int first_block = 1;
int dst_idx, off;
int fwd;
int dmv_x[2], dmv_y[2], pred_flag[2];
int bmvtype = BMV_TYPE_BACKWARD;
int idx_mbmode, interpmvp;
mquant = v->pq;
s->mb_intra = 0;
idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_IF_MBMODE_VLC_BITS, 2);
if (idx_mbmode <= 1) {
s->mb_intra = v->is_intra[s->mb_x] = 1;
s->current_picture.f.motion_val[1][s->block_index[0]][0] = 0;
s->current_picture.f.motion_val[1][s->block_index[0]][1] = 0;
s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_INTRA;
GET_MQUANT();
s->current_picture.f.qscale_table[mb_pos] = mquant;
s->y_dc_scale = s->y_dc_scale_table[mquant];
s->c_dc_scale = s->c_dc_scale_table[mquant];
v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb);
mb_has_coeffs = idx_mbmode & 1;
if (mb_has_coeffs)
cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_ICBPCY_VLC_BITS, 2);
dst_idx = 0;
for (i = 0; i < 6; i++) {
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
v->mb_type[0][s->block_index[i]] = s->mb_intra;
v->a_avail = v->c_avail = 0;
if (i == 2 || i == 3 || !s->first_slice_line)
v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]];
if (i == 1 || i == 3 || s->mb_x)
v->c_avail = v->mb_type[0][s->block_index[i] - 1];
vc1_decode_intra_block(v, s->block[i], i, val, mquant,
(i & 4) ? v->codingset2 : v->codingset);
if ((i>3) && (s->flags & CODEC_FLAG_GRAY))
continue;
v->vc1dsp.vc1_inv_trans_8x8(s->block[i]);
if (v->rangeredfrm)
for (j = 0; j < 64; j++)
s->block[i][j] <<= 1;
off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize);
off += v->second_field ? ((i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0]) : 0;
s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : s->linesize);
}
} else {
s->mb_intra = v->is_intra[s->mb_x] = 0;
s->current_picture.f.mb_type[mb_pos + v->mb_off] = MB_TYPE_16x16;
for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0;
if (v->fmb_is_raw)
fwd = v->forward_mb_plane[mb_pos] = get_bits1(gb);
else
fwd = v->forward_mb_plane[mb_pos];
if (idx_mbmode <= 5) {
dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0;
pred_flag[0] = pred_flag[1] = 0;
if (fwd)
bmvtype = BMV_TYPE_FORWARD;
else {
bmvtype = decode012(gb);
switch (bmvtype) {
case 0:
bmvtype = BMV_TYPE_BACKWARD;
break;
case 1:
bmvtype = BMV_TYPE_DIRECT;
break;
case 2:
bmvtype = BMV_TYPE_INTERPOLATED;
interpmvp = get_bits1(gb);
}
}
v->bmvtype = bmvtype;
if (bmvtype != BMV_TYPE_DIRECT && idx_mbmode & 1) {
get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD], &dmv_y[bmvtype == BMV_TYPE_BACKWARD], &pred_flag[bmvtype == BMV_TYPE_BACKWARD]);
}
if (bmvtype == BMV_TYPE_INTERPOLATED && interpmvp) {
get_mvdata_interlaced(v, &dmv_x[1], &dmv_y[1], &pred_flag[1]);
}
if (bmvtype == BMV_TYPE_DIRECT) {
dmv_x[0] = dmv_y[0] = pred_flag[0] = 0;
dmv_x[1] = dmv_y[1] = pred_flag[0] = 0;
}
vc1_pred_b_mv_intfi(v, 0, dmv_x, dmv_y, 1, pred_flag);
vc1_b_mc(v, dmv_x, dmv_y, (bmvtype == BMV_TYPE_DIRECT), bmvtype);
mb_has_coeffs = !(idx_mbmode & 2);
} else {
if (fwd)
bmvtype = BMV_TYPE_FORWARD;
v->bmvtype = bmvtype;
v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1);
for (i = 0; i < 6; i++) {
if (i < 4) {
dmv_x[0] = dmv_y[0] = pred_flag[0] = 0;
dmv_x[1] = dmv_y[1] = pred_flag[1] = 0;
val = ((v->fourmvbp >> (3 - i)) & 1);
if (val) {
get_mvdata_interlaced(v, &dmv_x[bmvtype == BMV_TYPE_BACKWARD],
&dmv_y[bmvtype == BMV_TYPE_BACKWARD],
&pred_flag[bmvtype == BMV_TYPE_BACKWARD]);
}
vc1_pred_b_mv_intfi(v, i, dmv_x, dmv_y, 0, pred_flag);
vc1_mc_4mv_luma(v, i, bmvtype == BMV_TYPE_BACKWARD);
} else if (i == 4)
vc1_mc_4mv_chroma(v, bmvtype == BMV_TYPE_BACKWARD);
}
mb_has_coeffs = idx_mbmode & 1;
}
if (mb_has_coeffs)
cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2);
if (cbp) {
GET_MQUANT();
}
s->current_picture.f.qscale_table[mb_pos] = mquant;
if (!v->ttmbf && cbp) {
ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2);
}
dst_idx = 0;
for (i = 0; i < 6; i++) {
s->dc_val[0][s->block_index[i]] = 0;
dst_idx += i >> 2;
val = ((cbp >> (5 - i)) & 1);
off = (i & 4) ? 0 : (i & 1) * 8 + (i & 2) * 4 * s->linesize;
if (v->second_field)
off += (i & 4) ? s->current_picture_ptr->f.linesize[1] : s->current_picture_ptr->f.linesize[0];
if (val) {
vc1_decode_p_block(v, s->block[i], i, mquant, ttmb,
first_block, s->dest[dst_idx] + off,
(i & 4) ? s->uvlinesize : s->linesize,
(i & 4) && (s->flags & CODEC_FLAG_GRAY), NULL);
if (!v->ttmbf && ttmb < 8)
ttmb = -1;
first_block = 0;
}
}
}
}
| 1threat |
window.location.href = 'http://attack.com?user=' + user_input; | 1threat |
Updating multiple MYSQL rows with one submit button : <p>i was trying to updating multiple MYSQL rows with one submit button,</p>
<p>before i used to create submit for each row, but since i have a lot of rows now i need to update them all together</p>
<p>index.php</p>
<pre><code><?php
if (mysqli_num_rows($row){
while($row1= mysqli_fetch_assoc($row){
id<input type="text" value="<?php echo $row["id"];?>" name='id' id="id" >
id<input type="text" value="<?php echo $row["name"];?>" name='name' id="name" >
}
<button type="submit" formaction="update.php">
submit
</button>
}
</code></pre>
<p>update.php</p>
<pre><code>
$id= $_POST['id'];
$name= $_POST['name'];
$sql = "UPDATE `$tabelname` SET
name='$name'
WHERE id='$id'";
</code></pre>
<p>its updating the first row only</p>
| 0debug |
document.getElementById('input').innerHTML = user_input; | 1threat |
static int opt_list(void *obj, void *av_log_obj, char *unit)
{
AVOption *opt=NULL;
while((opt= av_next_option(obj, opt))){
if(!(opt->flags & (AV_OPT_FLAG_ENCODING_PARAM|AV_OPT_FLAG_DECODING_PARAM)))
continue;
if (!unit && opt->type==FF_OPT_TYPE_CONST)
continue;
else if (unit && opt->type!=FF_OPT_TYPE_CONST)
continue;
else if (unit && opt->type==FF_OPT_TYPE_CONST && strcmp(unit, opt->unit))
continue;
else if (unit && opt->type == FF_OPT_TYPE_CONST)
av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name);
else
av_log(av_log_obj, AV_LOG_INFO, "-%-17s ", opt->name);
switch( opt->type )
{
case FF_OPT_TYPE_FLAGS:
av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<flags>" );
break;
case FF_OPT_TYPE_INT:
av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<int>" );
break;
case FF_OPT_TYPE_INT64:
av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<int64>" );
break;
case FF_OPT_TYPE_DOUBLE:
av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<double>" );
break;
case FF_OPT_TYPE_FLOAT:
av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<float>" );
break;
case FF_OPT_TYPE_STRING:
av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<string>" );
break;
case FF_OPT_TYPE_RATIONAL:
av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "<rational>" );
break;
case FF_OPT_TYPE_CONST:
default:
av_log( av_log_obj, AV_LOG_INFO, "%-7s ", "" );
break;
}
av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.');
av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.');
av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.');
av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.');
av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.');
if(opt->help)
av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
av_log(av_log_obj, AV_LOG_INFO, "\n");
if (opt->unit && opt->type != FF_OPT_TYPE_CONST) {
opt_list(obj, av_log_obj, opt->unit);
}
}
}
| 1threat |
resizing image that generated by paintcode app : I have imported a vector image to paincode app and then export its swift to code. I want to use this vector image in a small View (30x30) but since I want it to work on different devices, I need it to be size-independent.
The original size of the vector image is 512x512. When I add its class to a UIView, only a very small part of the vector image can be seen.
[screenshot of the UIView the image inside it][1]
[1]: https://i.stack.imgur.com/L1XIY.png
I need to somehow resize the image that can be fit in any size of a frame. I read somewhere, that I have to draw a frame in paintcode app around the image, I did it but nothing changed.
could you help me on this?
thank you so much | 0debug |
Disable or avoid fake gps : <p>I have an Android app.</p>
<p>This program can detect fake positions.</p>
<p>But I want to avoid this problem by using Java programming.</p>
<p>Please help me.</p>
<p>Thanks</p>
| 0debug |
Reading from a text file with unknown formatting : <p>I am trying to read from a text file. this text file does not have a specific pattern but is a paragraph of a story. I am trying to get each individual word and track their number of occurrences.</p>
<p>For example, this is a exerpt from the text file to give an idea of the formatting.</p>
<blockquote>
<p>In submitting the following record we are conscious of the fact that we have errors. Some of them have been found and
corrected by pen even after the stencil had been out. Others, I presume will be found by you. Others will not be
found, there are none among us today who have lived long enough in the past to know them. It is our sincere desire
to make this record as accurate as possible. To do this we must have your help. If you fin a mistake kindly notify
this writer who will in turn correct his copy. It is our intention to rewrite this story, making it more readable by
including such personal human interest stories as are available; more accurate by correcting the mistakes which you
may find. The first three pages are taken directly without any changes form the family record as written by cousin
Ethel Mards Carr Marsh. We are deeply indebted to here for this information. Without her help it would have been
impossible to have gone back beyond the parents of Daniel and David. As stated in the history, four Marsh brothers
came to the colonies some time prior to 1761. How many years before this date it was, we do not know. Samuel Marsh,
Son of Zebediah Marsh, was born in 1761. We may well imagine that it was several years before his birth. We have
studied the records of England of their period. They were perilous years. Many came to America to escape the wrath
of a tyrant Marsh King, others to escape the judgement of the Puritan Cromwell.</p>
</blockquote>
<p>I know how to read from a file that is of a specific formatting but I am not sure how I am going to read this file to find every individual word without any punctuation.</p>
<p>I am guessing i am going to use a fscanf with a regex to do this but I am not 100% sure how to implement this.</p>
| 0debug |
Async HostBinding in directive : <p>I'm looking for the best way to handle HostBinding with async value.</p>
<p>Before Angular <strong>v2.1.2</strong> I could use the <code>host</code> property in the <code>@Directive</code> decorator like that :</p>
<pre><code>@Directive({
selector: 'img[my-directive]',
host : {
'[alt]' : "alt | async"
}
})
export class MyDirective {
alt: Observable<string>;
}
</code></pre>
<p>But it looks like this was not the intended behavior, since version 2.1.2 fixes it. See <a href="https://github.com/angular/angular/commit/867494a" rel="noreferrer">don't access view local variables nor pipes in host expressions</a>.</p>
<p>Now, when compiling with AoT compilation, I get <code>Parser Error: Host binding expression cannot contain pipes in Directive</code>.</p>
| 0debug |
Angular 4+ ngOnDestroy() in service - destroy observable : <p>In an angular application we have <code>ngOnDestroy()</code> lifecycle hook for a component / directive and we use this hook to unsubscribe the observables.</p>
<p>I want to clear / destory observable that are created in an <code>@injectable()</code> service.
I saw some posts saying that <code>ngOnDestroy()</code> can be used in a service as well.</p>
<p>But, is it a good practice and only way to do so and When will it get called ?
someone please clarify.</p>
| 0debug |
Create Round Button with Border IN UWP Windows 10 C# : <p>I am trying to create a round button, with a White Border and a Transparent Background (as the old AppBarButtons in Windows 8.1) in UWP Windows 10. </p>
<p>I have found several samples like these:</p>
<p><a href="https://comentsys.wordpress.com/2015/05/23/windows-10-universal-windows-platform-custom-button/" rel="noreferrer">https://comentsys.wordpress.com/2015/05/23/windows-10-universal-windows-platform-custom-button/</a></p>
<p><a href="https://social.msdn.microsoft.com/Forums/sqlserver/en-US/cda7a526-5e99-4d4a-a73c-0be4ce77f961/uwpwindows10-how-to-make-button-with-round-edges?forum=wpdevelop&prof=required" rel="noreferrer">https://social.msdn.microsoft.com/Forums/sqlserver/en-US/cda7a526-5e99-4d4a-a73c-0be4ce77f961/uwpwindows10-how-to-make-button-with-round-edges?forum=wpdevelop&prof=required</a> </p>
<p>But the problem is with the Border.
When I setting the BorderBrush to a certain color, it turns out the Border is for Button's "Rectangle".</p>
<p>Is there a way I can create a Round border for a button?</p>
| 0debug |
i want to chage this mySQL to a Laravels ORM :
**mySQL Querry**
select count(distinct vote_checks.user_id) AS count from vote_checks join vote_items on vote_checks.item_id=vote_items.id where vote_items.vote_id=3; | 0debug |
Implicitly lazy static members in Swift : <p>I just noticed that <code>static</code> members of Swift <code>structs</code> are implicitly <code>lazy</code>. </p>
<p>For instance, this will only call the <code>init</code> once:</p>
<pre><code>class Baz {
init(){
print("initializing a Baz")
}
}
struct Foo {
static let bar = Baz()
}
var z = Foo.bar
z = Foo.bar
</code></pre>
<p>What's the rationale behind this?</p>
<p>What if I want the opposite behaviour?</p>
| 0debug |
static void gen_ldarx(DisasContext *ctx)
{
TCGv t0;
gen_set_access_type(ctx, ACCESS_RES);
t0 = tcg_temp_local_new();
gen_addr_reg_index(ctx, t0);
gen_check_align(ctx, t0, 0x07);
gen_qemu_ld64(ctx, cpu_gpr[rD(ctx->opcode)], t0);
tcg_gen_mov_tl(cpu_reserve, t0);
tcg_temp_free(t0);
}
| 1threat |
Brute Force in java : <p>Okay I know how brute force works can anyone explain me how to implement it/create it in java. If possible I don't need the original source code, I just want to understand the algorithm. Can anyone please?</p>
| 0debug |
how to count the duplicate integer using hash map in java : <p>suppose there are an array [1,2,4,5,1,6,1,5,1,7,8,1]
and i want to find the repeated number in array like 1 is repeated 5 time how we can get using hash map .</p>
<p>Other Question
we can find repeated number in array without using key in hash map </p>
| 0debug |
Ionic 2 Align Button Label to left : <p>I created a button in Ionic 2 as follows:</p>
<pre><code> <button secondary block round padding style="text-align : left;">
<ion-icon ios="ios-key" md="md-key"></ion-icon>
Login
</button>
</code></pre>
<p>I am trying to align the button text to left side but its not coming there. Is there build in twik available to achieve that?</p>
| 0debug |
php webservice not working in android using volly : When fist time webservices call then response is getting perfectly but at that time when try to call again then same cache response get every time. like first time get status 0 response every time get status 0. condition correct or wrong not check. that mean second time not call api.
But this webservices are upload another server that working fine my application. and all working my playstore apps not working.. I don't no exactly issue server or android side? | 0debug |
How to use $scope variable got from one function to another? : My angular controller's function looks like:
$scope.selectinteresteduser= function(Id){
$scope.selecteduserid=Id;
}
$scope.sendMessageToEmployeer = function($scope.selecteduserid) {
alert($scope.selecteduserid);
}
I want to pass the value of $scope.selecteduserid to sendMessageToEmployer function. How to do it? I am blank :(
Thanks in advance
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.