problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
static int mpeg_mux_end(AVFormatContext *ctx)
{
MpegMuxContext *s = ctx->priv_data;
StreamInfo *stream;
int i;
for(i=0;i<ctx->nb_streams;i++) {
stream = ctx->streams[i]->priv_data;
while (stream->buffer_ptr > 0) {
flush_packet(ctx, i, AV_NOPTS_VALUE, AV_NOPTS_VALUE, s->last_scr);
}
}
for(i=0;i<ctx->nb_streams;i++)
av_freep(&ctx->streams[i]->priv_data);
return 0;
}
| 1threat
|
Why does changing int to long speed up the execution? : <p>I was trying to solve <a href="https://projecteuler.net/problem=14" rel="noreferrer">problem #14 from Project Euler</a>, and had written the following C#...</p>
<pre><code>int maxColl = 0;
int maxLen = 0;
for (int i = 2; i < 1000000; i++) {
int coll = i;
int len = 1;
while (coll != 1) {
if (coll % 2 == 0) {
coll = coll / 2;
} else {
coll = 3 * coll + 1;
}
len++;
}
if (len > maxLen) {
maxLen = len;
maxColl = i;
}
}
</code></pre>
<p>Trouble was, it just ran and ran without seeming to stop.</p>
<p>After searching for other people's solution to the problem, I saw one looking very similar, except that he had used long instead of int. I didn't see why this should be necessary, as all of the numbers involved in this problem are well within the range of an int, but I tried it anyway.</p>
<p>Changing int to long made the code run in just over 2 seconds.</p>
<p>Anyone able to explain this to me?</p>
| 0debug
|
GREP - Exclude line entries that have a question mark "?" : <p>I have a large file with over 800k entries (access log file). I need to output a file with only clean URLs (without parameters / "?") in the URL. </p>
<p>Output should only display entries that DON'T have a "?" in the URL.</p>
<p>Parameter url:</p>
<p><a href="http://www.example.com/sample?parameter=1" rel="nofollow noreferrer">http://www.example.com/sample?parameter=1</a></p>
| 0debug
|
How to make recursive singly linked list (C++) : <p>My book is asking me to make a recursive definition of a singly linked list. I have no idea at all how to do that. Can someone please help me out with a sample? Thanks</p>
| 0debug
|
XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path? : <p>I am facing this problem while moving the python-package directory of XGBoost.</p>
<pre><code>Traceback (most recent call last): File "setup.py", line 19, in LIB_PATH = libpath'find_lib_path' File "xgboost/libpath.py", line 46, in find_lib_path 'List of candidates:\n' + ('\n'.join(dll_path))) builtin.XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?
</code></pre>
<p>Could anyone explain to me how to fix it?
thanks in advance.</p>
| 0debug
|
Group by operation using one of arrays' values : <p>I have array of arrays in <code>javascript</code> that looks like: <code>[[1, 23.34, -5.22], [1, 2.34, -52.22], [2, 0.34, -5.02], ...]</code>. I need to <code>group by</code> by the first number in the arrays and produce 2 different ouputs:</p>
<ol>
<li><p>Object (<code>key: 2D array</code>) that looks like this: </p>
<pre><code>{1: [[23.34, -5.22], [2.34, -52.22]],
2: [[0.34, -5.02], ...],
...}
</code></pre></li>
<li><p>3D array that would just signify the grouping: </p>
<pre><code>[[[23.34, -5.22], [2.34, -52.22]], [[0.34, -5.02], ...], ...]
</code></pre></li>
</ol>
<p>I want to use <code>ES6</code>. Any suggestions would be greatly appreciated.</p>
| 0debug
|
combine two strings and convert it to integer variable : <p>I want to take two strings and their combination will give a name of integer variable for example:</p>
<pre><code>int Value1 = 0;
int Value2 = 0;
.
.
.
int Value30 = 0;
int index = 0;
string startOfVar = "Value";
</code></pre>
<p>and now i want to do something like this:</p>
<pre><code>(startOfVar & index) = 50;
</code></pre>
<p>so, if index = 1 then Value1 will be change to 50.
if index = 25 then Value25 will be change to 50.
Obviously, i don't want to do it with array...</p>
<p>I hope the question is clear...</p>
<p>Thanks,
Lior</p>
| 0debug
|
Session data could not be read from another window : <p>On a test1.php I have this:</p>
<pre><code><?php
echo "Session variables are about to be set.";
// Set session variables
$_SESSION["animal"] = "cat";
echo "Session variables are set.";
echo "Favorite animal is " . $_SESSION["animal"] . ".";
?>
<div ms_positioning="text2D" class="style7"><a href="javascript:winOpen();" test2.php="">Contact Information</a></div>
<script>
function winOpen() {
window.open("/test2.php",null,"scrollbars=no,resizable=no,width=600,height=300,top=100,left=100");
}
</script>
</code></pre>
<p>In test2.php, I have this:</p>
<pre><code><?php
// Echo session variables that were set on previous page
echo "Favorite animal is " . $_SESSION["animal"] . ".";
?>
</code></pre>
<p>But data is not showing up on test2.php. It did echo back on test1.php.</p>
<p>any suggestions?</p>
| 0debug
|
How to link one JS file to two HTML files? : <p>I have two HTML files, both are linked to one JS file. The first HTML file can be manipulated by the js but the other way around for the second one. Does this mean I need separate JS files for the two? </p>
| 0debug
|
json won`t get parsed with variables out of an array : I don´t understand why my json doesn´t get parsed. I hope someone could explain this to me. I try to send a json from php to javascript.
**This code works fine:**
From PHP
echo json_encode(array($row['jobunique'], $row['jobtitle']));
to JAVASCRIPT
success: function(getjoblist) {
var getjobdetails = $.parseJSON(getjoblist);
}
**But this code gives me an error back:**
From PHP - data comes out of an array
echo json_encode(array($data[2], $data[3]));
I thought, maybe it's an object and I need to make a string out of the variables like this:
echo json_encode(array(strval($data[2]), strval($data[3])));
But it did not work either.
Here is the JAVASCRIPT code:
success: function(callback) {
var namearray = $.parseJSON(callback);
}
**Here is the error from the console:**
Uncaught SyntaxError: Unexpected token in JSON at position 0
| 0debug
|
Laravel @extends and @include : <p>I'm working on this project using Laravel.</p>
<p>According to this tutorial I'm watching, I had to add this bit of code at the top of the main view. </p>
<pre><code> @extends('layouts.masters.main')
</code></pre>
<p>Since I'm new to Laravel this got me wondering why can i not simply use. </p>
<pre><code> @include('layouts.masters.main')
</code></pre>
<p>I tried it instead and it did the same thing basically. Only thing is i do know how include works but i don't really know what extends does.
Is there a difference and so yeah what is it. Why did tutorial guy go for <code>@extends</code> and not <code>@include.</code></p>
| 0debug
|
in for loop no adding elements in list please see my sorce and help me please with this problem : no adding elements in list
and please help me whit this I am beginner
list1 =[]
print("How much numbers")
x =int(input())
print("input numbers:")
for n in range(x):
int(input())
y =list1.append(n)
print(list1)
"""
output:
[0,1,2,3]
"""
lkfl;dklf; k;kjk;lfj;kj;edjf;ejf;ejf;ejirfj
| 0debug
|
Multiple input with different data type using scanf(); : hello am working on some project and am stuck on one problem.
am not able to use scanf() function properly. I want to scan multiple input with different data types.
But I don't know whats the problem. there is no compiler errors.
plz help
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<html>
<title></title>
<body>
<p>#include "stdio.h"</p>
<p>int main()<br />{<br /> unsigned char minx[1024], x, y, z;</p>
<p> printf("Enter four ints: ");<br /> scanf( "%s %x %c %i", &minx, &x, &y, &z);</p>
<p> printf("You wrote: %s %x %c %i", minx, x, y, z);<br />}</p>
</body>
</html>
<!-- end snippet -->
| 0debug
|
Significance of scoped type variables standing for type variables and not types : <p>In the GHC <a href="https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#lexically-scoped-type-variables" rel="noreferrer">documentation</a> for the ScopedTypeVariables extension, the overview states the following as a design principle:</p>
<blockquote>
<p>A scoped type variable stands for a type <em>variable</em>, and not for a <em>type</em>. (This is a change from GHC’s earlier design.)</p>
</blockquote>
<p>I know the general purpose of the scoped type variables extension, but I don't know the implications of the distinction made here between standing for type variables and standing for types. What is the significance of the difference, from the perspective of users of the language?</p>
<p>The comment above alludes to two designs which approached this decision differently and made different tradeoffs. What was the alternative design, and how does it compare to the one currently implemented?</p>
| 0debug
|
Debugging code from dynamically loaded assembly in .net core 2.0 : <p>I have a .net core 2.0 console app that does the following (simplified):</p>
<pre><code>var a = Assembly.Load(Assembly.GetEntryAssembly()
.GetReferencedAssemblies()
.First(i => i.Name == "MyAssembly"));
var t = a.GetType("MyType");
var i = (MyBaseType)Activator.CreateInstance(t);
i.Execute();
</code></pre>
<p>When I debug through the code it stepps into <code>MyType.Execute()</code> as expected.</p>
<p>However If I load the assembly with the following code:</p>
<pre><code>var path = new FileInfo(Assembly.GetExecutingAssembly().Location);
var a = Assembly.LoadFile(Path.Combine(path.DirectoryName, "MyAssembly.dll"));
</code></pre>
<p>The code still works but I can't step into <code>MyType.Execute()</code> while debugging.</p>
<p>Any Idea why/what's wrong?</p>
| 0debug
|
static int pcm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
PCMDecode *s = avctx->priv_data;
int sample_size, c, n;
short *samples;
const uint8_t *src, *src2[MAX_CHANNELS];
uint8_t *dstu8;
int16_t *dst_int16_t;
int32_t *dst_int32_t;
int64_t *dst_int64_t;
uint16_t *dst_uint16_t;
uint32_t *dst_uint32_t;
samples = data;
src = buf;
if (avctx->sample_fmt!=avctx->codec->sample_fmts[0]) {
av_log(avctx, AV_LOG_ERROR, "invalid sample_fmt\n");
return -1;
}
if(avctx->channels <= 0 || avctx->channels > MAX_CHANNELS){
av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n");
return -1;
}
sample_size = av_get_bits_per_sample(avctx->codec_id)/8;
n = avctx->channels * sample_size;
if (CODEC_ID_PCM_DVD == avctx->codec_id)
n = 2 * avctx->channels * avctx->bits_per_sample/8;
if(n && buf_size % n){
av_log(avctx, AV_LOG_ERROR, "invalid PCM packet\n");
return -1;
}
buf_size= FFMIN(buf_size, *data_size/2);
*data_size=0;
n = buf_size/sample_size;
switch(avctx->codec->id) {
case CODEC_ID_PCM_U32LE:
DECODE(uint32_t, le32, src, samples, n, 0, 0x80000000)
break;
case CODEC_ID_PCM_U32BE:
DECODE(uint32_t, be32, src, samples, n, 0, 0x80000000)
break;
case CODEC_ID_PCM_S24LE:
DECODE(int32_t, le24, src, samples, n, 8, 0)
break;
case CODEC_ID_PCM_S24BE:
DECODE(int32_t, be24, src, samples, n, 8, 0)
break;
case CODEC_ID_PCM_U24LE:
DECODE(uint32_t, le24, src, samples, n, 8, 0x800000)
break;
case CODEC_ID_PCM_U24BE:
DECODE(uint32_t, be24, src, samples, n, 8, 0x800000)
break;
case CODEC_ID_PCM_S24DAUD:
for(;n>0;n--) {
uint32_t v = bytestream_get_be24(&src);
v >>= 4;
*samples++ = ff_reverse[(v >> 8) & 0xff] +
(ff_reverse[v & 0xff] << 8);
}
break;
case CODEC_ID_PCM_S16LE_PLANAR:
n /= avctx->channels;
for(c=0;c<avctx->channels;c++)
src2[c] = &src[c*n*2];
for(;n>0;n--)
for(c=0;c<avctx->channels;c++)
*samples++ = bytestream_get_le16(&src2[c]);
src = src2[avctx->channels-1];
break;
case CODEC_ID_PCM_U16LE:
DECODE(uint16_t, le16, src, samples, n, 0, 0x8000)
break;
case CODEC_ID_PCM_U16BE:
DECODE(uint16_t, be16, src, samples, n, 0, 0x8000)
break;
case CODEC_ID_PCM_S8:
dstu8= (uint8_t*)samples;
for(;n>0;n--) {
*dstu8++ = *src++ + 128;
}
samples= (short*)dstu8;
break;
#if WORDS_BIGENDIAN
case CODEC_ID_PCM_F64LE:
DECODE(int64_t, le64, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_F32LE:
DECODE(int32_t, le32, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_S16LE:
DECODE(int16_t, le16, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_F64BE:
case CODEC_ID_PCM_F32BE:
case CODEC_ID_PCM_S32BE:
case CODEC_ID_PCM_S16BE:
#else
case CODEC_ID_PCM_F64BE:
DECODE(int64_t, be64, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_F32BE:
case CODEC_ID_PCM_S32BE:
DECODE(int32_t, be32, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_S16BE:
DECODE(int16_t, be16, src, samples, n, 0, 0)
break;
case CODEC_ID_PCM_F64LE:
case CODEC_ID_PCM_F32LE:
case CODEC_ID_PCM_S32LE:
case CODEC_ID_PCM_S16LE:
#endif
case CODEC_ID_PCM_U8:
memcpy(samples, src, n*sample_size);
src += n*sample_size;
samples = (short*)((uint8_t*)data + n*sample_size);
break;
case CODEC_ID_PCM_ZORK:
for(;n>0;n--) {
int x= *src++;
if(x&128) x-= 128;
else x = -x;
*samples++ = x << 8;
}
break;
case CODEC_ID_PCM_ALAW:
case CODEC_ID_PCM_MULAW:
for(;n>0;n--) {
*samples++ = s->table[*src++];
}
break;
case CODEC_ID_PCM_DVD:
if(avctx->bits_per_sample != 20 && avctx->bits_per_sample != 24) {
av_log(avctx, AV_LOG_ERROR, "PCM DVD unsupported sample depth\n");
return -1;
} else {
int jump = avctx->channels * (avctx->bits_per_sample-16) / 4;
n = buf_size / (avctx->channels * 2 * avctx->bits_per_sample / 8);
while (n--) {
for (c=0; c < 2*avctx->channels; c++)
*samples++ = bytestream_get_be16(&src);
src += jump;
}
}
break;
default:
return -1;
}
*data_size = (uint8_t *)samples - (uint8_t *)data;
return src - buf;
}
| 1threat
|
Minimum no of bracket reversals : Given an expression with only ‘}’ and ‘{‘. The expression may not be balanced. Find minimum number of bracket reversals to make the expression balanced
…. python
``
a=['}{}{}{}}}{{{{{}{}{}}{{}{}{}}{{}}{{']
for elem in a:
sol=0
stack=[]
#stack.append(elem[i])
i=0
while i<len(elem)-1:
if elem[i]=='{' and elem[i+1]=='{':
stack.append(elem[i])
stack.append(elem[i+1])
sol+=1
elif elem[i]=='}' and elem[i+1]=='{':
if len(stack)!=0:
if stack[-1]=='{':
stack.pop()
stack.append(elem[i+1])
else:
stack.append(elem[i])
stack.append(elem[i+1])
sol+=1
else:
stack.append(elem[i])
`` stack.append(elem[i+1])
sol+=2
elif elem[i]=='}' and elem[i+1]=='}':
if len(stack)!=0:
if stack[-1]=='{' and stack[-2]=='{':
stack.pop()
stack.pop()
sol-=1
elif stack[-1]=='{' and stack[-2]=='}':
stack.pop()
stack.append(elem[i+1])
else:
stack.append(elem[i])
stack.append(elem[i+1])
sol+=1
else:
stack.append(elem[i])
stack.append(elem[i+1])
sol+=1
i+=2
print(sol)
….
expected 5
output 6
| 0debug
|
static void pc_init1(MachineState *machine,
const char *host_type, const char *pci_type)
{
PCMachineState *pcms = PC_MACHINE(machine);
PCMachineClass *pcmc = PC_MACHINE_GET_CLASS(pcms);
MemoryRegion *system_memory = get_system_memory();
MemoryRegion *system_io = get_system_io();
int i;
PCIBus *pci_bus;
ISABus *isa_bus;
PCII440FXState *i440fx_state;
int piix3_devfn = -1;
qemu_irq *i8259;
qemu_irq smi_irq;
GSIState *gsi_state;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
BusState *idebus[MAX_IDE_BUS];
ISADevice *rtc_state;
MemoryRegion *ram_memory;
MemoryRegion *pci_memory;
MemoryRegion *rom_memory;
ram_addr_t lowmem;
if (xen_enabled()) {
xen_hvm_init(pcms, &ram_memory);
} else {
if (!pcms->max_ram_below_4g) {
pcms->max_ram_below_4g = 0xe0000000;
}
lowmem = pcms->max_ram_below_4g;
if (machine->ram_size >= pcms->max_ram_below_4g) {
if (pcmc->gigabyte_align) {
if (lowmem > 0xc0000000) {
lowmem = 0xc0000000;
}
if (lowmem & ((1ULL << 30) - 1)) {
error_report("Warning: Large machine and max_ram_below_4g "
"(%" PRIu64 ") not a multiple of 1G; "
"possible bad performance.",
pcms->max_ram_below_4g);
}
}
}
if (machine->ram_size >= lowmem) {
pcms->above_4g_mem_size = machine->ram_size - lowmem;
pcms->below_4g_mem_size = lowmem;
} else {
pcms->above_4g_mem_size = 0;
pcms->below_4g_mem_size = machine->ram_size;
}
}
pc_cpus_init(pcms);
if (kvm_enabled() && pcmc->kvmclock_enabled) {
kvmclock_create();
}
if (pcmc->pci_enabled) {
pci_memory = g_new(MemoryRegion, 1);
memory_region_init(pci_memory, NULL, "pci", UINT64_MAX);
rom_memory = pci_memory;
} else {
pci_memory = NULL;
rom_memory = system_memory;
}
pc_guest_info_init(pcms);
if (pcmc->smbios_defaults) {
MachineClass *mc = MACHINE_GET_CLASS(machine);
smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
mc->name, pcmc->smbios_legacy_mode,
pcmc->smbios_uuid_encoded,
SMBIOS_ENTRY_POINT_21);
}
if (!xen_enabled()) {
pc_memory_init(pcms, system_memory,
rom_memory, &ram_memory);
} else if (machine->kernel_filename != NULL) {
xen_load_linux(pcms);
}
gsi_state = g_malloc0(sizeof(*gsi_state));
if (kvm_ioapic_in_kernel()) {
kvm_pc_setup_irq_routing(pcmc->pci_enabled);
pcms->gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state,
GSI_NUM_PINS);
} else {
pcms->gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS);
}
if (pcmc->pci_enabled) {
pci_bus = i440fx_init(host_type,
pci_type,
&i440fx_state, &piix3_devfn, &isa_bus, pcms->gsi,
system_memory, system_io, machine->ram_size,
pcms->below_4g_mem_size,
pcms->above_4g_mem_size,
pci_memory, ram_memory);
pcms->bus = pci_bus;
} else {
pci_bus = NULL;
i440fx_state = NULL;
isa_bus = isa_bus_new(NULL, get_system_memory(), system_io,
&error_abort);
no_hpet = 1;
}
isa_bus_irqs(isa_bus, pcms->gsi);
if (kvm_pic_in_kernel()) {
i8259 = kvm_i8259_init(isa_bus);
} else if (xen_enabled()) {
i8259 = xen_interrupt_controller_init();
} else {
i8259 = i8259_init(isa_bus, pc_allocate_cpu_irq());
}
for (i = 0; i < ISA_NUM_IRQS; i++) {
gsi_state->i8259_irq[i] = i8259[i];
}
g_free(i8259);
if (pcmc->pci_enabled) {
ioapic_init_gsi(gsi_state, "i440fx");
}
pc_register_ferr_irq(pcms->gsi[13]);
pc_vga_init(isa_bus, pcmc->pci_enabled ? pci_bus : NULL);
assert(pcms->vmport != ON_OFF_AUTO__MAX);
if (pcms->vmport == ON_OFF_AUTO_AUTO) {
pcms->vmport = xen_enabled() ? ON_OFF_AUTO_OFF : ON_OFF_AUTO_ON;
}
pc_basic_device_init(isa_bus, pcms->gsi, &rtc_state, true,
(pcms->vmport != ON_OFF_AUTO_ON), pcms->pit, 0x4);
pc_nic_init(isa_bus, pci_bus);
ide_drive_get(hd, ARRAY_SIZE(hd));
if (pcmc->pci_enabled) {
PCIDevice *dev;
if (xen_enabled()) {
dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1);
} else {
dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1);
}
idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0");
idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1");
} else {
for(i = 0; i < MAX_IDE_BUS; i++) {
ISADevice *dev;
char busname[] = "ide.0";
dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i],
ide_irq[i],
hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]);
busname[4] = '0' + i;
idebus[i] = qdev_get_child_bus(DEVICE(dev), busname);
}
}
pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state);
if (pcmc->pci_enabled && machine_usb(machine)) {
pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci");
}
if (pcmc->pci_enabled && acpi_enabled) {
DeviceState *piix4_pm;
I2CBus *smbus;
smi_irq = qemu_allocate_irq(pc_acpi_smi_interrupt, first_cpu, 0);
smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100,
pcms->gsi[9], smi_irq,
pc_machine_is_smm_enabled(pcms),
&piix4_pm);
smbus_eeprom_init(smbus, 8, NULL, 0);
object_property_add_link(OBJECT(machine), PC_MACHINE_ACPI_DEVICE_PROP,
TYPE_HOTPLUG_HANDLER,
(Object **)&pcms->acpi_dev,
object_property_allow_set_link,
OBJ_PROP_LINK_UNREF_ON_RELEASE, &error_abort);
object_property_set_link(OBJECT(machine), OBJECT(piix4_pm),
PC_MACHINE_ACPI_DEVICE_PROP, &error_abort);
}
if (pcmc->pci_enabled) {
pc_pci_device_init(pci_bus);
}
if (pcms->acpi_nvdimm_state.is_enabled) {
nvdimm_init_acpi_state(&pcms->acpi_nvdimm_state, system_io,
pcms->fw_cfg, OBJECT(pcms));
}
}
| 1threat
|
void qemu_chr_generic_open(CharDriverState *s)
{
if (s->open_timer == NULL) {
s->open_timer = qemu_new_timer_ms(rt_clock,
qemu_chr_fire_open_event, s);
qemu_mod_timer(s->open_timer, qemu_get_clock_ms(rt_clock) - 1);
}
}
| 1threat
|
Selecting by details with MySQL, after join : <p>First I'll introduce what I'm trying to achieve and how I'm doing it.</p>
<p>I have three tables, <code>Posts</code>, <code>Details</code>, and <code>Posts_Details</code>.</p>
<p><code>Posts</code> is the table where I keep the basic post data, <code>Details</code> is keeping the detail instances, with information about the title of the detail, possible values and some information if the detail is required for input, display flags etc. <code>Posts_Details</code> is the entity that represents the <code>M->N</code> relation which keeps one value of the detail, so it has three attributes, the id pairs of the post and detail and a value.</p>
<p>What I'm trying to setup is, a search functionality.</p>
<p>The first part of the search is simple, I use <code>Posts.title LIKE '%?%'</code> and the client is happy with the way it functions, I know its limitations, but this is really basic search functionality for now. The next feature is what brings me the troubles, as I don't feel like I know how to form the relation properly and I'm already behind the schedule to stop working and read up on relations.</p>
<p>I need to create a feature like "advanced search" where the user could not only pick the category and title keyword, but also match the details with drop-down inputs. I'm working with PHP and PDO, but I don't think that's too much relevant here as my problem is more SQL-related.</p>
<p>How I tried to solve this - I'm parsing the get data and collecting it in an associative array with details id as keys and the values as value, so I thought to iterate over the array and append the rules in the WHERE part of the SQL string. I kind of get some result with this approach after I parse the mashed columns, but it doesn't feel right, I feel like I'm doing just a hack-around.</p>
<p>Is there a "righter" way to implement this kind of search by details where I'll make a rule for selecting posts with values from the list of details after the three tables are joined?</p>
| 0debug
|
PHP CURL Post Fields is not working : <p>PHP curl post is not working..</p>
<p>Here's my code </p>
<pre><code> function post_to_url($url, $data) {
$fields = '';
foreach($data as $key => $value) {
$fields .= $key . '=' . $value . '&';
}
rtrim($fields, '&');
$post = curl_init();
curl_setopt($post, CURLOPT_URL, $url);
curl_setopt($post, CURLOPT_POST, count($data));
curl_setopt($post, CURLOPT_POSTFIELDS, $fields);
curl_setopt($post, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($post);
curl_close($post);
}
post_to_url("http://www.i-autosurf.com/signup.php",$data);
</code></pre>
<p>can you please checkout the error..</p>
<p>is the code going wrong or is there anything different in website.</p>
| 0debug
|
static void init_proc_970FX (CPUPPCState *env)
{
gen_spr_ne_601(env);
gen_spr_7xx(env);
gen_tbl(env);
spr_register(env, SPR_HID0, "HID0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_clear,
0x60000000);
spr_register(env, SPR_HID1, "HID1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_750FX_HID2, "HID2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_970_HID5, "HID5",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
POWERPC970_HID5_INIT);
spr_register(env, SPR_L2CR, "L2CR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, NULL,
0x00000000);
gen_low_BATs(env);
spr_register(env, SPR_MMUCFG, "MMUCFG",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, SPR_NOACCESS,
0x00000000);
spr_register(env, SPR_MMUCSR0, "MMUCSR0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_HIOR, "SPR_HIOR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_hior, &spr_write_hior,
0x00000000);
spr_register(env, SPR_CTRL, "SPR_CTRL",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_UCTRL, "SPR_UCTRL",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
spr_register(env, SPR_VRSAVE, "SPR_VRSAVE",
&spr_read_generic, &spr_write_generic,
&spr_read_generic, &spr_write_generic,
0x00000000);
#if !defined(CONFIG_USER_ONLY)
env->slb_nr = 64;
#endif
init_excp_970(env);
env->dcache_line_size = 128;
env->icache_line_size = 128;
ppc970_irq_init(env);
vscr_init(env, 0x00010000);
}
| 1threat
|
def string_to_list(string):
lst = list(string.split(" "))
return lst
| 0debug
|
My program keeps getting an error called 'inconsistent use of tabs and spaces' when I add an else or elif statement : <p>My code goes as follows</p>
<pre><code>if (input("").lower() == "yes"):
gender_set()
elif name.lower()=="dev mode":
print("dev mode activated")
gender_set()
else:
name_set()
</code></pre>
<p>my file is at
<a href="https://github.com/GamingTimelord19/first-project/commit/0f5639e689a0824580bf5135ecbf8a0c12abf445#diff-9f9a01b179db586487b21757ae29e719L29" rel="nofollow noreferrer">https://github.com/GamingTimelord19/first-project/commit/0f5639e689a0824580bf5135ecbf8a0c12abf445#diff-9f9a01b179db586487b21757ae29e719L29</a></p>
| 0debug
|
static int process_metadata(AVFormatContext *s, uint8_t *name, uint16_t name_len,
uint16_t val_len, uint16_t type, AVDictionary **met)
{
int ret;
ff_asf_guid guid;
if (val_len) {
switch (type) {
case ASF_UNICODE:
asf_read_value(s, name, name_len, val_len, type, met);
break;
case ASF_BYTE_ARRAY:
if (!strcmp(name, "WM/Picture"))
asf_read_picture(s, val_len);
else if (!strcmp(name, "ID3"))
get_id3_tag(s, val_len);
else
asf_read_value(s, name, name_len, val_len, type, met);
break;
case ASF_GUID:
ff_get_guid(s->pb, &guid);
break;
default:
if ((ret = asf_read_generic_value(s, name, name_len, type, met)) < 0)
return ret;
break;
}
}
av_freep(&name);
return 0;
}
| 1threat
|
void register_avcodec(AVCodec *codec)
{
AVCodec **p;
p = &first_avcodec;
while (*p != NULL) p = &(*p)->next;
*p = codec;
codec->next = NULL;
}
| 1threat
|
NestJS returning the result of an HTTP request : <p>In my NestJS application I want to return the result of an http call.</p>
<p>Following the example of the <a href="https://docs.nestjs.com/techniques/http-module" rel="noreferrer">NestJS HTTP module</a>, what I'm doing is simply:</p>
<pre><code>import { Controller, HttpService, Post } from '@nestjs/common';
import { AxiosResponse } from '@nestjs/common/http/interfaces/axios.interfaces';
import { Observable } from 'rxjs/internal/Observable';
@Controller('authenticate')
export class AuthController {
constructor(private readonly httpService: HttpService) {}
@Post()
authenticate(): Observable<AxiosResponse<any>> {
return this.httpService.post(...);
}
}
</code></pre>
<p>However from the client I'm getting 500 and the server console is saying:</p>
<blockquote>
<p>TypeError: Converting circular structure to JSON
at JSON.stringify ()
at stringify (/Users/francesco.borzi/sources/business-controller-rewrite/node_modules/express/lib/response.js:1119:12)
at ServerResponse.json (/Users/francesco.borzi/sources/business-controller-rewrite/node_modules/express/lib/response.js:260:14)
at ExpressAdapter.reply (/Users/francesco.borzi/sources/business-controller-rewrite/node_modules/@nestjs/core/adapters/express-adapter.js:41:52)
at RouterResponseController.apply (/Users/francesco.borzi/sources/business-controller-rewrite/node_modules/@nestjs/core/router/router-response-controller.js:11:36)
at
at process._tickCallback (internal/process/next_tick.js:182:7)</p>
</blockquote>
| 0debug
|
static void audio_init (PCIBus *pci_bus, qemu_irq *pic)
{
struct soundhw *c;
int audio_enabled = 0;
for (c = soundhw; !audio_enabled && c->name; ++c) {
audio_enabled = c->enabled;
}
if (audio_enabled) {
AudioState *s;
s = AUD_init ();
if (s) {
for (c = soundhw; c->name; ++c) {
if (c->enabled) {
if (c->isa) {
c->init.init_isa (s, pic);
}
else {
if (pci_bus) {
c->init.init_pci (pci_bus, s);
}
}
}
}
}
}
}
| 1threat
|
document.location = 'http://evil.com?username=' + user_input;
| 1threat
|
Edit text in File - QTCreator :
HELP QTCreator
In the program records various information and would like to edit two in one file, the user will type in a lineEdit and will swap in the file
My code:
QString valor = ui->edtRValor->text();
QDate dateIn = ui->dateRInicial->date();
QString dataInicio = dateIn.toString();
QDate dateFi = ui->dateRFim->date();
QString FimDate = dateFi.toString();
QFile arch("C:\\Users\\Caio\\Documents\\cadastrarQuarto.txt");
if(!sr.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QTextStream out(&arch);
How do I get the value typed and swap with a value that is written in the file?
My file:
231-1º-40-sáb jan 1 2000-qua jan 5 2000-160-2
441-4º-40-sáb jan 1 2020-qua jan 5 2200-190-8
| 0debug
|
static void rocker_test_dma_ctrl(Rocker *r, uint32_t val)
{
PCIDevice *dev = PCI_DEVICE(r);
char *buf;
int i;
buf = g_malloc(r->test_dma_size);
if (!buf) {
DPRINTF("test dma buffer alloc failed");
return;
}
switch (val) {
case ROCKER_TEST_DMA_CTRL_CLEAR:
memset(buf, 0, r->test_dma_size);
break;
case ROCKER_TEST_DMA_CTRL_FILL:
memset(buf, 0x96, r->test_dma_size);
break;
case ROCKER_TEST_DMA_CTRL_INVERT:
pci_dma_read(dev, r->test_dma_addr, buf, r->test_dma_size);
for (i = 0; i < r->test_dma_size; i++) {
buf[i] = ~buf[i];
}
break;
default:
DPRINTF("not test dma control val=0x%08x\n", val);
goto err_out;
}
pci_dma_write(dev, r->test_dma_addr, buf, r->test_dma_size);
rocker_msix_irq(r, ROCKER_MSIX_VEC_TEST);
err_out:
g_free(buf);
}
| 1threat
|
How to detect if webpack-dev-server is running? : <p>How can I determine if <code>webpack.config.js</code> was loaded via <code>webpack</code> vs <code>webpack-dev-server</code>?</p>
| 0debug
|
Declare URL in Swift : <p>I'm trying to declare a URL variable but it's giving me the error:</p>
<p><code>Cannot use instance member 'url' within property initializer; property initializers run before 'self' is available</code></p>
<p>I'm trying to create a hard coded data so it's fine to write is inside the array, is there a way to do so?</p>
<p>For example inside the array I have many strings <code>"myString"</code>, can I do that with the URL?</p>
<p>This is my code:</p>
<pre><code>class UserSalonViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
// This is the view to display all posts from all Authors
@IBOutlet var allPostsTableView: UITableView!
// var posts = [UserPosts]()
let url = URL(string: "https://duckduckgo.com/")!
var posts = [
UserPosts(author: "Arturo", postTitle: "Hello World", postDescription: "First Post", postUrl: url, postAddress: "1 NW 1 ave")
]
override func viewDidLoad() {
super.viewDidLoad()
...
</code></pre>
<p>What can I do?</p>
| 0debug
|
ASP.NET MVC Form choose color and send form : This is my entity class:
class Data{
public Color FrontColor { get; set; }
}
View:
@using (Html.BeginForm("ConfigureFurniture", "Home", FormMethod.Post))
{
<input type="color" name="FrontColor" id="color1"/>
<input type="submit" class="btn btn-success" value="Zamów" />
}
In controller when I am getting Post data send, there is no data in color property assigned to my ViewModelClass...
| 0debug
|
Creating an advanced e-commerce website in Rails : <p>Okay, so, as the title suggests I'm supposed to create a rails app. - an e-commerce platform. I've done some background research and found a few useful gems like shoppe, spree. Specifications of my website are:</p>
<ol>
<li>Searching using wide variety of options like price, company, title etc</li>
<li>Companies' accounts for uploading/updating products</li>
<li>Users' accounts for purchasing them</li>
<li>A staff panel (separate from companies' accounts) showing latest orders etc</li>
</ol>
<p>What I want to ask is, is there anyone who has created some sort of a similar app in rails? Which gems are the most useful? With one gem, let's say shoppe, extending its functionality: is it going to be easy like adding companies accounts, user accounts and admin panel? Any general guidelines that you have?</p>
| 0debug
|
Contact lookup via Email field : <p>I am using <em>Force.com Toolkit for PHP (Version 20.0)</em> to integrate with Salesforce.</p>
<p>I would like to lookup some Contact via the email field and print in on page if the condition is met. Here is the query I used:</p>
<pre><code>SELECT Name, Email, npe01__HomeEmail__c, npe01__WorkEmail__c, npe01__AlternateEmail__c FROM Contact WHERE Email = "a@a.com"
</code></pre>
<p>In <a href="https://workbench.developerforce.com/" rel="noreferrer">Workbench</a> everything works fine, however, when I use the same query in PHP I get the following error:</p>
<blockquote>
<p>'MALFORMED_QUERY: npe01__AlternateEmail__c FROM Contact WHERE Email="a@a.com"<br>
ERROR at Row:1:Column:112<br>
Bind variables only allowed in Apex code' </p>
</blockquote>
<p>What would be best practice to help me solve this problem?</p>
<p>Thanks!</p>
| 0debug
|
Regex - Match any string longer than 2 characters but not containing '%' : <p>After extensive research, I have still not been able to find a regex which would match any string longer than 2 characters and not including a percentage (%) sign. Please could anyone relieve me from this headache?</p>
<p>Many thanks!</p>
| 0debug
|
Trying to see if this is responsive : <p>Review the basic CSS below, confirm whether this will provide a responsive page or not. If not, what changes would need to take place for it to be responsive?</p>
<pre><code> <style>
.article {
float: left;
margin: 5px;
padding: 5px;
width: 300px;
height: 300px;
border: 1px solid black;
}
</style>
</code></pre>
| 0debug
|
ptyhon - How do I execute this function syntax? : def swap_value(x,y):
temp = x
x = y
y = temp
return
swap_value(3,4)
I tried it like this. But it didn't work
| 0debug
|
Change Destinatin method : I created a method changeTarget in the TraCICommandInterface.cc file where I used the chageTarget Traci command to change the destination.I wanted to know whether tis is a correct implementation or not and also the nodeId mentioned in the method is the same as the nodeId of TraCICommandInterface.h.So can I use the nodeId or do I need to use the getexternalId() method to get the vehicle id.
void TraCICommandInterface::Vehicle::changeTarget(std::string roadId)
{
uint8_t variableId = CMD_CHANGETARGET;
uint8_t variableType = TYPE_COMPOUND;
uint8_t edgeIdT = TYPE_STRING;
std::string edgeId = roadId;
TraCIBuffer buf = connection->query(CMD_SET_VEHICLE_VARIABLE, TraCIBuffer() << variableId << nodeId << variableType << edgeId<<edgeIdT);
ASSERT(buf.eof());
}
| 0debug
|
Are maps passed by value or by reference in Go? : <p>Are maps passed by value or reference in Go ?</p>
<p>It is always possible to define a function as following, but is this an overkill ?</p>
<pre><code>func foo(dat *map[string]interface{}) {...}
</code></pre>
<p>Same question for return value. Should I return a pointer to the map, or return the map as value ? </p>
<p>The intention is of course to avoid unnecessary data copy. </p>
| 0debug
|
VSO(TFS) - get current date time as variable : <p>How can I get a current date-time and pass it as a variable to some Deployment task?</p>
| 0debug
|
Mac spark-shell Error initializing SparkContext : <p>I tried to start spark 1.6.0 (spark-1.6.0-bin-hadoop2.4) on Mac OS Yosemite 10.10.5 using </p>
<pre><code>"./bin/spark-shell".
</code></pre>
<p>It has the error below. I also tried to install different versions of Spark but all have the same error. This is the second time I'm running Spark. My previous run works fine. </p>
<pre><code>log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Using Spark's repl log4j profile: org/apache/spark/log4j-defaults-repl.properties
To adjust logging level use sc.setLogLevel("INFO")
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 1.6.0
/_/
Using Scala version 2.10.5 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_79)
Type in expressions to have them evaluated.
Type :help for more information.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 WARN Utils: Service 'sparkDriver' could not bind on port 0. Attempting port 1.
16/01/04 13:49:40 ERROR SparkContext: Error initializing SparkContext.
java.net.BindException: Can't assign requested address: Service 'sparkDriver' failed after 16 retries!
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:125)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:485)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1089)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:430)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:415)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:903)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:198)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:348)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at java.lang.Thread.run(Thread.java:745)
java.net.BindException: Can't assign requested address: Service 'sparkDriver' failed after 16 retries!
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at io.netty.channel.socket.nio.NioServerSocketChannel.doBind(NioServerSocketChannel.java:125)
at io.netty.channel.AbstractChannel$AbstractUnsafe.bind(AbstractChannel.java:485)
at io.netty.channel.DefaultChannelPipeline$HeadContext.bind(DefaultChannelPipeline.java:1089)
at io.netty.channel.AbstractChannelHandlerContext.invokeBind(AbstractChannelHandlerContext.java:430)
at io.netty.channel.AbstractChannelHandlerContext.bind(AbstractChannelHandlerContext.java:415)
at io.netty.channel.DefaultChannelPipeline.bind(DefaultChannelPipeline.java:903)
at io.netty.channel.AbstractChannel.bind(AbstractChannel.java:198)
at io.netty.bootstrap.AbstractBootstrap$2.run(AbstractBootstrap.java:348)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:357)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111)
at java.lang.Thread.run(Thread.java:745)
java.lang.NullPointerException
at org.apache.spark.sql.SQLContext$.createListenerAndUI(SQLContext.scala:1367)
at org.apache.spark.sql.hive.HiveContext.<init>(HiveContext.scala:101)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.spark.repl.SparkILoop.createSQLContext(SparkILoop.scala:1028)
at $iwC$$iwC.<init>(<console>:15)
at $iwC.<init>(<console>:24)
at <init>(<console>:26)
at .<init>(<console>:30)
at .<clinit>(<console>)
at .<init>(<console>:7)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.spark.repl.SparkIMain$ReadEvalPrint.call(SparkIMain.scala:1065)
at org.apache.spark.repl.SparkIMain$Request.loadAndRun(SparkIMain.scala:1346)
at org.apache.spark.repl.SparkIMain.loadAndRunReq$1(SparkIMain.scala:840)
at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:871)
at org.apache.spark.repl.SparkIMain.interpret(SparkIMain.scala:819)
at org.apache.spark.repl.SparkILoop.reallyInterpret$1(SparkILoop.scala:857)
at org.apache.spark.repl.SparkILoop.interpretStartingWith(SparkILoop.scala:902)
at org.apache.spark.repl.SparkILoop.command(SparkILoop.scala:814)
at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:132)
at org.apache.spark.repl.SparkILoopInit$$anonfun$initializeSpark$1.apply(SparkILoopInit.scala:124)
at org.apache.spark.repl.SparkIMain.beQuietDuring(SparkIMain.scala:324)
at org.apache.spark.repl.SparkILoopInit$class.initializeSpark(SparkILoopInit.scala:124)
at org.apache.spark.repl.SparkILoop.initializeSpark(SparkILoop.scala:64)
at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1$$anonfun$apply$mcZ$sp$5.apply$mcV$sp(SparkILoop.scala:974)
at org.apache.spark.repl.SparkILoopInit$class.runThunks(SparkILoopInit.scala:159)
at org.apache.spark.repl.SparkILoop.runThunks(SparkILoop.scala:64)
at org.apache.spark.repl.SparkILoopInit$class.postInitialization(SparkILoopInit.scala:108)
at org.apache.spark.repl.SparkILoop.postInitialization(SparkILoop.scala:64)
at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply$mcZ$sp(SparkILoop.scala:991)
at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)
at org.apache.spark.repl.SparkILoop$$anonfun$org$apache$spark$repl$SparkILoop$$process$1.apply(SparkILoop.scala:945)
at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:135)
at org.apache.spark.repl.SparkILoop.org$apache$spark$repl$SparkILoop$$process(SparkILoop.scala:945)
at org.apache.spark.repl.SparkILoop.process(SparkILoop.scala:1059)
at org.apache.spark.repl.Main$.main(Main.scala:31)
at org.apache.spark.repl.Main.main(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:731)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:181)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:206)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:121)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
<console>:16: error: not found: value sqlContext
import sqlContext.implicits._
^
<console>:16: error: not found: value sqlContext
import sqlContext.sql
</code></pre>
<p>Then I add </p>
<pre><code>export SPARK_LOCAL_IP="127.0.0.1"
</code></pre>
<p>to spark-env.sh, error changes to:</p>
<pre><code> ERROR : No route to host
java.net.ConnectException: No route to host
at java.net.Inet6AddressImpl.isReachable0(Native Method)
at java.net.Inet6AddressImpl.isReachable(Inet6AddressImpl.java:77)
at java.net.InetAddress.isReachable(InetAddress.java:475)
...
<console>:10: error: not found: value sqlContext
import sqlContext.implicits._
^
<console>:10: error: not found: value sqlContext
import sqlContext.sql
</code></pre>
| 0debug
|
Removing first element in array and NOT returning new array : Given an array:
arr1 = [x,y,z]
I need a way to remove the first element in arr1 and assigning the new array to a new array:
arr2 = [y,z]
Such that I end up with
arr1 = [x,y,z] AND the new array arr2 = [y,z]
| 0debug
|
Creating the xml format to pass to zeep : <p>I'm new to zeep.
I have the following that works very well:</p>
<pre><code>import zeep
from zeep.cache import SqliteCache
from zeep.transports import Transport
wsdl = 'https://emaapitest.eset.com/Services/v2015_1/MSPService.svc?singleWsdl'
transport = Transport(cache=SqliteCache())
client = zeep.Client(wsdl=wsdl, transport=transport )
</code></pre>
<p>With the above I can use the defined API for most calls.
For example:</p>
<pre><code>data = {'Username': 'xxxx123', 'Password': 'Secretpassword'}
loginreq = client.service.Login(data)
data = {'LoginID': 'xxxyyy', 'Token': 'gregrwevds543', 'CompanyID': 123}
company_details = client.service.GetCompanyDetails(data)
</code></pre>
<p>That all works well.
However the API call to UpdateSite needs a different format as below:</p>
<pre><code><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/" xmlns:msp="http://schemas.datacontract.org/2004/07/MSPApi.Services.v2015_1.Requests">
<soapenv:Header/>
<soapenv:Body>
<tem:UpdateSite>
<tem:request>
<msp:LoginID>123abc</msp:LoginID>
<msp:Token>hpjzncpduqyfreyakcsdilqv</msp:Token>
<msp:LicenseRequests>
<LicenseRequest xmlns:d7="http://schemas.datacontract.org/2004/07/MSPApi.Services.v2015_1.Requests"
i:type="d7:LicenseCreateRequest" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MSPApi.Services.v2015_1.ViewModels">
<d7:ProductCode>112</d7:ProductCode>
<d7:Quantity>3</d7:Quantity>
<d7:Trial>false</d7:Trial>
</LicenseRequest>
</msp:LicenseRequests>
<msp:SiteID>123456</msp:SiteID>
</tem:request>
</tem:UpdateSite>
</soapenv:Body>
</soapenv:Envelope>
</code></pre>
<p>That is I need to change the namespace on the LicenseRequest.
Is there any way I can generate this xml (say using etree maybe) and then pass this into zeep?
Exact syntax would be a great help.
Thanks for any help in advance.</p>
| 0debug
|
Iron Python script for cross Table taggle Rows Grand Total : <p>can any one help me script for cross table rows Grand Total in a cross table.</p>
<p>Thanks
Raju</p>
| 0debug
|
Any help? I need these 3 ID's to work for me in SQL : The Title of my project is Media Advertisements DB. I want these to be displayed in a Java GUI in a pretty accordingly and neat way. Like there are options where the user can view those different tables, but also to display them all at but when i display those, it is disaccordingly... Any help to make the structure better?
[Here are the tables i've made:][1]
[1]: https://i.stack.imgur.com/QPhzj.png
| 0debug
|
static void validate_numa_cpus(void)
{
int i;
unsigned long *seen_cpus = bitmap_new(max_cpus);
for (i = 0; i < nb_numa_nodes; i++) {
if (bitmap_intersects(seen_cpus, numa_info[i].node_cpu, max_cpus)) {
bitmap_and(seen_cpus, seen_cpus,
numa_info[i].node_cpu, max_cpus);
error_report("CPU(s) present in multiple NUMA nodes: %s",
enumerate_cpus(seen_cpus, max_cpus));
g_free(seen_cpus);
exit(EXIT_FAILURE);
}
bitmap_or(seen_cpus, seen_cpus,
numa_info[i].node_cpu, max_cpus);
}
if (!bitmap_full(seen_cpus, max_cpus)) {
char *msg;
bitmap_complement(seen_cpus, seen_cpus, max_cpus);
msg = enumerate_cpus(seen_cpus, max_cpus);
error_report("warning: CPU(s) not present in any NUMA nodes: %s", msg);
error_report("warning: All CPU(s) up to maxcpus should be described "
"in NUMA config");
g_free(msg);
}
g_free(seen_cpus);
}
| 1threat
|
static void put_ebml_uint(ByteIOContext *pb, unsigned int elementid, uint64_t val)
{
int i, bytes = 1;
while (val >> bytes*8) bytes++;
put_ebml_id(pb, elementid);
put_ebml_num(pb, bytes, 0);
for (i = bytes - 1; i >= 0; i--)
put_byte(pb, val >> i*8);
}
| 1threat
|
Python modifying a dictionary with a function call : <p>Here is my code. I am trying to construct a list of names to create a bunch of defaultdicts. Then I want to modify these default dicts by calling a function.
Having problems as you can see in the comments.</p>
<pre><code>#!/usr/bin/python
from collections import defaultdict
class Stats(object):
def __init__(self, name, namedict):
self.name = name
self.namedict = namedict
def update_stats(self, playerdict):
self.playerdict = playerdict
playerdict['HR'] += 1
return(playerdict)
l = ['a', 'b', 'c']
for x in l:
d = x + 'dict' # trying to make a list of dict names
print "Name is",d # it is a string so far
d = defaultdict(int) # now it is a dict but what is its name?
print d # i have a structure here but don't know its name
stats = Stats('stats',d)
# next test code block does not work
#for k,v in adict.iteritems(): # adict not defined!
# print k,v
# next code block does not work either
for y in l:
dictname = y + 'dict'
dictname = stats.update_stats(**dictname)
# it thinks dictname is a String
# in general what is the right way to pass in a dictionary
# and get it back in a modified state?
</code></pre>
| 0debug
|
Difference between ArrayList and Array of object : <p>I am not able to make the difference between ArrayList and Array of objects in java. I am just a beginner. Also I am not able to understand that why Array is sorted by Arrays.sort and ArrayList is sorted by Collections.sort if both are array only.</p>
| 0debug
|
How to show check box text if it is not next to check box using Jquey : [click to see the image][1]
I am tying to achive checked value text should visible like shown in the image.without refresh or any click can anyone help me out.?
This is my php dynamic from :
<div class="products-row">
<?php $tq=$conn->query("select * from os_tiffen where tiffen_status=1 order by id_tiffen ASC");
while ($tiffen = $tq->fetch_assoc()) {
?>
<div class="col-md-3">
<div class="foodmenuform row text-center">
<input multiple="multiple" type="checkbox" id="<?php echo $tiffen['tiffen_image']; ?>" name="tifeen" hidden>
<label for="<?php echo $tiffen['tiffen_image'];?>"><img src="img/tiffen/<?php echo $tiffen['tiffen_image']; ?>" class="img img-responsive" /></label>
<h3 class="FoodName"><?php echo $tiffen['tiffen_name'];?></h3>
</div>
</div>
<?php } ?>
</div>
This is my sript to show the text:
<script type="text/javascript" language="JavaScript">
$( document ).ready(function() {
var FoodMenu = $('input[type=checkbox]:checked').map(function(){
return $(this).next('.FoodName').text();
}).get().join("<br>");
$("#selectedfood").html(FoodMenu);
});
</script>
[1]: http://i.stack.imgur.com/NMuuZ.png
Out put id: `<a id="selectedfood"></a></li>`
| 0debug
|
Equivalent of "@section" in ASP.NET Core MVC? : <p>In the default <code>_Layout.cshtml</code> file, scripts are defined in "environment"s like so:</p>
<pre><code><environment names="Development">
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
</environment>
<environment names="Staging,Production">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
</script>
<script src="~/js/site.min.js" asp-append-version="true"></script>
</environment>
</code></pre>
<p>And below that is <code>@RenderSection("scripts", required: false)</code></p>
<p>I can't seem to implement a section (in this case "scripts") in any separate .cshtml file since it looks like they got rid of "<code>@section</code>" in Core</p>
<p>I would like to add specific scripts for specific views. What is the new way to go about this? Do I just dump everything in <code>_Layout</code> now?</p>
| 0debug
|
static int smacker_read_header(AVFormatContext *s)
{
AVIOContext *pb = s->pb;
SmackerContext *smk = s->priv_data;
AVStream *st, *ast[7];
int i, ret;
int tbase;
smk->magic = avio_rl32(pb);
if (smk->magic != MKTAG('S', 'M', 'K', '2') && smk->magic != MKTAG('S', 'M', 'K', '4'))
return AVERROR_INVALIDDATA;
smk->width = avio_rl32(pb);
smk->height = avio_rl32(pb);
smk->frames = avio_rl32(pb);
smk->pts_inc = (int32_t)avio_rl32(pb);
smk->flags = avio_rl32(pb);
if(smk->flags & SMACKER_FLAG_RING_FRAME)
smk->frames++;
for(i = 0; i < 7; i++)
smk->audio[i] = avio_rl32(pb);
smk->treesize = avio_rl32(pb);
if(smk->treesize >= UINT_MAX/4){
av_log(s, AV_LOG_ERROR, "treesize too large\n");
return AVERROR_INVALIDDATA;
}
smk->mmap_size = avio_rl32(pb);
smk->mclr_size = avio_rl32(pb);
smk->full_size = avio_rl32(pb);
smk->type_size = avio_rl32(pb);
for(i = 0; i < 7; i++) {
smk->rates[i] = avio_rl24(pb);
smk->aflags[i] = avio_r8(pb);
}
smk->pad = avio_rl32(pb);
if(smk->frames > 0xFFFFFF) {
av_log(s, AV_LOG_ERROR, "Too many frames: %i\n", smk->frames);
return AVERROR_INVALIDDATA;
}
smk->frm_size = av_malloc(smk->frames * 4);
smk->frm_flags = av_malloc(smk->frames);
smk->is_ver4 = (smk->magic != MKTAG('S', 'M', 'K', '2'));
for(i = 0; i < smk->frames; i++) {
smk->frm_size[i] = avio_rl32(pb);
}
for(i = 0; i < smk->frames; i++) {
smk->frm_flags[i] = avio_r8(pb);
}
st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
smk->videoindex = st->index;
st->codec->width = smk->width;
st->codec->height = smk->height;
st->codec->pix_fmt = AV_PIX_FMT_PAL8;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = AV_CODEC_ID_SMACKVIDEO;
st->codec->codec_tag = smk->magic;
if(smk->pts_inc < 0)
smk->pts_inc = -smk->pts_inc;
else
smk->pts_inc *= 100;
tbase = 100000;
av_reduce(&tbase, &smk->pts_inc, tbase, smk->pts_inc, (1UL<<31)-1);
avpriv_set_pts_info(st, 33, smk->pts_inc, tbase);
st->duration = smk->frames;
for(i = 0; i < 7; i++) {
smk->indexes[i] = -1;
if (smk->rates[i]) {
ast[i] = avformat_new_stream(s, NULL);
if (!ast[i])
return AVERROR(ENOMEM);
smk->indexes[i] = ast[i]->index;
ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO;
if (smk->aflags[i] & SMK_AUD_BINKAUD) {
ast[i]->codec->codec_id = AV_CODEC_ID_BINKAUDIO_RDFT;
} else if (smk->aflags[i] & SMK_AUD_USEDCT) {
ast[i]->codec->codec_id = AV_CODEC_ID_BINKAUDIO_DCT;
} else if (smk->aflags[i] & SMK_AUD_PACKED){
ast[i]->codec->codec_id = AV_CODEC_ID_SMACKAUDIO;
ast[i]->codec->codec_tag = MKTAG('S', 'M', 'K', 'A');
} else {
ast[i]->codec->codec_id = AV_CODEC_ID_PCM_U8;
}
if (smk->aflags[i] & SMK_AUD_STEREO) {
ast[i]->codec->channels = 2;
ast[i]->codec->channel_layout = AV_CH_LAYOUT_STEREO;
} else {
ast[i]->codec->channels = 1;
ast[i]->codec->channel_layout = AV_CH_LAYOUT_MONO;
}
ast[i]->codec->sample_rate = smk->rates[i];
ast[i]->codec->bits_per_coded_sample = (smk->aflags[i] & SMK_AUD_16BITS) ? 16 : 8;
if(ast[i]->codec->bits_per_coded_sample == 16 && ast[i]->codec->codec_id == AV_CODEC_ID_PCM_U8)
ast[i]->codec->codec_id = AV_CODEC_ID_PCM_S16LE;
avpriv_set_pts_info(ast[i], 64, 1, ast[i]->codec->sample_rate
* ast[i]->codec->channels * ast[i]->codec->bits_per_coded_sample / 8);
}
}
st->codec->extradata = av_mallocz(smk->treesize + 16 +
FF_INPUT_BUFFER_PADDING_SIZE);
st->codec->extradata_size = smk->treesize + 16;
if(!st->codec->extradata){
av_log(s, AV_LOG_ERROR, "Cannot allocate %i bytes of extradata\n", smk->treesize + 16);
av_freep(&smk->frm_size);
av_freep(&smk->frm_flags);
return AVERROR(ENOMEM);
}
ret = avio_read(pb, st->codec->extradata + 16, st->codec->extradata_size - 16);
if(ret != st->codec->extradata_size - 16){
av_freep(&smk->frm_size);
av_freep(&smk->frm_flags);
return AVERROR(EIO);
}
((int32_t*)st->codec->extradata)[0] = av_le2ne32(smk->mmap_size);
((int32_t*)st->codec->extradata)[1] = av_le2ne32(smk->mclr_size);
((int32_t*)st->codec->extradata)[2] = av_le2ne32(smk->full_size);
((int32_t*)st->codec->extradata)[3] = av_le2ne32(smk->type_size);
smk->curstream = -1;
smk->nextpos = avio_tell(pb);
return 0;
}
| 1threat
|
passing hex command to c function : <p>In the function declaration below for uart write on a mcu, can I pass a hex command?</p>
<pre><code>uart_write(const uart_t uart, const uint8_t data);
uart_write(uart_1, 0x56);
</code></pre>
| 0debug
|
How to getIDs of SVG Paths : <p>I'm currently working on this svg file and I'm trying to get the ID of each path. I converted the image using Raphael so this was the code.
<a href="https://i.stack.imgur.com/rrnU6.png" rel="nofollow noreferrer">Image of path code</a></p>
<p>Then here's my svg in my html file.</p>
<p><a href="https://i.stack.imgur.com/dndqa.png" rel="nofollow noreferrer">Image of svg code</a></p>
| 0debug
|
Javascript to parse string that may contain invalid daylight date : I need help to convert input string that looks something like '20160313023000' (invalid daylight saving date) to date in 'yyyyMMddHHmmss' format using javascript.
Thanks in advance.
| 0debug
|
static int rkmpp_retrieve_frame(AVCodecContext *avctx, AVFrame *frame)
{
RKMPPDecodeContext *rk_context = avctx->priv_data;
RKMPPDecoder *decoder = (RKMPPDecoder *)rk_context->decoder_ref->data;
RKMPPFrameContext *framecontext = NULL;
AVBufferRef *framecontextref = NULL;
int ret;
MppFrame mppframe = NULL;
MppBuffer buffer = NULL;
AVDRMFrameDescriptor *desc = NULL;
AVDRMLayerDescriptor *layer = NULL;
int retrycount = 0;
int mode;
MppFrameFormat mppformat;
uint32_t drmformat;
retry_get_frame:
ret = decoder->mpi->decode_get_frame(decoder->ctx, &mppframe);
if (ret != MPP_OK && ret != MPP_ERR_TIMEOUT && !decoder->first_frame) {
if (retrycount < 5) {
av_log(avctx, AV_LOG_DEBUG, "Failed to get a frame, retrying (code = %d, retrycount = %d)\n", ret, retrycount);
usleep(10000);
retrycount++;
goto retry_get_frame;
} else {
av_log(avctx, AV_LOG_ERROR, "Failed to get a frame from MPP (code = %d)\n", ret);
goto fail;
}
}
if (mppframe) {
if (mpp_frame_get_info_change(mppframe)) {
AVHWFramesContext *hwframes;
av_log(avctx, AV_LOG_INFO, "Decoder noticed an info change (%dx%d), format=%d\n",
(int)mpp_frame_get_width(mppframe), (int)mpp_frame_get_height(mppframe),
(int)mpp_frame_get_fmt(mppframe));
avctx->width = mpp_frame_get_width(mppframe);
avctx->height = mpp_frame_get_height(mppframe);
decoder->mpi->control(decoder->ctx, MPP_DEC_SET_INFO_CHANGE_READY, NULL);
decoder->first_frame = 1;
av_buffer_unref(&decoder->frames_ref);
decoder->frames_ref = av_hwframe_ctx_alloc(decoder->device_ref);
if (!decoder->frames_ref) {
ret = AVERROR(ENOMEM);
goto fail;
}
mppformat = mpp_frame_get_fmt(mppframe);
drmformat = rkmpp_get_frameformat(mppformat);
hwframes = (AVHWFramesContext*)decoder->frames_ref->data;
hwframes->format = AV_PIX_FMT_DRM_PRIME;
hwframes->sw_format = drmformat == DRM_FORMAT_NV12 ? AV_PIX_FMT_NV12 : AV_PIX_FMT_NONE;
hwframes->width = avctx->width;
hwframes->height = avctx->height;
ret = av_hwframe_ctx_init(decoder->frames_ref);
if (ret < 0)
goto fail;
ret = AVERROR(EAGAIN);
goto fail;
} else if (mpp_frame_get_eos(mppframe)) {
av_log(avctx, AV_LOG_DEBUG, "Received a EOS frame.\n");
decoder->eos_reached = 1;
ret = AVERROR_EOF;
goto fail;
} else if (mpp_frame_get_discard(mppframe)) {
av_log(avctx, AV_LOG_DEBUG, "Received a discard frame.\n");
ret = AVERROR(EAGAIN);
goto fail;
} else if (mpp_frame_get_errinfo(mppframe)) {
av_log(avctx, AV_LOG_ERROR, "Received a errinfo frame.\n");
ret = AVERROR_UNKNOWN;
goto fail;
}
av_log(avctx, AV_LOG_DEBUG, "Received a frame.\n");
frame->format = AV_PIX_FMT_DRM_PRIME;
frame->width = mpp_frame_get_width(mppframe);
frame->height = mpp_frame_get_height(mppframe);
frame->pts = mpp_frame_get_pts(mppframe);
frame->color_range = mpp_frame_get_color_range(mppframe);
frame->color_primaries = mpp_frame_get_color_primaries(mppframe);
frame->color_trc = mpp_frame_get_color_trc(mppframe);
frame->colorspace = mpp_frame_get_colorspace(mppframe);
mode = mpp_frame_get_mode(mppframe);
frame->interlaced_frame = ((mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK) == MPP_FRAME_FLAG_DEINTERLACED);
frame->top_field_first = ((mode & MPP_FRAME_FLAG_FIELD_ORDER_MASK) == MPP_FRAME_FLAG_TOP_FIRST);
mppformat = mpp_frame_get_fmt(mppframe);
drmformat = rkmpp_get_frameformat(mppformat);
buffer = mpp_frame_get_buffer(mppframe);
if (buffer) {
desc = av_mallocz(sizeof(AVDRMFrameDescriptor));
if (!desc) {
ret = AVERROR(ENOMEM);
goto fail;
}
desc->nb_objects = 1;
desc->objects[0].fd = mpp_buffer_get_fd(buffer);
desc->objects[0].size = mpp_buffer_get_size(buffer);
desc->nb_layers = 1;
layer = &desc->layers[0];
layer->format = drmformat;
layer->nb_planes = 2;
layer->planes[0].object_index = 0;
layer->planes[0].offset = 0;
layer->planes[0].pitch = mpp_frame_get_hor_stride(mppframe);
layer->planes[1].object_index = 0;
layer->planes[1].offset = layer->planes[0].pitch * mpp_frame_get_ver_stride(mppframe);
layer->planes[1].pitch = layer->planes[0].pitch;
framecontextref = av_buffer_allocz(sizeof(*framecontext));
if (!framecontextref) {
ret = AVERROR(ENOMEM);
goto fail;
}
framecontext = (RKMPPFrameContext *)framecontextref->data;
framecontext->decoder_ref = av_buffer_ref(rk_context->decoder_ref);
framecontext->frame = mppframe;
frame->data[0] = (uint8_t *)desc;
frame->buf[0] = av_buffer_create((uint8_t *)desc, sizeof(*desc), rkmpp_release_frame,
framecontextref, AV_BUFFER_FLAG_READONLY);
if (!frame->buf[0]) {
ret = AVERROR(ENOMEM);
goto fail;
}
frame->hw_frames_ctx = av_buffer_ref(decoder->frames_ref);
if (!frame->hw_frames_ctx) {
ret = AVERROR(ENOMEM);
goto fail;
}
decoder->first_frame = 0;
return 0;
} else {
av_log(avctx, AV_LOG_ERROR, "Failed to retrieve the frame buffer, frame is dropped (code = %d)\n", ret);
mpp_frame_deinit(&mppframe);
}
} else if (decoder->eos_reached) {
return AVERROR_EOF;
} else if (ret == MPP_ERR_TIMEOUT) {
av_log(avctx, AV_LOG_DEBUG, "Timeout when trying to get a frame from MPP\n");
}
return AVERROR(EAGAIN);
fail:
if (mppframe)
mpp_frame_deinit(&mppframe);
if (framecontext)
av_buffer_unref(&framecontext->decoder_ref);
if (framecontextref)
av_buffer_unref(&framecontextref);
if (desc)
av_free(desc);
return ret;
}
| 1threat
|
PHP 7.1.1 - All printer functions not working : <p>I am trying to print using PHP I am using php version 7.1.1 xamp in my local machine. I have seen many answers or solution but they did not work. Some solutions included downloading and installing php_printer.dll, but i still fail.
i tried printer_list(), printer_open(); nun of this work. i get Fatal error: Uncaught Error: Call to undefined function printer_list() and so on.</p>
<pre><code> ///////////////////////////example 1//////////////
//////////////////////////////////////////////////
$print_data = $_POST['zpl_data'];
try
{
$fp=pfsockopen("10.136.3.64",0001); //9100
fputs($fp,'test');
fclose($fp);
echo 'Successfully Printed';
}
catch (Exception $e)
{
echo 'Caught exception: ', $e->getMessage(), "\n";
}
/////////////////example 2////////////////////////////
/////////////////////////////////////////////////////////
$handle = printer_open('\\\\192.168.2.206:9100\\');
printer_set_option($handle, PRINTER_MODE, "RAW");
printer_write($handle, "TEXT To print");
printer_close($handle);
$printer_name = "Your Printer Name exactly as it is";
$handle = printer_open($printer_name);
printer_start_doc($handle, "My Document");
printer_start_page($handle);
$font = printer_create_font("Arial", 100, 100, 400, false, false, false, 0);
printer_select_font($handle, $font);
printer_draw_text($handle, 'This sentence should be printed.', 100, 400);
printer_delete_font($font);
printer_end_page($handle);
printer_end_doc($handle);
printer_close($handle);
///////////example 3 ///////////////////////////
///////////////////////////////////////////////
var_dump(printer_list(PRINTER_ENUM_LOCAL | PRINTER_ENUM_SHARED));
</code></pre>
| 0debug
|
Javascript: Comparing elements in nested arrays using nested for loops : <p>I'm working with an array of arrays that looks like this:</p>
<p><code>let matrix = [[0,1,1,2], [0,5,0,0], [2,0,3,3]]</code></p>
<p>I want to loop through each array and compare the value to the same element in the other arrays i.e. I want to compare the 0th element in the 0th array to the 0th elements in the 1th and 2nd array (in this case I would be comparing 0 to 0 and 2 respectively).</p>
<p>I want to iterate through the arrays comparing the current array element in the current array to it's counterpart in the following arrays i.e. look at the 0th element of this array and compare it to the 0th element in the next two arrays, then look at the 1th element in this array and compare it to the 1th element in the next two arrays, and so forth.</p>
<pre><code>Compare the values 0, 0, 2
Then compare 1,5,0
Then compare 1,0,3,
Then compare 2, 0, 3
</code></pre>
<p>How can I do this with nested for loops? Is there a better way to do this not involving nested for loops?</p>
| 0debug
|
static int ehci_execute(EHCIQueue *q)
{
USBDevice *dev;
int ret;
int endp;
int devadr;
if ( !(q->qh.token & QTD_TOKEN_ACTIVE)) {
fprintf(stderr, "Attempting to execute inactive QH\n");
return USB_RET_PROCERR;
}
q->tbytes = (q->qh.token & QTD_TOKEN_TBYTES_MASK) >> QTD_TOKEN_TBYTES_SH;
if (q->tbytes > BUFF_SIZE) {
fprintf(stderr, "Request for more bytes than allowed\n");
return USB_RET_PROCERR;
}
q->pid = (q->qh.token & QTD_TOKEN_PID_MASK) >> QTD_TOKEN_PID_SH;
switch(q->pid) {
case 0: q->pid = USB_TOKEN_OUT; break;
case 1: q->pid = USB_TOKEN_IN; break;
case 2: q->pid = USB_TOKEN_SETUP; break;
default: fprintf(stderr, "bad token\n"); break;
}
if (ehci_init_transfer(q) != 0) {
return USB_RET_PROCERR;
}
endp = get_field(q->qh.epchar, QH_EPCHAR_EP);
devadr = get_field(q->qh.epchar, QH_EPCHAR_DEVADDR);
ret = USB_RET_NODEV;
usb_packet_setup(&q->packet, q->pid, devadr, endp);
usb_packet_map(&q->packet, &q->sgl);
dev = ehci_find_device(q->ehci, q->packet.devaddr);
ret = usb_handle_packet(dev, &q->packet);
DPRINTF("submit: qh %x next %x qtd %x pid %x len %zd "
"(total %d) endp %x ret %d\n",
q->qhaddr, q->qh.next, q->qtdaddr, q->pid,
q->packet.iov.size, q->tbytes, endp, ret);
if (ret > BUFF_SIZE) {
fprintf(stderr, "ret from usb_handle_packet > BUFF_SIZE\n");
return USB_RET_PROCERR;
}
return ret;
}
| 1threat
|
@Override in all methods is decripted in new project created in android : I created new project in android studio and it shows @Override for all methods decrypted well as when i opened my old projects in it @Override shows decrypted.[enter image description here][1]
[1]: https://i.stack.imgur.com/kJRVs.png
| 0debug
|
void stq_phys_notdirty(target_phys_addr_t addr, uint64_t val)
{
uint8_t *ptr;
MemoryRegionSection *section;
section = phys_page_find(addr >> TARGET_PAGE_BITS);
if (!memory_region_is_ram(section->mr) || section->readonly) {
addr = memory_region_section_addr(section, addr);
if (memory_region_is_ram(section->mr)) {
section = &phys_sections[phys_section_rom];
}
#ifdef TARGET_WORDS_BIGENDIAN
io_mem_write(section->mr, addr, val >> 32, 4);
io_mem_write(section->mr, addr + 4, (uint32_t)val, 4);
#else
io_mem_write(section->mr, addr, (uint32_t)val, 4);
io_mem_write(section->mr, addr + 4, val >> 32, 4);
#endif
} else {
ptr = qemu_get_ram_ptr((memory_region_get_ram_addr(section->mr)
& TARGET_PAGE_MASK)
+ memory_region_section_addr(section, addr));
stq_p(ptr, val);
}
}
| 1threat
|
void module_call_init(module_init_type type)
{
ModuleTypeList *l;
ModuleEntry *e;
l = find_type(type);
TAILQ_FOREACH(e, l, node) {
e->init();
}
}
| 1threat
|
Iterative decoding : <p>So, I have a cipher that I would need to break. I have the key, but the problem is that every number in a cipher corresponds to three or two letters. For example, if we had the cipher '12', and we know that '1' corresponds to either 'A', 'J' or 'S', and '2' corresponds to 'B', 'K' or 'T', we would need to output all possible combinations, so: 'AB', 'AK', 'AT', 'JB', 'JK', 'JT', 'SB', 'SK', 'ST'. How would I go around doing this in C#? </p>
<p>Thanks in advance. </p>
| 0debug
|
Up/Down Key not working in Onenote 2016 for Autohotkey : <p>I mapped alt+i/k to Up/down key using Autohotkey, with the following code:</p>
<pre><code>!i:: Send {up}
!k:: Send {down}
</code></pre>
<p>These remappings work with every application except Onenote 2016. I checked it online and found some discussions in the following links:</p>
<p><a href="https://autohotkey.com/board/topic/15307-up-and-down-hotkeys-not-working-for-onenote-2007/" rel="noreferrer">https://autohotkey.com/board/topic/15307-up-and-down-hotkeys-not-working-for-onenote-2007/</a></p>
<p><a href="https://autohotkey.com/board/topic/41454-remap-key-doesnt-work-in-ms-onenote/" rel="noreferrer">https://autohotkey.com/board/topic/41454-remap-key-doesnt-work-in-ms-onenote/</a></p>
<p>They suggest to use sendplay or sendraw, but these didn't work for me. Can anyone help me with this?</p>
| 0debug
|
static void vga_mm_init(VGAState *s, target_phys_addr_t vram_base,
target_phys_addr_t ctrl_base, int it_shift)
{
int s_ioport_ctrl, vga_io_memory;
s->it_shift = it_shift;
s_ioport_ctrl = cpu_register_io_memory(0, vga_mm_read_ctrl, vga_mm_write_ctrl, s);
vga_io_memory = cpu_register_io_memory(0, vga_mem_read, vga_mem_write, s);
register_savevm("vga", 0, 2, vga_save, vga_load, s);
cpu_register_physical_memory(ctrl_base, 0x100000, s_ioport_ctrl);
s->bank_offset = 0;
cpu_register_physical_memory(vram_base + 0x000a0000, 0x20000, vga_io_memory);
}
| 1threat
|
iOS 11 Safari bootstrap modal text area outside of cursor : <p>With iOS 11 safari, input textbox cursor are outside of input textbox. We did not get why it is having this problem. As you can see my focused text box is email text input but my cursor is outside of it. This only happens with iOS 11 Safari </p>
<p><a href="https://i.stack.imgur.com/34d6d.png" rel="noreferrer"><img src="https://i.stack.imgur.com/34d6d.png" alt="Problem"></a></p>
| 0debug
|
python. How can I write a function that takes a list of spaces as input : Hi because I'm a beginner in python I have some questions. How can I write a function that takes a list of spaces as input and returns the sum of the lengths of the spaces.
| 0debug
|
Does bash have a way to un-export a variable without unsetting it? : <p>Is it possible to <code>export</code> a variable in Bash, then later un-export it, without unsetting it entirely? I.e. have it still available to the current shell, but not to sub-processes.</p>
<p>You can always do this, but it's ugly (and I'm curious):</p>
<pre><code>export FOO
#...
_FOO=$FOO
unset FOO
FOO=$_FOO
</code></pre>
<p>Answers about other shells also accepted.</p>
| 0debug
|
def average_tuple(nums):
result = [sum(x) / len(x) for x in zip(*nums)]
return result
| 0debug
|
How to segue to a specific viewcontroller in a different storyboard? : <p>When you execute a segue back to a storyboard using a storyboard reference, it loads up the initial view controller for that storyboard. </p>
<p>I'm needing to segue to a view controller that is not my initial view controller from the other storyboard. </p>
<p>How do you accomplish this?</p>
| 0debug
|
static int read_seek(AVFormatContext *s, int stream_index,
int64_t timestamp, int flags)
{
AVStream *st = s->streams[0];
CaffContext *caf = s->priv_data;
int64_t pos;
timestamp = FFMAX(timestamp, 0);
if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {
pos = caf->bytes_per_packet * timestamp / caf->frames_per_packet;
if (caf->data_size > 0)
pos = FFMIN(pos, caf->data_size);
caf->packet_cnt = pos / caf->bytes_per_packet;
caf->frame_cnt = caf->frames_per_packet * caf->packet_cnt;
} else if (st->nb_index_entries) {
caf->packet_cnt = av_index_search_timestamp(st, timestamp, flags);
caf->frame_cnt = st->index_entries[caf->packet_cnt].timestamp;
pos = st->index_entries[caf->packet_cnt].pos;
} else {
return -1;
}
avio_seek(s->pb, pos + caf->data_start, SEEK_SET);
return 0;
}
| 1threat
|
Why use pandas.assign rather than simply initialize new column? : <p>I just discovered the <code>assign</code> method for pandas dataframes, and it looks nice and very similar to dplyr's <code>mutate</code> in R. However, I've always gotten by by just initializing a new column 'on the fly'. Is there a reason why <code>assign</code> is better?</p>
<p>For instance (based on the example in the pandas documentation), to create a new column in a dataframe, I could just do this:</p>
<pre><code>df = DataFrame({'A': range(1, 11), 'B': np.random.randn(10)})
df['ln_A'] = np.log(df['A'])
</code></pre>
<p>but the <code>pandas.DataFrame.assign</code> documentation recommends doing this:</p>
<pre><code>df.assign(ln_A = lambda x: np.log(x.A))
# or
newcol = np.log(df['A'])
df.assign(ln_A=newcol)
</code></pre>
<p>Both methods return the same dataframe. In fact, the first method (my 'on the fly' method) is significantly faster (0.20225788200332318 seconds for 1000 iterations) than the <code>.assign</code> method (0.3526602769998135 seconds for 1000 iterations). </p>
<p>So is there a reason I should stop using my old method in favour of <code>df.assign</code>? </p>
| 0debug
|
alert('Hello ' + user_input);
| 1threat
|
static int jpeg2000_read_main_headers(Jpeg2000DecoderContext *s)
{
Jpeg2000CodingStyle *codsty = s->codsty;
Jpeg2000QuantStyle *qntsty = s->qntsty;
uint8_t *properties = s->properties;
for (;;) {
int len, ret = 0;
uint16_t marker;
int oldpos;
if (bytestream2_get_bytes_left(&s->g) < 2) {
av_log(s->avctx, AV_LOG_ERROR, "Missing EOC\n");
break;
}
marker = bytestream2_get_be16u(&s->g);
oldpos = bytestream2_tell(&s->g);
if (marker == JPEG2000_SOD) {
Jpeg2000Tile *tile = s->tile + s->curtileno;
Jpeg2000TilePart *tp = tile->tile_part + tile->tp_idx;
bytestream2_init(&tp->tpg, s->g.buffer, tp->tp_end - s->g.buffer);
bytestream2_skip(&s->g, tp->tp_end - s->g.buffer);
continue;
}
if (marker == JPEG2000_EOC)
break;
if (bytestream2_get_bytes_left(&s->g) < 2)
return AVERROR(EINVAL);
len = bytestream2_get_be16u(&s->g);
switch (marker) {
case JPEG2000_SIZ:
ret = get_siz(s);
if (!s->tile)
s->numXtiles = s->numYtiles = 0;
break;
case JPEG2000_COC:
ret = get_coc(s, codsty, properties);
break;
case JPEG2000_COD:
ret = get_cod(s, codsty, properties);
break;
case JPEG2000_QCC:
ret = get_qcc(s, len, qntsty, properties);
break;
case JPEG2000_QCD:
ret = get_qcd(s, len, qntsty, properties);
break;
case JPEG2000_SOT:
if (!(ret = get_sot(s, len))) {
av_assert1(s->curtileno >= 0);
codsty = s->tile[s->curtileno].codsty;
qntsty = s->tile[s->curtileno].qntsty;
properties = s->tile[s->curtileno].properties;
}
break;
case JPEG2000_COM:
bytestream2_skip(&s->g, len - 2);
break;
case JPEG2000_TLM:
ret = get_tlm(s, len);
break;
default:
av_log(s->avctx, AV_LOG_ERROR,
"unsupported marker 0x%.4X at pos 0x%X\n",
marker, bytestream2_tell(&s->g) - 4);
bytestream2_skip(&s->g, len - 2);
break;
}
if (bytestream2_tell(&s->g) - oldpos != len || ret) {
av_log(s->avctx, AV_LOG_ERROR,
"error during processing marker segment %.4x\n", marker);
return ret ? ret : -1;
}
}
return 0;
}
| 1threat
|
stored procedures to check date for example i want to check first whether start date is larger than expiry date then only i want to execute query : table passenger
create table passenger
(
passport_no varchar(15) not null,
fname varchar(25) not null,
minit char(1),
lname varchar(25) not null,
gender char(1) not null,
nationalty varchar(50) not null,
dob date not null,
issue_of_pport date not null,
exp_of_pport date not null,
catagory varchar(10) not null,
acc_pport_no varchar(15),
constraint pk_passenger primary key (passport_no),
constraint fk_gauardian_passenger foreign key (acc_pport_no) references passenger(passport_no), //****//
constraint check_catagory check (catagory='adult' or catagory='senior' or catagory='child' or catagory='infant'),
constraint chech_gender_passenger check (gender='m' or gender='f')
my stored procedure
create or alter procedure find_passport_expiry_date
(@passport_id varchar(50),@no_of_days int output)
as
begin
select @no_of_days=DATEDIFF(DAY,issue_of_pport,exp_of_pport) from passenger
where passport_no=@no_of_days
end
declare @days int
exec find_passport_expiry_date '43fafea',@days output
select @days as 'no_of_days_until_expiry'
| 0debug
|
How to count number of scripts are use in a particular view using asp.net mvc : How to count number of scripts tag use in a particular view in mvc
I want to do this in mvc please help as soon as possible.
| 0debug
|
What is wrong with int() function not accepting string in Python? : <p>I am relatively new to programming and I would like to test the base conversion ability of the int() function.
When I write:</p>
<pre><code>>>> int("3",2)
11
</code></pre>
<p>it displays this. However, if I use:</p>
<pre><code>>>> int('3',2)
</code></pre>
<p>it displays a value error, invalid literal for int with base 2: '3'
What is going on? This does not allow me to use int(str(a),2) for example.
I'm using Python 3.7.0 if this helps. I'm very frustrated with this problem.</p>
| 0debug
|
Javascript Regular Expression for a specific numeric pattern : <p>I'm actually looking for a javascript regex for a numeric pattern. Regex should accept any numeric input of below formats but not <strong>0.0.0</strong></p>
<p><strong>Condition:</strong></p>
<ul>
<li>each segment in the pattern ranges between 0-10</li>
</ul>
<p><strong>Valid</strong><br>2.9.6<br>0.6.10<br>10.10.10<br>0.0.1<br></p>
<p><strong>Invalid</strong><br>0.0.0</p>
<p>Any help would be appreciated..!! Thank you...!!</p>
| 0debug
|
def is_decimal(num):
import re
dnumre = re.compile(r"""^[0-9]+(\.[0-9]{1,2})?$""")
result = dnumre.search(num)
return bool(result)
| 0debug
|
why cant we use orginal for loop for Set : <p>The basic difference between the set and the list is that set wont allow the duplicates
the question is why cant we use original for loop for the set as we use for list</p>
<p>eg: length of set and list is same</p>
<pre><code> for(int i =0 ; i< list.size;i++){
list.get(i);
set.get(i); // here it is throwing an error like get(index ) cant be applied for set
</code></pre>
<p>}</p>
<p>but if i use advance for loop(for each) its working </p>
<pre><code>for(Object sample : set){
system.out.println(sample);
</code></pre>
<p>}</p>
<p>why is this happening ... is there any operational defference between for loop and for each , set and list ....</p>
<p>any help and suggestion would be useful ... thank you in advance</p>
| 0debug
|
static void disas_cond_select(DisasContext *s, uint32_t insn)
{
unsigned int sf, else_inv, rm, cond, else_inc, rn, rd;
TCGv_i64 tcg_rd, tcg_src;
if (extract32(insn, 29, 1) || extract32(insn, 11, 1)) {
unallocated_encoding(s);
return;
}
sf = extract32(insn, 31, 1);
else_inv = extract32(insn, 30, 1);
rm = extract32(insn, 16, 5);
cond = extract32(insn, 12, 4);
else_inc = extract32(insn, 10, 1);
rn = extract32(insn, 5, 5);
rd = extract32(insn, 0, 5);
if (rd == 31) {
return;
}
tcg_rd = cpu_reg(s, rd);
if (cond >= 0x0e) {
tcg_src = read_cpu_reg(s, rn, sf);
tcg_gen_mov_i64(tcg_rd, tcg_src);
} else {
int label_match = gen_new_label();
int label_continue = gen_new_label();
arm_gen_test_cc(cond, label_match);
tcg_src = cpu_reg(s, rm);
if (else_inv && else_inc) {
tcg_gen_neg_i64(tcg_rd, tcg_src);
} else if (else_inv) {
tcg_gen_not_i64(tcg_rd, tcg_src);
} else if (else_inc) {
tcg_gen_addi_i64(tcg_rd, tcg_src, 1);
} else {
tcg_gen_mov_i64(tcg_rd, tcg_src);
}
if (!sf) {
tcg_gen_ext32u_i64(tcg_rd, tcg_rd);
}
tcg_gen_br(label_continue);
gen_set_label(label_match);
tcg_src = read_cpu_reg(s, rn, sf);
tcg_gen_mov_i64(tcg_rd, tcg_src);
gen_set_label(label_continue);
}
}
| 1threat
|
static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac,
uint8_t (*layout_map)[3],
GetBitContext *gb)
{
int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc, sampling_index;
int comment_len;
int tags;
skip_bits(gb, 2);
sampling_index = get_bits(gb, 4);
if (m4ac->sampling_index != sampling_index)
av_log(avctx, AV_LOG_WARNING, "Sample rate index in program config element does not match the sample rate index configured by the container.\n");
num_front = get_bits(gb, 4);
num_side = get_bits(gb, 4);
num_back = get_bits(gb, 4);
num_lfe = get_bits(gb, 2);
num_assoc_data = get_bits(gb, 3);
num_cc = get_bits(gb, 4);
if (get_bits1(gb))
skip_bits(gb, 4);
if (get_bits1(gb))
skip_bits(gb, 4);
if (get_bits1(gb))
skip_bits(gb, 3);
if (get_bits_left(gb) < 4 * (num_front + num_side + num_back + num_lfe + num_assoc_data + num_cc)) {
av_log(avctx, AV_LOG_ERROR, overread_err);
return -1;
}
decode_channel_map(layout_map , AAC_CHANNEL_FRONT, gb, num_front);
tags = num_front;
decode_channel_map(layout_map + tags, AAC_CHANNEL_SIDE, gb, num_side);
tags += num_side;
decode_channel_map(layout_map + tags, AAC_CHANNEL_BACK, gb, num_back);
tags += num_back;
decode_channel_map(layout_map + tags, AAC_CHANNEL_LFE, gb, num_lfe);
tags += num_lfe;
skip_bits_long(gb, 4 * num_assoc_data);
decode_channel_map(layout_map + tags, AAC_CHANNEL_CC, gb, num_cc);
tags += num_cc;
align_get_bits(gb);
comment_len = get_bits(gb, 8) * 8;
if (get_bits_left(gb) < comment_len) {
av_log(avctx, AV_LOG_ERROR, overread_err);
return -1;
}
skip_bits_long(gb, comment_len);
return tags;
}
| 1threat
|
static int get_uint64(QEMUFile *f, void *pv, size_t size)
{
uint64_t *v = pv;
qemu_get_be64s(f, v);
return 0;
}
| 1threat
|
"java.sql.SQLException: Column count doesn't match value count at row 1" I CANNOT INSERT VALUES INTO THE DATABASE TABLES PLEASE HELP ME OUT, : MY DATABASE OVER HERE :- [MYSQL SCREENSHOT][1]
SERVLET CODE HERE:-
import java.io.*;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import java.sql.*;
@WebServlet(name = "Register")
public class Register extends HttpServlet {
static String username="root";
static String password="root";
static String dburl=
"jdbc:mysql://localhost:3306/conferencesystem";
static String mydriver = "com.mysql.cj.jdbc.Driver";
protected void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String Firstname = request.getParameter("firstname");
String Lastname = request.getParameter("lastname");
int Mobilenumber =
Integer.parseInt(request.getParameter("mobilenumber"));
String Email = request.getParameter("emailid");
String Pass = request.getParameter("password");
out.println("<html>");
out.println("<body>");
out.println("<h3>Guest Details </h3>");
out.println("" + Firstname);
out.println("" + Lastname);
out.println("" + Email);
out.println("</body>");
out.println("</html>");
int id = 1101;
Connection con = null;
try {
Class.forName(mydriver);
con = DriverManager.getConnection(dburl, username,
password);
String query = "INSERT INTO author
"+"values(Firstname,Lastname,Mobilenumber,Email,Pass)";
Statement stmt = con.createStatement();
stmt.executeUpdate(query);
out.println("Your Record has been successfully
inserted");
con.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
[
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
h3{
font-family: Calibri;
font-size: 25pt;
font-style: normal;
font-weight: bold;
color:SlateBlue;
text-align: center;
text-decoration: underline
}
table{
font-family: Calibri;
color:white;
font-size: 11pt;
font-style: normal;
font-weight: bold;
text-align:center;
background-color: SlateBlue;
border-collapse: collapse;
border: 2px solid navy
}
table.inner{
border: 0px
}
<!-- language: lang-html -->
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<html>
<head>
<title> Author Registration Form </title>
</head>
<link rel="stylesheet" href="styles.css">
<body>
<form method="post" action="http://localhost:8080/Register">
<h3>AUTHOR REGISTRATION FORM</h3>
<table align="center" cellpadding = "10">
<!----- First Name ---------------------------------------------------------->
<tr>
<td>FIRST NAME</td>
<td><input type="text" name="firstname" maxlength="30"/>
(max 30 characters a-z and A-Z)
</td>
</tr>
<!----- Last Name ---------------------------------------------------------->
<tr>
<td>LAST NAME</td>
<td><input type="text" name="lastname" maxlength="30"/>
(max 30 characters a-z and A-Z)
</td>
</tr>
<!----- Mobile Number ---------------------------------------------------------->
<tr>
<td>MOBILE NUMBER</td>
<td>
<input type="text" name="mobilenumber" maxlength="10" />
(10 digit number)
</td>
</tr>
<!----- Email Id ---------------------------------------------------------->
<tr>
<td>EMAIL ID</td>
<td><input type="text" name="emailid" maxlength="100" /></td>
</tr>
<!----- Choose password ---------------------------------------------------------->
<tr>
<td>PASSWORD</td>
<td><input type="password" name="password" maxlength="100" /></td>
</tr>
<!----- Submit and Reset ------------------------------------------------->
<tr>
<td colspan="2" align="center">
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</td>
</tr>
</table>
</form>
</body>
</html>
<!-- end snippet -->
][2]
[1]: https://i.stack.imgur.com/laaOP.jpg
[2]: https://i.stack.imgur.com/pM0dC.
I'M TRYING TO INSERT DATA FROM THE FORM DATA, PLEASE ANYBODY HELP ME GET OUT OF THIS PROBELM.. THANK YOU IN ADVANCE.
ANY PERSON SHALL BE BLESSED IN ALL THE WAYS HE WHO HELPS ME ONLINE..
PLEASE HELP ME HELP ME HELP ME MEMEMEMEMEMEMMMMMMMMMMMMMMMMM......
| 0debug
|
How can i import a tables into microsoft sql sever 2008? : I had 5 tables with a values which is exported from other system. Now i want to import that 5 tables into my database. Is it any possibles to import ?
| 0debug
|
static AddressSpace *q35_host_dma_iommu(PCIBus *bus, void *opaque, int devfn)
{
IntelIOMMUState *s = opaque;
VTDAddressSpace **pvtd_as;
int bus_num = pci_bus_num(bus);
assert(0 <= bus_num && bus_num <= VTD_PCI_BUS_MAX);
assert(0 <= devfn && devfn <= VTD_PCI_DEVFN_MAX);
pvtd_as = s->address_spaces[bus_num];
if (!pvtd_as) {
pvtd_as = g_malloc0(sizeof(VTDAddressSpace *) * VTD_PCI_DEVFN_MAX);
s->address_spaces[bus_num] = pvtd_as;
}
if (!pvtd_as[devfn]) {
pvtd_as[devfn] = g_malloc0(sizeof(VTDAddressSpace));
pvtd_as[devfn]->bus_num = (uint8_t)bus_num;
pvtd_as[devfn]->devfn = (uint8_t)devfn;
pvtd_as[devfn]->iommu_state = s;
pvtd_as[devfn]->context_cache_entry.context_cache_gen = 0;
memory_region_init_iommu(&pvtd_as[devfn]->iommu, OBJECT(s),
&s->iommu_ops, "intel_iommu", UINT64_MAX);
address_space_init(&pvtd_as[devfn]->as,
&pvtd_as[devfn]->iommu, "intel_iommu");
}
return &pvtd_as[devfn]->as;
}
| 1threat
|
Minify android app but do not obfuscate it : <p>When I do not minify my app I reach the maximum method count and building the dex file fails. This can be avoided by enabling <code>minify</code> in <code>build.gradle</code>. The downside, however, is that now the code gets obfuscated. This is OK for the Release build but it is problematic for a Debug build.</p>
<p>Is there a way to tell gradle to minify a Debug build but not obfuscate it?</p>
| 0debug
|
How to run two webapplication in a single domain? Is that possible? : <p>I have a php application configured in apache server that serves api in www.example.com/api1, now i want to run my django app in the same domain but with different route like www.example.com/api2. Is that possible? please give your valuable solutions and suggestions.</p>
| 0debug
|
Including HTML inside Jekyll tag : <p>Instead of writing out <code>{% include link_to.html i=5 text="hello world" %}</code> all the time, I've written a custom tag that allows me to do <code>{% link_to 5 hello world %}</code>. It finds the page with data <code>i</code> equal to 5 and creates a link to it.</p>
<p>But it feels clunky to generate HTML strings from inside the tag code, and it is awkward to write complicated code logic inside the HTML include code. So is there a way to have the tag definition do the heavy lifting of finding the relevant page to link to, and have it pass on what it found to <code>link_to.html</code> to render? Sort of like the controller passing information on to the view in Rails.</p>
| 0debug
|
static int file_open_dir(URLContext *h)
{
#if HAVE_DIRENT_H
FileContext *c = h->priv_data;
c->dir = opendir(h->filename);
if (!c->dir)
return AVERROR(errno);
return 0;
#else
return AVERROR(ENOSYS);
#endif
}
| 1threat
|
Angular2 - how to start and with which IDE : <p>I have used AngularJS 1.x now for a couple of months. Now I will switch to Angular2 (with TypeScript) and actually I am not sure which IDE to use.
It is also not clear for me how to compile the TypeScript Code into JavaScript - actually is this necessary?
I have read that Visual Studio Code would be a nice editor for Angular2 projects - is there a TypeScript compiler included? I would be glad for any information in this direction.</p>
| 0debug
|
Why TFS with GIT is not working from command line? : <p>I want to use the git command line tools with the Microsoft Team Foundation Server Git repositories.</p>
<p>But every time I want to access to remote repos the authentication fails. And of course I am using Active Directory (this is a TFS server). The git repo management works perfectly from Visual Studio. (even push, sync, clone, etc).</p>
<pre><code>Cloning into 'blabla'
fatal: Authentication failed for 'http://server:8080/tfs/BlaCollection/_git/blabla/'
</code></pre>
<p>I have intented using this patters and always fail. </p>
<ul>
<li>DOMAIN\username</li>
<li>username@domainforest</li>
</ul>
<p>Anyone has get connected using command line tools to a TFS with git server?
In my company we use tokens to log on Windows, may be the reason?</p>
| 0debug
|
Enum type no longer working in .Net core 3.0 FromBody request object : <p>I have recently upgraded my web api from .Net core 2.2 to .Net core 3.0 and noticed that my requests are getting an error now when I pass an enum in a post to my endpoint. For example:</p>
<p>I have the following model for my api endpoint:</p>
<pre><code> public class SendFeedbackRequest
{
public FeedbackType Type { get; set; }
public string Message { get; set; }
}
</code></pre>
<p>Where the FeedbackType looks like so:</p>
<pre><code> public enum FeedbackType
{
Comment,
Question
}
</code></pre>
<p>And this is the controller method:</p>
<pre><code> [HttpPost]
public async Task<IActionResult> SendFeedbackAsync([FromBody]SendFeedbackRequest request)
{
var response = await _feedbackService.SendFeedbackAsync(request);
return Ok(response);
}
</code></pre>
<p>Where I send this as the post body to the controller:</p>
<pre><code>{
message: "Test"
type: "comment"
}
</code></pre>
<p>And I am now getting the following error posting to this endpoint:</p>
<p><code>The JSON value could not be converted to MyApp.Feedback.Enums.FeedbackType. Path: $.type | LineNumber: 0 | BytePositionInLine: 13."</code></p>
<p>This was working in 2.2 and started the error in 3.0. I saw talk about the json serializer changing in 3.0, but not sure how this should be handled.</p>
| 0debug
|
JWT Verify client-side? : <p>I have a nodejs api with an angular frontend. The API is successfully using JWT with passport to secure it's endpoints. </p>
<p>I am now conscious that after the tokens have expired, my front end will still allow the user to request my api endpoints without prompting them to reenter their log in details to get a fresh token. </p>
<p>This is how my backend generates the token:</p>
<pre><code>function generateToken(user) {
return jwt.sign(user, secret, {
expiresIn: 10080 // in seconds
});
}
</code></pre>
<p>So to implement this logic I think I need to verify the JWT token client-side. Q1, is this a sensible approach. </p>
<p>Q2, the <a href="https://github.com/auth0/node-jsonwebtoken" rel="noreferrer"><code>JWT</code></a> library I am using seems to require a public key to use it's <code>verify()</code> function. I don't seem to have a public key, only a secret, which I just made up, so it wasn't generated with a pair. Where does my public key come from, or is there another way of verifying my token without this? </p>
<p>This all seems like it should be obvious and that I have missed something, so apologies if this is a stupid question, but I can't seem to find the answer?</p>
| 0debug
|
Mobaxterm annoying sidebar : <p>This seems like a simple question but I can't find an answer. I use mobaxterm free edition to ssh into my machines. Every time I ssh into a machine the side bar automatically expands with the paths on the remote machine. I don't need this side bar and every time I have to collapse it. Is there a way to permanently disable the side bar or at least not automatically expend it when ssh-ing?</p>
<p>Here is a picture (linked) of the expaned sidebar:
<a href="https://i.stack.imgur.com/8M98n.png" rel="noreferrer">mobaxterm_sidebar</a></p>
| 0debug
|
Grant access to views in postgresql : <p>I have a view called testview in postgresql.</p>
<p>I created a new user called testuser. </p>
<p>I would like testuser to have all privileges on all tables and views in the database.</p>
<p>To do this I ran the following commands:</p>
<pre><code>GRANT ALL PRIVILEGES ON DATABASE testdb TO testuser;
GRANT USAGE ON SCHEMA public TO testuser;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO testuser;
</code></pre>
<p>testuser now has access to all tables in the database, but if I try to run SELECT * FROM testview I get the following error: permission denied for relation testview.</p>
<p>What is wrong? How do testuser get access to testview?</p>
| 0debug
|
static void vc1_interp_mc(VC1Context *v)
{
MpegEncContext *s = &v->s;
H264ChromaContext *h264chroma = &v->h264chroma;
uint8_t *srcY, *srcU, *srcV;
int dxy, mx, my, uvmx, uvmy, src_x, src_y, uvsrc_x, uvsrc_y;
int off, off_uv;
int v_edge_pos = s->v_edge_pos >> v->field_mode;
int use_ic = v->next_use_ic;
if (!v->field_mode && !v->s.next_picture.f.data[0])
return;
mx = s->mv[1][0][0];
my = s->mv[1][0][1];
uvmx = (mx + ((mx & 3) == 3)) >> 1;
uvmy = (my + ((my & 3) == 3)) >> 1;
if (v->field_mode) {
if (v->cur_field_type != v->ref_field_type[1])
my = my - 2 + 4 * v->cur_field_type;
uvmy = uvmy - 2 + 4 * v->cur_field_type;
}
if (v->fastuvmc) {
uvmx = uvmx + ((uvmx < 0) ? -(uvmx & 1) : (uvmx & 1));
uvmy = uvmy + ((uvmy < 0) ? -(uvmy & 1) : (uvmy & 1));
}
srcY = s->next_picture.f.data[0];
srcU = s->next_picture.f.data[1];
srcV = s->next_picture.f.data[2];
src_x = s->mb_x * 16 + (mx >> 2);
src_y = s->mb_y * 16 + (my >> 2);
uvsrc_x = s->mb_x * 8 + (uvmx >> 2);
uvsrc_y = s->mb_y * 8 + (uvmy >> 2);
if (v->profile != PROFILE_ADVANCED) {
src_x = av_clip( src_x, -16, s->mb_width * 16);
src_y = av_clip( src_y, -16, s->mb_height * 16);
uvsrc_x = av_clip(uvsrc_x, -8, s->mb_width * 8);
uvsrc_y = av_clip(uvsrc_y, -8, s->mb_height * 8);
} else {
src_x = av_clip( src_x, -17, s->avctx->coded_width);
src_y = av_clip( src_y, -18, s->avctx->coded_height + 1);
uvsrc_x = av_clip(uvsrc_x, -8, s->avctx->coded_width >> 1);
uvsrc_y = av_clip(uvsrc_y, -8, s->avctx->coded_height >> 1);
}
srcY += src_y * s->linesize + src_x;
srcU += uvsrc_y * s->uvlinesize + uvsrc_x;
srcV += uvsrc_y * s->uvlinesize + uvsrc_x;
if (v->field_mode && v->ref_field_type[1]) {
srcY += s->current_picture_ptr->f.linesize[0];
srcU += s->current_picture_ptr->f.linesize[1];
srcV += s->current_picture_ptr->f.linesize[2];
}
if (s->flags & CODEC_FLAG_GRAY) {
srcU = s->edge_emu_buffer + 18 * s->linesize;
srcV = s->edge_emu_buffer + 18 * s->linesize;
}
if (v->rangeredfrm || s->h_edge_pos < 22 || v_edge_pos < 22 || use_ic
|| (unsigned)(src_x - 1) > s->h_edge_pos - (mx & 3) - 16 - 3
|| (unsigned)(src_y - 1) > v_edge_pos - (my & 3) - 16 - 3) {
uint8_t *uvbuf = s->edge_emu_buffer + 19 * s->linesize;
srcY -= s->mspel * (1 + s->linesize);
s->vdsp.emulated_edge_mc(s->edge_emu_buffer, srcY,
s->linesize, s->linesize,
17 + s->mspel * 2, 17 + s->mspel * 2,
src_x - s->mspel, src_y - s->mspel,
s->h_edge_pos, v_edge_pos);
srcY = s->edge_emu_buffer;
s->vdsp.emulated_edge_mc(uvbuf, srcU,
s->uvlinesize, s->uvlinesize,
8 + 1, 8 + 1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1);
s->vdsp.emulated_edge_mc(uvbuf + 16, srcV,
s->uvlinesize, s->uvlinesize,
8 + 1, 8 + 1,
uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, v_edge_pos >> 1);
srcU = uvbuf;
srcV = uvbuf + 16;
if (v->rangeredfrm) {
int i, j;
uint8_t *src, *src2;
src = srcY;
for (j = 0; j < 17 + s->mspel * 2; j++) {
for (i = 0; i < 17 + s->mspel * 2; i++)
src[i] = ((src[i] - 128) >> 1) + 128;
src += s->linesize;
}
src = srcU;
src2 = srcV;
for (j = 0; j < 9; j++) {
for (i = 0; i < 9; i++) {
src[i] = ((src[i] - 128) >> 1) + 128;
src2[i] = ((src2[i] - 128) >> 1) + 128;
}
src += s->uvlinesize;
src2 += s->uvlinesize;
}
}
if (use_ic) {
uint8_t (*luty )[256] = v->next_luty;
uint8_t (*lutuv)[256] = v->next_lutuv;
int i, j;
uint8_t *src, *src2;
src = srcY;
for (j = 0; j < 17 + s->mspel * 2; j++) {
int f = v->field_mode ? v->ref_field_type[1] : ((j+src_y - s->mspel) & 1);
for (i = 0; i < 17 + s->mspel * 2; i++)
src[i] = luty[f][src[i]];
src += s->linesize;
}
src = srcU;
src2 = srcV;
for (j = 0; j < 9; j++) {
int f = v->field_mode ? v->ref_field_type[1] : ((j+uvsrc_y) & 1);
for (i = 0; i < 9; i++) {
src[i] = lutuv[f][src[i]];
src2[i] = lutuv[f][src2[i]];
}
src += s->uvlinesize;
src2 += s->uvlinesize;
}
}
srcY += s->mspel * (1 + s->linesize);
}
off = 0;
off_uv = 0;
if (s->mspel) {
dxy = ((my & 3) << 2) | (mx & 3);
v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off , srcY , s->linesize, v->rnd);
v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8, srcY + 8, s->linesize, v->rnd);
srcY += s->linesize * 8;
v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8 * s->linesize , srcY , s->linesize, v->rnd);
v->vc1dsp.avg_vc1_mspel_pixels_tab[dxy](s->dest[0] + off + 8 * s->linesize + 8, srcY + 8, s->linesize, v->rnd);
} else {
dxy = (my & 2) | ((mx & 2) >> 1);
if (!v->rnd)
s->hdsp.avg_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16);
else
s->hdsp.avg_no_rnd_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, 16);
}
if (s->flags & CODEC_FLAG_GRAY) return;
uvmx = (uvmx & 3) << 1;
uvmy = (uvmy & 3) << 1;
if (!v->rnd) {
h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy);
h264chroma->avg_h264_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy);
} else {
v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[1] + off_uv, srcU, s->uvlinesize, 8, uvmx, uvmy);
v->vc1dsp.avg_no_rnd_vc1_chroma_pixels_tab[0](s->dest[2] + off_uv, srcV, s->uvlinesize, 8, uvmx, uvmy);
}
}
| 1threat
|
javascript cofirm not working in php file : <pre><code><script type="text/javascript">
var r = confirm("Press a button");
if (r == true) {
<?php header('location:index.php');?>
}</script>
</code></pre>
<p>//Its redirect in index.php without conformation dialog and below code execute properly no any code contain simple navigation code..</p>
<pre><code><script type="text/javascript">
var r = confirm("Press a button");
if (r == true) {
x = "You pressed OK!";
}</script>
</code></pre>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.