problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
static int get_pci_config_device(QEMUFile *f, void *pv, size_t size)
{
PCIDevice *s = container_of(pv, PCIDevice, config);
uint8_t *config;
int i;
assert(size == pci_config_size(s));
config = qemu_malloc(size);
qemu_get_buffer(f, config, size);
for (i = 0; i < size; ++i) {
if ((config[i] ^ s->config[i]) & s->cmask[i] & ~s->wmask[i]) {
qemu_free(config);
return -EINVAL;
}
}
memcpy(s->config, config, size);
pci_update_mappings(s);
qemu_free(config);
return 0;
}
| 1threat |
angular 5 *ngFor two array : I am getting array from two get method in angular 5. What i want is two combine those two array (JSON) in one array and print it in single for loop
my two arrays:-
servers3 =[
{
sub:'sub',
subDesc:'subDesc'
}];
public tableData:any;
i am using concat two combine two arrays like follows
<table>
<tr>
<th>fileName</th>
<th>icon</th>
<th>fullPath</th>
<th>sub</th>
<th>subDesc</th>
<th>image</th>
</tr>
<tr *ngFor="let item of tableData.concat(servers3)">
<td>{{item?.fileName}}</td>
<td>{{item?.icon}} </td>
<td>{{item?.fullPath}}</td>
<td>{{item?.sub}}</td>
<td>{{item?.subDesc}}</td>
<td><img src="{{item?.fullPath}}" width="200px" height="200px" alt="adawdawd"/></td>
</tr>
</table>
</div>
And i am getting outp\put as follows:-
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/wHVrd.png
as you can see its not showing in one line
each array completes individually
please give me solution if any one know the answer
thank you in advance | 0debug |
C Program will not compile : <p>When I try to compile my C program the terminal tells me:</p>
<p><code>warning: implicit declaration of function 'strcopy' is
invalid in C99 [-Wimplicit-function-declaration]strcopy("test","test");</code></p>
<p>I have <code>#include <string.h></code> at the top of my code so I am very confused as to why it will not compile. Any help would be appreciated</p>
| 0debug |
static void ppc_cpu_class_init(ObjectClass *oc, void *data)
{
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
CPUClass *cc = CPU_CLASS(oc);
DeviceClass *dc = DEVICE_CLASS(oc);
pcc->parent_realize = dc->realize;
dc->realize = ppc_cpu_realizefn;
dc->unrealize = ppc_cpu_unrealizefn;
pcc->parent_reset = cc->reset;
cc->reset = ppc_cpu_reset;
cc->class_by_name = ppc_cpu_class_by_name;
cc->do_interrupt = ppc_cpu_do_interrupt;
cc->dump_state = ppc_cpu_dump_state;
cc->dump_statistics = ppc_cpu_dump_statistics;
cc->set_pc = ppc_cpu_set_pc;
cc->gdb_read_register = ppc_cpu_gdb_read_register;
cc->gdb_write_register = ppc_cpu_gdb_write_register;
#ifndef CONFIG_USER_ONLY
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
cc->vmsd = &vmstate_ppc_cpu;
cc->gdb_num_core_regs = 71;
cc->gdb_core_xml_file = "power64-core.xml";
#else
cc->gdb_core_xml_file = "power-core.xml";
} | 1threat |
NodeJS recommended max-old-space-size : <p>I'm having some trouble to understand how NodeJS acts based on the parameter max-old-space-size.</p>
<p>In my case for example, I'm running two t2.small aws instances (2GB of RAM).</p>
<p>Not sure why but I did set max-old-space-size=4096 (4GB). What does node do in this case? Could this configuration lead to a posible memory allocation failure?</p>
<p>How do I determine the correct value of max-old-space-size based on the server resources?</p>
<p>PD: My application is constantly growing the memory usage and I'm trying to understand everything about node internals.</p>
| 0debug |
require a SQL query to split a column into 3 columns : I have designed a table named as 'customeradd'. Till now no data has been entered into it.
Can anyone suggest me any SQL query to split 'customeradd'. column into 3 sub columns so that it looks like this in the schema:-
**customeradd**
| A | B | C |
| | | |
A,B,C are 3 sub columns of customeradd column
Thanks a lot. | 0debug |
Which data structure should I use for storing eye retina? : <p>I need to develop and application for opening/closing of main gate of my office. That application will recognize human eye retina and then open the gate if it is valid. The image of retina is to be stored in database where it matches the upcoming image with the stored images of retina in db. Also when i want to delete the data of retina of specific person from database, it should be deleted.
In my criteria, memory usage is to be less and very fast response of time</p>
<p><strong>Which data structure should I use for this scenario?</strong></p>
| 0debug |
static GThread *trace_thread_create(GThreadFunc fn)
{
GThread *thread;
#ifndef _WIN32
sigset_t set, oldset;
sigfillset(&set);
pthread_sigmask(SIG_SETMASK, &set, &oldset);
#endif
thread = g_thread_create(writeout_thread, NULL, FALSE, NULL);
#ifndef _WIN32
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
#endif
return thread;
}
| 1threat |
static av_always_inline void predict_slice_buffered(SnowContext *s, slice_buffer * sb, IDWTELEM * old_buffer, int plane_index, int add, int mb_y){
Plane *p= &s->plane[plane_index];
const int mb_w= s->b_width << s->block_max_depth;
const int mb_h= s->b_height << s->block_max_depth;
int x, y, mb_x;
int block_size = MB_SIZE >> s->block_max_depth;
int block_w = plane_index ? block_size>>s->chroma_h_shift : block_size;
int block_h = plane_index ? block_size>>s->chroma_v_shift : block_size;
const uint8_t *obmc = plane_index ? ff_obmc_tab[s->block_max_depth+s->chroma_h_shift] : ff_obmc_tab[s->block_max_depth];
int obmc_stride= plane_index ? (2*block_size)>>s->chroma_h_shift : 2*block_size;
int ref_stride= s->current_picture->linesize[plane_index];
uint8_t *dst8= s->current_picture->data[plane_index];
int w= p->width;
int h= p->height;
if(s->keyframe || (s->avctx->debug&512)){
if(mb_y==mb_h)
return;
if(add){
for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){
IDWTELEM * line = sb->line[y];
for(x=0; x<w; x++){
int v= line[x] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1));
v >>= FRAC_BITS;
if(v&(~255)) v= ~(v>>31);
dst8[x + y*ref_stride]= v;
}
}
}else{
for(y=block_h*mb_y; y<FFMIN(h,block_h*(mb_y+1)); y++){
IDWTELEM * line = sb->line[y];
for(x=0; x<w; x++){
line[x] -= 128 << FRAC_BITS;
}
}
}
return;
}
for(mb_x=0; mb_x<=mb_w; mb_x++){
add_yblock(s, 1, sb, old_buffer, dst8, obmc,
block_w*mb_x - block_w/2,
block_h*mb_y - block_h/2,
block_w, block_h,
w, h,
w, ref_stride, obmc_stride,
mb_x - 1, mb_y - 1,
add, 0, plane_index);
}
if(s->avmv && mb_y < mb_h && plane_index == 0)
for(mb_x=0; mb_x<mb_w; mb_x++){
AVMotionVector *avmv = s->avmv + (s->avmv_index++);
const int b_width = s->b_width << s->block_max_depth;
const int b_stride= b_width;
BlockNode *bn= &s->block[mb_x + mb_y*b_stride];
if (bn->type)
continue;
avmv->w = block_w;
avmv->h = block_h;
avmv->dst_x = block_w*mb_x - block_w/2;
avmv->dst_y = block_h*mb_y - block_h/2;
avmv->src_x = avmv->dst_x + (bn->mx * s->mv_scale)/8;
avmv->src_y = avmv->dst_y + (bn->my * s->mv_scale)/8;
avmv->source= -1 - bn->ref;
avmv->flags = 0;
}
}
| 1threat |
static void gic_dist_writeb(void *opaque, hwaddr offset,
uint32_t value, MemTxAttrs attrs)
{
GICState *s = (GICState *)opaque;
int irq;
int i;
int cpu;
cpu = gic_get_current_cpu(s);
if (offset < 0x100) {
if (offset == 0) {
if (s->security_extn && !attrs.secure) {
s->ctlr = deposit32(s->ctlr, 1, 1, value);
} else if (gic_has_groups(s)) {
s->ctlr = value & (GICD_CTLR_EN_GRP0 | GICD_CTLR_EN_GRP1);
} else {
s->ctlr = value & GICD_CTLR_EN_GRP0;
}
DPRINTF("Distributor: Group0 %sabled; Group 1 %sabled\n",
s->ctlr & GICD_CTLR_EN_GRP0 ? "En" : "Dis",
s->ctlr & GICD_CTLR_EN_GRP1 ? "En" : "Dis");
} else if (offset < 4) {
} else if (offset >= 0x80) {
if (!(s->security_extn && !attrs.secure) && gic_has_groups(s)) {
irq = (offset - 0x80) * 8 + GIC_BASE_IRQ;
if (irq >= s->num_irq) {
goto bad_reg;
}
for (i = 0; i < 8; i++) {
int cm = (irq < GIC_INTERNAL) ? (1 << cpu) : ALL_CPU_MASK;
if (value & (1 << i)) {
GIC_SET_GROUP(irq + i, cm);
} else {
GIC_CLEAR_GROUP(irq + i, cm);
}
}
}
} else {
goto bad_reg;
}
} else if (offset < 0x180) {
irq = (offset - 0x100) * 8 + GIC_BASE_IRQ;
if (irq >= s->num_irq)
goto bad_reg;
if (irq < GIC_NR_SGIS) {
value = 0xff;
}
for (i = 0; i < 8; i++) {
if (value & (1 << i)) {
int mask =
(irq < GIC_INTERNAL) ? (1 << cpu) : GIC_TARGET(irq + i);
int cm = (irq < GIC_INTERNAL) ? (1 << cpu) : ALL_CPU_MASK;
if (!GIC_TEST_ENABLED(irq + i, cm)) {
DPRINTF("Enabled IRQ %d\n", irq + i);
}
GIC_SET_ENABLED(irq + i, cm);
if (GIC_TEST_LEVEL(irq + i, mask)
&& !GIC_TEST_EDGE_TRIGGER(irq + i)) {
DPRINTF("Set %d pending mask %x\n", irq + i, mask);
GIC_SET_PENDING(irq + i, mask);
}
}
}
} else if (offset < 0x200) {
irq = (offset - 0x180) * 8 + GIC_BASE_IRQ;
if (irq >= s->num_irq)
goto bad_reg;
if (irq < GIC_NR_SGIS) {
value = 0;
}
for (i = 0; i < 8; i++) {
if (value & (1 << i)) {
int cm = (irq < GIC_INTERNAL) ? (1 << cpu) : ALL_CPU_MASK;
if (GIC_TEST_ENABLED(irq + i, cm)) {
DPRINTF("Disabled IRQ %d\n", irq + i);
trace_gic_disable_irq(irq + i);
}
GIC_CLEAR_ENABLED(irq + i, cm);
}
}
} else if (offset < 0x280) {
irq = (offset - 0x200) * 8 + GIC_BASE_IRQ;
if (irq >= s->num_irq)
goto bad_reg;
if (irq < GIC_NR_SGIS) {
value = 0;
}
for (i = 0; i < 8; i++) {
if (value & (1 << i)) {
GIC_SET_PENDING(irq + i, GIC_TARGET(irq + i));
}
}
} else if (offset < 0x300) {
irq = (offset - 0x280) * 8 + GIC_BASE_IRQ;
if (irq >= s->num_irq)
goto bad_reg;
if (irq < GIC_NR_SGIS) {
value = 0;
}
for (i = 0; i < 8; i++) {
if (value & (1 << i)) {
GIC_CLEAR_PENDING(irq + i, ALL_CPU_MASK);
}
}
} else if (offset < 0x400) {
goto bad_reg;
} else if (offset < 0x800) {
irq = (offset - 0x400) + GIC_BASE_IRQ;
if (irq >= s->num_irq)
goto bad_reg;
gic_set_priority(s, cpu, irq, value, attrs);
} else if (offset < 0xc00) {
if (s->num_cpu != 1 || s->revision == REV_11MPCORE) {
irq = (offset - 0x800) + GIC_BASE_IRQ;
if (irq >= s->num_irq) {
goto bad_reg;
}
if (irq < 29) {
value = 0;
} else if (irq < GIC_INTERNAL) {
value = ALL_CPU_MASK;
}
s->irq_target[irq] = value & ALL_CPU_MASK;
}
} else if (offset < 0xf00) {
irq = (offset - 0xc00) * 4 + GIC_BASE_IRQ;
if (irq >= s->num_irq)
goto bad_reg;
if (irq < GIC_NR_SGIS)
value |= 0xaa;
for (i = 0; i < 4; i++) {
if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {
if (value & (1 << (i * 2))) {
GIC_SET_MODEL(irq + i);
} else {
GIC_CLEAR_MODEL(irq + i);
}
}
if (value & (2 << (i * 2))) {
GIC_SET_EDGE_TRIGGER(irq + i);
} else {
GIC_CLEAR_EDGE_TRIGGER(irq + i);
}
}
} else if (offset < 0xf10) {
goto bad_reg;
} else if (offset < 0xf20) {
if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {
goto bad_reg;
}
irq = (offset - 0xf10);
s->sgi_pending[irq][cpu] &= ~value;
if (s->sgi_pending[irq][cpu] == 0) {
GIC_CLEAR_PENDING(irq, 1 << cpu);
}
} else if (offset < 0xf30) {
if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {
goto bad_reg;
}
irq = (offset - 0xf20);
GIC_SET_PENDING(irq, 1 << cpu);
s->sgi_pending[irq][cpu] |= value;
} else {
goto bad_reg;
}
gic_update(s);
return;
bad_reg:
qemu_log_mask(LOG_GUEST_ERROR,
"gic_dist_writeb: Bad offset %x\n", (int)offset);
} | 1threat |
Is it possible to make money with ads if you have few users? : <p>Hello everyone let's say I just published my app at the App Store and set some interstitial ads from Ads mob, If first ”app downloader” or user sees my ad will I make money or there is some kind of fixed quantity of users from where I can make some income? Or maybe it depends on another things which I do not know, please tell me about that advertisement stuff))</p>
| 0debug |
Understanding fetch_assoc() : <p>I am trying to understand how/why fetch_assoc works the way it does.
I have the following piece of code: </p>
<pre><code>$results = $connectToDb->fetch("SELECT * FROM customer");
$resultsArray = $results->fetch_assoc();
print_r($resultsArray); //print_r 1
while($row = $results->fetch_assoc()){
print_r($row); //print_r 2
}
</code></pre>
<p>The query returns 3 rows from a table.
Why does the 1st print_r return only the 1st row of the queried data but the 2nd print_r returns all 3? How does putting fetch_assoc into a while loop tell it to do the action more than once? I read that fetch_assoc returns either an associative array or NULL but I'm struggling to understand how the while loop "tells" fetch_assoc to fetch the next row, if that makes sense?</p>
<p>Thank you.</p>
| 0debug |
static int decode_subframe(TAKDecContext *s, int32_t *decoded,
int subframe_size, int prev_subframe_size)
{
GetBitContext *gb = &s->gb;
int x, y, i, j, ret = 0;
int dshift, size, filter_quant, filter_order, filter_order16;
int tfilter[MAX_PREDICTORS];
if (!get_bits1(gb))
return decode_residues(s, decoded, subframe_size);
filter_order = predictor_sizes[get_bits(gb, 4)];
if (prev_subframe_size > 0 && get_bits1(gb)) {
if (filter_order > prev_subframe_size)
return AVERROR_INVALIDDATA;
decoded -= filter_order;
subframe_size += filter_order;
if (filter_order > subframe_size)
return AVERROR_INVALIDDATA;
} else {
int lpc_mode;
if (filter_order > subframe_size)
return AVERROR_INVALIDDATA;
lpc_mode = get_bits(gb, 2);
if (lpc_mode > 2)
return AVERROR_INVALIDDATA;
if ((ret = decode_residues(s, decoded, filter_order)) < 0)
return ret;
if (lpc_mode)
decode_lpc(decoded, lpc_mode, filter_order);
}
dshift = get_bits_esc4(gb);
size = get_bits1(gb) + 6;
filter_quant = 10;
if (get_bits1(gb)) {
filter_quant -= get_bits(gb, 3) + 1;
if (filter_quant < 3)
return AVERROR_INVALIDDATA;
}
s->predictors[0] = get_sbits(gb, 10);
s->predictors[1] = get_sbits(gb, 10);
s->predictors[2] = get_sbits(gb, size) << (10 - size);
s->predictors[3] = get_sbits(gb, size) << (10 - size);
if (filter_order > 4) {
int tmp = size - get_bits1(gb);
for (i = 4; i < filter_order; i++) {
if (!(i & 3))
x = tmp - get_bits(gb, 2);
s->predictors[i] = get_sbits(gb, x) << (10 - size);
}
}
tfilter[0] = s->predictors[0] << 6;
for (i = 1; i < filter_order; i++) {
int32_t *p1 = &tfilter[0];
int32_t *p2 = &tfilter[i - 1];
for (j = 0; j < (i + 1) / 2; j++) {
x = *p1 + (s->predictors[i] * *p2 + 256 >> 9);
*p2 += s->predictors[i] * *p1 + 256 >> 9;
*p1++ = x;
p2--;
}
tfilter[i] = s->predictors[i] << 6;
}
filter_order16 = FFALIGN(filter_order, 16);
AV_ZERO128(s->filter + filter_order16 - 16);
AV_ZERO128(s->filter + filter_order16 - 8);
x = 1 << (32 - (15 - filter_quant));
y = 1 << ((15 - filter_quant) - 1);
for (i = 0, j = filter_order - 1; i < filter_order / 2; i++, j--) {
s->filter[j] = x - ((tfilter[i] + y) >> (15 - filter_quant));
s->filter[i] = x - ((tfilter[j] + y) >> (15 - filter_quant));
}
if ((ret = decode_residues(s, &decoded[filter_order],
subframe_size - filter_order)) < 0)
return ret;
for (i = 0; i < filter_order; i++)
s->residues[i] = *decoded++ >> dshift;
y = FF_ARRAY_ELEMS(s->residues) - filter_order;
x = subframe_size - filter_order;
while (x > 0) {
int tmp = FFMIN(y, x);
for (i = 0; i < tmp; i++) {
int v = 1 << (filter_quant - 1);
v += s->adsp.scalarproduct_int16(&s->residues[i], s->filter,
filter_order16);
v = (av_clip_intp2(v >> filter_quant, 13) << dshift) - *decoded;
*decoded++ = v;
s->residues[filter_order + i] = v >> dshift;
}
x -= tmp;
if (x > 0)
memcpy(s->residues, &s->residues[y], 2 * filter_order);
}
emms_c();
return 0;
}
| 1threat |
android text to speech not speeking :
the problem i am having is when i set tts.speak using the s string variable it works perfectly however when i use the text i pass in with the function call it does not work both string veriables are the exact same
private void speek(final String text){
tts = new TextToSpeech(this, new TextToSpeech.OnInitListener() {
@Override
public void onInit(int status) {
if(status == TextToSpeech.SUCCESS){
int isTTs = tts.setLanguage(Locale.ENGLISH);
if(isTTs == TextToSpeech.LANG_MISSING_DATA || isTTs == TextToSpeech.LANG_NOT_SUPPORTED){
System.out.println("----------------------------- ++ not working " + isTTs);
System.out.println("----------------------------- ++ " + TextToSpeech.LANG_MISSING_DATA + " " + TextToSpeech.LANG_NOT_SUPPORTED);
}else{
System.out.println("----------------------------- ++ working yay " + text);
tts.setPitch(0.9f);
tts.setSpeechRate(0.8f);
// if i use the variable s it works
String t = "Chapter 1 ...";
tts.speak(t, TextToSpeech.QUEUE_ADD, null);
// howevet this does not
tts.speak(text, TextToSpeech.QUEUE_ADD, null);
}
}
}
});
}
TextToSpeech tts;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_read_novel);
// call async task
new getPage().execute(b.getString("link"));
}
private class getPage extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... urls) {}
@Override
protected void onPostExecute(String result) {
// call speak function and pass string to be spoken
speek(result);
}
}
| 0debug |
why does datetime.today.minute doesn't give the actual minutes : I'm learning Python. Recently, I have encountered, that while using "datetime.today().minute" gives me o/p by adding 30. When I'm commenting the -30 part that time the output is +30 of what the recent minute is, if I keep the -30 part then it gives the correct reselt. Why is that?
Code :
from datetime import datetime
odds = [1, 3, 5, 7, 9, 11 ,13, 15, 17, 19, 21, 23, 25, 27, 29 ,31, 33, 35, 37, 39 ,41, 43, 45, 47 ,49 ,51 ,53 ,55 ,57, 59]
odd_min = datetime.today().minute #- 30
print(odd_min)
#print("\n")
if odd_min in odds:
print("Odd min")
else:
print("Not odd min")
O/P : 48
Not odd min
When I'm subtracting 30 it gives the correct result. But I wanna know why it doesn't gives the correct output. | 0debug |
static void vtd_address_space_unmap(VTDAddressSpace *as, IOMMUNotifier *n)
{
IOMMUTLBEntry entry;
hwaddr size;
hwaddr start = n->start;
hwaddr end = n->end;
if (end > VTD_ADDRESS_SIZE(VTD_HOST_ADDRESS_WIDTH)) {
end = VTD_ADDRESS_SIZE(VTD_HOST_ADDRESS_WIDTH);
}
assert(start <= end);
size = end - start;
if (ctpop64(size) != 1) {
int n = 64 - clz64(size);
if (n > VTD_MGAW) {
n = VTD_MGAW;
}
size = 1ULL << n;
}
entry.target_as = &address_space_memory;
entry.iova = n->start & ~(size - 1);
entry.translated_addr = 0;
entry.perm = IOMMU_NONE;
entry.addr_mask = size - 1;
trace_vtd_as_unmap_whole(pci_bus_num(as->bus),
VTD_PCI_SLOT(as->devfn),
VTD_PCI_FUNC(as->devfn),
entry.iova, size);
memory_region_notify_one(n, &entry);
}
| 1threat |
C++ Randomize Different Variables Using a Constructor : <p><pre></p>
<p>Robot::Robot()</p>
<code>fitness = 5;
totalBattery = 5;
int randNum;
int i = 0;
bool valid = true;
srand(time(NULL));
//get robot's position on board and check to see if it is not starting on the wall
while (valid)
{
position = (rand()+i++) % 196;
if (position >= 0 && position <= 14)
{ }
else if ((position % 14) == 0 || (position % 14) == 13)
{ }
else if (position >= 183 && position <= 195)
{ }
else
{
valid = false;
cout << endl << "MY POSITION IS : " << position << endl << endl;
}
}
//randomize Robot Genetics
for (int j = 0; j < genes; j++)
{
for (int k = 0; k < chromosomes; k++)
{
//first 4; set N S E W(what the robot looks for in that direction)
//0 = empty; 1 = battery; 2 = don't care; 3 = wall
if (k < 4)
{
randNum = ((rand()+i++) % 4);
switch(randNum)
{
//Empty Space
case 0:
DNA[j][k] = " * ";
break;
//Battery
case 1:
DNA[j][k] = " B ";
break;
//Don't Care
case 2:
DNA[j][k] = " D ";
break;
//Wall
case 3:
DNA[j][k] = " W ";
break;
default:
cout << "YOUR CODE SCREWED UP IF YOU ARE IN HERE!! " << endl;
}
}
//direction facing; N S E W
else if (k < 5)
{
randNum = ((rand()+i++) % 4);
switch(randNum)
{
case 0:
DNA[j][k] = "N";
break;
case 1:
DNA[j][k] = "S";
break;
case 2:
DNA[j][k] = "E";
break;
case 3:
DNA[j][k] = "W";
break;
default:
cout << "YOUR CODE SCREWED UP IF YOU ARE IN HERE!! " << endl;
break;
}
}
//step counter in that direction
else if (k < 6)
{
DNA[j][k] = "0";
}
//Rotate Right(R); Rotate Left(L); Move in facing Direction(M); Do Nothing (X)
else
{
randNum = ((rand()+i++) % 4);
switch(randNum)
{
case 0:
DNA[j][k] = "X";
break;
case 1:
DNA[j][k] = "L";
break;
case 2:
DNA[j][k] = "R";
break;
case 3:
DNA[j][k] = "M";
break;
default:
cout << "YOUR CODE SCREWED UP IF YOU ARE IN HERE!! " << endl;
break;
}
}
}
}
</code></pre>
<p>}
</p>
<p>I am trying to construct objects of a class, and I need 200 of them. I am using a vector and iterating through a while loop and each time i construct a new instance of the class, the objects come out with the exact same data. How are you supposed to properly use the randomizer function to get different data into variables while constructing objects of a class? I tried doing research, but it just got me to this point, and I'm unsure why this isn't working. Thank You in advanced.</p>
| 0debug |
Get Serializable ArrayList on Intent fragment : <p>On my fragment I want to get <code>ArrayList<Animal></code>. I have created a newInstance function.</p>
<pre><code> companion object {
private val ARG_TITLE = "ARG_TITLE"
private val ARG_ANIMALS = "ARG_ANIMALS"
fun newInstance(title: String,animals: ArrayList<Animal>): ExampleFragment{
val fragment = ExampleFragment()
val args = Bundle()
args.putString(ARG_TITLE, title)
args.putSerializable(ARG_ANIMALS, animals)
fragment.arguments = args
return fragment
}
}
</code></pre>
<p>And on my <code>onCreate()</code> I have this.</p>
<pre><code> private var title: String = ""
lateinit private var animals:ArrayList<Animal>
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (arguments != null) {
title = arguments.getString(ARG_TITLE)
animals = arguments.getSerializable(ARG_ANIMALS)
}
}
</code></pre>
<p>But </p>
<blockquote>
<p>Required: ArrayList found Serialized!</p>
</blockquote>
<p>Can't cast to ArrayList neither.</p>
| 0debug |
i just face the problem when run the php function : i just write a function in php.....when i run it on browser it will show the empty page... pls help
my code is
<?php
require_once "conf.php";
function nuser()
{
$fname=$_POST['name'];
$uname=$_POST['user'];
$email=$_POST['email'];
$pass=$_POST['pass'];
$query="INSERT INTO websign(name,uname,email,pass)VALUES('$fname','$user','$email','$pass')";
$data=mysql_query($query)or die(mysql_error());
if ($data)
{
echo "your registration is completed";
}
}
function signup()
{
.......
.......
}
?>
when | 0debug |
Pyinstaller "Failed to execute script pyi_rth_pkgres" and missing packages : <p>This is my first time posting a question here as most of my questions have already been answered by someone else! I am working on a GUI application in python and am attempting to use pyinstaller to package it into a single folder and .exe for easier portability. Currently, I am using windows 10 and anaconda3 to manage my python packages. The application relies on tkinter, pillow, numpy, scikit-learn, opencv, ffmpeg, and matplotlib. The application is formatted with a main GUI.py file that creates objects of a number of other files (many of which are stored in a subfolder as this GUI is replacing a command line utility that served the same purpose). The issue I am running into (as you can see in the title) is that the .exe is throwing the error block:</p>
<blockquote>
<p>Traceback (most recent call last):
File "site-packages\PyInstaller\loader\rthooks\pyi_rth_pkgres.py", line 11, in
File "c:\users\gurnben\anaconda3\envs\opencv\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 389, in load_module
exec(bytecode, module.<strong>dict</strong>)
File "site-packages\setuptools-20.7.0-py3.5.egg\pkg_resources__init__.py", line 68, in
File "site-packages\setuptools-20.7.0-py3.5.egg\pkg_resources\extern__init__.py", line 60, in load_module
ImportError: The 'packaging' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution.
Failed to execute script pyi_rth_pkgres</p>
</blockquote>
<p>When I look at the warn.txt it gives a massive list of missing packages including parts of some packages that are actually in the single folder package.<br>
I have, however, successfully gotten it to recognize the dll files from opencv and it is not listed among the missing (nor is ffmpeg however I did not see any ffmpeg files in the folder). I had to pass in a custom path to get it to include the opencv files as they are not in anaconda at this time. </p>
<p>Any hints or ideas for next troubleshooting steps? I am overly greatful for all of the help you an offer and I can upload any code, files, etc. that would help you diagnose the issue. In the meantime I will continue searching for a solution myself!</p>
| 0debug |
static int put_flac_codecpriv(AVFormatContext *s,
AVIOContext *pb, AVCodecContext *codec)
{
int write_comment = (codec->channel_layout &&
!(codec->channel_layout & ~0x3ffffULL) &&
!ff_flac_is_native_layout(codec->channel_layout));
int ret = ff_flac_write_header(pb, codec->extradata, codec->extradata_size,
!write_comment);
if (ret < 0)
return ret;
if (write_comment) {
const char *vendor = (s->flags & AVFMT_FLAG_BITEXACT) ?
"Lavf" : LIBAVFORMAT_IDENT;
AVDictionary *dict = NULL;
uint8_t buf[32], *data, *p;
int len;
snprintf(buf, sizeof(buf), "0x%"PRIx64, codec->channel_layout);
av_dict_set(&dict, "WAVEFORMATEXTENSIBLE_CHANNEL_MASK", buf, 0);
len = ff_vorbiscomment_length(dict, vendor);
data = av_malloc(len + 4);
if (!data) {
av_dict_free(&dict);
return AVERROR(ENOMEM);
}
data[0] = 0x84;
AV_WB24(data + 1, len);
p = data + 4;
ff_vorbiscomment_write(&p, &dict, vendor);
avio_write(pb, data, len + 4);
av_freep(&data);
av_dict_free(&dict);
}
return 0;
}
| 1threat |
Android: "Bad Request-Invalid Hostname" When accessing localhost from emulators : <p>I am not able to use localhost with xamarin.android application.
I have executed Web project & Service project(not mobile app) on Chrome Browser.</p>
<p><a href="https://i.stack.imgur.com/6CLaz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6CLaz.png" alt="This is emulators executed project"></a></p>
<p>The displayed port number I tried browsing in Android Studio emulators & Genymotion emulators by appending 10.0.2.2: & 10.0.3.2: respectively, I got result <em>Bad Request-Invalid Hostname</em>. Even I have tried <strong>Service project port number</strong>, both not working.</p>
<p>Web Project: ASP.NET project using Visual Studio 2017 & Having service project in the same solution.</p>
| 0debug |
Cannot invoke equals(string) on the primitive type char : <p>In the if statement in my User class it says cannot invoke equals(String) on the primitive type char what is the problem?</p>
<p><a href="https://i.stack.imgur.com/R4lDe.png" rel="nofollow noreferrer">My rock paper scissors code</a></p>
| 0debug |
Expected view to be called with a URL keyword argument named "pk" : <p>I'm writing a test for a Django Rest Framework view following closely the <a href="http://www.django-rest-framework.org/api-guide/testing/" rel="noreferrer">testing documentation</a></p>
<p>Here's my simple test: </p>
<pre><code>def test_patient_detail_api_opens(self):
factory = APIRequestFactory()
view =PatientDetailApi.as_view()
request = factory.get(reverse('api_pacjent', kwargs={'pk' :1}))
force_authenticate(request, user=self.user)
response = view(request)
self.assertEqual(response.status_code, 200)
</code></pre>
<p>This test fails with the following message: </p>
<pre><code>AssertionError: Expected view PatientDetailApi to be called with a URL keyword argument named "pk". Fix your URL conf, or set the `.lookup_field` attribute on the view correctly.
</code></pre>
<p>I fail to understand why this is happening and how to fix this. </p>
<ul>
<li>The <code>pk</code> kwargs is there in the URL, </li>
<li>according to the docs there's no need to add the <code>lookup-field</code> value explicitly if it defaults to <code>pk</code>, </li>
<li>the view opens correctly and yet this test fails... </li>
</ul>
<p><strong>Can somebody please explain why this error occurs?</strong> </p>
<p>Here's the relevant code:</p>
<p>the 'main' <code>url.py</code>:</p>
<pre><code>urlpatterns = [
url(r'^pacjent/', include('pacjent.urls')),
]
</code></pre>
<p><code>pacjent.urls</code> looks like this:</p>
<pre><code>url(r'^api/szczegoly/(?P<pk>\d+)/$', PatientDetailApi.as_view(), name="api_pacjent"),
</code></pre>
<p>And <code>PatientDetailApi</code> is this:</p>
<pre><code>class PatientDetailApi(generics.RetrieveUpdateAPIView):
model = Patient
serializer_class = PatientDetailsSerializer
queryset = Patient.objects.all()
authentication_classes = (SessionAuthentication, BasicAuthentication)
permission_classes = (IsAuthenticated,)
</code></pre>
| 0debug |
show user's enter names in alphabetical order : Write a program that asks the user to enter three names, and then displays the names sorted in alphabetical order. Assume that none of the names are the same. For example, if the user entered “Charlie,” “Leslie,” and “Andy,” the program would display:
Andy Charlie Leslie......
but my output is:
**Enter a name: charlie
Enter a name: leslie
Enter a name: andy
andy leslie charlie
Press any key to continue . . .**
again another output:
**Enter a name: abc
Enter a name: def
Enter a name: ghi
ghi def abc
Press any key to continue . . .**
my output always show third enter name in first order and then second and then first it does't matter what i've write it always show names in this order....
please help me.thanku
<!-- begin snippet: js hide: false -->
<!-- language: lang-html -->
const int size = 10;
char name1[size];
char name2[size];
char name3[size];
cout << "Enter a name: ";
cin.getline(name1, size);
cout << "Enter a name: ";
cin.getline(name2, size);
cout << "Enter a name: ";
cin.getline(name3, size);
if ("name1" > "name2" && "name1" > "name3")
{
cout << name1 << " ";
if ("name2" > "name3")
{
cout << name2 << " " << name3 << endl;
}
else
{
cout << name3 << " " << name2 << endl;
}
}
else if ("name2" > "name1" && "name2" > "name3")
{
cout << name2 << " ";
if ("name1" > "name3")
{
cout << name1 << " " << name3 << endl;
}
else
{
cout << name3 << " " << name1 << endl;
}
}
else if ("name3" > "name1" && "name3" > "name2")
{
cout << name3 << " ";
if ("name1" > "name2")
{
cout << name1 << " " << name2 << endl;
}
else
{
cout << name2 << " " << name1 << endl;
}
}
else
{
cout << "nothing happened....." << endl;
}
<!-- end snippet --> | 0debug |
Match characters of two strings : <p>Suppose,i have two strings.<code>NameIs</code> and <code>Nam</code>.Now i can check if one string is as same as the other using :</p>
<pre><code>If (string1 == string2)
</code></pre>
<p>But it won't work here as the strings are not the same.But a portion of it is same.What i am trying to achieve is to check if my main string has any portion of the string given...I came across <code>String.StartWith</code> and <code>EndWith</code> methods but there,i need to specify what the string might start or end with but i cannot as the strings can be anything(that's why at the beginning,i said "Suppose").</p>
<p>So my first question is how to achieve this ? I don't want any step=to=step instruction but atleast a little bit of direction :)</p>
<p>However,if i get past that,there's still a drawback and it is the <code>Case-Sensitive</code> issue.I've come across <a href="https://stackoverflow.com/questions/3121957/how-can-i-do-a-case-insensitive-string-comparison">this</a> but i can't seem to figure the required implementation of this in my case because i need to overcome the first issue first.</p>
<p>How should i achieve these ?</p>
| 0debug |
static int load_data(AVFilterContext *ctx, int azim, int elev, float radius)
{
struct SOFAlizerContext *s = ctx->priv;
const int n_samples = s->sofa.n_samples;
int n_conv = s->n_conv;
int n_fft = s->n_fft;
int delay_l[16];
int delay_r[16];
int nb_input_channels = ctx->inputs[0]->channels;
float gain_lin = expf((s->gain - 3 * nb_input_channels) / 20 * M_LN10);
FFTComplex *data_hrtf_l = NULL;
FFTComplex *data_hrtf_r = NULL;
FFTComplex *fft_in_l = NULL;
FFTComplex *fft_in_r = NULL;
float *data_ir_l = NULL;
float *data_ir_r = NULL;
int offset = 0;
int m[16];
int i, j, azim_orig = azim, elev_orig = elev;
if (!s->sofa.ncid) {
av_log(ctx, AV_LOG_ERROR, "Selected SOFA file is invalid. Please select valid SOFA file.\n");
return AVERROR_INVALIDDATA;
}
if (s->type == TIME_DOMAIN) {
s->temp_src[0] = av_calloc(FFALIGN(n_samples, 16), sizeof(float));
s->temp_src[1] = av_calloc(FFALIGN(n_samples, 16), sizeof(float));
data_ir_l = av_malloc_array(n_conv * n_samples, sizeof(*data_ir_l));
data_ir_r = av_malloc_array(n_conv * n_samples, sizeof(*data_ir_r));
if (!data_ir_r || !data_ir_l || !s->temp_src[0] || !s->temp_src[1]) {
av_free(data_ir_l);
av_free(data_ir_r);
return AVERROR(ENOMEM);
}
} else {
data_hrtf_l = av_malloc_array(n_fft, sizeof(*data_hrtf_l) * n_conv);
data_hrtf_r = av_malloc_array(n_fft, sizeof(*data_hrtf_r) * n_conv);
if (!data_hrtf_r || !data_hrtf_l) {
av_free(data_hrtf_l);
av_free(data_hrtf_r);
return AVERROR(ENOMEM);
}
}
for (i = 0; i < s->n_conv; i++) {
azim = (int)(s->speaker_azim[i] + azim_orig) % 360;
elev = (int)(s->speaker_elev[i] + elev_orig) % 90;
m[i] = find_m(s, azim, elev, radius);
delay_l[i] = *(s->sofa.data_delay + 2 * m[i]);
delay_r[i] = *(s->sofa.data_delay + 2 * m[i] + 1);
if (s->type == TIME_DOMAIN) {
offset = i * n_samples;
for (j = 0; j < n_samples; j++) {
*(data_ir_l + offset + j) =
*(s->sofa.data_ir + 2 * m[i] * n_samples + n_samples - 1 - j) * gain_lin;
*(data_ir_r + offset + j) =
*(s->sofa.data_ir + 2 * m[i] * n_samples + n_samples - 1 - j + n_samples) * gain_lin;
}
} else {
fft_in_l = av_calloc(n_fft, sizeof(*fft_in_l));
fft_in_r = av_calloc(n_fft, sizeof(*fft_in_r));
if (!fft_in_l || !fft_in_r) {
av_free(data_hrtf_l);
av_free(data_hrtf_r);
av_free(fft_in_l);
av_free(fft_in_r);
return AVERROR(ENOMEM);
}
offset = i * n_fft;
for (j = 0; j < n_samples; j++) {
fft_in_l[delay_l[i] + j].re =
*(s->sofa.data_ir + 2 * m[i] * n_samples + j) * gain_lin;
fft_in_r[delay_r[i] + j].re =
*(s->sofa.data_ir + (2 * m[i] + 1) * n_samples + j) * gain_lin;
}
av_fft_permute(s->fft[0], fft_in_l);
av_fft_calc(s->fft[0], fft_in_l);
memcpy(data_hrtf_l + offset, fft_in_l, n_fft * sizeof(*fft_in_l));
av_fft_permute(s->fft[0], fft_in_r);
av_fft_calc(s->fft[0], fft_in_r);
memcpy(data_hrtf_r + offset, fft_in_r, n_fft * sizeof(*fft_in_r));
}
av_log(ctx, AV_LOG_DEBUG, "Index: %d, Azimuth: %f, Elevation: %f, Radius: %f of SOFA file.\n",
m[i], *(s->sofa.sp_a + m[i]), *(s->sofa.sp_e + m[i]), *(s->sofa.sp_r + m[i]));
}
if (s->type == TIME_DOMAIN) {
memcpy(s->data_ir[0], data_ir_l, sizeof(float) * n_conv * n_samples);
memcpy(s->data_ir[1], data_ir_r, sizeof(float) * n_conv * n_samples);
av_freep(&data_ir_l);
av_freep(&data_ir_r);
} else {
s->data_hrtf[0] = av_malloc_array(n_fft * s->n_conv, sizeof(FFTComplex));
s->data_hrtf[1] = av_malloc_array(n_fft * s->n_conv, sizeof(FFTComplex));
if (!s->data_hrtf[0] || !s->data_hrtf[1]) {
av_freep(&data_hrtf_l);
av_freep(&data_hrtf_r);
av_freep(&fft_in_l);
av_freep(&fft_in_r);
return AVERROR(ENOMEM);
}
memcpy(s->data_hrtf[0], data_hrtf_l,
sizeof(FFTComplex) * n_conv * n_fft);
memcpy(s->data_hrtf[1], data_hrtf_r,
sizeof(FFTComplex) * n_conv * n_fft);
av_freep(&data_hrtf_l);
av_freep(&data_hrtf_r);
av_freep(&fft_in_l);
av_freep(&fft_in_r);
}
memcpy(s->delay[0], &delay_l[0], sizeof(int) * s->n_conv);
memcpy(s->delay[1], &delay_r[0], sizeof(int) * s->n_conv);
return 0;
}
| 1threat |
Object doesn't support property or method 'startsWith' : <p>In my webpack:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>{
"presets": [
["env", {
"targets": {
"browsers": [">0.1%", "last 4 versions", "not ie <= 9"]
}
}]
]
}</code></pre>
</div>
</div>
</p>
<p>But I have an error in IE:</p>
<blockquote>
<p>Object doesn't support property or method 'startsWith'</p>
</blockquote>
| 0debug |
void visit_type_uint16(Visitor *v, uint16_t *obj, const char *name, Error **errp)
{
int64_t value;
if (v->type_uint16) {
v->type_uint16(v, obj, name, errp);
} else {
value = *obj;
v->type_int64(v, &value, name, errp);
if (value < 0 || value > UINT16_MAX) {
error_setg(errp, QERR_INVALID_PARAMETER_VALUE,
name ? name : "null", "uint16_t");
return;
}
*obj = value;
}
}
| 1threat |
static void test_visitor_in_intList(TestInputVisitorData *data,
const void *unused)
{
int64_t value[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20};
int16List *res = NULL, *tmp;
Error *err = NULL;
Visitor *v;
int i = 0;
v = visitor_input_test_init(data, "1,2,0,2-4,20,5-9,1-8");
visit_type_int16List(v, NULL, &res, &error_abort);
tmp = res;
while (i < sizeof(value) / sizeof(value[0])) {
g_assert(tmp);
g_assert_cmpint(tmp->value, ==, value[i++]);
tmp = tmp->next;
}
g_assert(!tmp);
qapi_free_int16List(res);
visitor_input_teardown(data, unused);
v = visitor_input_test_init(data, "not an int list");
res = NULL;
visit_type_int16List(v, NULL, &res, &err);
error_free_or_abort(&err);
g_assert(!res);
}
| 1threat |
int kvm_arch_init(KVMState *s, int smp_cpus)
{
int ret;
struct utsname utsname;
uname(&utsname);
lm_capable_kernel = strcmp(utsname.machine, "x86_64") == 0;
ret = kvm_check_extension(s, KVM_CAP_SET_TSS_ADDR);
if (ret <= 0) {
fprintf(stderr, "kvm does not support KVM_CAP_SET_TSS_ADDR\n");
return ret;
}
if (e820_add_entry(0xfffbc000, 0x4000, E820_RESERVED) < 0) {
perror("e820_add_entry() table is full");
exit(1);
}
ret = kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, 0xfffbd000);
if (ret < 0) {
return ret;
}
return kvm_init_identity_map_page(s);
}
| 1threat |
visualvm fails with "No jdkhome found" on Ubuntu 15.10 with Oracle JDK : <p>I installed Oracle JDK from the <code>webupd8team/java</code> PPA, and then installed the <code>visualvm</code> package. When starting <code>visualvm</code>, I get the following error message:</p>
<pre><code>[beni:~]$ visualvm
No jdkhome found
</code></pre>
<p>My <code>$JAVA_HOME</code> is set correctly to <code>/usr/lib/jvm/java-7-oracle</code>.</p>
<p>Also, when starting <code>visualvm</code> with the <code>jdkhome</code> property set, I get the same error:</p>
<pre><code>[beni:~]$ visualvm --jdkhome $JAVA_HOME
No jdkhome found
</code></pre>
| 0debug |
c# intialize static variable from different class : I am doing this
public static class IDs{
public static string someID{ get; set; }
static IDs(){
log.info(someID);
//use someID here
}
}
pulic class otherClass{
public otherMethod(string sym){
IDs.someID = sym;
}
}
public class anotherClass{
//access instance of otherClass in wrp and call otherMethod()
wrp.otherMethod("someStringSymbol")
}
I dont have any build errors but `log.info(someID);` is printing `null` . I am expecting it to be `someStringSymbol`
| 0debug |
static void error_setv(Error **errp, ErrorClass err_class,
const char *fmt, va_list ap)
{
Error *err;
int saved_errno = errno;
if (errp == NULL) {
return;
}
assert(*errp == NULL);
err = g_malloc0(sizeof(*err));
err->msg = g_strdup_vprintf(fmt, ap);
err->err_class = err_class;
if (errp == &error_abort) {
error_report_err(err);
abort();
}
*errp = err;
errno = saved_errno;
}
| 1threat |
HOW CAN I ALTERNATE row colors but 4 row at a time? : for example, row 1-4 would have red background, row 5-9 would be blue, then 10-13 would be back to red, etc
all the tutorial i found only covers alternating each row | 0debug |
document.write('<script src="evil.js"></script>'); | 1threat |
how to represent floating point in assembly by 36 instructions of pic16? : hey guys I have a question, how is floating point represented in assembly for pic16? for example, if I wanna save a value of 1.623 in memory, how can I save it using the 36 assembly instructions in pic16? your help is appreciated | 0debug |
Google script - sum of arrays : I'm using the following code to get all the value of all my sheets that have a numeric name. Once it find a numeric sheet name, it must sum row 8 to 108 of column 6. All the sheets must be sum in the right array. Right now, my script add the data in the array after then it crash instead of doing a sum.
**exemple (cell = value : variable = value)**
1. sheet 1 (8,6)=1 : colonne[1] = 1
2. sheet 2 (8,6)=2 : colonne[1] = 3
3. sheet 3 (8,6)=3 : colonne[1] = 6
4. sheet 1 (8,7)=2 : colonne[2] = 2
5. sheet 2 (8,7)=2 : colonne[2] = 4
6. sheet 3 (8,7)=2 : colonne[2] = 6
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
function CalculTotal() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getActiveSheet();
var out = new Array()
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
var substring1;
var colonne=[];
for (var i=0 ; i<sheets.length ; i++)
{
substring1=sheets[i].getName();
if(!isNaN(parseFloat(substring1)) && isFinite(substring1)){
colonne=colonne+(ss.getSheetByName(substring1).getRange(8,6,100).getValues());
}
}
s.getRange(8,4,100).setValues(colonne);
}
<!-- end snippet -->
| 0debug |
static void render_slice(Vp3DecodeContext *s, int slice)
{
int x, y;
int m, n;
int i;
int16_t *dequantizer;
DCTELEM __align16 block[64];
unsigned char *output_plane;
unsigned char *last_plane;
unsigned char *golden_plane;
int stride;
int motion_x = 0xdeadbeef, motion_y = 0xdeadbeef;
int upper_motion_limit, lower_motion_limit;
int motion_halfpel_index;
uint8_t *motion_source;
int plane;
int plane_width;
int plane_height;
int slice_height;
int current_macroblock_entry = slice * s->macroblock_width * 6;
if (slice >= s->macroblock_height)
return;
for (plane = 0; plane < 3; plane++) {
if (plane == 0) {
output_plane = s->current_frame.data[0];
last_plane = s->last_frame.data[0];
golden_plane = s->golden_frame.data[0];
stride = s->current_frame.linesize[0];
if (!s->flipped_image) stride = -stride;
upper_motion_limit = 7 * s->current_frame.linesize[0];
lower_motion_limit = s->height * s->current_frame.linesize[0] + s->width - 8;
y = slice * FRAGMENT_PIXELS * 2;
plane_width = s->width;
plane_height = s->height;
slice_height = y + FRAGMENT_PIXELS * 2;
i = s->macroblock_fragments[current_macroblock_entry + 0];
} else if (plane == 1) {
output_plane = s->current_frame.data[1];
last_plane = s->last_frame.data[1];
golden_plane = s->golden_frame.data[1];
stride = s->current_frame.linesize[1];
if (!s->flipped_image) stride = -stride;
upper_motion_limit = 7 * s->current_frame.linesize[1];
lower_motion_limit = (s->height / 2) * s->current_frame.linesize[1] + (s->width / 2) - 8;
y = slice * FRAGMENT_PIXELS;
plane_width = s->width / 2;
plane_height = s->height / 2;
slice_height = y + FRAGMENT_PIXELS;
i = s->macroblock_fragments[current_macroblock_entry + 4];
} else {
output_plane = s->current_frame.data[2];
last_plane = s->last_frame.data[2];
golden_plane = s->golden_frame.data[2];
stride = s->current_frame.linesize[2];
if (!s->flipped_image) stride = -stride;
upper_motion_limit = 7 * s->current_frame.linesize[2];
lower_motion_limit = (s->height / 2) * s->current_frame.linesize[2] + (s->width / 2) - 8;
y = slice * FRAGMENT_PIXELS;
plane_width = s->width / 2;
plane_height = s->height / 2;
slice_height = y + FRAGMENT_PIXELS;
i = s->macroblock_fragments[current_macroblock_entry + 5];
}
if(ABS(stride) > 2048)
return;
for (; y < slice_height; y += 8) {
for (x = 0; x < plane_width; x += 8, i++) {
if ((i < 0) || (i >= s->fragment_count)) {
av_log(s->avctx, AV_LOG_ERROR, " vp3:render_slice(): bad fragment number (%d)\n", i);
return;
}
if ((s->all_fragments[i].coding_method != MODE_COPY) &&
!((s->avctx->flags & CODEC_FLAG_GRAY) && plane)) {
if ((s->all_fragments[i].coding_method == MODE_USING_GOLDEN) ||
(s->all_fragments[i].coding_method == MODE_GOLDEN_MV))
motion_source= golden_plane;
else
motion_source= last_plane;
motion_source += s->all_fragments[i].first_pixel;
motion_halfpel_index = 0;
if ((s->all_fragments[i].coding_method > MODE_INTRA) &&
(s->all_fragments[i].coding_method != MODE_USING_GOLDEN)) {
int src_x, src_y;
motion_x = s->all_fragments[i].motion_x;
motion_y = s->all_fragments[i].motion_y;
if(plane){
motion_x= (motion_x>>1) | (motion_x&1);
motion_y= (motion_y>>1) | (motion_y&1);
}
src_x= (motion_x>>1) + x;
src_y= (motion_y>>1) + y;
if ((motion_x == 127) || (motion_y == 127))
av_log(s->avctx, AV_LOG_ERROR, " help! got invalid motion vector! (%X, %X)\n", motion_x, motion_y);
motion_halfpel_index = motion_x & 0x01;
motion_source += (motion_x >> 1);
motion_halfpel_index |= (motion_y & 0x01) << 1;
motion_source += ((motion_y >> 1) * stride);
if(src_x<0 || src_y<0 || src_x + 9 >= plane_width || src_y + 9 >= plane_height){
uint8_t *temp= s->edge_emu_buffer;
if(stride<0) temp -= 9*stride;
else temp += 9*stride;
ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);
motion_source= temp;
}
}
if (s->all_fragments[i].coding_method != MODE_INTRA) {
if(motion_halfpel_index != 3){
s->dsp.put_no_rnd_pixels_tab[1][motion_halfpel_index](
output_plane + s->all_fragments[i].first_pixel,
motion_source, stride, 8);
}else{
int d= (motion_x ^ motion_y)>>31;
s->dsp.put_no_rnd_pixels_l2[1](
output_plane + s->all_fragments[i].first_pixel,
motion_source - d,
motion_source + stride + 1 + d,
stride, 8);
}
dequantizer = s->inter_dequant;
}else{
if (plane == 0)
dequantizer = s->intra_y_dequant;
else
dequantizer = s->intra_c_dequant;
}
debug_idct("fragment %d, coding mode %d, DC = %d, dequant = %d:\n",
i, s->all_fragments[i].coding_method,
DC_COEFF(i), dequantizer[0]);
if(s->avctx->idct_algo==FF_IDCT_VP3){
Coeff *coeff= s->coeffs + i;
memset(block, 0, sizeof(block));
while(coeff->next){
block[coeff->index]= coeff->coeff * dequantizer[coeff->index];
coeff= coeff->next;
}
}else{
Coeff *coeff= s->coeffs + i;
memset(block, 0, sizeof(block));
while(coeff->next){
block[coeff->index]= (coeff->coeff * dequantizer[coeff->index] + 2)>>2;
coeff= coeff->next;
}
}
if (s->all_fragments[i].coding_method == MODE_INTRA) {
if(s->avctx->idct_algo!=FF_IDCT_VP3)
block[0] += 128<<3;
s->dsp.idct_put(
output_plane + s->all_fragments[i].first_pixel,
stride,
block);
} else {
s->dsp.idct_add(
output_plane + s->all_fragments[i].first_pixel,
stride,
block);
}
debug_idct("block after idct_%s():\n",
(s->all_fragments[i].coding_method == MODE_INTRA)?
"put" : "add");
for (m = 0; m < 8; m++) {
for (n = 0; n < 8; n++) {
debug_idct(" %3d", *(output_plane +
s->all_fragments[i].first_pixel + (m * stride + n)));
}
debug_idct("\n");
}
debug_idct("\n");
} else {
s->dsp.put_pixels_tab[1][0](
output_plane + s->all_fragments[i].first_pixel,
last_plane + s->all_fragments[i].first_pixel,
stride, 8);
}
}
}
}
emms_c();
}
| 1threat |
static void set_sar(TiffContext *s, unsigned tag, unsigned num, unsigned den)
{
int offset = tag == TIFF_YRES ? 2 : 0;
s->res[offset++] = num;
s->res[offset] = den;
if (s->res[0] && s->res[1] && s->res[2] && s->res[3])
av_reduce(&s->avctx->sample_aspect_ratio.num, &s->avctx->sample_aspect_ratio.den,
s->res[2] * (uint64_t)s->res[1], s->res[0] * (uint64_t)s->res[3], INT32_MAX);
}
| 1threat |
SyntaxError: Generator expression must be parenthezised / python manage.py migrate : <p>I'm really new in programming and I wanted to follow the Djangogirls tutorial, but I'm stucked now.
In the tutorial, I am <a href="https://tutorial.djangogirls.org/en/django_start_project/" rel="noreferrer">here</a>:</p>
<blockquote>
<p>To create a database for our blog, let's run the following in the console: python manage.py migrate (we need to be in the djangogirls directory that contains the manage.py file). If that goes well, you should see something like this: ...</p>
</blockquote>
<p>There is no option to fail in the tutorial but I have an error message:</p>
<pre><code>(myvenv) C:\Users\Julcsi\djangogirls> python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\Julcsi\djangogirls\myvenv\lib\site-packages\django\core\management\__init__.py",
line 364, in execute_from_command_line
utility.execute()
File "C:\Users\Julcsi\djangogirls\myvenv\lib\site-packages\django\core\management\__init__.py",
line 338, in execute
django.setup()
File "C:\Users\Julcsi\djangogirls\myvenv\lib\site-packages\django\__init__.py",
line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\Julcsi\djangogirls\myvenv\lib\site-packages\django\apps\registry.py",
line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\Julcsi\djangogirls\myvenv\lib\site-packages\django\apps\config.py",
line 94, in create
module = import_module(entry)
File "C:\Users\Julcsi\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py",
line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 723, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_remove
File "C:\Users\Julcsi\djangogirls\myvenv\lib\site-packages\django\contrib\admin\__init__.py",
line 4, in <module>
from django.contrib.admin.filters import (
File "C:\Users\Julcsi\djangogirls\myvenv\lib\site-packages\django\contrib\admin\filters.py",
line 10, in <module>
from django.contrib.admin.options import IncorrectLookupParameters
File "C:\Users\Julcsi\djangogirls\myvenv\lib\site-packages\django\contrib\admin\options.py",
line 12, in <module>
from django.contrib.admin import helpers, widgets
File "C:\Users\Julcsi\djangogirls\myvenv\lib\site-packages\django\contrib\admin\widgets.py",
line 152
'%s=%s' % (k, v) for k, v in params.items(),
SyntaxError: Generator expression must be parenthesized
</code></pre>
<p>What am I doing wrong? What should I do?</p>
<p>I have Python 3.7.0b1</p>
<p>Thanks a lot in advance for the help :)</p>
| 0debug |
is code sharing between react and react native possible? : <p>I want to know whether, is it possible to create an app which works both on web and mobile app with same code. I think it is possible in angular 2 ionic. But, I'm not sure about react. Can anyone help me on this?</p>
<p>Thanks in advance!</p>
| 0debug |
i cant see the onactivityresult in android studio : <p>heres my code i cant see the activity result when i type "on" please help
there is no pop up on onActivityResult.</p>
<p>heres my code i cant see the activity result when i type "on" please help
there is no pop up on onActivityResult.</p>
<p>heres my code i cant see the activity result when i type "on" please help
there is no pop up on onActivityResult.</p>
<pre><code>package com.ssss.myapplication;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.provider.MediaStore;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import java.io.File;
import static android.R.attr.data;
public class MainActivity extends AppCompatActivity {
Button button;
ImageView imageView;
static final int CAM_REQUEST = 1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button = (Button) findViewById(R.id.button);
imageView = (ImageView) findViewById(R.id.image_view);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent camera_intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
File file = getFile();
camera_intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file));
startActivityForResult(camera_intent,CAM_REQUEST);
}
});
}
private File getFile() {
File folder = new File("sdcard/camera_app");
if (!folder.exists()) {
folder.mkdir();
}
File image_file = new File(folder, "hiapp_image.jpg");
return image_file;
}
}
</code></pre>
| 0debug |
Add description attribute to enum and read this description in TypeScript : <p>I’m wondering how to add description attributes to enum in TypeScript.
I would like to create enum as follows(or something similar):</p>
<pre><code>public enum Sample
{
[Display(Name = "Blah V")]
V,
[Display(Name = " Blah IV")]
IV,
[Display(Name = " Blah III")]
III,
}
</code></pre>
<p>To be able to do basic operations on such enum I would create generic EnumHelper. This helper class should contain methods which allow: getting a description value, getting the name and numeric value. The question is how to achieve this in typescript? If it is not possible to add attributes to the enum, is there any way around?
I would like to be able to:</p>
<pre><code>- get number of enum value,
- get description value,
- get the name of enum field.
</code></pre>
<p>e.g. for Sample.IV it would be: </p>
<pre><code>1,
Blah IV,
IV.
</code></pre>
| 0debug |
Hibernate dialect for MySQL 8? : <p>Is there a Hibernate dialect for MySQL 8? Or should I use the org.hibernate.dialect.MySQL57Dialect that ships with Hibernate?
I'm using hibernate 5.2.16</p>
| 0debug |
Format Curly Braces on Same Line in C++ VSCode : <p>I'm using the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools" rel="noreferrer">C++ Extension</a> for <a href="https://code.visualstudio.com/" rel="noreferrer">VSCode</a> <em>(Visual Studio Code)</em>.</p>
<p>Currently, I have the setting <code>"C_Cpp.clang_format_formatOnSave"</code> set to <code>true</code>.</p>
<p>This format's my code when I save my C++ file. But the format results in curly braces on new lines rather than on the same line.</p>
<p><strong>Current C++ VSCode Formatted</strong></p>
<pre><code>for (int i = 0; i < 10; i++)
{
// ...
}
</code></pre>
<p><strong>What I Want C++ VSCode Formatted Code to Look Like</strong></p>
<pre><code>for (int i = 0; i < 10; i++) {
// ...
}
</code></pre>
<p>I also have <code>editor.wrappingIndent</code> set to <code>"same"</code>.</p>
<p><strong>How can I make curly braces in C++ format on the same line in Visual Studio Code?</strong></p>
| 0debug |
Error with LINQ in MVC : First of all, sorry for my bad english.
Im developing a MVC website. In one of the View i need to use:
return View(db.Logs.OrderByDescending(l => l.Date)
.Where(l => ((DateTime)l.Date).ToLocalTime().ToString().Contains(search)
|| l.Name.Contains(search)).ToList().ToPagedList(pageNumber, pageSize));
But i get this error:
> LINQ to Entities does not recognize the method 'System.DateTime
> ToLocalTime()' method, and this method cannot be translated into a
> store expression.
I need transform `l.Date` toLocalTime and then compare with `search`
How can i do it? | 0debug |
Switch between icons when using FontAwesome 5.0 SVG Framework : <p>I'm looking to be able to switch between icons in Javascript while using the new FontAwesome SVG framework.</p>
<p>Previously in the old WebFont method, this was achieved by toggling or changing the class on the tag, however as these are now rendered as SVG's in the source code this no longer works.</p>
<p>Is there a way to do this without needing to render both SVG icons in source code and using additional classes/CSS to toggle display?</p>
| 0debug |
How to run these asynchronous functions in loop, sequentially? : <p>Below written javascript code runs asynchronously and produces output in the following format.</p>
<pre><code>const check = () => {
const arr = [3,2,1]
arr.forEach(async (val) => {
await setTimeout(() => console.log(val), val*1000)
})
}
check();
</code></pre>
<p>The actual output is:</p>
<pre><code>1
2
3
</code></pre>
<p>But I want output in the following format:</p>
<pre><code>3
2
1
</code></pre>
| 0debug |
void qmp_change_blockdev(const char *device, const char *filename,
const char *format, Error **errp)
{
BlockBackend *blk;
BlockDriverState *bs;
BlockDriver *drv = NULL;
int bdrv_flags;
Error *err = NULL;
blk = blk_by_name(device);
if (!blk) {
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
return;
}
bs = blk_bs(blk);
if (format) {
drv = bdrv_find_whitelisted_format(format, bs->read_only);
if (!drv) {
error_set(errp, QERR_INVALID_BLOCK_FORMAT, format);
return;
}
}
eject_device(blk, 0, &err);
if (err) {
error_propagate(errp, err);
return;
}
bdrv_flags = bdrv_is_read_only(bs) ? 0 : BDRV_O_RDWR;
bdrv_flags |= bdrv_is_snapshot(bs) ? BDRV_O_SNAPSHOT : 0;
qmp_bdrv_open_encrypted(bs, filename, bdrv_flags, drv, NULL, errp);
}
| 1threat |
void usb_info(Monitor *mon)
{
USBBus *bus;
USBDevice *dev;
USBPort *port;
if (TAILQ_EMPTY(&busses)) {
monitor_printf(mon, "USB support not enabled\n");
return;
}
TAILQ_FOREACH(bus, &busses, next) {
TAILQ_FOREACH(port, &bus->used, next) {
dev = port->dev;
if (!dev)
continue;
monitor_printf(mon, " Device %d.%d, Speed %s Mb/s, Product %s\n",
bus->busnr, dev->addr, usb_speed(dev->speed), dev->devname);
}
}
}
| 1threat |
Robot framwork how to verify value of element in window : [enter image description here][1]
[1]: https://i.stack.imgur.com/qS0yw.png
I want to validate the value 'Ping Information For' that it exists in window | 0debug |
int xen_be_init(void)
{
xenstore = xs_daemon_open();
if (!xenstore) {
xen_be_printf(NULL, 0, "can't connect to xenstored\n");
return -1;
}
if (qemu_set_fd_handler(xs_fileno(xenstore), xenstore_update, NULL, NULL) < 0) {
goto err;
}
if (xen_xc == XC_HANDLER_INITIAL_VALUE) {
goto err;
}
return 0;
err:
qemu_set_fd_handler(xs_fileno(xenstore), NULL, NULL, NULL);
xs_daemon_close(xenstore);
xenstore = NULL;
return -1;
}
| 1threat |
.NET CLI how to run app after publish on Linux : <p>I spent ~4 hours investigation and still can't find out how to run published application ( <code>dotnet publish</code> )</p>
<p>Now I can download sources to my remote machine, then call <code>dotnet build</code> and <code>dotnet run</code> - then my app runs as intended. But I want to publish just DLL's (or *.so ?) to my VPS without source files. </p>
<p><strong>What official docs says?</strong> To define command in project.json</p>
<pre><code>"commands": {
"web": "Microsoft.AspNet.Server.Kestrel --server.urls http://unix:/var/aspnet/HelloMVC/kestrel.sock",
}
</code></pre>
<p>But it is obsolette, isn't it?</p>
<p><strong>What about default samples?</strong></p>
<p>In default VS2015 sample solution they use publish-iis, Full .NET framework and IIS server, but there is nothing about deployment on linux. </p>
<pre><code>postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
</code></pre>
<hr>
<p>Here is my dotnet info</p>
<pre><code>.NET Command Line Tools (1.0.0-preview1-002702)
Product Information:
Version: 1.0.0-preview1-002702
Commit Sha: 6cde21225e
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64
</code></pre>
<p>.NET Core RC2</p>
| 0debug |
How to have a set of sets in Python? : <p>In Python there's no full support for heterogeneous data structures. For example this fails:</p>
<pre><code>set(set(1,2),set(2,3))
</code></pre>
<p>What's the best way to treat sets of sets?</p>
| 0debug |
PageCache *cache_init(size_t num_pages, size_t page_size)
{
int64_t i;
PageCache *cache;
if (num_pages <= 0) {
DPRINTF("invalid number of pages\n");
return NULL;
}
cache = g_try_malloc(sizeof(*cache));
if (!cache) {
DPRINTF("Failed to allocate cache\n");
return NULL;
}
if (!is_power_of_2(num_pages)) {
num_pages = pow2floor(num_pages);
DPRINTF("rounding down to %" PRId64 "\n", num_pages);
}
cache->page_size = page_size;
cache->num_items = 0;
cache->max_num_items = num_pages;
DPRINTF("Setting cache buckets to %" PRId64 "\n", cache->max_num_items);
cache->page_cache = g_try_malloc((cache->max_num_items) *
sizeof(*cache->page_cache));
if (!cache->page_cache) {
DPRINTF("Failed to allocate cache->page_cache\n");
g_free(cache);
return NULL;
}
for (i = 0; i < cache->max_num_items; i++) {
cache->page_cache[i].it_data = NULL;
cache->page_cache[i].it_age = 0;
cache->page_cache[i].it_addr = -1;
}
return cache;
}
| 1threat |
Why use json format when read mode and write mode are available? : Why do we use `json files` when we can as easily store and load data with two other functions, namely `read()` and `write()`?
Since I am a beginner in Python I don't know what else `json` can be used for except to store and load data from different files. Is `json` used for something else too? | 0debug |
hopefully a simple Mysql/php query : I'm working with a mysql date column called 'class_of' that has dates ranging from 2014-08-01 to 2019-08-01, all formatted as a date. These dates coincide to what year an article was written.
I have set up my php execution page to grab the year through a url action.
for example - www.mywebsite.com/mypage.php?action=2016
\\\\
$classOf = ($_GET["action"]);
\\\\
I now need to somehow use said variable within a mysql query so my php while loop will only echo dates that have for example 2016 within the date.
This is what I have tried
This works, but I need the year to be a variable
\\\
$query = 'SELECT * FROM news_content WHERE hot = "false" AND trash="false" AND class_of = DATE("2020-08-01") ORDER BY article_id DESC';
\\\
I have tried the below, but with no success
\\\
$query = 'SELECT * FROM news_content WHERE hot = "false" AND trash="false" AND class_of = DATE("<?php echo $classOf ?>-08-01") ORDER BY article_id DESC';
\\\
And
\\\
$query = 'SELECT * FROM news_content WHERE hot = "false" AND trash="false" AND class_of = "<?php echo $classOf ?>" ORDER BY article_id DESC';
\\\
And
\\\
$query = 'SELECT * FROM news_content WHERE hot = "false" AND trash="false" AND class_of LIKE "%<?php echo $classOf ?>%" ORDER BY article_id DESC';
\\\
And
\\\
$query = 'SELECT * FROM news_content WHERE hot = "false" AND trash="false" AND class_of = "<?php date("echo $classOf-08-01")?>" ORDER BY article_id DESC';
\\\
All of the above no success.
Hopefully some has a few ideas or a work around so my while loop only picks up the dates in my variable.
Thanks | 0debug |
document.location = 'http://evil.com?username=' + user_input; | 1threat |
alert('Hello ' + user_input); | 1threat |
Use the same value for the next 10 occurrences in python : <p>I have a column with values and I need to create a new column where the first instance of 1 is repeated for the next 5 occurrences.</p>
| 0debug |
learning c wrote code.whats wrong.(no error acoording to compiler) : #include <stdio.h>
#include <stdlib.h>
int main()
{int array1[10],i=0,sum=0;
while(i<10)
{scanf("%d",&array1[i]);
i=i+1;
}
while(i<10)
{sum=sum+array1[i];i=i+1;
}
printf("sum =%d",sum);
return 0;
}
DO SEND CORRECTED CODE FOR ME TO CHECK IT ON MY COMPILER.
my compiler works but sum is always equal to 0.
| 0debug |
"Index out of range" while reading contents from a file through cat PYTHON : <p>I am trying to get input from a file, through cat command, into a python file. My python version is 3.5. The code looks like this. </p>
<pre><code>with open(sys.argv[1]) as f:
while True:
if f.readline()== '':
break
line = f.readline().strip()
</code></pre>
<p>And i am getting the input through the following command. </p>
<pre><code>python cptest.py | cat ts.csv
</code></pre>
<p>But i keep running into the following error.</p>
<blockquote>
<p>File "cptest.py", line 9, in
with open(sys.argv[1]) as f:
IndexError: list index out of range</p>
</blockquote>
<p>How can i send input to a python script from a file using cat command? I have to use cat command, or any other way i can pipe the input to the file.</p>
| 0debug |
putsum(uint8_t *data, uint32_t n, uint32_t sloc, uint32_t css, uint32_t cse)
{
if (cse && cse < n)
n = cse + 1;
if (sloc < n-1)
cpu_to_be16wu((uint16_t *)(data + sloc),
do_cksum(data + css, data + n));
}
| 1threat |
Probability of happening function : <p>Basically I have a race, in every lap of the race each pilot have 5% probability of crashing.</p>
<p>How can I make a function that test the probability of crashing?</p>
<pre><code>
//the professor gave us this code but wasn't able to use it/ or understand it
//Returns the value 1 with probability prob. Otherwise, return 0
int probEvent(float prob){
return prob > ((float)rand()/RAND_MAX);
}
</code></pre>
| 0debug |
void MPV_common_end(MpegEncContext *s)
{
int i;
av_freep(&s->mb_type);
av_freep(&s->p_mv_table);
av_freep(&s->b_forw_mv_table);
av_freep(&s->b_back_mv_table);
av_freep(&s->b_bidir_forw_mv_table);
av_freep(&s->b_bidir_back_mv_table);
av_freep(&s->b_direct_mv_table);
av_freep(&s->motion_val);
av_freep(&s->dc_val[0]);
av_freep(&s->ac_val[0]);
av_freep(&s->coded_block);
av_freep(&s->mbintra_table);
av_freep(&s->cbp_table);
av_freep(&s->pred_dir_table);
av_freep(&s->me.scratchpad);
av_freep(&s->me.map);
av_freep(&s->me.score_map);
av_freep(&s->mbskip_table);
av_freep(&s->bitstream_buffer);
av_freep(&s->tex_pb_buffer);
av_freep(&s->pb2_buffer);
av_freep(&s->edge_emu_buffer);
av_freep(&s->co_located_type_table);
av_freep(&s->field_mv_table);
av_freep(&s->field_select_table);
av_freep(&s->avctx->stats_out);
av_freep(&s->ac_stats);
av_freep(&s->error_status_table);
for(i=0; i<MAX_PICTURE_COUNT; i++){
free_picture(s, &s->picture[i]);
}
s->context_initialized = 0;
}
| 1threat |
How to get string formate from response of HTTP GET in Python? : <p>I have the following task </p>
<p>Write a function named "get_response" that three string parameters representing the protocol, name of a server, and a path for an HTTP GET request in this order. Return the response of an HTTPS GET request to the url formed by these inputs. The response should be returned as a string</p>
<p>I wrote the following code. </p>
<pre><code>def get_response(protocol, server, path):
str = protocol + "://" + server + "/" + path
contents = urllib.request.urlopen(str).read()
return contents
</code></pre>
<p>I get the following thing when I run the code</p>
<blockquote>
<p>b'pupils'</p>
</blockquote>
<p>What the question wants is the string format and only "pupils" in the answer. I try to convert it into str, but it's not working. </p>
<p>Any suggestions?</p>
| 0debug |
static int megasas_handle_dcmd(MegasasState *s, MegasasCmd *cmd)
{
int opcode, len;
int retval = 0;
const struct dcmd_cmd_tbl_t *cmdptr = dcmd_cmd_tbl;
opcode = le32_to_cpu(cmd->frame->dcmd.opcode);
trace_megasas_handle_dcmd(cmd->index, opcode);
len = megasas_map_dcmd(s, cmd);
if (len < 0) {
return MFI_STAT_MEMORY_NOT_AVAILABLE;
}
while (cmdptr->opcode != -1 && cmdptr->opcode != opcode) {
cmdptr++;
}
if (cmdptr->opcode == -1) {
trace_megasas_dcmd_unhandled(cmd->index, opcode, len);
retval = megasas_dcmd_dummy(s, cmd);
} else {
trace_megasas_dcmd_enter(cmd->index, cmdptr->desc, len);
retval = cmdptr->func(s, cmd);
}
if (retval != MFI_STAT_INVALID_STATUS) {
megasas_finish_dcmd(cmd, len);
}
return retval;
}
| 1threat |
How would I make a basic alert for Android : I have a `if then` statement. If the `if then` statement is true, I want the android system to fire a basic alert with 1 button that says ok. I have done plenty of recchearch, but nothing I can find will work. Thanks in advance. | 0debug |
AWS CodeBuild – Build does not have internet connectivity. Please check subnet network configuration : <p>I am experimenting with CodeBuild but have reached a dead-end. My build always fails with the error message:</p>
<blockquote>
<p>Build does not have internet connectivity. Please check subnet network configuration.</p>
</blockquote>
<p>I checked the VPC configuration (subnet, security groups), and they seem okay. To test internet connectivity, I launched an EC2 instance in the same subnet, and it is able to communicate with external services (I tried a ping and some HTTP GETs).</p>
<p>How do I resolve this 'internet connectivity' issue?</p>
| 0debug |
static unsigned tget_long(const uint8_t **p, int le)
{
unsigned v = le ? AV_RL32(*p) : AV_RB32(*p);
*p += 4;
return v;
}
| 1threat |
static void fsl_imx6_class_init(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
dc->realize = fsl_imx6_realize;
dc->desc = "i.MX6 SOC";
}
| 1threat |
BigQuery - IFERROR for standardSQL : <p>I'm about to migrate queries from Legacy to Standard in BQ.
In Legacy I used to have <code>x/y</code> returning <code>null</code> if <code>y=0</code>, however, I'm stuck in StandardSQL with the error:</p>
<blockquote>
<p>Error: division by zero</p>
</blockquote>
<p>I'd like to apply something like <code>IFERROR(x/y,null)</code></p>
<p>Is it available in StandardSQL?</p>
| 0debug |
Why are these two algorithms for finding the n-th Fabonacci number so inefficient? : When calculating the 64th Fabonacci number, the first algorithm takes several hours, and the second one takes less than a second.
Why is the efficiency of the second algorithm so much higher than that of the first one?
They look very similar.
Please tell me why, thx :)
def fib_divide_recursion(n):
if n <= 2:
return n-1
else:
return fib_divide_recursion(n-1) + fib_divide_recursion(n-2)
def fib_linear_recursion(n, prev={}):
if n <= 2:
return n-1
try:
return prev[n]
except KeyError:
prev[n] = fib_linear_recursion(n - 1, prev) +
fib_linear_recursion(n - 2, prev)
return prev[n]
| 0debug |
duplicate data when insert to db through form : the problem is when insert it duplicate the data like this in photo its added 2 times in Database[mysql table][1]
[page][2]
submit redirect to menu_submit when done insert it redirect to create_menu.php
here is
menu_submit.php
enter code here
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<?php
include ("../include/layout/header.php");
include ("../include/check_connection.php");
include ("../include/check_page.php");
if(isset($_POST["submit"])){
$menu_name=$_POST["menu"];
$optradio_choise=(int)$_POST["optradio"];
$rank_name=(int)$_POST["rank"];
$menu_name2=mysqli_real_escape_String($conn,$menu_name);
//$query="INSERT INTO website_navbar(id,item_name,rank) values (null,'$menu_name',$rank_name)";
$query=" INSERT INTO `website_navbar`( `item_name`, `rank`, `visible` ) VALUES
( '{$menu_name}' , '{$rank_name}' , {$optradio_choise} ) ";
$result=mysqli_query($conn,$query);
if(mysqli_query($conn,$query) && mysqli_affected_rows($conn)){
echo "Menu add sucessfully";
redirect1("mange_content.php");
}
}
mysqli_close($conn);
?>
<!-- end snippet -->
`
[1]: https://i.stack.imgur.com/vR6eF.png
[2]: https://i.stack.imgur.com/CosBU.png | 0debug |
Is there any way to emulate perfectly a OnePlus device? : <p>I'm trying to debug a problem that seems to be happening only on OnePlus devices, unfortunately buying this device is not an option for me, so I've been looking on Google how to emulate an OnePlus device but without any success :(</p>
<p>Is there any way I can reproduce the hardware specs and software characteristics on a GOOD android emulator??</p>
| 0debug |
please help me from this module not found error ? github of my code is below : //please visit this github link for full source code.
https://github.com/roshantak44/todo
var mongoose = require('mongoose');
module.exports = mongoose.model('Todo', {
text : String,
done : Boolean
}); | 0debug |
jQuery - Can't get the proper id to click : <p>i have html like this</p>
<pre><code><div class="ui pagination menu">
<li class="active item">1</li>
<li class="item"><a href="http://localhost/csgorakCI/market/2" data-ci-pagination-page="2">2</a></li>
<li class="item"><a href="http://localhost/csgorakCI/market/2" data-ci-pagination-page="2" rel="next"><i class="right chevron icon"></i></a></li>
</div>
</code></pre>
<p>i want to click the link and get the data attribute data-ci-pagination-page</p>
<p>and this is my jquery code</p>
<pre><code>$('li.item').on('click','a',function () {
var link = $(this).attr("data-ci-pagination-page");
console.log(link);
load_result(link);
return false;
});
</code></pre>
| 0debug |
Awareness API & Android O using BroadcastReceiver : <p>I have an Android app which uses the Awareness API to setup a fence when a headset is plugged in. </p>
<p>I have implemented the AwarenessFence using code much like in the examples at: <a href="https://developers.google.com/awareness/android-api/fence-register" rel="noreferrer">https://developers.google.com/awareness/android-api/fence-register</a>.</p>
<p>I have a PendingIntent defined as: </p>
<pre><code>PendingIntent.getBroadcast(context, 0, new Intent("my.application.packageFENCE_RECEIVER_ACTION"), 0)
</code></pre>
<p>Then in my AndroidManifest.xml file I have</p>
<pre><code><receiver android:name=".fence.FenceDetector$MyFenceReceiver">
<intent-filter>
<action android:name="my.application.packageFENCE_RECEIVER_ACTION" />
</intent-filter>
</code></pre>
<p></p>
<p>This is declared in the Manifest due to the fact that I want to receive broadcasts even when my app is in the background.</p>
<p>This all worked fine on Android 7.0 and below, but when I run this on a Android 8.0 I get the error:</p>
<pre><code>BroadcastQueue: Background execution not allowed: receiving Intent { act=my.application.packageFENCE_RECEIVER_ACTION
</code></pre>
<p>I assume this is due to the new restrictions for background execution on Android O.</p>
<p>Can anybody tell me how to register a broadcast receiver which can listen to awareness fence triggers when in the background on a Android device running API 26.</p>
<p>Let me know If there is something which is unclear or if I need to elaborate something.</p>
<p>Thanks in advance</p>
| 0debug |
How to float list view just below the Edit text (search Box) and over the the others views like Button : <p>I wanna show the List like as shown in the image.Searched a lot on Google but did not get the answer. Please help... <a href="https://i.stack.imgur.com/IlJkl.png" rel="nofollow noreferrer">Example Image Link</a></p>
| 0debug |
make a batch file that adds iteself to startup and (windows 10) : so I was wondering is there a way to make a batch file that adds itself to startup
without getting the error: access is denied. 0 file moved
here is my bat code:
move "C:\Users\Deathblade\Desktop\Startup bat\funtime.bat" "C:\Documents and Settings\Administrator\Start Menu\Programs\Startup"
move "C:\Users\Deathblade\Desktop\Startup bat\funtime.bat" "C:\Documents and Settings\All Users\Start Menu\Programs\Startup"
pause
That's the end of it so yeah all elp appreciated, even .vbs script or anything
accepted | 0debug |
static CharDriverState *qemu_chr_open_win_path(const char *filename)
{
CharDriverState *chr;
WinCharState *s;
chr = g_malloc0(sizeof(CharDriverState));
s = g_malloc0(sizeof(WinCharState));
chr->opaque = s;
chr->chr_write = win_chr_write;
chr->chr_close = win_chr_close;
if (win_chr_init(chr, filename) < 0) {
g_free(s);
g_free(chr);
return NULL;
}
qemu_chr_be_generic_open(chr);
return chr;
}
| 1threat |
hello all,I am new in java...plz tell below program behaviour? : can anybody tell?why it do not give compile time error saying..
Incompatible type cannot convert int to string.
public class Test1 {
public static void main(String[] args)
{
String[] a= new String[3];
a[0]="10";
a[1]="20";
a[2]="30";
for(String x:a)
{
System.out.println(x);
}
}
}
| 0debug |
operand types are incompatible ("bool (*)()" and "bool") : <p>I am trying to create a program in Visual Studio Community 2015 to play Tic-Tac-Toe. Sounds simple, not so much.
Anyway, I am using a function [bool playerCheck()] to make a switch for the function that checks whether the space that the user chooses is already taken. </p>
<pre><code>void checkInput()
{
if (playerCheck == true)
</code></pre>
<p>Visual Studio gives the squiggly lines under the "==" and gives the message </p>
<p>operand types are incompatible ("bool (*)()" and "bool").</p>
<p>Not sure how the syntax should be for comparing function output to a constant.</p>
| 0debug |
In R, get a subset of the data frame where the value in a column are contained in a list : <p>For instance, let's say I have a dataframe named <code>df</code> with a column <code>"ID"</code> of integers and I want to grab the subset of my dataframe in which the value in <code>"ID"</code> is in the vector <code>[123,198,204,245,87,91,921].</code></p>
<p>What would the syntax for this be in R?</p>
| 0debug |
Why doesn't this for loop in Python take ages? : <p>I am running this little loop on a Jupyter notebook</p>
<pre><code>import time
def time_loop(reps):
start = time.clock()
count = 0
for i in range(reps):
count += 1
return time.clock() - start
time_loop(10000^100)
</code></pre>
<p>No matter what I enter as an argument, I seem to always get an output around 0.003</p>
<pre><code>0.0031050000000050204
</code></pre>
<p>What is going on?</p>
<p>One guess is that python understands that the result of the loop will simply be count = reps, and quits the loop?</p>
<p>But if I run this instead</p>
<pre><code>import time
import numpy as np
def time_loop(reps):
start = time.clock()
count = 0
for i in range(reps):
count += np.sin(reps)
return time.clock() - start
time_loop(10000^100)
</code></pre>
<p>It does take longer as I increase the argument, even though the result of the loop is still quite simply count = reps*sin(reps).</p>
| 0debug |
Printing all the id names for a class in javascript : <p>I want print the Id of every element that has the class name "test". Right now nothing is printing. I would like this to print </p>
<pre><code>myAnchor
SecondId
</code></pre>
<p>I left my comments in there to show how an Id can be printed by accessing the Id name</p>
<p>This is my script</p>
<pre><code><!DOCTYPE html>
<html>
<body>
<p><a id="myAnchor" class="test" href="http://www.w3schools.com/">W3Schools</a></p>
<p><a id="SecondId" class="test" href="http://www.w3schools.com/">Second</a></p>
<p>Click the button to display the value of the id attribute of the link above.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
//var x = document.getElementById("myAnchor");
//document.getElementById("demo").innerHTML = x.id;
var x = document.getElementByClassName("test");
for(count = 0; count < x.length; count++){
document.getElementById("demo").innerHTML = x.id;
}
}
</script>
</body>
</html>
</code></pre>
| 0debug |
static int local_rename(FsContext *ctx, const char *oldpath,
const char *newpath)
{
char *tmp;
int err;
tmp = qemu_strdup(rpath(ctx, oldpath));
if (tmp == NULL) {
return -1;
}
err = rename(tmp, rpath(ctx, newpath));
if (err == -1) {
int serrno = errno;
qemu_free(tmp);
errno = serrno;
} else {
qemu_free(tmp);
}
return err;
}
| 1threat |
Bug in Bootstrap carousel when click on next and back : <p>I have integrated bootstrap carousel but when i click on next and prev it shows some bug. Can someone help me what am missing ?</p>
<p>here is the link of website <a href="http://logmak.justevent.in/" rel="nofollow noreferrer">http://logmak.justevent.in/</a> please check 4 product slider. </p>
| 0debug |
Any way (Best way) to alter user's IP address before passing query onto remote server : <p>We have a script running on a managed server (LAMP) that uses php/curl to post a user's query to a remote server and then display the results that are returned. What we would like to do is anonymize the users by passing our server IP to the remote server instead of the user IP. How can we implement this? Any suggestions will be appreciated and tried with no hard feelings or snide comments if it doesn't work. We're out of ideas. Thank you.</p>
| 0debug |
Change value of div while scrolling : <p>how could I change a position of a div, based on scroll level of my website? I have a landing screen (whole page fullscreen background) only with big centered logo. What I'm asking is, how to do that it'll scale down and catch into a navbar, where it'll be sticked, untill it would be scrolled up again.</p>
<p>I did a video showcase, how I mean it. <a href="https://www.youtube.com/watch?v=3fecyRsOkz8&feature=youtu.be" rel="nofollow">https://www.youtube.com/watch?v=3fecyRsOkz8&feature=youtu.be</a></p>
<p>I'm so glad for any help, have a nice day, senior coders! :)</p>
| 0debug |
static int decode_cblk(J2kDecoderContext *s, J2kCodingStyle *codsty, J2kT1Context *t1, J2kCblk *cblk,
int width, int height, int bandpos)
{
int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y, clnpass_cnt = 0;
int bpass_csty_symbol = J2K_CBLK_BYPASS & codsty->cblk_style;
int vert_causal_ctx_csty_symbol = J2K_CBLK_VSC & codsty->cblk_style;
for (y = 0; y < height+2; y++)
memset(t1->flags[y], 0, (width+2)*sizeof(int));
for (y = 0; y < height; y++)
memset(t1->data[y], 0, width*sizeof(int));
ff_mqc_initdec(&t1->mqc, cblk->data);
cblk->data[cblk->length] = 0xff;
cblk->data[cblk->length+1] = 0xff;
while(passno--){
switch(pass_t){
case 0: decode_sigpass(t1, width, height, bpno+1, bandpos,
bpass_csty_symbol && (clnpass_cnt >= 4), vert_causal_ctx_csty_symbol);
break;
case 1: decode_refpass(t1, width, height, bpno+1);
if (bpass_csty_symbol && clnpass_cnt >= 4)
ff_mqc_initdec(&t1->mqc, cblk->data);
break;
case 2: decode_clnpass(s, t1, width, height, bpno+1, bandpos,
codsty->cblk_style & J2K_CBLK_SEGSYM);
clnpass_cnt = clnpass_cnt + 1;
if (bpass_csty_symbol && clnpass_cnt >= 4)
ff_mqc_initdec(&t1->mqc, cblk->data);
break;
}
pass_t++;
if (pass_t == 3){
bpno--;
pass_t = 0;
}
}
return 0;
}
| 1threat |
Don't get compilation error when using three dots notation for parameters : <p>I want to generate CSV files. I have a <code>generateCSV</code> method which takes a filename as parameters and a bunch of entries</p>
<pre><code>private static void generateCSV(String pFilename, String... pColumns) {
try(FileWriter fileWriter = new FileWriter(pFilename,true)) {
for(String column : pColumns) {
fileWriter.append(column);
fileWriter.append(";");
}
fileWriter.append("\n");
fileWriter.flush();
}
catch (IOException e) {
e.printStackTrace();
}
}
</code></pre>
<p>When calling the method with <code>generateCSV("myfile.csv")</code> without the entries i don't get any compilation error. I thought that this notation implies passing 1-N parameters from this object type. No ?</p>
| 0debug |
Setter doesnt work : <p>Iam trying to make login activity
I got a problem. My setter doesnt work, i dont know why?
I have 3 classes.</p>
<p>1st one is Data with server data and getters and setters</p>
<pre><code>public class Data{
String addressesURL = "/DataSnap/rest/TServerMethods1/LookupCustomers";
String articlesURL = "/DataSnap/rest/TServerMethods1/LookupArticle";
String invoicesURL = "/DataSnap/rest/TServerMethods1/LookupInvoice";
String invoicesDetailsURL = "/DataSnap/rest/TServerMethods1/LookupInvoicePos";
String invoicesDetailsAddressesURL = "/DataSnap/rest/TServerMethods1/LookupInvoiceAddress";
String ordersURL = "/DataSnap/rest/TServerMethods1/LookupOrders";
String ordersDetailsURL = "/DataSnap/rest/TServerMethods1/LookupOrdersPos";
String ordersDetailsAddressesURL = "/DataSnap/rest/TServerMethods1/LookupOrdersAddress";
public String serverURL;
//String serverURL = "http://10.10.10.75:8081";
String username = "admin";
String password = "admin";
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getAddressesURL() {
return addressesURL;
}
public void setAddressesURL(String addressesURL) {
this.addressesURL = addressesURL;
}
public String getArticlesURL() {
return articlesURL;
}
public void setArticlesURL(String articlesURL) {
this.articlesURL = articlesURL;
}
public String getInvoicesURL() {
return invoicesURL;
}
public void setInvoicesURL(String invoicesURL) {
this.invoicesURL = invoicesURL;
}
public String getInvoicesDetailsURL() {
return invoicesDetailsURL;
}
public void setInvoicesDetailsURL(String invoicesDetailsURL) {
this.invoicesDetailsURL = invoicesDetailsURL;
}
public String getInvoicesDetailsAddressesURL() {
return invoicesDetailsAddressesURL;
}
public void setInvoicesDetailsAddressesURL(String invoicesDetailsAddressesURL) {
this.invoicesDetailsAddressesURL = invoicesDetailsAddressesURL;
}
public String getOrdersURL() {
return ordersURL;
}
public void setOrdersURL(String ordersURL) {
this.ordersURL = ordersURL;
}
public String getOrdersDetailsURL() {
return ordersDetailsURL;
}
public void setOrdersDetailsURL(String ordersDetailsURL) {
this.ordersDetailsURL = ordersDetailsURL;
}
public String getOrdersDetailsAddressesURL() {
return ordersDetailsAddressesURL;
}
public void setOrdersDetailsAddressesURL(String ordersDetailsAddressesURL) {
this.ordersDetailsAddressesURL = ordersDetailsAddressesURL;
}
public String getServerURL() {
return serverURL;
}
public void setServerURL(String serverURL) {
this.serverURL = serverURL;
}}
</code></pre>
<p>2nd one is where I start my login Activity</p>
<pre><code>public class Settings extends AppCompatActivity {
//declarations
//Edittext fields for username , server, password & port information
EditText edtIpurl, edtPort, edtUsername, edtPassword;
//Textviews that can be clicked
TextView databaseDel, databaseRef, magnumgmbh, contact, support;
//imagebuttons for bottom menu
ImageButton contacts, articles, invoices, orders;
//string for server URL
//String sURL = "http://";
Thread newSettingsThread;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
setTitle("Settings");
newSettingsThread = new Thread(){
public void run(){
runOnUiThread(new Runnable() {
@Override
public void run() {
String serverURL = "http://rest.magnumgmbh.de";
//edtIpurl = (EditText)findViewById(R.id.edtIpurl);
Data newD = new Data();
newD.setServerURL(serverURL);
}
});
}
};
newSettingsThread.start();
//start activitys if bottom buttons clicked
contacts = (ImageButton) findViewById(R.id.contacts);
//articles activity start
contacts.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//start activity addresses
Intent startAddresses = new Intent(Settings.this, Addresses.class);
startActivity(startAddresses);
}
});
}}
</code></pre>
<p>And the next one is where i try to get my new serverURL</p>
<pre><code>public class Address extends AppCompatActivity{
Thread newAddressThread;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_addresses);
//set activity name
setTitle("Addresses");
//new thread for network operations
newAddressesThread = new Thread() {
public void run() {
//make text from json
jsonText = new StringBuilder();
try {
String str;
Data newData = new Data();
//json dates url
String addressesURL = newData.getAddressesURL();
String serverUrl = newData.getServerURL();
String username = newData.getUsername();
String password = newData.getPassword();
URL url = new URL(serverUrl + addressesURL);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
//String encoded = Base64.encode("admin:admin");
String encoded = Base64.encodeToString((username+":"+password).getBytes("UTF-8"), Base64.NO_WRAP);
urlConnection.setRequestProperty("Authorization", "Basic " + encoded);
//check http status code
try {
int statusCode = urlConnection.getResponseCode();
System.out.println(statusCode);
} catch (IOException e) {
}
BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
while ((str = in.readLine()) != null) {
jsonText.append(str);
}
//cast stringbuilder to string
addressesJsonStr = jsonText.toString();
//close IOstream
in.close();
} catch (MalformedURLException e1) {
System.out.println(e1.getMessage());
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
};
//start thread
newAddressesThread.start();
}}
</code></pre>
<p>Hier in the third one by serverURL I got null and it thow me an exeption "<code>Protocol not found: null/DataSnap/rest/TServerMethods1/LookupCustomers</code>" so that is my problem.
What do I wrong?</p>
| 0debug |
static int packed_16bpc_bswap(SwsContext *c, const uint8_t *src[],
int srcStride[], int srcSliceY, int srcSliceH,
uint8_t *dst[], int dstStride[])
{
int i, j, p;
for (p = 0; p < 4; p++) {
int srcstr = srcStride[p] >> 1;
int dststr = dstStride[p] >> 1;
uint16_t *dstPtr = (uint16_t *) dst[p];
const uint16_t *srcPtr = (const uint16_t *) src[p];
int min_stride = FFMIN(srcstr, dststr);
if(!dstPtr || !srcPtr)
continue;
for (i = 0; i < (srcSliceH >> c->chrDstVSubSample); i++) {
for (j = 0; j < min_stride; j++) {
dstPtr[j] = av_bswap16(srcPtr[j]);
}
srcPtr += srcstr;
dstPtr += dststr;
}
}
return srcSliceH;
}
| 1threat |
Website posting and login : <p>How can I make website where the moderator will be able to publish a post or an image without accessing to the code. To publish something like a facebook status from some part of site. And second question, who can I make that someone can login to my site(moderator/administrator), I know how to make login form but just visualy withaout some functionality. Thanks
(I know HTML, CSS, JavaScript)</p>
| 0debug |
int64_t url_fseek(ByteIOContext *s, int64_t offset, int whence)
{
int64_t offset1;
int64_t pos;
int force = whence & AVSEEK_FORCE;
whence &= ~AVSEEK_FORCE;
if(!s)
return AVERROR(EINVAL);
pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
if (whence != SEEK_CUR && whence != SEEK_SET)
return AVERROR(EINVAL);
if (whence == SEEK_CUR) {
offset1 = pos + (s->buf_ptr - s->buffer);
if (offset == 0)
return offset1;
offset += offset1;
}
offset1 = offset - pos;
if (!s->must_flush &&
offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
s->buf_ptr = s->buffer + offset1;
} else if(s->is_streamed && !s->write_flag && offset1 >= 0 &&
(whence != SEEK_END || force)) {
while(s->pos < offset && !s->eof_reached)
fill_buffer(s);
if (s->eof_reached)
return AVERROR_EOF;
s->buf_ptr = s->buf_end + offset - s->pos;
} else {
int64_t res = AVERROR(EPIPE);
#if CONFIG_MUXERS || CONFIG_NETWORK
if (s->write_flag) {
flush_buffer(s);
s->must_flush = 1;
}
#endif
if (!s->seek || (res = s->seek(s->opaque, offset, SEEK_SET)) < 0)
return res;
if (!s->write_flag)
s->buf_end = s->buffer;
s->buf_ptr = s->buffer;
s->pos = offset;
}
s->eof_reached = 0;
return offset;
}
| 1threat |
Get complete UTC offset format in Golang : I need to get the UTC offset from a location. I am getting trouble with the inconsistency of the results from different values. All I need to get are of the format `+AB:CD`.
func main() {
loc, _:= time.LoadLocation("Asia/Kathmandu")
offset, others:= time.Now().In(loc).Zone()
fmt.Println(offset, others)
}
[Playground](https://play.golang.org/p/aVxflQ3Z9eU)
* "Asia/Kathmandu": `+0545`
* "Asia/Ho_Chi_Minh": `+07` but should be `+0700`
* "America/Phoenix": `MST` but should be `-0700`
* "Europe/Rome": `CET` but should be `+0100`
[Reference Timezone country names](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
Please help me.
| 0debug |
how to get output as "select * from employee" ,"select * from salaries","select * from student" and "select * from attendance" : <p>package array;</p>
<p>public class A {</p>
<pre><code>public static void main(String[] args) {
String[] arr = { "employee","salaries","student","attendance"};
for (String x : arr)
{
System.out.println(x);
}
}
</code></pre>
<p>}
//output:
employee
salaries
student
attendance</p>
| 0debug |
static int mpeg2_decode_block_non_intra(MpegEncContext *s,
DCTELEM *block,
int n)
{
int level, i, j, run;
int code;
RLTable *rl = &rl_mpeg1;
const UINT8 *scan_table;
const UINT16 *matrix;
int mismatch;
if (s->alternate_scan)
scan_table = ff_alternate_vertical_scan;
else
scan_table = zigzag_direct;
mismatch = 1;
{
int bit_cnt, v;
UINT32 bit_buf;
UINT8 *buf_ptr;
i = 0;
if (n < 4)
matrix = s->non_intra_matrix;
else
matrix = s->chroma_non_intra_matrix;
SAVE_BITS(&s->gb);
SHOW_BITS(&s->gb, v, 2);
if (v & 2) {
run = 0;
level = 1 - ((v & 1) << 1);
FLUSH_BITS(2);
RESTORE_BITS(&s->gb);
goto add_coef;
}
RESTORE_BITS(&s->gb);
}
for(;;) {
code = get_vlc(&s->gb, &rl->vlc);
if (code < 0)
return -1;
if (code == 112) {
break;
} else if (code == 111) {
run = get_bits(&s->gb, 6);
level = get_bits(&s->gb, 12);
level = (level << 20) >> 20;
} else {
run = rl->table_run[code];
level = rl->table_level[code];
if (get_bits1(&s->gb))
level = -level;
}
i += run;
if (i >= 64)
return -1;
add_coef:
j = scan_table[i];
dprintf("%d: run=%d level=%d\n", n, run, level);
if (level > 0) {
level = ((level * 2 + 1) * s->qscale * matrix[j]) >> 5;
} else {
level = ((-level * 2 + 1) * s->qscale * matrix[j]) >> 5;
level = -level;
}
mismatch ^= level;
block[j] = level;
i++;
}
block[63] ^= (mismatch & 1);
s->block_last_index[n] = i;
return 0;
}
| 1threat |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.