problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Problems with configuring Mtrg : Im trying to configure Mrtg on my Windows machine. im folowing the mrtg guide
<b>http://oss.oetiker.ch/mrtg/doc/mrtg-nt-guide.en.html.</b>
but i get this http://sv.tinypic.com/r/246w41d/9
ive trying to folow youtube video to, but i get the same fault. | 0debug |
vue-router : how to remove underline from router-link : <p>This results in an underlined link:</p>
<pre><code><li><router-link to="/hello">Hello</router-link></li>
</code></pre>
<p>My understanding is that the <code>router-link</code> element generates an <code>a</code> tag.</p>
<p>I've tried these things in the CSS:</p>
<pre><code>router-link{
text-decoration: none;
}
</code></pre>
<hr>
<pre><code>router-link a{
text-decoration: none;
}
</code></pre>
<hr>
<pre><code>router-link a{
text-decoration: none !important;
}
</code></pre>
<p>..but unfortunately none of these work.</p>
| 0debug |
how to apply css properties on a checkbox when clicked : What i want is to make checkbox look different when someone click it like changing their color, making texts bold or something else. I am confused whether i should use some function or their some predefined function or any other method.
I have gone through these questions
[css checkbox style for border color ](https://stackoverflow.com/questions/41757006/css-checkbox-style-for-border-color)
and
[How to change checkbox's border style in CSS?](https://stackoverflow.com/questions/2460501/how-to-change-checkboxs-border-style-in-css)
but couldnot find anything beautiful
I am new to stackoverflow and not aware about the rules and regulation so forgive if i do something wrong | 0debug |
static inline uint64_t inline_cvttq(CPUAlphaState *env, uint64_t a,
int roundmode, int VI)
{
uint64_t frac, ret = 0;
uint32_t exp, sign, exc = 0;
int shift;
sign = (a >> 63);
exp = (uint32_t)(a >> 52) & 0x7ff;
frac = a & 0xfffffffffffffull;
if (exp == 0) {
if (unlikely(frac != 0)) {
goto do_underflow;
}
} else if (exp == 0x7ff) {
exc = (frac ? FPCR_INV : VI ? FPCR_OVF : 0);
} else {
frac |= 0x10000000000000ull;
shift = exp - 1023 - 52;
if (shift >= 0) {
if (shift < 63) {
ret = frac << shift;
if (VI && (ret >> shift) != frac) {
exc = FPCR_OVF;
}
}
} else {
uint64_t round;
shift = -shift;
if (shift < 63) {
ret = frac >> shift;
round = frac << (64 - shift);
} else {
do_underflow:
round = 1;
}
if (round) {
exc = (VI ? FPCR_INE : 0);
switch (roundmode) {
case float_round_nearest_even:
if (round == (1ull << 63)) {
ret += (ret & 1);
} else if (round > (1ull << 63)) {
ret += 1;
}
break;
case float_round_to_zero:
break;
case float_round_up:
ret += 1 - sign;
break;
case float_round_down:
ret += sign;
break;
}
}
}
if (sign) {
ret = -ret;
}
}
env->error_code = exc;
return ret;
}
| 1threat |
static int hds_write_header(AVFormatContext *s)
{
HDSContext *c = s->priv_data;
int ret = 0, i;
AVOutputFormat *oformat;
mkdir(s->filename, 0777);
oformat = av_guess_format("flv", NULL, NULL);
if (!oformat) {
ret = AVERROR_MUXER_NOT_FOUND;
goto fail;
}
c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams);
if (!c->streams) {
ret = AVERROR(ENOMEM);
goto fail;
}
for (i = 0; i < s->nb_streams; i++) {
OutputStream *os = &c->streams[c->nb_streams];
AVFormatContext *ctx;
AVStream *st = s->streams[i];
if (!st->codec->bit_rate) {
av_log(s, AV_LOG_ERROR, "No bit rate set for stream %d\n", i);
ret = AVERROR(EINVAL);
goto fail;
}
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (os->has_video) {
c->nb_streams++;
os++;
}
os->has_video = 1;
} else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
if (os->has_audio) {
c->nb_streams++;
os++;
}
os->has_audio = 1;
} else {
av_log(s, AV_LOG_ERROR, "Unsupported stream type in stream %d\n", i);
ret = AVERROR(EINVAL);
goto fail;
}
os->bitrate += s->streams[i]->codec->bit_rate;
if (!os->ctx) {
os->first_stream = i;
ctx = avformat_alloc_context();
if (!ctx) {
ret = AVERROR(ENOMEM);
goto fail;
}
os->ctx = ctx;
ctx->oformat = oformat;
ctx->interrupt_callback = s->interrupt_callback;
ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf),
AVIO_FLAG_WRITE, os,
NULL, hds_write, NULL);
if (!ctx->pb) {
ret = AVERROR(ENOMEM);
goto fail;
}
} else {
ctx = os->ctx;
}
s->streams[i]->id = c->nb_streams;
if (!(st = avformat_new_stream(ctx, NULL))) {
ret = AVERROR(ENOMEM);
goto fail;
}
avcodec_copy_context(st->codec, s->streams[i]->codec);
st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
}
if (c->streams[c->nb_streams].ctx)
c->nb_streams++;
for (i = 0; i < c->nb_streams; i++) {
OutputStream *os = &c->streams[i];
int j;
if ((ret = avformat_write_header(os->ctx, NULL)) < 0) {
goto fail;
}
os->ctx_inited = 1;
avio_flush(os->ctx->pb);
for (j = 0; j < os->ctx->nb_streams; j++)
s->streams[os->first_stream + j]->time_base = os->ctx->streams[j]->time_base;
snprintf(os->temp_filename, sizeof(os->temp_filename),
"%s/stream%d_temp", s->filename, i);
init_file(s, os, 0);
if (!os->has_video && c->min_frag_duration <= 0) {
av_log(s, AV_LOG_WARNING,
"No video stream in output stream %d and no min frag duration set\n", i);
ret = AVERROR(EINVAL);
}
os->fragment_index = 1;
write_abst(s, os, 0);
}
ret = write_manifest(s, 0);
fail:
if (ret)
hds_free(s);
return ret;
}
| 1threat |
What is Difference between cp and ditto command on OSX? : <p>I want to know what is exact difference between cp and ditto command on OSX? </p>
<p>What are the main points that differentiate these two commands? </p>
| 0debug |
Request validation using serverless framework : <p>I am using serverless framework for the backend. How can I implement request validation? (do not want to write validation inside lambda functions). </p>
| 0debug |
Search an array of structs for a string variable : <p>consider:</p>
<pre><code>const int CAP = 20;
struct bookType
{
string bookTitle = "EMPTY";
string ISBN = "EMPTY";
string author = "EMPTY";
string publisher = "EMPTY";
string dateAdded = "EMPTY";
int qty = 0;
double wholesale = 0.00;
double retail = 0.00;
};bookType book[CAP];
</code></pre>
<p>What I need to do here is hopefully simple, though I can't seem to get a straight answer on it. I want to search this array of structs (book[]) for a matching bookTitle. for instance, if I have a book named "Star Wars" I need to be able to search the array of structs by typing in "star" and finding a book, "Star Wars". I've been searching for hours, but all the solutions I've found don't seem to actually work.</p>
| 0debug |
[Beginner]Inserting a function into main part - c++ : I'm a beginner and I have a little problem about calling a function into the main part of the program.
#include <iostream>
#include<cmath>
int getAbsProd(int a, int b)
{
cout<<"Insert integer: "<<endl;
cin>>a;
cout<<"Insert another integer: "<<endl;
cin>>b;
cout<<"The absolute value of the multiplication is: "<<abs(a*b)<<endl;
return abs(a*b);
}
int main()
{
cout<<getAbsProd();
return 0;
}
I'm using codeblocks, couldn't call <math.h>, somewhere it was suggested to call <cmath>, I'm just beginning to code, so go easy :)
| 0debug |
Simple python: palindrome function (returns true if palindrome, false if not palindrome) : <p>Good evening folks,</p>
<p>I'm working on an assignment for a course in Python. Our job is to write a function that returns True if the string it takes is a palindrome, otherwise it returns False. The following code reports False to the console for nonpalindromes, but does not report anything to the console when it is a palindrome. I hypothesize it's getting lost in either the recursive call or the second elif statement, but I really don't know where it's going wrong. Any help greatly appreciated :) Here's the code:</p>
<pre><code>def middle(word):
return word[1:-1]
def last(word):
return word[-1]
def first(word):
return word[0]
def isPalindrome(word):
if(len(word)<1):
print("You entered a blank word!")
elif(len(word)==1):
return True
elif(first(word)==last(word)):
if(middle(word)==''):
return True
isPalindrome(middle(word))
else:
return False
</code></pre>
| 0debug |
void ram_control_before_iterate(QEMUFile *f, uint64_t flags)
{
int ret = 0;
if (f->ops->before_ram_iterate) {
ret = f->ops->before_ram_iterate(f, f->opaque, flags);
if (ret < 0) {
qemu_file_set_error(f, ret);
}
}
}
| 1threat |
static void xenfb_mouse_event(void *opaque,
int dx, int dy, int dz, int button_state)
{
struct XenInput *xenfb = opaque;
DisplaySurface *surface = qemu_console_surface(xenfb->c.con);
int dw = surface_width(surface);
int dh = surface_height(surface);
int i;
trace_xenfb_mouse_event(opaque, dx, dy, dz, button_state,
xenfb->abs_pointer_wanted);
if (xenfb->abs_pointer_wanted)
xenfb_send_position(xenfb,
dx * (dw - 1) / 0x7fff,
dy * (dh - 1) / 0x7fff,
dz);
else
xenfb_send_motion(xenfb, dx, dy, dz);
for (i = 0 ; i < 8 ; i++) {
int lastDown = xenfb->button_state & (1 << i);
int down = button_state & (1 << i);
if (down == lastDown)
continue;
if (xenfb_send_key(xenfb, down, BTN_LEFT+i) < 0)
return;
}
xenfb->button_state = button_state;
}
| 1threat |
How to move files with firebase storage? : <p>Is there a way to move files with firebase.storage()?</p>
<p>Example:
user1/public/image.jpg to user1/private/image.jpg</p>
| 0debug |
def find_tuples(test_list, K):
res = [sub for sub in test_list if all(ele % K == 0 for ele in sub)]
return (str(res)) | 0debug |
How to check the value? : <p>Does anyone know how to set the condition in the IF loop for the value of NN010102, and to check only the last two digits? If 01 is to print something, or if 02 is to print something else.
Thank you.</p>
| 0debug |
PHP Error: Mysqli_real_query() expects exactly 2 parameters, 1 given (line 6) + mysqli_use_result() expects exactly 1 parameter, 3 given (line 7) : <p>I have a page from a website that I took over a few years back. I am a novice on php and are more into Wordpress. Now the page is starting having problems and I get the above errors in the given lines.<br>
This is the code: </p>
<pre><code>1. $db = mysqli_connect("localhost", "vrvtnl_data", "eric") or die
("fout1");
2. //mysqli_select_db("vrvtnl_data",$db) or die ("fout2");
3. function test($nummer,$week){
4. $sql = 'SELECT * FROM `vakantie` WHERE `tandarts` =' .
5. $nummer . '';
6. $result = mysqli_real_query($sql);
7. $test = mysqli_use_result($result, 0, "". $week ."");
8. return $test; }
</code></pre>
<p>Can somebody help me, as said I am a novice with php, so detailed help ia appreciated.</p>
| 0debug |
Android - Calling methods from notification action button : <p>I know that you can launch Activities from the action buttons using PendingIntents. How do you make it so that the a method gets called when the user clicks the notification action button?</p>
<pre><code>public static void createNotif(Context context){
...
drivingNotifBldr = (NotificationCompat.Builder) new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.steeringwheel)
.setContentTitle("NoTextZone")
.setContentText("Driving mode it ON!")
//Using this action button I would like to call logTest
.addAction(R.drawable.smallmanwalking, "Turn OFF driving mode", null)
.setOngoing(true);
...
}
public static void logTest(){
Log.d("Action Button", "Action Button Worked!");
}
</code></pre>
| 0debug |
void resume_all_vcpus(void)
{
}
| 1threat |
What's the point of encyption if there exist decryption? : Let's say in database user password is encypting in MD5 and it's no more readable by human, but i can copy MD5 hash and go to any website which provide MD5 decryption and get actually password. So I'am missing something ? | 0debug |
Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
unsigned long ram_size)
{
int i, n;
Exynos4210State *s = g_new(Exynos4210State, 1);
qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS];
unsigned long mem_size;
DeviceState *dev;
SysBusDevice *busdev;
ObjectClass *cpu_oc;
cpu_oc = cpu_class_by_name(TYPE_ARM_CPU, "cortex-a9");
assert(cpu_oc);
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
Object *cpuobj = object_new(object_class_get_name(cpu_oc));
Error *err = NULL;
if (object_property_find(cpuobj, "has_el3", NULL)) {
object_property_set_bool(cpuobj, false, "has_el3", &err);
if (err) {
error_report_err(err);
exit(1);
}
}
s->cpu[n] = ARM_CPU(cpuobj);
object_property_set_int(cpuobj, EXYNOS4210_SMP_PRIVATE_BASE_ADDR,
"reset-cbar", &error_abort);
object_property_set_bool(cpuobj, true, "realized", &err);
if (err) {
error_report_err(err);
exit(1);
}
}
s->irq_table = exynos4210_init_irq(&s->irqs);
for (i = 0; i < EXYNOS4210_NCPUS; i++) {
dev = qdev_create(NULL, "exynos4210.irq_gate");
qdev_prop_set_uint32(dev, "n_in", EXYNOS4210_IRQ_GATE_NINPUTS);
qdev_init_nofail(dev);
for (n = 0; n < EXYNOS4210_IRQ_GATE_NINPUTS; n++) {
gate_irq[i][n] = qdev_get_gpio_in(dev, n);
}
busdev = SYS_BUS_DEVICE(dev);
sysbus_connect_irq(busdev, 0,
qdev_get_gpio_in(DEVICE(s->cpu[i]), ARM_CPU_IRQ));
}
dev = qdev_create(NULL, "a9mpcore_priv");
qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS);
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(busdev, 0, EXYNOS4210_SMP_PRIVATE_BASE_ADDR);
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
sysbus_connect_irq(busdev, n, gate_irq[n][0]);
}
for (n = 0; n < EXYNOS4210_INT_GIC_NIRQ; n++) {
s->irqs.int_gic_irq[n] = qdev_get_gpio_in(dev, n);
}
sysbus_create_simple("l2x0", EXYNOS4210_L2X0_BASE_ADDR, NULL);
dev = qdev_create(NULL, "exynos4210.gic");
qdev_prop_set_uint32(dev, "num-cpu", EXYNOS4210_NCPUS);
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_GIC_CPU_BASE_ADDR);
sysbus_mmio_map(busdev, 1, EXYNOS4210_EXT_GIC_DIST_BASE_ADDR);
for (n = 0; n < EXYNOS4210_NCPUS; n++) {
sysbus_connect_irq(busdev, n, gate_irq[n][1]);
}
for (n = 0; n < EXYNOS4210_EXT_GIC_NIRQ; n++) {
s->irqs.ext_gic_irq[n] = qdev_get_gpio_in(dev, n);
}
dev = qdev_create(NULL, "exynos4210.combiner");
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) {
sysbus_connect_irq(busdev, n, s->irqs.int_gic_irq[n]);
}
exynos4210_combiner_get_gpioin(&s->irqs, dev, 0);
sysbus_mmio_map(busdev, 0, EXYNOS4210_INT_COMBINER_BASE_ADDR);
dev = qdev_create(NULL, "exynos4210.combiner");
qdev_prop_set_uint32(dev, "external", 1);
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
for (n = 0; n < EXYNOS4210_MAX_INT_COMBINER_OUT_IRQ; n++) {
sysbus_connect_irq(busdev, n, s->irqs.ext_gic_irq[n]);
}
exynos4210_combiner_get_gpioin(&s->irqs, dev, 1);
sysbus_mmio_map(busdev, 0, EXYNOS4210_EXT_COMBINER_BASE_ADDR);
exynos4210_init_board_irqs(&s->irqs);
memory_region_init_io(&s->chipid_mem, NULL, &exynos4210_chipid_and_omr_ops,
NULL, "exynos4210.chipid", sizeof(chipid_and_omr));
memory_region_add_subregion(system_mem, EXYNOS4210_CHIPID_ADDR,
&s->chipid_mem);
memory_region_init_ram(&s->irom_mem, NULL, "exynos4210.irom",
EXYNOS4210_IROM_SIZE, &error_abort);
vmstate_register_ram_global(&s->irom_mem);
memory_region_set_readonly(&s->irom_mem, true);
memory_region_add_subregion(system_mem, EXYNOS4210_IROM_BASE_ADDR,
&s->irom_mem);
memory_region_init_alias(&s->irom_alias_mem, NULL, "exynos4210.irom_alias",
&s->irom_mem,
0,
EXYNOS4210_IROM_SIZE);
memory_region_set_readonly(&s->irom_alias_mem, true);
memory_region_add_subregion(system_mem, EXYNOS4210_IROM_MIRROR_BASE_ADDR,
&s->irom_alias_mem);
memory_region_init_ram(&s->iram_mem, NULL, "exynos4210.iram",
EXYNOS4210_IRAM_SIZE, &error_abort);
vmstate_register_ram_global(&s->iram_mem);
memory_region_add_subregion(system_mem, EXYNOS4210_IRAM_BASE_ADDR,
&s->iram_mem);
mem_size = ram_size;
if (mem_size > EXYNOS4210_DRAM_MAX_SIZE) {
memory_region_init_ram(&s->dram1_mem, NULL, "exynos4210.dram1",
mem_size - EXYNOS4210_DRAM_MAX_SIZE, &error_abort);
vmstate_register_ram_global(&s->dram1_mem);
memory_region_add_subregion(system_mem, EXYNOS4210_DRAM1_BASE_ADDR,
&s->dram1_mem);
mem_size = EXYNOS4210_DRAM_MAX_SIZE;
}
memory_region_init_ram(&s->dram0_mem, NULL, "exynos4210.dram0", mem_size,
&error_abort);
vmstate_register_ram_global(&s->dram0_mem);
memory_region_add_subregion(system_mem, EXYNOS4210_DRAM0_BASE_ADDR,
&s->dram0_mem);
sysbus_create_simple("exynos4210.pmu", EXYNOS4210_PMU_BASE_ADDR, NULL);
sysbus_create_varargs("exynos4210.pwm", EXYNOS4210_PWM_BASE_ADDR,
s->irq_table[exynos4210_get_irq(22, 0)],
s->irq_table[exynos4210_get_irq(22, 1)],
s->irq_table[exynos4210_get_irq(22, 2)],
s->irq_table[exynos4210_get_irq(22, 3)],
s->irq_table[exynos4210_get_irq(22, 4)],
NULL);
sysbus_create_varargs("exynos4210.rtc", EXYNOS4210_RTC_BASE_ADDR,
s->irq_table[exynos4210_get_irq(23, 0)],
s->irq_table[exynos4210_get_irq(23, 1)],
NULL);
dev = qdev_create(NULL, "exynos4210.mct");
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
for (n = 0; n < 4; n++) {
sysbus_connect_irq(busdev, n,
s->irq_table[exynos4210_get_irq(1, 4 + n)]);
}
sysbus_connect_irq(busdev, 4,
s->irq_table[exynos4210_get_irq(51, 0)]);
sysbus_connect_irq(busdev, 5,
s->irq_table[exynos4210_get_irq(35, 3)]);
sysbus_mmio_map(busdev, 0, EXYNOS4210_MCT_BASE_ADDR);
for (n = 0; n < EXYNOS4210_I2C_NUMBER; n++) {
uint32_t addr = EXYNOS4210_I2C_BASE_ADDR + EXYNOS4210_I2C_SHIFT * n;
qemu_irq i2c_irq;
if (n < 8) {
i2c_irq = s->irq_table[exynos4210_get_irq(EXYNOS4210_I2C_INTG, n)];
} else {
i2c_irq = s->irq_table[exynos4210_get_irq(EXYNOS4210_HDMI_INTG, 1)];
}
dev = qdev_create(NULL, "exynos4210.i2c");
qdev_init_nofail(dev);
busdev = SYS_BUS_DEVICE(dev);
sysbus_connect_irq(busdev, 0, i2c_irq);
sysbus_mmio_map(busdev, 0, addr);
s->i2c_if[n] = (I2CBus *)qdev_get_child_bus(dev, "i2c");
}
exynos4210_uart_create(EXYNOS4210_UART0_BASE_ADDR,
EXYNOS4210_UART0_FIFO_SIZE, 0, NULL,
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 0)]);
exynos4210_uart_create(EXYNOS4210_UART1_BASE_ADDR,
EXYNOS4210_UART1_FIFO_SIZE, 1, NULL,
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 1)]);
exynos4210_uart_create(EXYNOS4210_UART2_BASE_ADDR,
EXYNOS4210_UART2_FIFO_SIZE, 2, NULL,
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 2)]);
exynos4210_uart_create(EXYNOS4210_UART3_BASE_ADDR,
EXYNOS4210_UART3_FIFO_SIZE, 3, NULL,
s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP, 3)]);
sysbus_create_varargs("exynos4210.fimd", EXYNOS4210_FIMD0_BASE_ADDR,
s->irq_table[exynos4210_get_irq(11, 0)],
s->irq_table[exynos4210_get_irq(11, 1)],
s->irq_table[exynos4210_get_irq(11, 2)],
NULL);
sysbus_create_simple(TYPE_EXYNOS4210_EHCI, EXYNOS4210_EHCI_BASE_ADDR,
s->irq_table[exynos4210_get_irq(28, 3)]);
return s;
}
| 1threat |
How can Multiprocessing be achieved by Programming Languages? : <p>I am trying to develop a simple Operating System. Till now all programs that I developed can be run in a single processor. But when I went through a concept called Multiprocessing Systems which almost all of the latest systems are based, I got lot of doubts.</p>
<p>First, How can I create a program which can run in Multiprocessor systems. Is it Hardware oriented or Programmer specific?</p>
<p>Second I went through Parallel Programming Languages which can be helpful in Multiprocessing Systems where Java is one but C is not. Then how can an OS developed in C(Windows) can achieve Multiprocessing?</p>
<p>Thanks.</p>
| 0debug |
Google maps won't work on my website despite good API key : <p>I had a website with google map, but few weeks ago google maps on my website stop working. I created google maps api key and entered it in my Joomla btgoogle maps module, but maps still won't work. What can be the problem?</p>
<p>URL Link: <a href="http://studiomob.rs/index.php/en/contact" rel="nofollow noreferrer">http://studiomob.rs/index.php/en/contact</a></p>
| 0debug |
Apache Airflow : airflow initdb throws ModuleNotFoundError: No module named 'werkzeug.wrappers.json'; 'werkzeug.wrappers' is not a package error : <p>On Ubuntu 18.04 with python 3.6.8, trying to install airflow. When I ran airflow initdb command, below error is thrown</p>
<pre><code>Traceback (most recent call last):
File "/home/uEnAFpip/.virtualenvs/airflow/bin/airflow", line 21, in <module>
from airflow import configuration
File "/home/uEnAFpip/.virtualenvs/airflow/lib/python3.6/site-packages/airflow/__init__.py", line 40, in <module>
from flask_admin import BaseView
File "/home/uEnAFpip/.virtualenvs/airflow/lib/python3.6/site-packages/flask_admin/__init__.py", line 6, in <module>
from .base import expose, expose_plugview, Admin, BaseView, AdminIndexView # noqa: F401
File "/home/uEnAFpip/.virtualenvs/airflow/lib/python3.6/site-packages/flask_admin/base.py", line 6, in <module>
from flask import Blueprint, current_app, render_template, abort, g, url_for
File "/home/uEnAFpip/.virtualenvs/airflow/lib/python3.6/site-packages/flask/__init__.py", line 20, in <module>
from .app import Flask
File "/home/uEnAFpip/.virtualenvs/airflow/lib/python3.6/site-packages/flask/app.py", line 69, in <module>
from .wrappers import Request
File "/home/uEnAFpip/.virtualenvs/airflow/lib/python3.6/site-packages/flask/wrappers.py", line 14, in <module>
from werkzeug.wrappers.json import JSONMixin as _JSONMixin
ModuleNotFoundError: No module named 'werkzeug.wrappers.json'; 'werkzeug.wrappers' is not a package
</code></pre>
<p>tried pip3 install --upgrade Flask</p>
| 0debug |
Trying to sort values in a key from a dictionary. : So. I have this problem. I have created a program (image [1]) that receives information of restaurant reservations, but I want to sort the reservations chronologically like this (image[2]). I just don't know how to sort it.
My code - so far [1] https://i.stack.imgur.com/NZoKd.png
The structure that I want my program to follow [2]
https://i.stack.imgur.com/sN0eb.png | 0debug |
add an element to an array of object : i have a class called "receipt" .. and one of the attributes is an array of object "item []items;" .. and i have method "addItem" with 3 parameter (string name , int quantity , double price) .. question is how i can add these parameters to the array items[] ?? and i have to check the quantity is more than 0 ..
whats the code?
is my question clear?
Hers is my code
public boolean addItem(String name, int quantity,double price){
if(quantity <= 0){
System.out.println("Item wasnt added");
return false;}
else{
item [nItem++];//here is the problem
}
}
| 0debug |
WordPress + WooCommerce : I installed WordPress yesterday. I want to try to change the navigation links however no menus are listed and when I create one it still does not change. Is there any way to fix this?
Thanks.
Ben J | 0debug |
Iptables setup on VPN client having LAN : <p>I am struggling with some problem, probably because there is simply not enough information on the web regarding some specifics I am trying to setup.</p>
<p>I have bought OpenVPN service via tun (routing).
I connect to the OpenVPN server through Raspberry PI (serving me as router), which has two interfaces - <code>eth0</code> for handling Internet connection and <code>wlan0</code> for my internal LAN.</p>
<p>My goal is to setup firewall in such way, that I can filter <code>tun</code>-ned income traffic and be able to reach web from LAN behind <code>wlan0</code>. Also - everything should go via VPN.</p>
<p>From the architectural point of view I think it should look like this:</p>
<ul>
<li><code>INPUT</code>, <code>FORWARD</code> - dropped,</li>
<li><code>OUTPUT</code> - allowed,</li>
<li><code>eth0</code> allows to flow only packets via default OpenVPN service port,</li>
<li><code>tun</code> adapter should have all INPUT-related policies applied and should be NAT-ted.</li>
</ul>
<p>What you think - is this correct thinking? I have managed so far to be able to ping from SSH-ed Raspberry PI into web, but yet no DNS - do I understand correctly that I should have own DNS forwarder? DHCP server is set on Raspberry PI.</p>
<p>Thanks!</p>
| 0debug |
xslt to read the message of specific pattern : I've below message in a variable .
7c {"code":3001,"message":"issued"} 0
I would like to take the message starting with '{' and ending with '}' using xslt. Tried using sub string and starts with functions .. can some one help.
My final out put should be
{"code":3001,"message":"issued"}
Thanks
| 0debug |
How to secure a php connect file with database passwords : <p>I want to know how to secure a php file that has the <strong><em>database connect</em></strong> passwords (info). </p>
<p>Currently I have just saved the file as <strong><em>connect.php</em></strong> because it is stored locally but now I need to upload the application and make it live. </p>
| 0debug |
How to sum date based dictionary values in python? : <p>I have the below dictionary format, I want to sum the dictionary values based on date.</p>
<pre><code>dict1 = [
{'date':"10-05-2017", 'cost':20},
{'date':"10-05-2017", 'cost':10},
{'date':"11-05-2017", 'cost':15},
{'date':"11-05-2017", 'cost':10},
{'date':"12-05-2017", 'cost':5}
]
</code></pre>
<p>Result:</p>
<pre><code>[
{'date':"10-05-2017", 'cost':30},
{'date':"11-05-2017", 'cost':25},
{'date':"12-05-2017", 'cost':5}
]
</code></pre>
| 0debug |
In MatLab how can i read multiple .m files from 5 different folders which are store in my main folder : I am bit new in MAT LAB and i need some help.
I have **one folder containing 5 different folders** ( *each has 10 .m files*) and i want to **load or read all files in Mat-Lab**. Can you give me some hint or some helpful info how can i do that ?
each **.m file contains 30000*6 matrix** and i also **need to store one column vector from each files** and save it **in one separate matrix**.
i need this matrix for PCA.
Any help will be appreciated. | 0debug |
Is there a way to force Bazel to run tests serially : <p>By default, Bazel runs tests in a parallel fashion to speed things up. However, I have a resource (GPU) that can't handle parallel jobs due to the GPU memory limit. Is there a way to force Bazel to run tests in a serial, i.e., non-parallel way? </p>
<p>Thanks.</p>
| 0debug |
static void get_sdr(IPMIBmcSim *ibs,
uint8_t *cmd, unsigned int cmd_len,
uint8_t *rsp, unsigned int *rsp_len,
unsigned int max_rsp_len)
{
unsigned int pos;
uint16_t nextrec;
struct ipmi_sdr_header *sdrh;
IPMI_CHECK_CMD_LEN(8);
if (cmd[6]) {
IPMI_CHECK_RESERVATION(2, ibs->sdr.reservation);
}
pos = 0;
if (sdr_find_entry(&ibs->sdr, cmd[4] | (cmd[5] << 8),
&pos, &nextrec)) {
rsp[2] = IPMI_CC_REQ_ENTRY_NOT_PRESENT;
return;
}
sdrh = (struct ipmi_sdr_header *) &ibs->sdr.sdr[pos];
if (cmd[6] > ipmi_sdr_length(sdrh)) {
rsp[2] = IPMI_CC_PARM_OUT_OF_RANGE;
return;
}
IPMI_ADD_RSP_DATA(nextrec & 0xff);
IPMI_ADD_RSP_DATA((nextrec >> 8) & 0xff);
if (cmd[7] == 0xff) {
cmd[7] = ipmi_sdr_length(sdrh) - cmd[6];
}
if ((cmd[7] + *rsp_len) > max_rsp_len) {
rsp[2] = IPMI_CC_CANNOT_RETURN_REQ_NUM_BYTES;
return;
}
memcpy(rsp + *rsp_len, ibs->sdr.sdr + pos + cmd[6], cmd[7]);
*rsp_len += cmd[7];
}
| 1threat |
Getting Crash When I use RGB in CGColor :
Im giving `RGB color` in `CGColor`.It is getting crashed in `shapeLayer.fillColor` and `shapeLayer.strokeColor`.
let circlePath = UIBezierPath(arcCenter: CGPoint(x: bounds.origin.x+60,y: bounds.origin.y+107), radius: CGFloat(6), startAngle: CGFloat(0), endAngle:CGFloat(7), clockwise: true)
let shapeLayer = CAShapeLayer()
shapeLayer.path = circlePath.cgPath
circlePath.lineCapStyle = .round
shapeLayer.fillColor = (UIColor(red: 57, green: 65, blue: 101, alpha: 1) as! CGColor)
shapeLayer.strokeColor = (UIColor(red: 57, green: 65, blue: 101, alpha: 1) as! CGColor)
shapeLayer.lineWidth = 3.0
self.layer.addSublayer(shapeLayer)
[If I write RGB code as `UIColor(red: 57, green: 65, blue: 101, alpha: 1)`,it give me warning to change to `(UIColor(red: 57, green: 65, blue: 101, alpha: 1) as! CGColor)`][1]
Can anyone give a solution to solve this?
[1]: https://i.stack.imgur.com/Te8Ks.png | 0debug |
static int64_t coroutine_fn bdrv_co_get_block_status_above(BlockDriverState *bs,
BlockDriverState *base,
int64_t sector_num,
int nb_sectors,
int *pnum,
BlockDriverState **file)
{
BlockDriverState *p;
int64_t ret = 0;
assert(bs != base);
for (p = bs; p != base; p = backing_bs(p)) {
ret = bdrv_co_get_block_status(p, sector_num, nb_sectors, pnum, file);
if (ret < 0 || ret & BDRV_BLOCK_ALLOCATED) {
break;
}
nb_sectors = MIN(nb_sectors, *pnum);
}
return ret;
}
| 1threat |
connection.query('SELECT * FROM users WHERE username = ' + input_string) | 1threat |
Hoe to know who is changing database data in mysql : Some changes made in my database which is in server how to know who changes the data and what changes they made ? | 0debug |
static void test_validate_fail_alternate(TestInputVisitorData *data,
const void *unused)
{
UserDefAlternate *tmp;
Visitor *v;
Error *err = NULL;
v = validate_test_init(data, "3.14");
visit_type_UserDefAlternate(v, NULL, &tmp, &err);
error_free_or_abort(&err);
g_assert(!tmp);
}
| 1threat |
How to add Chromedriver to PATH in linux? : <p>Trying to use Selenium with Chrome in a python script.</p>
<p>I get the following error:</p>
<pre><code>WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
</code></pre>
<p>I know the location of the chromedriver executable.
How do I add it to the PATH?</p>
<p>thank you</p>
| 0debug |
Can we turn off "chatty" in logcat? : <p>So I'm trying to find an elusive bug in a large codebase. As such, I've put a lot of logging into my app. I'm lucky enough to have multiple testers working on this. However, I've found that a lot of my logcat logs are missing. They're hidden as 'chatty'. For example</p>
<p><code>1799 12017 I logd: uid=10007 chatty comm=Binder_B, expire 4 lines</code></p>
<p>I've found some mention of using the adb command</p>
<p><code>adb logcat -p</code></p>
<p>but I can't find any documentation for the -p. I've also found that with a lot of devices (possibly all devices on Marshmallow) this is not supported.</p>
<p>Other than having the device plugged into Android Studio / Eclipse, is there a way to stop 'chatty' from hiding my logs?</p>
| 0debug |
C++ User defined sequence integers without using arrays : <p>I'm trying to figure this one out on my own and I can't.
The professor is asking for this.
User will define the length of the sequence.
User will then enter numbers from any range being both neg and pos.
The program:
Find the two largest numbers and display in descending order.
Find the two smallest numbers and display in ascending order.</p>
<p>Can't use sort or arrays.
I have an outline but, my head just wants to use arrays..... I don't see this simple without an array. Confused. I'm a beginner. I just want help. Advice? Tutor? </p>
| 0debug |
i can not edite WordPress home pege so place help me : I have just installed a WordPress site & all plugin install but unfortunately the home page of the site does not appear
my WordPress project home page images link http://prntscr.com/j1mrdq | 0debug |
Div overflow does not allign correct : How can I make the second line be one line and not broken up as it is now.
[![enter image description here][1]][1]
And look like this:
[![enter image description here][2]][2]
I tried to use the `display: table` and `table-cell` but it makes no difference.
I never seem to get along with CSS.
css:
<style>
.column1 {
float: left;
width: 10%;
font-size: 350%;
}
.column2 {
float: left;
width: 10%;
font-size: 350%;
}
.column3 {
float: left;
width: 80%;
font-size: 350%;
}
</style>
html:
<div class="row" display: table;>
<div class="column1" style="background-color:#ccc;" display: table-cell;>
<b>col1</b><br>
<div style="background-color:#FF0000;">32</div>
<div style="background-color:#00FF00;">33</div>
</div>
<div class="column2" style="background-color:#ccc;" display: table-cell;>
<b>col2</b><br>
<div style="background-color:#FF0000;">11:00</div>
<div style="background-color:#00FF00;">12:00</div>
</div>
<div class="column3" style="background-color:#ccc;" display: table-cell;>
<b>col3</b><br>
<div style="background-color:#FF0000;">This is some text That will overflow the div by a few words</div>
<div style="background-color:#00FF00;">Next line</div>
</div>
[1]: https://i.stack.imgur.com/kdj5z.png
[2]: https://i.stack.imgur.com/YCONT.png | 0debug |
Multiple .dockerignore files in same directory : <p>In the same directory I have two <code>Dockerfiles</code> and I would like to add a separate <code>.dockerignore</code> for each of them.</p>
<p>Currently, I have:</p>
<pre><code>Dockerfile.npm
Dockerfile.nginx
</code></pre>
<p>But can I have something like this?:</p>
<pre><code>.dockerignore.npm
.dockerignore.nginx
</code></pre>
| 0debug |
How do I set the Hibernate dialect in SpringBoot? : <p>I have a custom dialect to set for Hibernate in SpringBoot. The dialect is for Gemfire. The instructions (<a href="https://discuss.zendesk.com/hc/en-us/articles/201724017-Pivotal-GemFire-XD-Hibernate-Dialect" rel="noreferrer">https://discuss.zendesk.com/hc/en-us/articles/201724017-Pivotal-GemFire-XD-Hibernate-Dialect</a>) are for XML-based config. However, I am using SpringBoot and I cannot figure out how to set this property.</p>
<p>The dialect is "com.pivotal.gemfirexd.hibernate.GemFireXDDialect"</p>
| 0debug |
void tcg_gen_brcondi_i32(TCGCond cond, TCGv_i32 arg1, int32_t arg2, int label)
{
TCGv_i32 t0 = tcg_const_i32(arg2);
tcg_gen_brcond_i32(cond, arg1, t0, label);
tcg_temp_free_i32(t0);
}
| 1threat |
iOS Generic type for codable property in Swift : <p>I need to get a generic variable for a struct for parsing a JSON </p>
<p>but there is an error that I am getting
<strong>Type 'BaseJsonModel' does not conform to protocol 'Codable</strong></p>
<p>Below is my struct</p>
<pre><code> struct BaseJsonStruct<T>: Codable {
let info: String
let data: T
}
</code></pre>
<p>Error:- Type 'BaseJsonModel' does not conform to protocol 'Codable'</p>
| 0debug |
Simple python code repeating an else statement, and i don't know why : <p>So i am new to python and have just started creating a basic program with a menu system that i will add to, to help display my progress and knowledge on python within one file, and to help make me more comfortable with multiple functions, functions calling function etc....</p>
<p>My program is repeating an else statement after inputting the sting that would make the if statement correct.</p>
<p>Take a look:</p>
<pre><code>def menuReturn():
returnAns = input("Would you like to return to the menu? [y/n] ")
if returnAns.lower == "y":
print("Returning you to the menu")
print("")
print("")
print("")
menu()
elif returnAns.lower == "n":
print("Exiting...")
else:
print("Please repeat the answer")
menuReturn()
def askName():
name = input("What is your name? ")
print(name + "? Thats a beautiful name!")
menuReturn()
def menu(menuAnswer):
if menuAnswer.lower == "askname":
print("Good Choice!")
askName()
else:
print("Please try again")
menu(menuAnswer)
print("Welcome to the menu!")
print("")
print("Please enter a keyword from the following")
print("")
#Add items here!
print("-askName")
menuAnswer = input("")
menu(menuAnswer)
</code></pre>
<p>I had to add some unnecessary indentations for me to post this question, so sorry about that</p>
<p>Please give a simple answer, as my programming 'lingo' is not at full capacity</p>
<p>Hope to hear from you soon,
John Fletcher</p>
| 0debug |
static int flv_write_packet(AVFormatContext *s, int stream_index,
const uint8_t *buf, int size, int64_t timestamp)
{
ByteIOContext *pb = &s->pb;
AVCodecContext *enc = &s->streams[stream_index]->codec;
FLVContext *flv = s->priv_data;
if (enc->codec_type == CODEC_TYPE_VIDEO) {
FLVFrame *frame = av_malloc(sizeof(FLVFrame));
frame->next = 0;
frame->type = 9;
frame->flags = 2;
frame->flags |= enc->coded_frame->key_frame ? 0x10 : 0x20;
frame->timestamp = timestamp;
frame->size = size;
frame->data = av_malloc(size);
memcpy(frame->data,buf,size);
flv->hasVideo = 1;
InsertSorted(flv,frame);
flv->frameCount ++;
}
else if (enc->codec_type == CODEC_TYPE_AUDIO) {
#ifdef CONFIG_MP3LAME
if (enc->codec_id == CODEC_ID_MP3 ) {
int c=0;
for (;c<size;c++) {
flv->audioFifo[(flv->audioOutPos+c)%AUDIO_FIFO_SIZE] = buf[c];
}
flv->audioSize += size;
flv->audioOutPos += size;
flv->audioOutPos %= AUDIO_FIFO_SIZE;
if ( flv->initDelay == -1 ) {
flv->initDelay = timestamp;
}
if ( flv->audioTime == -1 ) {
flv->audioTime = timestamp;
}
}
for ( ; flv->audioSize >= 4 ; ) {
int mp3FrameSize = 0;
int mp3SampleRate = 0;
int mp3IsMono = 0;
int mp3SamplesPerFrame = 0;
if ( mp3info(&flv->audioFifo[flv->audioInPos],&mp3FrameSize,&mp3SamplesPerFrame,&mp3SampleRate,&mp3IsMono) ) {
if ( flv->audioSize >= mp3FrameSize ) {
int soundFormat = 0x22;
int c=0;
FLVFrame *frame = av_malloc(sizeof(FLVFrame));
flv->audioRate = mp3SampleRate;
switch (mp3SampleRate) {
case 44100:
soundFormat |= 0x0C;
break;
case 22050:
soundFormat |= 0x08;
break;
case 11025:
soundFormat |= 0x04;
break;
}
if ( !mp3IsMono ) {
soundFormat |= 0x01;
}
frame->next = 0;
frame->type = 8;
frame->flags = soundFormat;
frame->timestamp = flv->audioTime;
frame->size = mp3FrameSize;
frame->data = av_malloc(mp3FrameSize);
for (;c<mp3FrameSize;c++) {
frame->data[c] = flv->audioFifo[(flv->audioInPos+c)%AUDIO_FIFO_SIZE];
}
flv->audioInPos += mp3FrameSize;
flv->audioSize -= mp3FrameSize;
flv->audioInPos %= AUDIO_FIFO_SIZE;
flv->sampleCount += mp3SamplesPerFrame;
flv->audioTime = -1;
flv->hasAudio = 1;
InsertSorted(flv,frame);
}
break;
}
flv->audioInPos ++;
flv->audioSize --;
flv->audioInPos %= AUDIO_FIFO_SIZE;
flv->audioTime = -1;
}
#endif
}
Dump(flv,pb,128);
put_flush_packet(pb);
return 0;
}
| 1threat |
How to remove first character from string without using any function in PHP? : <p>Suppose it's my string "Hi, you are goood developer". How can i remove first character without using any php function.</p>
| 0debug |
OpenGL/C++ How to get cross point from perpendicular line (B->A) and (middleBC->C) : I can not put questions in one line also here they are:
How to draw a curve which is part of the circle(depending on the end point)
Let:
- A=(Ax,Ay) be the first point (A)
- B=(Bx,By) be the second point (B)
- C=(Cx,Cy) be the end point (mouse location) (C)
- MBC(MBCx, MBC.y) are middle between B and C
- p2 and p2 are line AB
- p4 and p3 are line CD
Question:
- How to get cross(Mx,My) point from perpendicular line (B->A) and (middleBC->C)
-[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/z7cYS.png
Any ideas how to code it?
This question is relatet to [this](http://stackoverflow.com/questions/39274174/opengl-how-to-draw-curves-being-part-of-circle-depends-of-last-point-location-wi) topic | 0debug |
How to get field value in Java reflection : <p>I have following field in a class:</p>
<pre><code>private String str = "xyz";
</code></pre>
<p>How do I get the value <code>xyz</code> using the field name <em>only</em> i.e. </p>
<p>I know the name of the field is <code>str</code> and then get the assigned value. Something like:</p>
<pre><code>this.getClass().getDeclaredField("str").getValue();
</code></pre>
<p>Currently the Reflection API has <code>field.get(object)</code>.</p>
| 0debug |
static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
{
HLSContext *hls = s->priv_data;
AVFormatContext *oc = NULL;
AVStream *st = s->streams[pkt->stream_index];
int64_t end_pts = hls->recording_time * hls->number;
int is_ref_pkt = 1;
int ret, can_split = 1;
int stream_index = 0;
if (hls->sequence - hls->nb_entries > hls->start_sequence && hls->init_time > 0) {
int init_list_dur = hls->init_time * hls->nb_entries * AV_TIME_BASE;
int after_init_list_dur = (hls->sequence - hls->nb_entries ) * hls->time * AV_TIME_BASE;
hls->recording_time = hls->time * AV_TIME_BASE;
end_pts = init_list_dur + after_init_list_dur ;
}
if( st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE ) {
oc = hls->vtt_avf;
stream_index = 0;
} else {
oc = hls->avf;
stream_index = pkt->stream_index;
}
if (hls->start_pts == AV_NOPTS_VALUE) {
hls->start_pts = pkt->pts;
hls->end_pts = pkt->pts;
}
if (hls->has_video) {
can_split = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO &&
((pkt->flags & AV_PKT_FLAG_KEY) || (hls->flags & HLS_SPLIT_BY_TIME));
is_ref_pkt = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO;
}
if (pkt->pts == AV_NOPTS_VALUE)
is_ref_pkt = can_split = 0;
if (is_ref_pkt) {
if (hls->new_start) {
hls->new_start = 0;
hls->duration = (double)(pkt->pts - hls->end_pts)
* st->time_base.num / st->time_base.den;
hls->dpp = (double)(pkt->duration) * st->time_base.num / st->time_base.den;
} else {
hls->duration += (double)(pkt->duration) * st->time_base.num / st->time_base.den;
}
}
if (can_split && av_compare_ts(pkt->pts - hls->start_pts, st->time_base,
end_pts, AV_TIME_BASE_Q) >= 0) {
int64_t new_start_pos;
char *old_filename = av_strdup(hls->avf->filename);
if (!old_filename) {
return AVERROR(ENOMEM);
}
av_write_frame(oc, NULL);
new_start_pos = avio_tell(hls->avf->pb);
hls->size = new_start_pos - hls->start_pos;
ff_format_io_close(s, &oc->pb);
if (hls->vtt_avf) {
ff_format_io_close(s, &hls->vtt_avf->pb);
}
if ((hls->flags & HLS_TEMP_FILE) && oc->filename[0]) {
if (!(hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size <= 0))
if (hls->avf->oformat->priv_class && hls->avf->priv_data)
av_opt_set(hls->avf->priv_data, "mpegts_flags", "resend_headers", 0);
hls_rename_temp_file(s, oc);
}
ret = hls_append_segment(s, hls, hls->duration, hls->start_pos, hls->size);
hls->start_pos = new_start_pos;
if (ret < 0) {
av_free(old_filename);
return ret;
}
hls->end_pts = pkt->pts;
hls->duration = 0;
if (hls->flags & HLS_SINGLE_FILE) {
hls->number++;
} else if (hls->max_seg_size > 0) {
if (hls->start_pos >= hls->max_seg_size) {
hls->sequence++;
sls_flag_file_rename(hls, old_filename);
ret = hls_start(s);
hls->start_pos = 0;
hls->number--;
}
hls->number++;
} else {
sls_flag_file_rename(hls, old_filename);
ret = hls_start(s);
}
if (ret < 0) {
av_free(old_filename);
return ret;
}
if ((ret = hls_window(s, 0)) < 0) {
av_free(old_filename);
return ret;
}
}
ret = ff_write_chained(oc, stream_index, pkt, s, 0);
return ret;
}
| 1threat |
static void armv7m_nvic_reset(DeviceState *dev)
{
nvic_state *s = NVIC(dev);
NVICClass *nc = NVIC_GET_CLASS(s);
nc->parent_reset(dev);
s->gic.cpu_enabled[0] = true;
s->gic.priority_mask[0] = 0x100;
s->gic.enabled = true;
systick_reset(s);
}
| 1threat |
bool is_tcg_gen_code(uintptr_t tc_ptr)
{
return (tc_ptr >= (uintptr_t)tcg_ctx.code_gen_buffer &&
tc_ptr < (uintptr_t)(tcg_ctx.code_gen_buffer +
tcg_ctx.code_gen_buffer_max_size));
}
| 1threat |
Open a custom url when clicking on a web push notification : <p>I am implementing the <a href="https://github.com/zaru/webpush" rel="noreferrer">Webpush ruby gem</a> to send push notifications to users of my website. </p>
<p>Server code:</p>
<pre><code> Webpush.payload_send({
message: notification.message,
url: notification.url, # I can't figure out how to access this key
id: notification.id, # or this key from the service worker
endpoint: endpoint,
p256dh: p256dh_key,
vapid: vapid_keys,
ttl: 24 * 60 * 60,
auth: auth_key,
})
</code></pre>
<p>I have a service worker set up on the client side to show the notification and make it clickable.</p>
<pre><code>self.addEventListener("push", function (event) {
var title = (event.data && event.data.text()) || "New Message";
event.waitUntil(
self.registration.showNotification(title, {
body: "New push notification",
icon: "/images/logo@2x.png",
tag: "push-notification-tag",
data: {
url: event.data.url, // This is returning null
id: event.data.id // And this is returning null
}
})
)
});
self.addEventListener('notificationclick', function(event) {
event.notification.close();
event.waitUntil(
clients.openWindow(event.data.url + "?notification_id=" + event.data.id)
);
})
</code></pre>
<p>It is all working fine, except the custom keys (<code>url</code>, <code>id</code>) that I am passing through are not accessible from within the service worker.</p>
<p>Does anyone know how to pass custom data through the WebPush gem?</p>
| 0debug |
PHP iterable to array or Traversable : <p>I'm quite happy that PHP 7.1 introduced <a href="https://secure.php.net/manual/en/language.types.iterable.php" rel="noreferrer">the iterable pseudo-type</a>.</p>
<p>Now while this is great when just looping over a parameter of this type, it is unclear to me what to do when you need to pass it to PHP functions that accept just an <code>array</code> or just a <code>Traversable</code>. For instance, if you want to do an array_diff, and your <code>iterable</code> is a <code>Traversable</code>, you will get an <code>array</code>. Conversely, if you call a function that takes an Iterator, you will get an error if the <code>iterable</code> is an <code>array</code>.</p>
<p>Is there something like <code>iterable_to_array</code> (NOT: <code>iterator_to_array</code>) and <code>iterable_to_traversable</code>?</p>
<p>I'm looking for a solution that avoids conditionals in my functions just to take care of this difference, and that does not depend on me defining my own global functions.</p>
<p>Using PHP 7.1</p>
| 0debug |
how to add string message when the condition is true : double score = 16;
String grade = (score <= 100 && score >= 85) ? "Excellent"
: (score >= 75 && score < 85) ? "Very Good"
: (score >= 65 && score < 75) ? "Good"
: (score >= 50 && score < 65) ? "pass"
: (score > 0 && score < 50) ? "Fail" : "Enter Valid Number !";
System.out.println(">>>"+grade);
I need to print => Your Grade Is : (message) if the score is true but when it's getting false I want to print => Enter Valid Number
NOTE::
I don't want to repeat this message => (Your Grade Is) in the code :D | 0debug |
static int get_phys_addr_v6(CPUARMState *env, uint32_t address, int access_type,
int is_user, hwaddr *phys_ptr,
int *prot, target_ulong *page_size)
{
CPUState *cs = ENV_GET_CPU(env);
int code;
uint32_t table;
uint32_t desc;
uint32_t xn;
uint32_t pxn = 0;
int type;
int ap;
int domain = 0;
int domain_prot;
hwaddr phys_addr;
table = get_level1_table_address(env, address);
desc = ldl_phys(cs->as, table);
type = (desc & 3);
if (type == 0 || (type == 3 && !arm_feature(env, ARM_FEATURE_PXN))) {
code = 5;
goto do_fault;
}
if ((type == 1) || !(desc & (1 << 18))) {
domain = (desc >> 5) & 0x0f;
}
domain_prot = (env->cp15.c3 >> (domain * 2)) & 3;
if (domain_prot == 0 || domain_prot == 2) {
if (type != 1) {
code = 9;
} else {
code = 11;
}
goto do_fault;
}
if (type != 1) {
if (desc & (1 << 18)) {
phys_addr = (desc & 0xff000000) | (address & 0x00ffffff);
*page_size = 0x1000000;
} else {
phys_addr = (desc & 0xfff00000) | (address & 0x000fffff);
*page_size = 0x100000;
}
ap = ((desc >> 10) & 3) | ((desc >> 13) & 4);
xn = desc & (1 << 4);
pxn = desc & 1;
code = 13;
} else {
if (arm_feature(env, ARM_FEATURE_PXN)) {
pxn = (desc >> 2) & 1;
}
table = (desc & 0xfffffc00) | ((address >> 10) & 0x3fc);
desc = ldl_phys(cs->as, table);
ap = ((desc >> 4) & 3) | ((desc >> 7) & 4);
switch (desc & 3) {
case 0:
code = 7;
goto do_fault;
case 1:
phys_addr = (desc & 0xffff0000) | (address & 0xffff);
xn = desc & (1 << 15);
*page_size = 0x10000;
break;
case 2: case 3:
phys_addr = (desc & 0xfffff000) | (address & 0xfff);
xn = desc & 1;
*page_size = 0x1000;
break;
default:
abort();
}
code = 15;
}
if (domain_prot == 3) {
*prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
} else {
if (pxn && !is_user) {
xn = 1;
}
if (xn && access_type == 2)
goto do_fault;
if ((env->cp15.c1_sys & (1 << 29)) && (ap & 1) == 0) {
code = (code == 15) ? 6 : 3;
goto do_fault;
}
*prot = check_ap(env, ap, domain_prot, access_type, is_user);
if (!*prot) {
goto do_fault;
}
if (!xn) {
*prot |= PAGE_EXEC;
}
}
*phys_ptr = phys_addr;
return 0;
do_fault:
return code | (domain << 4);
}
| 1threat |
static void simple_whitespace(void)
{
int i;
struct {
const char *encoded;
LiteralQObject decoded;
} test_cases[] = {
{
.encoded = " [ 43 , 42 ]",
.decoded = QLIT_QLIST(((LiteralQObject[]){
QLIT_QINT(43),
QLIT_QINT(42),
{ }
})),
},
{
.encoded = " [ 43 , { 'h' : 'b' }, [ ], 42 ]",
.decoded = QLIT_QLIST(((LiteralQObject[]){
QLIT_QINT(43),
QLIT_QDICT(((LiteralQDictEntry[]){
{ "h", QLIT_QSTR("b") },
{ }})),
QLIT_QLIST(((LiteralQObject[]){
{ }})),
QLIT_QINT(42),
{ }
})),
},
{
.encoded = " [ 43 , { 'h' : 'b' , 'a' : 32 }, [ ], 42 ]",
.decoded = QLIT_QLIST(((LiteralQObject[]){
QLIT_QINT(43),
QLIT_QDICT(((LiteralQDictEntry[]){
{ "h", QLIT_QSTR("b") },
{ "a", QLIT_QINT(32) },
{ }})),
QLIT_QLIST(((LiteralQObject[]){
{ }})),
QLIT_QINT(42),
{ }
})),
},
{ }
};
for (i = 0; test_cases[i].encoded; i++) {
QObject *obj;
QString *str;
obj = qobject_from_json(test_cases[i].encoded);
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QLIST);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
str = qobject_to_json(obj);
qobject_decref(obj);
obj = qobject_from_json(qstring_get_str(str));
g_assert(obj != NULL);
g_assert(qobject_type(obj) == QTYPE_QLIST);
g_assert(compare_litqobj_to_qobj(&test_cases[i].decoded, obj) == 1);
qobject_decref(obj);
QDECREF(str);
}
}
| 1threat |
Can this be done in Excel? : I want a list of products and their prices like so:
D E
---------------
1 product | price
---------------
2 hat | 2.00
---------------
I'd like this list (and other like it) to be in their own tabs. I want my main tab to be able to pull the product name from a drop down list in one cell but auto-populate the price in another cell like this:
1 | hat | 2.00 (this is automatically populated when I choose hat)
I would also like more properties of the hat populated besides just price. I realize this is probably more for something like Access but I'd really like to do it in Excel.
| 0debug |
static int parse_key(DBEContext *s)
{
int key = 0;
if (s->key_present && s->input_size > 0)
key = AV_RB24(s->input) >> 24 - s->word_bits;
skip_input(s, s->key_present);
return key;
}
| 1threat |
C vs C++ sizeof : <p>I just came across this simple code snippet and am wondering why output of this program when it's compiled by a C compiler is <code>4</code> and when it's compiled by a C++ one is <code>8</code>.</p>
<pre><code>#include <stdio.h>
int x;
int main(){
struct x {int a; int b;};
printf("%d", sizeof(x));
return 0;
}
</code></pre>
<p>C++ output is rational (<code>8 = 4 + 4 = sizeof(x.a) + sizeof(x.b)</code>), but output of C isn't. So, how does <code>sizeof</code> work in C?</p>
<ul>
<li>C : <a href="https://ideone.com/zj5Qd2">https://ideone.com/zj5Qd2</a></li>
<li>C++ : <a href="https://ideone.com/ZZ4v6S">https://ideone.com/ZZ4v6S</a></li>
</ul>
<p>Seems C prefers global variables over local ones. Is it right?</p>
| 0debug |
Cannot login to Docker account : <pre><code>OS: Ubuntu 18.04 Server
Docker 18.3 CE
</code></pre>
<p>I am logged onto the server, from my Windows 10 laptop, using a PuTTY SSH session.</p>
<p>I don't have Docker on my local Windows laptop, so all the work is done on the remote server.</p>
<p>I can execute all Docker commands, on the remote server, using the terminal session.</p>
<p>However, when I try to save my image to the Docker hub, when I try to login, using:</p>
<pre><code>docker login
</code></pre>
<p>I get the following error message:</p>
<pre><code>error getting credentials - err: exit status 1, out: `GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.secrets was not provided by any .service files`
</code></pre>
<p>I did not get any error messages, when I created my image on the remote server.</p>
<p>I also do not see a .docker folder in the related home directory on the remote server. Any ideas?</p>
| 0debug |
Need help reading from a file(.dat) doing calculations then outputting into a new file : I need to make a program that reads the marks.dat file, outputs that file onto the screen,
marks.dat
23468555 88 55 67
55223344 45 90 78
32321111 67 89 73
77001234 79 59 99
21324354 62 84 88
40450765 34 45 56
26726826 93 69 71
30917823 57 65 80
54277888 87 77 55
The 8-digit number represents the student number and the following 3 2-digit numbers represent the assignment marks, calculate the average of the 3 that contributes 40% of the year mark, find the highest mark that contributes 60% of the year mark, then output the student number, followed by the average, followed by the year mark, i.e
yearmark.dat
23468555 70.00 80.80
The average and year mark should be of type *double* and display only 2 digits after the decimal, then output to the file and display the contents on the screen.
The problem I have is that trying to output the *double* of the 8-digit number outputs 234686e+007, however if its *int*, it then outputs correctly.
Would also like to see how you would tackle this problem, would you try create an array to insert the contents of the file, was thinking 2-d, first student number then the marks in the second dimension. Any advice or help will be appreciated | 0debug |
Python3 - How to randomly organize items in an array : <p>let's suppose I have an array</p>
<p>array = [A, B, C, D, E]<br>
how can I randomize the order of the items in this array and put everything together into a string variable to print it.</p>
<p>Example of output:
CABDE</p>
| 0debug |
Integer Division in Negative Numbers in Python : <p>I'm testing big integers in Python; they are implemented as an object with sign and an array of digits. It's, basically, to describe Karatsuba Multiplication, and, for those big integers, I need the same behaviour like oridinary numbers with integer division by <code>10</code>, and, there is a problem:<br>
Why, in Python, <code>-22 // 10 = -3</code>?</p>
| 0debug |
How to make React Native mobile application faster? : <p>React Native mobile <strong>application is working very slow on every click</strong>.
I am using react native <code>v0.40.0</code> and following are the dependencies of my project.</p>
<pre><code>{
"analytics-react-native": "^1.1.0",
"apisauce": "^0.7.0",
"babel-preset-es2015": "^6.18.0",
"es6-promise": "^4.0.5",
"flow-bin": "^0.36.0",
"geolib": "^2.0.22",
"immutable": "^3.8.1",
"intl": "^1.2.5",
"isomorphic-fetch": "^2.2.1",
"lodash": "^4.17.4",
"lodash.range": "^3.2.0",
"prop-types": "^15.5.10",
"raven-js": "^3.13.1",
"react": "^15.4.2",
"react-native": "^0.40.0",
"react-native-apple-healthkit-rn0.40": "^0.3.2",
"react-native-blur": "^2.0.0",
"react-native-button": "^1.7.1",
"react-native-checkbox": "^2.0.0",
"react-native-code-push": "^1.17.3-beta",
"react-native-datepicker": "^1.4.4",
"react-native-device-info": "^0.10.1",
"react-native-easy-toast": "^1.0.6",
"react-native-fbsdk": "^0.5.0",
"react-native-geocoder": "^0.4.5",
"react-native-gifted-chat": "^0.1.3",
"react-native-global-props": "^1.1.1",
"react-native-image-crop-picker": "^0.15.1",
"react-native-image-picker": "^0.25.1",
"react-native-image-slider": "^1.1.5",
"react-native-keyboard-aware-scroll-view": "^0.2.7",
"react-native-maps": "0.15.2",
"react-native-modal-dropdown": "^0.4.4",
"react-native-popup-menu": "^0.7.2",
"react-native-push-notification": "^2.2.1",
"react-native-radio-buttons": "^0.14.0",
"react-native-router-flux": "3.38.0",
"react-native-segmented-android": "^1.0.4",
"react-native-snap-carousel": "2.1.4",
"react-native-stars": "^1.1.0",
"react-native-swipeout": "^2.2.2",
"react-native-swiper": "^1.5.4",
"react-native-tableview-simple": "0.16.5",
"react-native-vector-icons": "^4.0.0",
"react-native-video": "^1.0.0",
"react-native-zendesk-chat": "^0.2.1",
"react-redux": "^4.4.6",
"recompose": "^0.20.2",
"redux": "^3.5.2",
"redux-thunk": "^2.0.1"
}
</code></pre>
<p>I did profiling with stacktrace in android studios, and found that mqt_js is one of the reason which takes more time on every UI clicks. You can check stacktrace report <a href="https://ufile.io/88yfh" rel="noreferrer">here</a> </p>
<p>Can anybody help me in solving this performance issue.?</p>
| 0debug |
ImportError: cannot import name 'structural_similarity' error : <p>In my image comparision code following: <a href="https://www.pyimagesearch.com/2014/09/15/python-compare-two-images/" rel="noreferrer">https://www.pyimagesearch.com/2014/09/15/python-compare-two-images/</a></p>
<p>While using
<code>from skimage.measure import structural_similarity as ssim</code></p>
<p>and then
<code>s = ssim(imageA, imageB)</code></p>
<p>I am getting error: </p>
<blockquote>
<pre><code>from skimage.measure import structural_similarity as ssim
</code></pre>
<p>ImportError: cannot import name 'structural_similarity'</p>
</blockquote>
| 0debug |
LDAP Sort with ordering rule fails : <p>I am trying to make an ldap query against AD LDS to get users sorted on the cn attribute. The sort ordering rule should not be the default English, but it should order according to Swedish. I am doing this with System.DirectoryServices.Protocols API in .Net.</p>
<p>To reproduce I have installed an AD LDS instance listening on port 389, and installed user object class.</p>
<p>The following code is used (base is copied from <a href="https://msdn.microsoft.com/en-us/library/bb332056.aspx?f=255&MSPPError=-2147217396#sdspintro_topic5_simplesearch" rel="noreferrer">Performing a Simple Search</a> ). Ordering rule has been taken from <a href="https://msdn.microsoft.com/en-us/library/cc223325.aspx" rel="noreferrer">here</a>.</p>
<pre><code>public class LdapSorter
{
public void SearchUsersSorted()
{
string hostOrDomainName = "localhost";
string targetOu = "cn=Test";
// create a search filter to find all objects
string ldapSearchFilter = "(objectClass=user)";
// establish a connection to the directory
LdapConnection connection = new LdapConnection(hostOrDomainName);
connection.SessionOptions.ProtocolVersion = 3;
Console.WriteLine("\r\nPerforming a simple search ...");
try
{
SearchRequest searchRequest = new SearchRequest
(targetOu,
ldapSearchFilter,
SearchScope.OneLevel,
null);
searchRequest.Controls.Add(new SortRequestControl("cn", "1.2.840.113556.1.4.1594", false));
//searchRequest.Controls.Add(new SortRequestControl("cn", false));
//searchRequest.Controls.Add(new SortRequestControl("cn", true));
// cast the returned directory response as a SearchResponse object
SearchResponse searchResponse =
(SearchResponse)connection.SendRequest(searchRequest);
Console.WriteLine("\r\nSearch Response Entries:{0}",
searchResponse.Entries.Count);
// enumerate the entries in the search response
foreach (SearchResultEntry entry in searchResponse.Entries)
{
Console.WriteLine("{0}:{1}",
searchResponse.Entries.IndexOf(entry),
entry.DistinguishedName);
}
}
catch (DirectoryOperationException e)
{
Console.WriteLine("\nUnexpected exception occured:\n\t{0}\n{1}",
e, e.Response.ErrorMessage);
var control = e.Response.Controls.First(c => c is SortResponseControl) as SortResponseControl;
if (control != null)
{
Console.WriteLine("\nControl result: " + control.Result);
}
}
}
}
</code></pre>
<p>This is the output:</p>
<pre><code>Performing a simple search ...
Unexpected exception occured:
System.DirectoryServices.Protocols.DirectoryOperationException: The server does not support the control. The control is critical.
at System.DirectoryServices.Protocols.LdapConnection.ConstructResponse(Int32 messageId, LdapOperation operation, ResultAll resultType, TimeSpan requestTimeOut, Boolean exceptionOnTimeOut)
at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request, TimeSpan requestTimeout)
at System.DirectoryServices.Protocols.LdapConnection.SendRequest(DirectoryRequest request)
at Sort.LdapSorter.SearchUsersSorted() in C:\Source\slask\DotNetSlask\Sort\LdapSorter.cs:line 41
00000057: LdapErr: DSID-0C090A3D, comment: Error processing control, data 0, v3839
Control result: InappropriateMatching
</code></pre>
<p>If using one of the two sort request controls that are commented out instead, then it works, but with English sort order.</p>
| 0debug |
Why is strcmp not returning 0 : <p>In this mini version of my program I am asking for user input. When the input is 'quit' or 'exit' I want the program to exit the while loop. The strcmp function doesn't seem to be working as I expect. I've spent some time looking for answers but can't find the issue. Any ideas?</p>
<pre><code>#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define BUFFER_SIZE 100
int main() {
char request[BUFFER_SIZE];
while(strcmp(request, "quit") != 0 && strcmp(request, exit) != 0) {
fgets(request, BUFFER_SIZE, stdin);
}
return 0;
}
</code></pre>
| 0debug |
Linear Layout is not properly show the component when using in the android studio : this is code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:text="Email:"
android:textSize="30dp"
android:paddingLeft="0dp"
android:paddingTop="10dp"/>
<EditText
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:singleLine="true" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:paddingTop="10dp"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:layout_width="200dp"
android:layout_height="100dp"
android:text="Home" />
<TextView
android:layout_width="200dp"
android:layout_height="200dp"
android:text="About" />
</LinearLayout>
</LinearLayout>
i want to practice on layout on android studio and facing the error while implementing the code
[this is the text which goes outside the mobile screen] [1][ i don't know why blue box goes outside the mobile screen][2]
[1]: http://i.stack.imgur.com/hBSPK.jpg
[2]: http://i.stack.imgur.com/A18wh.jpg
click on number 1 and number 2 which appear on blue color to see the image
plese somebody suggest solution
thank you
| 0debug |
Comparing unordered_map vs unordered_set : <p>First of all, what is the main difference between them? </p>
<p>The only thing i've found is that <code>unordered_set</code> has no operator <code>[]</code>.
How should i access an element in <code>unordered_set</code>, since there is no <code>[]</code>?</p>
<p>Which container is using random access to memory(or both)?</p>
<p>And which one of them faster in any sense or using less memory?</p>
| 0debug |
How to remove password for Jupyter Notebooks and set token again : <p>I need to do this for Pycharm.</p>
<p>Here are the steps that I did which I'm not able to undo.<br></p>
<ol>
<li><p>I <strong>added a password</strong> for authentication using:<br></p>
<blockquote>
<p>$ jupyter notebook password</p>
</blockquote></li>
<li><p>I then used the below command to <strong>comment all the code</strong> in jupyter_notebook_config.py</p>
<blockquote>
<p>$ jupyter notebook --generate-config</p>
</blockquote></li>
<li><p>Then I <strong>removed the hashed password</strong> generated in the jupyter_notebook_config.json which now looks like this</p>
<blockquote>
<p>{
"NotebookApp": {
"password": ""
}
}</p>
</blockquote></li>
<li><p>I then did the following <strong>changes</strong> in jupyter_notebook_config.py file</p>
<blockquote>
<p>c.NotebookApp.password = ''<br>
c.NotebookApp.token = '< generated>'<br></p>
</blockquote></li>
<li><p>Now, There is no token getting generated and there is no password as well when I start the Jupyter notebook.</p>
<blockquote>
<p>Pycharm git:(master) ✗ jupyter notebook<br>
[I 21:53:35.158 NotebookApp] Serving notebooks from local directory: /Users/...<br>
[I 21:53:35.158 NotebookApp] 0 active kernels<br>
[I 21:53:35.158 NotebookApp] The Jupyter Notebook is running at:<br>
[I 21:53:35.158 NotebookApp] <a href="http://localhost:8888/?token=%3Cgenerated%3E" rel="noreferrer">http://localhost:8888/?token=%3Cgenerated%3E</a><br><br>
Copy/paste this URL into your browser when you connect for the first time,<br>
to login with a token:<br>
<a href="http://localhost:8888/?token=%3Cgenerated%3E" rel="noreferrer">http://localhost:8888/?token=%3Cgenerated%3E</a><br></p>
</blockquote></li>
</ol>
<p><strong>Now, how do I make it like the way it was or how do I get the token back??</strong></p>
<p>PS - I even tried <em>jupyter notebook list</em>, but still the same URL is coming. Also, I'm doing this on a mac, so please advise accordingly.</p>
| 0debug |
static void ppc405_ocm_init(CPUPPCState *env)
{
ppc405_ocm_t *ocm;
ocm = g_malloc0(sizeof(ppc405_ocm_t));
memory_region_init_ram(&ocm->isarc_ram, NULL, "ppc405.ocm", 4096,
&error_abort);
vmstate_register_ram_global(&ocm->isarc_ram);
memory_region_init_alias(&ocm->dsarc_ram, NULL, "ppc405.dsarc", &ocm->isarc_ram,
0, 4096);
qemu_register_reset(&ocm_reset, ocm);
ppc_dcr_register(env, OCM0_ISARC,
ocm, &dcr_read_ocm, &dcr_write_ocm);
ppc_dcr_register(env, OCM0_ISACNTL,
ocm, &dcr_read_ocm, &dcr_write_ocm);
ppc_dcr_register(env, OCM0_DSARC,
ocm, &dcr_read_ocm, &dcr_write_ocm);
ppc_dcr_register(env, OCM0_DSACNTL,
ocm, &dcr_read_ocm, &dcr_write_ocm);
}
| 1threat |
static int dvvideo_encode_close(AVCodecContext *avctx)
{
av_frame_free(&avctx->coded_frame);
return 0;
}
| 1threat |
Download Manager Android Permissions error: write external Storage : <p>I programmed an Android App that downloads a sample PDF file to the Download directory using DownloadManager. Here's the code:</p>
<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_vertretungsplan);
Button dlbutton = (Button) findViewById(R.id.buttondownload);
final Context c = this;
dlbutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(myurl));
request.setTitle("Vertretungsplan");
request.setDescription("wird heruntergeladen");
request.allowScanningByMediaScanner();
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
String filename = URLUtil.guessFileName(myurl, null, MimeTypeMap.getFileExtensionFromUrl(myurl));
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
DownloadManager manager = (DownloadManager) c.getSystemService(Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
}
});
}
</code></pre>
<p>Now, I tried to debug-run it from Android Studio on my Xperia Z3 Android 6.0.
As I clicked on the download button, this error occurs:</p>
<pre><code>E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.markwitt.schul_app, PID: 29297
java.lang.SecurityException: No permission to write to /storage/emulated/0/Download/hrpsampletable.pdf: Neither user 10047 nor current process has android.permission.WRITE_EXTERNAL_STORAGE.
at android.os.Parcel.readException(Parcel.java:1627)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:476)
at android.content.ContentResolver.insert(ContentResolver.java:1240)
at android.app.DownloadManager.enqueue(DownloadManager.java:946)
at com.example.markwitt.schul_app.Vertretungsplan$1.onClick(Vertretungsplan.java:59)
at android.view.View.performClick(View.java:5280)
at android.view.View$PerformClick.run(View.java:21239)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
</code></pre>
<p>Disconnected from the target VM, address: 'localhost:8600', transport: 'socket'</p>
<p>(on the third line) it displays me that it has no write permission on external storage.</p>
<p>But my AndroidManifest is set up correctly:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.markwitt.schul_app">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:launchMode="singleTop"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".Stundenplan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Vertretungsplan"></activity>
</application>
</code></pre>
<p></p>
<p>What do I need to do?</p>
| 0debug |
static int dca_decode_frame(AVCodecContext * avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
int lfe_samples;
int num_core_channels = 0;
int i;
int xch_present = 0;
int16_t *samples = data;
DCAContext *s = avctx->priv_data;
int channels;
s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, DCA_MAX_FRAME_SIZE);
if (s->dca_buffer_size == -1) {
av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n");
return -1;
}
init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8);
if (dca_parse_frame_header(s) < 0) {
*data_size=0;
return buf_size;
}
avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate;
for (i = 0; i < (s->sample_blocks / 8); i++) {
dca_decode_block(s, 0, i);
}
num_core_channels = s->prim_channels;
skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
while(get_bits_left(&s->gb) >= 32) {
uint32_t bits = get_bits_long(&s->gb, 32);
switch(bits) {
case 0x5a5a5a5a: {
int ext_base_ch = s->prim_channels;
int ext_amode;
skip_bits(&s->gb, 10);
if ((ext_amode = get_bits(&s->gb, 4)) != 1) {
av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not"
" supported!\n",ext_amode);
continue;
}
dca_parse_audio_coding_header(s, ext_base_ch);
for (i = 0; i < (s->sample_blocks / 8); i++) {
dca_decode_block(s, ext_base_ch, i);
}
xch_present = 1;
break;
}
case 0x1d95f262:
av_log(avctx, AV_LOG_DEBUG, "Possible X96 extension found at %d bits\n", get_bits_count(&s->gb));
av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", get_bits(&s->gb, 12)+1);
av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4));
break;
}
skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31);
}
channels = s->prim_channels + !!s->lfe;
if (s->amode<16) {
avctx->channel_layout = dca_core_channel_layout[s->amode];
if (xch_present && (!avctx->request_channels ||
avctx->request_channels > num_core_channels)) {
avctx->channel_layout |= CH_BACK_CENTER;
if (s->lfe) {
avctx->channel_layout |= CH_LOW_FREQUENCY;
s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode];
} else {
s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode];
}
} else {
if (s->lfe) {
avctx->channel_layout |= CH_LOW_FREQUENCY;
s->channel_order_tab = dca_channel_reorder_lfe[s->amode];
} else
s->channel_order_tab = dca_channel_reorder_nolfe[s->amode];
}
if (s->prim_channels > 0 &&
s->channel_order_tab[s->prim_channels - 1] < 0)
return -1;
if (avctx->request_channels == 2 && s->prim_channels > 2) {
channels = 2;
s->output = DCA_STEREO;
avctx->channel_layout = CH_LAYOUT_STEREO;
}
} else {
av_log(avctx, AV_LOG_ERROR, "Non standard configuration %d !\n",s->amode);
return -1;
}
if (!avctx->channels)
avctx->channels = channels;
if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels)
return -1;
*data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels;
for (i = 0; i < (s->sample_blocks / 8); i++) {
dca_filter_channels(s, i);
s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels);
samples += 256 * channels;
}
lfe_samples = 2 * s->lfe * (s->sample_blocks / 8);
for (i = 0; i < 2 * s->lfe * 4; i++) {
s->lfe_data[i] = s->lfe_data[i + lfe_samples];
}
return buf_size;
}
| 1threat |
create zip file in .net with password : <p>I'm working on a project that I need to create zip with password protected from file content in c#.</p>
<p>Before I've use System.IO.Compression.GZipStream for creating gzip content.
Does .net have any functionality for create zip or rar password protected file?</p>
| 0debug |
void cpu_loop (CPUSPARCState *env)
{
int trapnr, ret;
target_siginfo_t info;
while (1) {
trapnr = cpu_sparc_exec (env);
switch (trapnr) {
#ifndef TARGET_SPARC64
case 0x88:
case 0x90:
#else
case 0x110:
case 0x16d:
#endif
ret = do_syscall (env, env->gregs[1],
env->regwptr[0], env->regwptr[1],
env->regwptr[2], env->regwptr[3],
env->regwptr[4], env->regwptr[5]);
if ((unsigned int)ret >= (unsigned int)(-515)) {
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
env->xcc |= PSR_CARRY;
#else
env->psr |= PSR_CARRY;
#endif
ret = -ret;
} else {
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
env->xcc &= ~PSR_CARRY;
#else
env->psr &= ~PSR_CARRY;
#endif
}
env->regwptr[0] = ret;
env->pc = env->npc;
env->npc = env->npc + 4;
break;
case 0x83:
#ifdef TARGET_ABI32
case 0x103:
#endif
flush_windows(env);
env->pc = env->npc;
env->npc = env->npc + 4;
break;
#ifndef TARGET_SPARC64
case TT_WIN_OVF:
save_window(env);
break;
case TT_WIN_UNF:
restore_window(env);
break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = TARGET_SEGV_MAPERR;
info._sifields._sigfault._addr = env->mmuregs[4];
queue_signal(env, info.si_signo, &info);
}
break;
#else
case TT_SPILL:
save_window(env);
break;
case TT_FILL:
restore_window(env);
break;
case TT_TFAULT:
case TT_DFAULT:
{
info.si_signo = SIGSEGV;
info.si_errno = 0;
info.si_code = TARGET_SEGV_MAPERR;
if (trapnr == TT_DFAULT)
info._sifields._sigfault._addr = env->dmmuregs[4];
else
info._sifields._sigfault._addr = env->tsptr->tpc;
queue_signal(env, info.si_signo, &info);
}
break;
#ifndef TARGET_ABI32
case 0x16e:
flush_windows(env);
sparc64_get_context(env);
break;
case 0x16f:
flush_windows(env);
sparc64_set_context(env);
break;
#endif
#endif
case EXCP_INTERRUPT:
break;
case EXCP_DEBUG:
{
int sig;
sig = gdb_handlesig (env, TARGET_SIGTRAP);
if (sig)
{
info.si_signo = sig;
info.si_errno = 0;
info.si_code = TARGET_TRAP_BRKPT;
queue_signal(env, info.si_signo, &info);
}
}
break;
default:
printf ("Unhandled trap: 0x%x\n", trapnr);
cpu_dump_state(env, stderr, fprintf, 0);
exit (1);
}
process_pending_signals (env);
}
}
| 1threat |
static int mov_write_source_reference_tag(AVIOContext *pb, MOVTrack *track, const char *reel_name){
int64_t pos = avio_tell(pb);
avio_wb32(pb, 0);
ffio_wfourcc(pb, "name");
avio_wb16(pb, strlen(reel_name));
avio_wb16(pb, track->language);
avio_write(pb, reel_name, strlen(reel_name));
return update_size(pb,pos);
}
| 1threat |
Input textbox allow only float number with maximum 5 length of number : <p>I need to allow only floating or number value in textbox allow only 0-9 & signal dot(.) maximum 5 length.</p>
<p>For e.g.: 12.02, 12345, 2.324, 0.254, .1234</p>
| 0debug |
how to get text from this element I can't understand this element :
How can I get text of this element please help..???
<div class="status-value" id="divdoctyp" xpath="1">AADHAAR CARD</div>
I tried this
WebElement doctype= driver.findElement(By.xpath("//div[@id='divdoctyp']"));
String type=doctype.getAttribute("type");
String label=doctype.getText();
Thread.sleep(5000);
System.out.print("doctype is "+type +"\n"+label);
| 0debug |
fail to run the file when defusing a bomb in phase_1 : ```
gdb bomb
...
(gdb) break phase_1
Breakpoint 1 at 0x1264
(gdb) run
Starting program: .../bomb
Initialization error: Running on an illegal host [2]
[Inferior 1 (process 3262) exited with code 010]
```
I don't know why i couldn't even run the bomb file, please help. Thank you so much! | 0debug |
git: Solve merge conflicts without performing a merge : <p>I just want to know, if there is any way, to resolve merge commits, of two git branches, without actually merging them.</p>
<p>Assuming, I have a branch "featureMy"; my colleague created another branch "featureHis". Both branches are created on "master" branch.</p>
<p>My colleague then created a merge request for his branch "featureHis" into master. When I then create my merge request of "featureMy" into master, I want to ensure, that it will not conflicts with master after "featureHis" is merged.</p>
<p>Usually, I will merge "featureHis" into "featureMy" before. However, this is not that satisfying, because I have a additional merge commit as "noise" and my merge request will contain changes from "featureHis".</p>
<p>Is there a way, so that I can solve the merge conflicts, without creating a merge commit?</p>
<p>Kind regards</p>
| 0debug |
Convert textbox value to int : <p>I have a database and I assigned the price of a product from that database into a textbox. Whenever I try to convert the textbox value into an int, I receive a Format exception. I use the following code to convert: </p>
<pre><code>unitsA = Int32.Parse(units.Text);
</code></pre>
<p>And the database value is a smallint.</p>
| 0debug |
query = 'SELECT * FROM customers WHERE email = ' + email_input | 1threat |
Save Screenshot to specified directory when a button is clicked : <p>I am looking to make a small windows utility that will let the user browse to a file directory. Is there a good C# method (Windows) to execute this?</p>
| 0debug |
Update <select> via AJAX sucess : I have some DropdownLists in my View
Here is code
@Html.DropDownList("Question1", null, "Вопрос 1", htmlAttributes: new {@class = "form-control", @style = "height:40px;margin-bottom: 20px;"})
I have AJAX call to add question
Here is code
<script>
$(document).ready(function () {
$('#save_quest').click(function () {
savequestion();
});
});
// Сохранение вопроса в модальном окне
function savequestion() {
$.ajax({
type: 'Post',
dataType: 'Json',
data: {
Question_new: $('#question').val(),
Answer: $('#answer').val(),
Preparing: $('#prepare').val(),
Retries: $('#retries').val(),
},
url: '@Url.Action("CreateNewQuestion", "Questions")',
success: function (da) {
if (da.Result === "Success") {
$('#myModal').hide();
emails_update();
} else {
alert('Error' + da.Message);
}
},
error: function (da) {
alert('Error');
}
});
}
</script>
How I can update DropDownList on sucess?
Thank's for help | 0debug |
static int fic_decode_slice(AVCodecContext *avctx, void *tdata)
{
FICContext *ctx = avctx->priv_data;
FICThreadContext *tctx = tdata;
GetBitContext gb;
uint8_t *src = tctx->src;
int slice_h = tctx->slice_h;
int src_size = tctx->src_size;
int y_off = tctx->y_off;
int x, y, p;
init_get_bits(&gb, src, src_size * 8);
for (p = 0; p < 3; p++) {
int stride = ctx->frame->linesize[p];
uint8_t* dst = ctx->frame->data[p] + (y_off >> !!p) * stride;
for (y = 0; y < (slice_h >> !!p); y += 8) {
for (x = 0; x < (ctx->aligned_width >> !!p); x += 8) {
int ret;
if ((ret = fic_decode_block(ctx, &gb, dst + x, stride, tctx->block)) != 0)
return ret;
}
dst += 8 * stride;
}
}
return 0;
}
| 1threat |
static inline void RENAME(rgb16to24)(const uint8_t *src, uint8_t *dst, unsigned src_size)
{
const uint16_t *end;
#ifdef HAVE_MMX
const uint16_t *mm_end;
#endif
uint8_t *d = (uint8_t *)dst;
const uint16_t *s = (const uint16_t *)src;
end = s + src_size/2;
#ifdef HAVE_MMX
__asm __volatile(PREFETCH" %0"::"m"(*s):"memory");
mm_end = end - 7;
while(s < mm_end)
{
__asm __volatile(
PREFETCH" 32%1\n\t"
"movq %1, %%mm0\n\t"
"movq %1, %%mm1\n\t"
"movq %1, %%mm2\n\t"
"pand %2, %%mm0\n\t"
"pand %3, %%mm1\n\t"
"pand %4, %%mm2\n\t"
"psllq $3, %%mm0\n\t"
"psrlq $3, %%mm1\n\t"
"psrlq $8, %%mm2\n\t"
"movq %%mm0, %%mm3\n\t"
"movq %%mm1, %%mm4\n\t"
"movq %%mm2, %%mm5\n\t"
"punpcklwd %5, %%mm0\n\t"
"punpcklwd %5, %%mm1\n\t"
"punpcklwd %5, %%mm2\n\t"
"punpckhwd %5, %%mm3\n\t"
"punpckhwd %5, %%mm4\n\t"
"punpckhwd %5, %%mm5\n\t"
"psllq $8, %%mm1\n\t"
"psllq $16, %%mm2\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm2, %%mm0\n\t"
"psllq $8, %%mm4\n\t"
"psllq $16, %%mm5\n\t"
"por %%mm4, %%mm3\n\t"
"por %%mm5, %%mm3\n\t"
"movq %%mm0, %%mm6\n\t"
"movq %%mm3, %%mm7\n\t"
"movq 8%1, %%mm0\n\t"
"movq 8%1, %%mm1\n\t"
"movq 8%1, %%mm2\n\t"
"pand %2, %%mm0\n\t"
"pand %3, %%mm1\n\t"
"pand %4, %%mm2\n\t"
"psllq $3, %%mm0\n\t"
"psrlq $3, %%mm1\n\t"
"psrlq $8, %%mm2\n\t"
"movq %%mm0, %%mm3\n\t"
"movq %%mm1, %%mm4\n\t"
"movq %%mm2, %%mm5\n\t"
"punpcklwd %5, %%mm0\n\t"
"punpcklwd %5, %%mm1\n\t"
"punpcklwd %5, %%mm2\n\t"
"punpckhwd %5, %%mm3\n\t"
"punpckhwd %5, %%mm4\n\t"
"punpckhwd %5, %%mm5\n\t"
"psllq $8, %%mm1\n\t"
"psllq $16, %%mm2\n\t"
"por %%mm1, %%mm0\n\t"
"por %%mm2, %%mm0\n\t"
"psllq $8, %%mm4\n\t"
"psllq $16, %%mm5\n\t"
"por %%mm4, %%mm3\n\t"
"por %%mm5, %%mm3\n\t"
:"=m"(*d)
:"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null)
:"memory");
__asm __volatile(
"movq %%mm0, %%mm4\n\t"
"movq %%mm3, %%mm5\n\t"
"movq %%mm6, %%mm0\n\t"
"movq %%mm7, %%mm1\n\t"
"movq %%mm4, %%mm6\n\t"
"movq %%mm5, %%mm7\n\t"
"movq %%mm0, %%mm2\n\t"
"movq %%mm1, %%mm3\n\t"
"psrlq $8, %%mm2\n\t"
"psrlq $8, %%mm3\n\t"
"psrlq $8, %%mm6\n\t"
"psrlq $8, %%mm7\n\t"
"pand %2, %%mm0\n\t"
"pand %2, %%mm1\n\t"
"pand %2, %%mm4\n\t"
"pand %2, %%mm5\n\t"
"pand %3, %%mm2\n\t"
"pand %3, %%mm3\n\t"
"pand %3, %%mm6\n\t"
"pand %3, %%mm7\n\t"
"por %%mm2, %%mm0\n\t"
"por %%mm3, %%mm1\n\t"
"por %%mm6, %%mm4\n\t"
"por %%mm7, %%mm5\n\t"
"movq %%mm1, %%mm2\n\t"
"movq %%mm4, %%mm3\n\t"
"psllq $48, %%mm2\n\t"
"psllq $32, %%mm3\n\t"
"pand %4, %%mm2\n\t"
"pand %5, %%mm3\n\t"
"por %%mm2, %%mm0\n\t"
"psrlq $16, %%mm1\n\t"
"psrlq $32, %%mm4\n\t"
"psllq $16, %%mm5\n\t"
"por %%mm3, %%mm1\n\t"
"pand %6, %%mm5\n\t"
"por %%mm5, %%mm4\n\t"
MOVNTQ" %%mm0, %0\n\t"
MOVNTQ" %%mm1, 8%0\n\t"
MOVNTQ" %%mm4, 16%0"
:"=m"(*d)
:"m"(*s),"m"(mask24l),"m"(mask24h),"m"(mask24hh),"m"(mask24hhh),"m"(mask24hhhh)
:"memory");
d += 24;
s += 8;
}
__asm __volatile(SFENCE:::"memory");
__asm __volatile(EMMS:::"memory");
#endif
while(s < end)
{
register uint16_t bgr;
bgr = *s++;
*d++ = (bgr&0x1F)<<3;
*d++ = (bgr&0x7E0)>>3;
*d++ = (bgr&0xF800)>>8;
}
}
| 1threat |
How to use variable name in object? : <p>I want to access the value of my object but with a <code>.var</code>.
For example, if I specifiy the full path by myself it's <code>apple = theApples.trees.green</code> but I want to do: </p>
<pre><code>var colorOfApple = "red";
apple = theApples.trees.colorOfApple;
</code></pre>
<p>the problem is it tries to access <code>.colorOfApple</code> of the object but I want to have the value of <code>colorOfApple</code> </p>
| 0debug |
Idiomatic way of handling a goroutine with one "return" value? : <p>Imagine I want to write a function that returns a random number divided by 2:</p>
<pre><code>func randomIntInHalf() int {
return rand.Int() / 2
}
</code></pre>
<p>But then I decide I want to build this function for concurrency so I end up with:</p>
<pre><code>func randomIntInHalf(c chan<- int) {
c <- rand.Int() / 2
}
func main() {
// Generate 10 random ints in parallel
amount := 10
c := make(chan int, amount)
for i := 0; i < amount; i++ {
go randomIntInHalf(c)
}
for i := 0; i < amount; i++ {
fmt.Println(<-c)
}
close(c)
}
</code></pre>
<p>I see some issues with this approach. For example, I require the caller to close the channel when it's done generating, making it possible that someone might call the function and leave the channel open indefinitely. It was sort of my understanding that you always want the sender to close the channel. A) is that true and b) is it even possible in this case? Is there a better way to write this code or approach this problem?</p>
<p>And, generally, is there a better, idiomatic approach for running a function in a parallel that only ever writes 1 (or a known N) value to the channel?</p>
<p>Thanks.</p>
| 0debug |
Iwant to running late program on c# : I make to run exe program on c#, but addinitional to I want to running after 10 minute pc. Could you help me please?
Process scriptProc = new Process();
scriptProc.StartInfo.FileName = @"C:\a.vbs";
scriptProc.Start();
scriptProc.WaitForExit();
scriptProc.Close(); `enter code here` | 0debug |
Rounding floats with f-string : <p>Using %-formatting, I can specify the number of decimal cases in a string:</p>
<pre><code>x = 3.14159265
print('pi = %0.2f' %x)
</code></pre>
<p>This would give me:</p>
<pre><code>pi = 3.14
</code></pre>
<p>Is there any way of doing this using f-strings in Python 3.6?</p>
| 0debug |
How to Stop an Endless String in R : <p>I'm new to R Programming and have somehow gotten stuck in an argument that will not stop. I wrote view(file) and hit enter and now there is an endless string of "+" and the argument will not close. Any help would be appreciated on how to close my argument. I know I can just force quit the program, but I would rather just figure out of to end the argument. Thank You!</p>
| 0debug |
Undefined_index ajax call : <h2>Hi Hello Every One i Start A New Code But i can not figure out the error on my code</h2>
<p>The Code wen i send a call to my script like this
<a href="http://www.mywebsite.com/savedata.php?user_id=abc" rel="nofollow">http://www.mywebsite.com/savedata.php?user_id=abc</a></p>
<p>and this is my code</p>
<pre><code><?php
header('Access-Control-Allow-Origin: *');
error_reporting(E_ALL);
ini_set('display_errors',1);
$servername = "localhost";
$username = "user_name";
$password = "pass";
try {
$conn = new PDO("mysql:host=$servername;dbname=mydb_name", $username, $password);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}
catch(PDOException $e){
echo "Connection failed: " . $e->getMessage();
}
if(isset($_GET['user_id'])){
//$user_id = intval($_GET['user_id']);
//Lightly sanitize the GET's to prevent SQL injections and possible XSS attacks
try {
$dbh = new PDO("mysql:host=$servername;dbname=db_name", $username, $password);
$user_id = @$_GET['user_id'];
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // <== add this line
$sql = "INSERT INTO users (user_id) VALUES ('".$_POST["user_id"]."')";
if ($dbh->query($sql)) {
echo "<script type= 'text/javascript'>alert('New Record Inserted Successfully');</script>";
}
else{
echo "<script type= 'text/javascript'>alert('Data not successfully Inserted.');</script>";
}
$dbh = null;
}
catch(PDOException $e){
echo $e->getMessage();
}
}
?>
$sql->execute(array($user_Id));
if($sql){
//The query returned true - now do whatever you like here.
echo 'Your ID was saved. Congrats!';
}else{
//The query returned false - you might want to put some sort of error reporting here. Even logging the error to a text file is fine.
echo 'There was a problem saving your points. Please try again later.';
}
}else{
echo 'Your id wasnt passed in the request.';
}
// close MySQL connection
$conn = null;
?>
<html>
<head>
</head>
<body>
<body bgcolor="#ffffff">
</body>
</html>
</code></pre>
| 0debug |
static void hpet_device_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = hpet_realize;
dc->reset = hpet_reset;
dc->vmsd = &vmstate_hpet;
dc->props = hpet_device_properties;
} | 1threat |
static void *file_ram_alloc(RAMBlock *block,
ram_addr_t memory,
const char *path)
{
char *filename;
char *sanitized_name;
char *c;
void *area;
int fd;
unsigned long hpagesize;
hpagesize = gethugepagesize(path);
if (!hpagesize) {
return NULL;
}
if (memory < hpagesize) {
return NULL;
}
if (kvm_enabled() && !kvm_has_sync_mmu()) {
fprintf(stderr, "host lacks kvm mmu notifiers, -mem-path unsupported\n");
return NULL;
}
sanitized_name = g_strdup(block->mr->name);
for (c = sanitized_name; *c != '\0'; c++) {
if (*c == '/')
*c = '_';
}
filename = g_strdup_printf("%s/qemu_back_mem.%s.XXXXXX", path,
sanitized_name);
g_free(sanitized_name);
fd = mkstemp(filename);
if (fd < 0) {
perror("unable to create backing store for hugepages");
g_free(filename);
return NULL;
}
unlink(filename);
g_free(filename);
memory = (memory+hpagesize-1) & ~(hpagesize-1);
if (ftruncate(fd, memory))
perror("ftruncate");
area = mmap(0, memory, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
if (area == MAP_FAILED) {
perror("file_ram_alloc: can't mmap RAM pages");
close(fd);
return (NULL);
}
if (mem_prealloc) {
int ret, i;
struct sigaction act, oldact;
sigset_t set, oldset;
memset(&act, 0, sizeof(act));
act.sa_handler = &sigbus_handler;
act.sa_flags = 0;
ret = sigaction(SIGBUS, &act, &oldact);
if (ret) {
perror("file_ram_alloc: failed to install signal handler");
exit(1);
}
sigemptyset(&set);
sigaddset(&set, SIGBUS);
pthread_sigmask(SIG_UNBLOCK, &set, &oldset);
if (sigsetjmp(sigjump, 1)) {
fprintf(stderr, "file_ram_alloc: failed to preallocate pages\n");
exit(1);
}
for (i = 0; i < (memory/hpagesize)-1; i++) {
memset(area + (hpagesize*i), 0, 1);
}
ret = sigaction(SIGBUS, &oldact, NULL);
if (ret) {
perror("file_ram_alloc: failed to reinstall signal handler");
exit(1);
}
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
}
block->fd = fd;
return area;
}
| 1threat |
Dark Theme for Ionic 4 : <p>In Ionic 3 I could easily apply a dark theme to my app by adding just one line to my <code>variables.scss</code>:</p>
<pre><code>@import "ionic.theme.dark";
</code></pre>
<p>Is that still possible in Ionic 4 as simple as that? And if yes, how?</p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.