problem
stringlengths
26
131k
labels
class label
2 classes
static CharDriverState *qmp_chardev_open_parallel(ChardevHostdev *parallel, Error **errp) { #ifdef HAVE_CHARDEV_PARPORT int fd; fd = qmp_chardev_open_file_source(parallel->device, O_RDWR, errp); if (error_is_set(errp)) { return NULL; } return qemu_chr_open_pp_fd(fd); #else error_setg(errp, "character device backend type 'parallel' not supported"); return NULL; #endif }
1threat
GitHub pages only showing ReadMe file? : <p>I'm trying to host my webpages into Github pages but for some reason it seems to only show my Readme file.</p> <p>GitHub repo: <a href="https://github.com/InquisitiveDev2016/InquisitiveDev2016.github.io" rel="noreferrer">https://github.com/InquisitiveDev2016/InquisitiveDev2016.github.io</a></p> <p>Website: </p> <p><a href="https://inquisitivedev2016.github.io/" rel="noreferrer">https://inquisitivedev2016.github.io/</a></p>
0debug
TypeError: convertDocument() takes 1 positional argument but 2 were given : <p>I'm try to use Converter class to convert my image file but when I'm use it in OOP it's give me </p> <p><strong>TypeError:</strong> convertDocument() takes 1 positional argument but 2 were given</p> <pre><code>class Converter: def convIMG2JPG(self): os.mkdir(inputfile+"\\"+Path(inputfile).stem) im = Image.open(inputfile) rgb_im = im.convert('RGB') rgb_im.save(outputdir+"\\"+ Path(inputfile).stem+"\\"+ Path(inputfile).stem + ".jpg") def convertDocument(inputfile): if(file_extension == ".gif" or file_extension == ".jfif" or file_extension == ".jpeg" or file_extension == ".jpg" or file_extension == ".BMP" or file_extension == ".png"): convIMG2JPG(inputfile) </code></pre> <pre><code>convert = Converter() input = "/10791227_7168491604.jpg" convert.convertDocument(input) </code></pre>
0debug
How to remove the hash from the url in react-router : <p>I'm using react-router for my routing and I use the hashHistory option so that I could refresh the page from the browser or specify a url of one of my existing routes and land on the right page. It works fine but I see the hash in the url like this: <a href="http://localhost/#/login?_k=ya6z6i">http://localhost/#/login?_k=ya6z6i</a></p> <p>This is my routing configuration:</p> <pre><code>ReactDOM.render(( &lt;Router history={hashHistory}&gt; &lt;Route path='/' component={MasterPage}&gt; &lt;IndexRoute component={LoginPage} /&gt; &lt;Route path='/search' component={SearchPage} /&gt; &lt;Route path='/login' component={LoginPage} /&gt; &lt;Route path='/payment' component={PaymentPage} /&gt; &lt;/Route&gt; &lt;/Router&gt;), document.getElementById('app-container')); </code></pre>
0debug
Django knowledge requirement in python : <p>it's about a month I am handling with python and what I know is its fundamental and OOP concepts and a little tkinter and other languages also css and html. My question is :what do I need to be prepared for django framework tutorial learning?</p>
0debug
static uint64_t bonito_cop_readl(void *opaque, hwaddr addr, unsigned size) { uint32_t val; PCIBonitoState *s = opaque; val = ((uint32_t *)(&s->boncop))[addr/sizeof(uint32_t)]; return val;
1threat
static ssize_t nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size) { EEPRO100State *s = vc->opaque; uint16_t rfd_status = 0xa000; static const uint8_t broadcast_macaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; assert(!(s->configuration[20] & BIT(6))); if (s->configuration[8] & 0x80) { logout("%p received while CSMA is disabled\n", s); return -1; } else if (size < 64 && (s->configuration[7] & 1)) { logout("%p received short frame (%zu byte)\n", s, size); s->statistics.rx_short_frame_errors++; } else if ((size > MAX_ETH_FRAME_SIZE + 4) && !(s->configuration[18] & 8)) { logout("%p received long frame (%zu byte), ignored\n", s, size); return -1; } else if (memcmp(buf, s->macaddr, 6) == 0) { TRACE(RXTX, logout("%p received frame for me, len=%zu\n", s, size)); } else if (memcmp(buf, broadcast_macaddr, 6) == 0) { TRACE(RXTX, logout("%p received broadcast, len=%zu\n", s, size)); rfd_status |= 0x0002; } else if (buf[0] & 0x01) { TRACE(RXTX, logout("%p received multicast, len=%zu\n", s, size)); assert(!(s->configuration[21] & BIT(3))); int mcast_idx = compute_mcast_idx(buf); if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) { return size; } rfd_status |= 0x0002; } else if (s->configuration[15] & 1) { TRACE(RXTX, logout("%p received frame in promiscuous mode, len=%zu\n", s, size)); rfd_status |= 0x0004; } else { TRACE(RXTX, logout("%p received frame, ignored, len=%zu,%s\n", s, size, nic_dump(buf, size))); return size; } if (get_ru_state(s) != ru_ready) { logout("no resources, state=%u\n", get_ru_state(s)); s->statistics.rx_resource_errors++; return -1; } eepro100_rx_t rx; cpu_physical_memory_read(s->ru_base + s->ru_offset, (uint8_t *) & rx, offsetof(eepro100_rx_t, packet)); uint16_t rfd_command = le16_to_cpu(rx.command); uint16_t rfd_size = le16_to_cpu(rx.size); assert(size <= rfd_size); if (size < 64) { rfd_status |= 0x0080; } TRACE(OTHER, logout("command 0x%04x, link 0x%08x, addr 0x%08x, size %u\n", rfd_command, rx.link, rx.rx_buf_addr, rfd_size)); stw_phys(s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, status), rfd_status); stw_phys(s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, count), size); assert(!(s->configuration[18] & 4)); cpu_physical_memory_write(s->ru_base + s->ru_offset + offsetof(eepro100_rx_t, packet), buf, size); s->statistics.rx_good_frames++; eepro100_fr_interrupt(s); s->ru_offset = le32_to_cpu(rx.link); if (rfd_command & 0x8000) { assert(0); } if (rfd_command & 0x4000) { set_ru_state(s, ru_suspended); } return size; }
1threat
Could not resolve substitution to a value: ${akka.stream.materializer} in AWS Lambda : <p>I have a java application, in which I'm using the <code>Flink Api</code>. So basically what I'm trying to do with the code, is to create two Datasets with few records and then register them as two tables along with the necessary fields.</p> <pre><code> DataSet&lt;Company&gt; comp = env.fromElements( new Company("Aux", 1), new Company("Comp2", 2), new Company("Comp3", 3)); DataSet&lt;Employee&gt; emp = env.fromElements( new Employee("Kula", 1), new Employee("Ish", 1), new Employee("Kula", 3)); tEnv.registerDataSet("Employee", emp, "name, empId"); tEnv.registerDataSet("Company", comp, "cName, empId"); </code></pre> <p>And then I'm trying to join these two tables using the <code>Table API</code>:</p> <pre><code>Table anotherJoin = tEnv.sql("SELECT Employee.name, Employee.empId, Company.cName FROM " + "Employee RIGHT JOIN Company on Employee.empId = Company.empId"); </code></pre> <p>And I'm just printing the results on the console. <strong>This works perfectly locally</strong> on my machine. I created a <code>fat-jar</code> by using the <code>maven-shade-plugin</code> with the dependencies and I'm trying to execute it in AWS <code>Lambda</code>.</p> <p>So when I try to execute it there, I'm being thrown with the following exception (I'm posting only the first few lines):</p> <blockquote> <p>reference.conf @ file:/var/task/reference.conf: 804: Could not resolve substitution to a value: ${akka.stream.materializer}: com.typesafe.config.ConfigException$UnresolvedSubstitution com.typesafe.config.ConfigException$UnresolvedSubstitution: reference.conf @ file:/var/task/reference.conf: 804: Could not resolve substitution to a value: ${akka.stream.materializer} at com.typesafe.config.impl.ConfigReference.resolveSubstitutions(ConfigReference.java:111) at com.typesafe.config.impl.ResolveContext.realResolve(ResolveContext.java:179) at com.typesafe.config.impl.ResolveContext.resolve(ResolveContext.java:142)</p> </blockquote> <p>I extracted the jar before executing it in Lambda, and happened to see all the dependencies were there. I can't figure out where is it going wrong?</p> <p>Any help could be appreciated.</p>
0debug
Firebase onTokenRefresh() is not called : <p>In my <code>MainActivity</code>in my log, I can see the token using <code>FirebaseInstanceId.getInstance().getToken()</code> and it display the generated token. But it seems like in my <code>MyFirebaseInstanceIDService</code> where it is extends to <code>FirebaseInstanceIdService</code>, the <code>onTokenRefresh()</code> is not called, where in this function it was said that the token is initially generated here. I needed to call <code>sendRegistrationToServer()</code> that's why I'm trying to know why it doesn't go in the <code>onTokenRefresh()</code>. </p> <p>Here is my code</p> <pre><code>public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService { @Override public void onTokenRefresh() { // Get updated InstanceID token. String refreshedToken = FirebaseInstanceId.getInstance().getToken(); Log.d(TAG, "Refreshed token: " + refreshedToken); sendRegistrationToServer(refreshedToken); } } </code></pre>
0debug
Rails Webpacker 3.0 import CSS file is not working : <p>I am working Rails5 project with Webpacker in order to run React properly</p> <p>But when <code>import</code> my css file inside my root component seems it is not working at all. Looking like stylesheet is not coming at all.</p> <p>This is my root Component</p> <pre><code>import React from 'react' import ReactDOM from 'react-dom' import StartForm from './insurance_form/start_form' //import PropTypes from 'prop-types' import 'react-datepicker/dist/react-datepicker.css'; // not working ReactDOM.render( &lt;StartForm /&gt;, document.getElementById('start-form-index-container') ) </code></pre> <p>This my <code>webpack/environment.js</code></p> <pre><code>const { environment } = require('@rails/webpacker') const merge = require('webpack-merge') const myCssLoaderOptions = { modules: true, sourceMap: true, localIdentName: '[name]__[local]___[hash:base64:5]' } const CSSLoader = environment.loaders.get('style').use.find(el =&gt; el.loader === 'css-loader') CSSLoader.options = merge(CSSLoader.options, myCssLoaderOptions) module.exports = environment </code></pre> <p>So how i can make imported css working well with webpacker?</p> <p>Thanks!</p>
0debug
How to find the size of an image in bytes using python? : <p>I couldn't find anyway to print the size of an image in bytes. </p>
0debug
static void realview_init(ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env; ram_addr_t ram_offset; DeviceState *dev; qemu_irq *irqp; qemu_irq pic[64]; PCIBus *pci_bus; NICInfo *nd; int n; int done_smc = 0; qemu_irq cpu_irq[4]; int ncpu; if (!cpu_model) cpu_model = "arm926"; if (strcmp(cpu_model, "arm11mpcore") == 0) { ncpu = 4; } else { ncpu = 1; } for (n = 0; n < ncpu; n++) { env = cpu_init(cpu_model); if (!env) { fprintf(stderr, "Unable to find CPU definition\n"); exit(1); } irqp = arm_pic_init_cpu(env); cpu_irq[n] = irqp[ARM_PIC_CPU_IRQ]; if (n > 0) { qemu_register_reset(secondary_cpu_reset, env); } } ram_offset = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0, ram_size, ram_offset | IO_MEM_RAM); arm_sysctl_init(0x10000000, 0xc1400400); if (ncpu == 1) { dev = sysbus_create_simple("realview_gic", 0x10040000, cpu_irq[0]); } else { dev = sysbus_create_varargs("realview_mpcore", -1, cpu_irq[0], cpu_irq[1], cpu_irq[2], cpu_irq[3], NULL); } for (n = 0; n < 64; n++) { pic[n] = qdev_get_gpio_in(dev, n); } sysbus_create_simple("pl050_keyboard", 0x10006000, pic[20]); sysbus_create_simple("pl050_mouse", 0x10007000, pic[21]); sysbus_create_simple("pl011", 0x10009000, pic[12]); sysbus_create_simple("pl011", 0x1000a000, pic[13]); sysbus_create_simple("pl011", 0x1000b000, pic[14]); sysbus_create_simple("pl011", 0x1000c000, pic[15]); sysbus_create_simple("pl081", 0x10030000, pic[24]); sysbus_create_simple("sp804", 0x10011000, pic[4]); sysbus_create_simple("sp804", 0x10012000, pic[5]); sysbus_create_simple("pl110_versatile", 0x10020000, pic[23]); sysbus_create_varargs("pl181", 0x10005000, pic[17], pic[18], NULL); sysbus_create_simple("pl031", 0x10017000, pic[10]); dev = sysbus_create_varargs("realview_pci", 0x60000000, pic[48], pic[49], pic[50], pic[51], NULL); pci_bus = (PCIBus *)qdev_get_child_bus(dev, "pci"); if (usb_enabled) { usb_ohci_init_pci(pci_bus, -1); } n = drive_get_max_bus(IF_SCSI); while (n >= 0) { pci_create_simple(pci_bus, -1, "lsi53c895a"); n--; } for(n = 0; n < nb_nics; n++) { nd = &nd_table[n]; if ((!nd->model && !done_smc) || strcmp(nd->model, "smc91c111") == 0) { smc91c111_init(nd, 0x4e000000, pic[28]); done_smc = 1; } else { pci_nic_init_nofail(nd, "rtl8139", NULL); } } ram_offset = qemu_ram_alloc(0x1000); cpu_register_physical_memory(0x80000000, 0x1000, ram_offset | IO_MEM_RAM); realview_binfo.ram_size = ram_size; realview_binfo.kernel_filename = kernel_filename; realview_binfo.kernel_cmdline = kernel_cmdline; realview_binfo.initrd_filename = initrd_filename; realview_binfo.nb_cpus = ncpu; arm_load_kernel(first_cpu, &realview_binfo); }
1threat
static int parse_dsd_prop(AVFormatContext *s, AVStream *st, uint64_t eof) { AVIOContext *pb = s->pb; char abss[24]; int hour, min, sec, i, ret, config; int dsd_layout[6]; ID3v2ExtraMeta *id3v2_extra_meta; while (avio_tell(pb) + 12 <= eof) { uint32_t tag = avio_rl32(pb); uint64_t size = avio_rb64(pb); uint64_t orig_pos = avio_tell(pb); switch(tag) { case MKTAG('A','B','S','S'): if (size < 8) return AVERROR_INVALIDDATA; hour = avio_rb16(pb); min = avio_r8(pb); sec = avio_r8(pb); snprintf(abss, sizeof(abss), "%02dh:%02dm:%02ds:%d", hour, min, sec, avio_rb32(pb)); av_dict_set(&st->metadata, "absolute_start_time", abss, 0); break; case MKTAG('C','H','N','L'): if (size < 2) return AVERROR_INVALIDDATA; st->codecpar->channels = avio_rb16(pb); if (size < 2 + st->codecpar->channels * 4) return AVERROR_INVALIDDATA; st->codecpar->channel_layout = 0; if (st->codecpar->channels > FF_ARRAY_ELEMS(dsd_layout)) { avpriv_request_sample(s, "channel layout"); break; } for (i = 0; i < st->codecpar->channels; i++) dsd_layout[i] = avio_rl32(pb); for (i = 0; i < FF_ARRAY_ELEMS(dsd_channel_layout); i++) { const DSDLayoutDesc * d = &dsd_channel_layout[i]; if (av_get_channel_layout_nb_channels(d->layout) == st->codecpar->channels && !memcmp(d->dsd_layout, dsd_layout, st->codecpar->channels * sizeof(uint32_t))) { st->codecpar->channel_layout = d->layout; break; } } break; case MKTAG('C','M','P','R'): if (size < 4) return AVERROR_INVALIDDATA; tag = avio_rl32(pb); st->codecpar->codec_id = ff_codec_get_id(dsd_codec_tags, tag); if (!st->codecpar->codec_id) { av_log(s, AV_LOG_ERROR, "'%c%c%c%c' compression is not supported\n", tag&0xFF, (tag>>8)&0xFF, (tag>>16)&0xFF, (tag>>24)&0xFF); return AVERROR_PATCHWELCOME; } break; case MKTAG('F','S',' ',' '): if (size < 4) return AVERROR_INVALIDDATA; st->codecpar->sample_rate = avio_rb32(pb) / 8; break; case MKTAG('I','D','3',' '): id3v2_extra_meta = NULL; ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta, size); if (id3v2_extra_meta) { if ((ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0) { ff_id3v2_free_extra_meta(&id3v2_extra_meta); return ret; } ff_id3v2_free_extra_meta(&id3v2_extra_meta); } if (size < avio_tell(pb) - orig_pos) { av_log(s, AV_LOG_ERROR, "id3 exceeds chunk size\n"); return AVERROR_INVALIDDATA; } break; case MKTAG('L','S','C','O'): if (size < 2) return AVERROR_INVALIDDATA; config = avio_rb16(pb); if (config != 0xFFFF) { if (config < FF_ARRAY_ELEMS(dsd_loudspeaker_config)) st->codecpar->channel_layout = dsd_loudspeaker_config[config]; if (!st->codecpar->channel_layout) avpriv_request_sample(s, "loudspeaker configuration %d", config); } break; } avio_skip(pb, size - (avio_tell(pb) - orig_pos) + (size & 1)); } return 0; }
1threat
How to declare a type globally in a project (typescript) : <p>In a typescript project, is there any way to declare a type and share it across all files, in the same way we have access to types defined globally at <code>node.d.ts</code>?</p> <p>For example, let's say that in my project a <code>IUser</code> is something such as </p> <pre><code>interface IUser { name: string, mail: string } </code></pre> <p>Ok, I can create that interface in a <code>common/interfaces.ts</code> file and import it every time I need it... but would be so nice to be able to declare such interfaces globally for the whole project and have quick access to them without importing any file</p>
0debug
static void help(int exitcode) { const char *options_help = #define QEMU_OPTIONS_GENERATE_HELP #include "qemu-options-wrapper.h" ; version(); printf("usage: %s [options] [disk_image]\n" "\n" "'disk_image' is a raw hard disk image for IDE hard disk 0\n" "\n" "%s\n" "During emulation, the following keys are useful:\n" "ctrl-alt-f toggle full screen\n" "ctrl-alt-n switch to virtual console 'n'\n" "ctrl-alt toggle mouse and keyboard grab\n" "\n" "When using -nographic, press 'ctrl-a h' to get some help.\n", error_get_progname(), options_help); exit(exitcode); }
1threat
NameError: name "user_choice1" is not defined : <p>I am trying out a simple program and keep getting this particular error:</p> <pre><code>line 34, in &lt;module&gt; user_choice1 == input("Do you want to exit or continue searching?") NameError: name 'user_choice1' is not defined </code></pre> <p>Here is the piece of code that is causing the error:</p> <pre><code>while True: choice = input("Do you want to add items?") if choice == "y": add_items() more = input("Do you want to add more items?") if more == "y": add_items() else: while True: user_choice = input("Adding items finished. Do you want to search items or exit?") if user_choice == "search": search_item() while True: user_choice1 == input("Do you want to exit or continue searching?") if user_choice1 == "continue": search_item() continue elif user_choice1 == "exit": sys.exit() else: break elif user_choice == "exit": sys.exit else: continue elif choice == "n": search_item() while True: user_choice2 = input("Searching finished. Do you want to continue or exit?") if user_choice2 == "continue": break continue elif user_choice2 == "exit": sys.exit() else: continue elif choice == "exit": sys.exit() else: print("Invalid Choice") </code></pre> <p>What is causing this error? I am using Python 3.5.2. Also, is there a better way to write this code as in, is there a way to optimize this code?</p>
0debug
static int local_lremovexattr(FsContext *ctx, const char *path, const char *name) { if ((ctx->fs_sm == SM_MAPPED) && (strncmp(name, "user.virtfs.", 12) == 0)) { errno = EACCES; return -1; } return lremovexattr(rpath(ctx, path), name); }
1threat
I am getting an error in Xcode, and I don't know why. Please Help :D : Me and my Friend are working on a project for code and we are getting this error. This is the exact code we told to use however we always get an error. I'm not really sure how to resolve this. For the line that says var tasks = task ()[] it keeps saying that "type 'task' has no subscript members". How can we fix this? import UIKit var taskMgr: TaskManager = TaskManager () struct task { var name = "Unnamed" var desc = "Undescribed" } class TaskManager: NSObject{ var tasks = task ()[] func addTask(name: String, desc: String) { self.tasks(task (name: name, desc: desc))! } }
0debug
static void extrapolate_isf(float isf[LP_ORDER_16k]) { float diff_isf[LP_ORDER - 2], diff_mean; float *diff_hi = diff_isf - LP_ORDER + 1; float corr_lag[3]; float est, scale; int i, i_max_corr; isf[LP_ORDER_16k - 1] = isf[LP_ORDER - 1]; for (i = 0; i < LP_ORDER - 2; i++) diff_isf[i] = isf[i + 1] - isf[i]; diff_mean = 0.0; for (i = 2; i < LP_ORDER - 2; i++) diff_mean += diff_isf[i] * (1.0f / (LP_ORDER - 4)); i_max_corr = 0; for (i = 0; i < 3; i++) { corr_lag[i] = auto_correlation(diff_isf, diff_mean, i + 2); if (corr_lag[i] > corr_lag[i_max_corr]) i_max_corr = i; } i_max_corr++; for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++) isf[i] = isf[i - 1] + isf[i - 1 - i_max_corr] - isf[i - 2 - i_max_corr]; est = 7965 + (isf[2] - isf[3] - isf[4]) / 6.0; scale = 0.5 * (FFMIN(est, 7600) - isf[LP_ORDER - 2]) / (isf[LP_ORDER_16k - 2] - isf[LP_ORDER - 2]); for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++) diff_hi[i] = scale * (isf[i] - isf[i - 1]); for (i = LP_ORDER; i < LP_ORDER_16k - 1; i++) if (diff_hi[i] + diff_hi[i - 1] < 5.0) { if (diff_hi[i] > diff_hi[i - 1]) { diff_hi[i - 1] = 5.0 - diff_hi[i]; } else diff_hi[i] = 5.0 - diff_hi[i - 1]; } for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++) isf[i] = isf[i - 1] + diff_hi[i] * (1.0f / (1 << 15)); for (i = 0; i < LP_ORDER_16k - 1; i++) isf[i] *= 0.8; }
1threat
Why does the cast operator to a private base not get used? : <p>In this code assigning to b1 works, but it won't allow assigning to b2 (with or without the static cast). I was actually trying to solve the opposite problem, public inheritance but not implicitly converting to the base. However the cast operator never seems to be used. Why is this?</p> <pre><code>struct B {}; struct D1 : private B { operator B&amp;() {return *this;} B&amp; getB() {return *this;} }; struct D2 : public B { explicit operator B&amp;() {return *this;} }; struct D3 : public B { operator B&amp;() = delete; }; void funB(B&amp; b){} int main () { D1 d1; funB(d1.getB()); // works // funB(d1); // fails to compile with 'inaccessible base class D2 d2; funB(d2); // works D3 d3; funB(d3); // works return 0; } </code></pre>
0debug
page not found in subpages of admin panel in live server : I have hosted a website of codeigniter framework by using godaddy server. The website is working nicely. And home page of admin panel is also working, but after first, the sub pages are giving page not found error, when i am trying to log in. I think its a url directions error.
0debug
Get name of dataframe passed through pipe in R : <p>I would like to be able to print the name of a dataframe passed through the pipe. Is this possible? I can do.</p> <pre><code>printname &lt;- function(df){ print(paste(substitute(df))) } printname(mtcars) #[1] "mtcars" </code></pre> <p>However, it returns "." when this function is piped using the <code>magrittr</code> pipe.</p> <pre><code>mtcars %&gt;% printname # [1] "." </code></pre> <p>This would be helpful when writing custom error messages of functions used in logged production processes -- it's hard to know where something failed if the only thing in the log is "." </p> <p>It would probably be enough to return the original call, which would include the <code>mtcars %&gt;%</code> piece.</p>
0debug
static void x8_init_block_index(MpegEncContext *s){ const int linesize = s->current_picture.f.linesize[0]; const int uvlinesize = s->current_picture.f.linesize[1]; s->dest[0] = s->current_picture.f.data[0]; s->dest[1] = s->current_picture.f.data[1]; s->dest[2] = s->current_picture.f.data[2]; s->dest[0] += s->mb_y * linesize << 3; s->dest[1] += ( s->mb_y&(~1) ) * uvlinesize << 2; s->dest[2] += ( s->mb_y&(~1) ) * uvlinesize << 2; }
1threat
static void test_i440fx_defaults(gconstpointer opaque) { const TestData *s = opaque; QPCIBus *bus; QPCIDevice *dev; uint32_t value; bus = test_start_get_bus(s); dev = qpci_device_find(bus, QPCI_DEVFN(0, 0)); g_assert(dev != NULL); g_assert_cmpint(qpci_config_readw(dev, PCI_VENDOR_ID), ==, 0x8086); g_assert_cmpint(qpci_config_readw(dev, PCI_DEVICE_ID), ==, 0x1237); #ifndef BROKEN g_assert_cmpint(qpci_config_readw(dev, PCI_COMMAND), ==, 0x0006); g_assert_cmpint(qpci_config_readw(dev, PCI_STATUS), ==, 0x0280); #endif g_assert_cmpint(qpci_config_readb(dev, PCI_CLASS_PROG), ==, 0x00); g_assert_cmpint(qpci_config_readw(dev, PCI_CLASS_DEVICE), ==, 0x0600); g_assert_cmpint(qpci_config_readb(dev, PCI_LATENCY_TIMER), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, PCI_HEADER_TYPE), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, PCI_BIST), ==, 0x00); value = qpci_config_readw(dev, 0x50); if (s->num_cpus == 1) { g_assert(!(value & (1 << 15))); } else { g_assert((value & (1 << 15))); } g_assert(!(value & (1 << 6))); g_assert_cmpint(qpci_config_readb(dev, 0x52), ==, 0x00); #ifndef BROKEN g_assert_cmpint(qpci_config_readb(dev, 0x53), ==, 0x80); #endif g_assert_cmpint(qpci_config_readb(dev, 0x54), ==, 0x00); g_assert_cmpint(qpci_config_readw(dev, 0x55), ==, 0x0000); #ifndef BROKEN g_assert_cmpint(qpci_config_readb(dev, 0x57), ==, 0x01); g_assert_cmpint(qpci_config_readb(dev, 0x58), ==, 0x10); #endif g_assert_cmpint(qpci_config_readb(dev, 0x59), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, 0x5A), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, 0x5B), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, 0x5C), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, 0x5D), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, 0x5E), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, 0x5F), ==, 0x00); #ifndef BROKEN g_assert_cmpint(qpci_config_readb(dev, 0x60), ==, 0x01); g_assert_cmpint(qpci_config_readb(dev, 0x61), ==, 0x01); g_assert_cmpint(qpci_config_readb(dev, 0x62), ==, 0x01); g_assert_cmpint(qpci_config_readb(dev, 0x63), ==, 0x01); g_assert_cmpint(qpci_config_readb(dev, 0x64), ==, 0x01); g_assert_cmpint(qpci_config_readb(dev, 0x65), ==, 0x01); g_assert_cmpint(qpci_config_readb(dev, 0x66), ==, 0x01); g_assert_cmpint(qpci_config_readb(dev, 0x67), ==, 0x01); #endif g_assert_cmpint(qpci_config_readb(dev, 0x68), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, 0x70), ==, 0x00); #ifndef BROKEN g_assert_cmpint(qpci_config_readb(dev, 0x71), ==, 0x10); #endif g_assert_cmpint(qpci_config_readb(dev, 0x72), ==, 0x02); g_assert_cmpint(qpci_config_readb(dev, 0x90), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, 0x91), ==, 0x00); g_assert_cmpint(qpci_config_readb(dev, 0x93), ==, 0x00); qtest_end(); }
1threat
CS50 PSET2 initials -less : I'm trying to get through this problem without looking at anyone else's code but i'm finding that extremely difficult. I understand how to iterate over characters and print those characters, I think. But i'm really stuck on how to only print one certain one and how to tell it to print the character after the space. Im guessing its something like, space char + 1? Here is what I have so far, however its isn't much. https://gist.github.com/ajess33/a79795847bc42eebe4463f504f427b9d
0debug
Adding local plugin to a Gradle project : <p>I have a Gradle plugin that compiles and works as expected. I would like to distribute with the source code an example application using the Gradle plugin which would also allow me to test changes to the plugin easily. Now to do this I must add a classpath dependency to the <code>buildScript</code> block. Is it possible to add a dependent local plugin that will be compiled with the example project? The main issue I'm having now is that the plugin does not exist when trying to sync the example project resulting in a failure.</p>
0debug
[Environment]::Exit(0) - MEANING OF THIS? : <p>What is the meaning of this line in PowerShell?</p> <p>I have tried searching on google but I do not see any specific explanations.</p>
0debug
Hello everyone! I am creating a Progressive Web App(PWA) and wanted to link it to firebase : As of now, I have successfully updated my data by manually making changes in firebase database and displaying it out in real time on my PWA. But now I wish to write/ insert data into realtime firebase database and simultaneously display the changes. My question is, how do we push data from a React WebApp to the real-time firebase database. I wasn't able to find any docs or videos on this matter. Kindly Help.
0debug
static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx) { int pic_size_indx, i, p; IVIPicConfig pic_conf; if (get_bits(&ctx->gb, 18) != 0x3FFF8) { av_log(avctx, AV_LOG_ERROR, "Invalid picture start code!\n"); return AVERROR_INVALIDDATA; } ctx->prev_frame_type = ctx->frame_type; ctx->frame_type = get_bits(&ctx->gb, 3); if (ctx->frame_type == 7) { av_log(avctx, AV_LOG_ERROR, "Invalid frame type: %d\n", ctx->frame_type); return AVERROR_INVALIDDATA; } #if IVI4_STREAM_ANALYSER if (ctx->frame_type == FRAMETYPE_BIDIR) ctx->has_b_frames = 1; #endif ctx->transp_status = get_bits1(&ctx->gb); #if IVI4_STREAM_ANALYSER if (ctx->transp_status) { ctx->has_transp = 1; } #endif if (get_bits1(&ctx->gb)) { av_log(avctx, AV_LOG_ERROR, "Sync bit is set!\n"); return AVERROR_INVALIDDATA; } ctx->data_size = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 24) : 0; if (ctx->frame_type >= FRAMETYPE_NULL_FIRST) { av_dlog(avctx, "Null frame encountered!\n"); return 0; } if (get_bits1(&ctx->gb)) { skip_bits_long(&ctx->gb, 32); av_dlog(avctx, "Password-protected clip!\n"); } pic_size_indx = get_bits(&ctx->gb, 3); if (pic_size_indx == IVI4_PIC_SIZE_ESC) { pic_conf.pic_height = get_bits(&ctx->gb, 16); pic_conf.pic_width = get_bits(&ctx->gb, 16); } else { pic_conf.pic_height = ivi4_common_pic_sizes[pic_size_indx * 2 + 1]; pic_conf.pic_width = ivi4_common_pic_sizes[pic_size_indx * 2 ]; } if (get_bits1(&ctx->gb)) { pic_conf.tile_height = scale_tile_size(pic_conf.pic_height, get_bits(&ctx->gb, 4)); pic_conf.tile_width = scale_tile_size(pic_conf.pic_width, get_bits(&ctx->gb, 4)); #if IVI4_STREAM_ANALYSER ctx->uses_tiling = 1; #endif } else { pic_conf.tile_height = pic_conf.pic_height; pic_conf.tile_width = pic_conf.pic_width; } if (get_bits(&ctx->gb, 2)) { av_log(avctx, AV_LOG_ERROR, "Only YVU9 picture format is supported!\n"); return AVERROR_INVALIDDATA; } pic_conf.chroma_height = (pic_conf.pic_height + 3) >> 2; pic_conf.chroma_width = (pic_conf.pic_width + 3) >> 2; pic_conf.luma_bands = decode_plane_subdivision(&ctx->gb); if (pic_conf.luma_bands) pic_conf.chroma_bands = decode_plane_subdivision(&ctx->gb); ctx->is_scalable = pic_conf.luma_bands != 1 || pic_conf.chroma_bands != 1; if (ctx->is_scalable && (pic_conf.luma_bands != 4 || pic_conf.chroma_bands != 1)) { av_log(avctx, AV_LOG_ERROR, "Scalability: unsupported subdivision! Luma bands: %d, chroma bands: %d\n", pic_conf.luma_bands, pic_conf.chroma_bands); return AVERROR_INVALIDDATA; } if (ivi_pic_config_cmp(&pic_conf, &ctx->pic_conf)) { if (ff_ivi_init_planes(ctx->planes, &pic_conf)) { av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate color planes!\n"); return AVERROR(ENOMEM); } ctx->pic_conf = pic_conf; for (p = 0; p <= 2; p++) { for (i = 0; i < (!p ? pic_conf.luma_bands : pic_conf.chroma_bands); i++) { ctx->planes[p].bands[i].mb_size = !p ? (!ctx->is_scalable ? 16 : 8) : 4; ctx->planes[p].bands[i].blk_size = !p ? 8 : 4; } } if (ff_ivi_init_tiles(ctx->planes, ctx->pic_conf.tile_width, ctx->pic_conf.tile_height)) { av_log(avctx, AV_LOG_ERROR, "Couldn't reallocate internal structures!\n"); return AVERROR(ENOMEM); } } ctx->frame_num = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 20) : 0; if (get_bits1(&ctx->gb)) skip_bits(&ctx->gb, 8); if (ff_ivi_dec_huff_desc(&ctx->gb, get_bits1(&ctx->gb), IVI_MB_HUFF, &ctx->mb_vlc, avctx) || ff_ivi_dec_huff_desc(&ctx->gb, get_bits1(&ctx->gb), IVI_BLK_HUFF, &ctx->blk_vlc, avctx)) return AVERROR_INVALIDDATA; ctx->rvmap_sel = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 3) : 8; ctx->in_imf = get_bits1(&ctx->gb); ctx->in_q = get_bits1(&ctx->gb); ctx->pic_glob_quant = get_bits(&ctx->gb, 5); ctx->unknown1 = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 3) : 0; ctx->checksum = get_bits1(&ctx->gb) ? get_bits(&ctx->gb, 16) : 0; while (get_bits1(&ctx->gb)) { av_dlog(avctx, "Pic hdr extension encountered!\n"); skip_bits(&ctx->gb, 8); } if (get_bits1(&ctx->gb)) { av_log(avctx, AV_LOG_ERROR, "Bad blocks bits encountered!\n"); } align_get_bits(&ctx->gb); return 0; }
1threat
Please help, guys : <p>Its app / site like brain trainer </p> <pre><code> &lt;body style="text-align: center;"&gt; &lt;h3 id="num1"&gt;&lt;/h3&gt; &lt;h3 id="num2"&gt;&lt;/h3&gt; &lt;input type="text" id="ans" /&gt; &lt;button id="myBtn" onclick="clickFunction()"&gt;Button&lt;/button&gt; &lt;p id="ind"&gt;&lt;/p&gt; &lt;script&gt; var i = 0; var number1 = Math.floor(Math.random() * 20); var number2 = Math.floor(Math.random() * 20); var result = number1 * number2; document.getElementById("num1").innerHTML = number1; document.getElementById("num2").innerHTML = number2; let answer = document.getElementById("ans"); if (result == answer) { document.getElementById("ind").innerHTML = "Indicator : Right " + i++ + "times."; } else { document.getElementById("ind").innerHTML = "Indicator : Right " + i-- + " times."; } answer.addEventListener("keyup", function(event) { if (event.keyCode === 13) { event.preventDefault(); document.getElementById("myBtn").click(); } }); &lt;/script&gt; </code></pre> <p>Please help, I need to add the button which submit the text in input and check,if it right.</p>
0debug
Xamarin.Forms.Maps 2.3.4 custom MapRenderer disables everything : <p>My problem occurs after I updated Xamarin.Forms and Xamarin.Forms.Maps to the new version (2.3.4).</p> <p>After that I also updated all google play services in Android project (and a lot of libraries that I hate).</p> <p>The main problem is that I have a custom MapRenderer for custom pins, in iOS and UWP works fine, but in Android version this custom MapRenderer brokes all the Map. Any property change or method call seems to be ignored.</p> <p>For example I have a button to toggle the map type (Hybrid or Street) and that action never changes it. I also noticed (according this tutorial: <a href="https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/map/customized-pin/" rel="noreferrer">https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/custom-renderer/map/customized-pin/</a>) that the property "VisibleRegion" never changes so the following code never executes:</p> <pre><code>protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) { base.OnElementPropertyChanged(sender, e); if (e.PropertyName.Equals("VisibleRegion") &amp;&amp; !_isDrawn) { // Do something with your custom map } } </code></pre> <p>Inside that <code>if</code> i used to populate my custom pins (like the tutorial above) and now my Map is always empty.</p> <p>Now i populate my map inside the <code>IOnMapReadyCallback</code> and it works fine, but the I still have the bindings problem.</p> <p>If I ignore the custom MapRendered (removing the assembly line) all the bindings starts working fine but my map now have the old pins and all customization is gone (obviously).</p> <p>In the PCL I have things like <code>MyMap.MoveToRegion(...)</code> and <code>MyMap.MapType = _currentType;</code> but those instructions only works if a don't use a custom MapRenderer.</p> <p>My custom MapRenderer is almost the same as the tutorial above.</p> <p>The custom Map is created with C# and not with XAML, it doesn't have any XAML binding but any property change or method call like the MoveToRegion or MapType is totally ignored if i'm using the MapRenderer.</p> <p>Any help?</p> <p>Thanks</p>
0debug
static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, int flags) { AVIOContext *pb = &asf->pb; int res, mflags, len_off; RTSPState *rt = s->priv_data; if (!rt->asf_ctx) if (len > 0) { int off, out_len = 0; if (len < 4) av_freep(&asf->buf); ffio_init_context(pb, buf, len, 0, NULL, NULL, NULL, NULL); while (avio_tell(pb) + 4 < len) { int start_off = avio_tell(pb); mflags = avio_r8(pb); if (mflags & 0x80) flags |= RTP_FLAG_KEY; len_off = avio_rb24(pb); if (mflags & 0x20) avio_skip(pb, 4); if (mflags & 0x10) avio_skip(pb, 4); if (mflags & 0x8) avio_skip(pb, 4); off = avio_tell(pb); if (!(mflags & 0x40)) { if (asf->pktbuf && len_off != avio_tell(asf->pktbuf)) { uint8_t *p; avio_close_dyn_buf(asf->pktbuf, &p); asf->pktbuf = NULL; av_free(p); } if (!len_off && !asf->pktbuf && (res = avio_open_dyn_buf(&asf->pktbuf)) < 0) return res; if (!asf->pktbuf) return AVERROR(EIO); avio_write(asf->pktbuf, buf + off, len - off); avio_skip(pb, len - off); if (!(flags & RTP_FLAG_MARKER)) out_len = avio_close_dyn_buf(asf->pktbuf, &asf->buf); asf->pktbuf = NULL; } else { int cur_len = start_off + len_off - off; int prev_len = out_len; out_len += cur_len; asf->buf = av_realloc(asf->buf, out_len); memcpy(asf->buf + prev_len, buf + off, FFMIN(cur_len, len - off)); avio_skip(pb, cur_len); } } init_packetizer(pb, asf->buf, out_len); pb->pos += rt->asf_pb_pos; pb->eof_reached = 0; rt->asf_ctx->pb = pb; } for (;;) { int i; res = av_read_packet(rt->asf_ctx, pkt); rt->asf_pb_pos = avio_tell(pb); if (res != 0) break; for (i = 0; i < s->nb_streams; i++) { if (s->streams[i]->id == rt->asf_ctx->streams[pkt->stream_index]->id) { pkt->stream_index = i; return 1; } } av_free_packet(pkt); } return res == 1 ? -1 : res; }
1threat
Why does parLapplyLB not actually balance load? : <p>I'm testing out the <code>parLapplyLB()</code> function to understand what it does to balance a load. But I'm not seeing any balancing happening. For example,</p> <pre><code>cl &lt;- parallel::makeCluster(2) system.time( parallel::parLapplyLB(cl, 1:4, function(y) { if (y == 1) { Sys.sleep(3) } else { Sys.sleep(0.5) }})) ## user system elapsed ## 0.004 0.009 3.511 parallel::stopCluster(cl) </code></pre> <p>If it was truly balancing the load, the first job (job 1) that sleeps for 3 seconds would be on the first node and the other three jobs (jobs 2:4) would sleep for a total of 1.5 seconds on the other node. In total, the system time should only be 3 seconds.</p> <p>Instead, I think that jobs 1 and 2 are given to node 1 and jobs 3 and 4 are given to node 2. This results in the total time being 3 + 0.5 = 3.5 seconds. If we run the same code above with <code>parLapply()</code> instead of <code>parLapplyLB()</code>, we get the same system time of about 3.5 seconds.</p> <p>What am I not understanding or doing wrong?</p>
0debug
void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt, int fdt_start_offset, Error **errp) { trace_spapr_drc_attach(spapr_drc_index(drc)); if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) { error_setg(errp, "an attached device is still awaiting release"); return; } if (spapr_drc_type(drc) == SPAPR_DR_CONNECTOR_TYPE_PCI) { g_assert(drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_USABLE); } g_assert(fdt); drc->dev = d; drc->fdt = fdt; drc->fdt_start_offset = fdt_start_offset; object_property_add_link(OBJECT(drc), "device", object_get_typename(OBJECT(drc->dev)), (Object **)(&drc->dev), NULL, 0, NULL); }
1threat
sofree(struct socket *so) { Slirp *slirp = so->slirp; struct mbuf *ifm; for (ifm = (struct mbuf *) slirp->if_fastq.qh_link; (struct quehead *) ifm != &slirp->if_fastq; ifm = ifm->ifq_next) { if (ifm->ifq_so == so) { ifm->ifq_so = NULL; for (ifm = (struct mbuf *) slirp->if_batchq.qh_link; (struct quehead *) ifm != &slirp->if_batchq; ifm = ifm->ifq_next) { if (ifm->ifq_so == so) { ifm->ifq_so = NULL; if (so->so_emu==EMU_RSH && so->extra) { sofree(so->extra); so->extra=NULL; if (so == slirp->tcp_last_so) { slirp->tcp_last_so = &slirp->tcb; } else if (so == slirp->udp_last_so) { slirp->udp_last_so = &slirp->udb; } else if (so == slirp->icmp_last_so) { slirp->icmp_last_so = &slirp->icmp; m_free(so->so_m); if(so->so_next && so->so_prev) remque(so); free(so);
1threat
Android Espresso - Click checkbox if not checked : <p>I have <code>onView(withId(R.id.check_box)).perform(click())</code>, but i only want to do this if the check box is not already checked. How can I do this in espresso?</p>
0debug
Android to iOS Unity3d : <p>I was wondering what is the difference in developing for mobile Android and porting it to iOS? I don't have any iOS devices or a Mac and do not know if my project will work on iOS. I am asking for some sort of reference of converting Android code to iOS, if there is a difference. I am using Unity 5.4 just in case that helps.</p>
0debug
Allow All Content Security Policy? : <p>Is it possible to configure the Content-Security-Policy to not block anything at all? I'm running a computer security class, and our web hacking project is running into issues on newer versions of Chrome because without any CSP headers, it's automatically blocking certain XSS attacks.</p>
0debug
php pashword_hash verificatioin : The following code should be straight forward and simple, the insert into the db on signup creates a hash, but later when I try to login with the same password the hash it is creating isn't matching up to what is in the database (I had print_r's throughout to verify). Can someone see if I'm just overlooking something dumb? session_start(); require_once("login.php"); $error = ""; $email = ""; $password = ""; if(isset($_GET['logout'])) { unset($_SESSION['id']); setcookie('id', '', time() - 60*60); $_COOKIE['id'] = ""; } else{ if(isset($_SESSION['id']) or isset($_COOKIE['id'])) { header("Location: loggedinpage.php"); } } if(isset($_POST["submit"])){ $link = mysqli_connect($hn, $un,$pw,$db); if($link->connect_error) die("Fatal Errror."); if(!$_POST["email"]){ $error .="An email address is required<br>"; } if(!$_POST["password"]){ $error .="A password address is required<br>"; } if($error != ""){ $error= "<p>There were error(s) in your form:</p>".$error; } else{ if($_POST['signup'] == 1) { $email = mysqli_real_escape_string($link, $_POST['email']); $password = mysqli_real_escape_string($link,$_POST['password']); $query = "SELECT id FROM `users` WHERE email = '".$email."' LIMIT 1"; $result=$link->query($query); if(mysqli_num_rows($result) > 0){ $error = "That email address is taken."; } else{ $hashedPassword = password_hash($password, PASSWORD_DEFAULT); $query = "INSERT INTO `users`(`email`,`password`) VALUES ('".$email."', '".$hashedPassword."')"; if(!mysqli_query($link,$query)){ $error = "<p>Could not sign you up, please try again later</p>"; } else{ $_SESSION['id'] = mysqli_insert_id($link); if(isset($_POST['stayLoggedIn']) and $_POST['stayLoggedIn'] == 1) { setcookie('id', mysqli_insert_id($link), time()+60*60*24); } header("Location: loggedinpage.php"); } } } else{ $email = mysqli_real_escape_string($link, $_POST['email']); $password = mysqli_real_escape_string($link, $_POST['password']); $hashedPassword = password_hash($password,PASSWORD_DEFAULT); $query = "SELECT * FROM users WHERE email = '".$email."' LIMIT 1"; $result = $link->query($query); if($result->num_rows > 0){ $row = $result->fetch_array(MYSQLI_ASSOC); if($email == $row['email'] and password_verify($password,$row['password'])){ if(isset($_POST['stayLoggedIn']) and $_POST['stayLoggedIn'] == 1){ setcookie('id', $row['id'], time()+60*60*24); header("Location: loggedinpage.php"); } } else{ $error = "Incorrect Username/Password combination"; } } } } }
0debug
What does "*&n" mean in double-pointer c++? : <p>here it is the code that the teacher gave me to solve in a quiz. can you explain to me what is the *&amp;n do or print out?</p> <p>first of all: is it even possible to have such a thing?</p> <pre class="lang-cpp prettyprint-override"><code>int x = 5; int* p = &amp;x; int** n = &amp;p; std::cout &lt;&lt; *&amp;n; </code></pre>
0debug
static void memory_region_add_subregion_common(MemoryRegion *mr, hwaddr offset, MemoryRegion *subregion) { MemoryRegion *other; memory_region_transaction_begin(); assert(!subregion->parent); memory_region_ref(subregion); subregion->parent = mr; subregion->addr = offset; QTAILQ_FOREACH(other, &mr->subregions, subregions_link) { if (subregion->may_overlap || other->may_overlap) { continue; } if (int128_ge(int128_make64(offset), int128_add(int128_make64(other->addr), other->size)) || int128_le(int128_add(int128_make64(offset), subregion->size), int128_make64(other->addr))) { continue; } #if 0 printf("warning: subregion collision %llx/%llx (%s) " "vs %llx/%llx (%s)\n", (unsigned long long)offset, (unsigned long long)int128_get64(subregion->size), subregion->name, (unsigned long long)other->addr, (unsigned long long)int128_get64(other->size), other->name); #endif } QTAILQ_FOREACH(other, &mr->subregions, subregions_link) { if (subregion->priority >= other->priority) { QTAILQ_INSERT_BEFORE(other, subregion, subregions_link); goto done; } } QTAILQ_INSERT_TAIL(&mr->subregions, subregion, subregions_link); done: memory_region_update_pending |= mr->enabled && subregion->enabled; memory_region_transaction_commit(); }
1threat
static BOOL WINAPI qemu_ctrl_handler(DWORD type) { exit(STATUS_CONTROL_C_EXIT); return TRUE; }
1threat
What's the difference between a Docker image's Image ID and its Digest? : <p>This has been surprisingly confusing for me. I thought Docker's Image ID is its SHA256 hash. However, apparently the result from <code>docker image ls --digests</code> (listed under the column header <code>DIGEST</code>) is different from the <code>IMAGE ID</code> of that image.</p> <p>For example</p> <pre><code>docker image ls --digests alpine REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE alpine latest sha256:769fddc7cc2f0a1c35abb2f91432e8beecf83916c421420e6a6da9f8975464b6 055936d39205 2 weeks ago 5.53MB </code></pre> <p>while </p> <pre><code>docker image ls --no-trunc REPOSITORY TAG IMAGE ID CREATED SIZE ... alpine latest sha256:055936d3920576da37aa9bc460d70c5f212028bda1c08c0879aedf03d7a66ea1 2 weeks ago 5.53MB </code></pre> <p>Clearly <code>sha256:055936d3920576da37aa9bc460d70c5f212028bda1c08c0879aedf03d7a66ea1</code> (IMAGE ID) and <code>sha256:769fddc7cc2f0a1c35abb2f91432e8beecf83916c421420e6a6da9f8975464b6</code> (DIGEST) are not the same value. But why? What's the purpose of having two different <code>sha256</code> hashes of the same image. How are they calculated, respectively?</p> <p>I was confused by this when reading the book <em>Docker Deep Dive</em>, and I haven't been able to find a clear answer either in the book or online.</p>
0debug
static void qio_dns_resolver_lookup_data_free(gpointer opaque) { struct QIODNSResolverLookupData *data = opaque; size_t i; qapi_free_SocketAddressLegacy(data->addr); for (i = 0; i < data->naddrs; i++) { qapi_free_SocketAddressLegacy(data->addrs[i]); } g_free(data->addrs); g_free(data); }
1threat
Java - Stream - Collect every N elements : <p>I am trying to learn java - stream. I am able to do simple iteration / filter / map / collection etc.</p> <p>When I was kind of trying to collect every 3 elements and print as shown here in this example, [collect every 3 elements and print and so on...]</p> <pre><code> List&lt;String&gt; list = Arrays.asList("a","b","c","d","e","f","g","h","i","j"); int count=0; String append=""; for(String l: list){ if(count&gt;2){ System.out.println(append); System.out.println("-------------------"); append=""; count=0; } append = append + l; count++; } System.out.println(append); </code></pre> <p><strong>output:</strong></p> <pre><code>abc ------------------- def ------------------- ghi ------------------- j </code></pre> <p>I am not getting any clue how to do this using stream. Should i implement my own collector to achieve this?</p>
0debug
How to pull image from dockerhub in kubernetes? : <p>I am planning to deploy an application in my kubernetes-clustering infra. I pushed image to dockerhub repo. How can I pull image from dockerhub?</p>
0debug
how to sum smallest five number out of seven in ms access querry rows : example history geography physics mathematics agriculture science Civics 1 2 4 5 6 7 3 if tried much to use =sum(small{1,2,3,4,5}) as used in excel, but what i need is for access
0debug
Xcode 9.2 says my "iPhone has recently restarted" and won't run : <p>I am making an app in Xcode 9.2 and trying to run it on my iPhone (5S running iOS 11.2.1), Xcode compiles the application fine (I can run it in the simulator) but it does not run on my iPhone.</p> <p>When I try to run it on my iPhone it just says "<em>iPhone has recently restarted</em>" and "<em>Xcode will continue when iPhone is unlocked.</em>" Now, my phone <strong>has not recently restarted</strong> and I tried unlocking the phone and restarting it but neither works. I also tried restarting Xcode.</p> <p>Is anyone else getting this "recently restarted" error? Is there anything I can do about it?</p>
0debug
How do I retrieve records from database which were inserted previous days after 9 am and today before 9 am. : <p>I have table with records being inserted along with its creation time stamp. Now I want to display records in laravel admin panel which were inserted between yesterday after 9 am and today before 9 am. How do I achieve this? A small lead on this would be very helpful. Thank You.</p>
0debug
Matrix in C! Please help and explain : SO if you already have a set 4x4 matrix. Ex. Matrix A = [1 2 3 4; 5 6 7 8;` 9 10 11 12; 13 14 15 16] how would you covert that into coding? Also what would there positions be in code? For instance to get number 1 one matrix A would the code be A[1][1]? If you can explain I will appreciate it!! main(){ int matrixA[4][4] = [{"1","2","3","4"}; {"1","0","1","1"}; {"1","1","0","1"}; {"1","1","1","0"}]; printf(matrix A); return 0; }
0debug
what is wrong with this block of code? : else{ if(getThread() != null && getThread().length() > 5){ System.out.println("thread character is les than 65, we dont need to cut"); try (PreparedStatement pstmt2 = conn.prepareStatement("CREATE TABLE " + getThread() +" (`Id` INT(4) NOT NULL AUTO_INCREMENT,`name` VARCHAR(65) NOT NULL,`comment` LONGTEXT NOT NULL,`date` VARCHAR(65) NOT NULL,PRIMARY KEY (`Id`)) COLLATE=`utf8_general_ci` ENGINE=InnoDB;")) { pstmt2.execute(); } System.out.println(" table created with thread name"); java.util.Date dt = new java.util.Date(); java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String currentTime = sdf.format(dt); if(getCommentor() != null){ try (PreparedStatement pstmt = conn.prepareStatement("INSERT INTO"+ getThread() +"( `Id`,`name`,`comment`,`date`) VALUES (NULL,?,?,?);")) { pstmt.setString(1,getCommentor()); pstmt.setString(2,getText()); pstmt.setString(3,currentTime); pstmt.executeUpdate(); pstmt.close(); conn.close(); } FacesContext context1 = FacesContext.getCurrentInstance(); context1.addMessage(null, new FacesMessage("Comment Recieved")); } i'm trying to excute a create statement but i keep getting ***com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'news (`Id` INT(4) NOT NULL AUTO_INCREMENT,`name` VARCHAR(65) NOT NULL,`comment` ' at line 1*** and i dont see what i'm doing wrong! why am i getting this error?
0debug
How to create an immutable list in Kotlin that is also an immutable list in Java? : <p>I have a Java/Kotlin interop problem. A Kotlin immutable list is compiled into a normal java.util.ArrayList that is mutable!</p> <p>Kotlin (library):</p> <pre><code>class A { val items: List&lt;Item&gt; = ArrayList() } </code></pre> <p>Java (consumer):</p> <pre><code>A a = new A(); a.getItems().add(new Item()); // Compiles and runs but I wish to fail or throw </code></pre> <p>How to make my Kotlin class fully immutable from Java perspective too?</p>
0debug
static void host_memory_backend_set_prealloc(Object *obj, bool value, Error **errp) { Error *local_err = NULL; HostMemoryBackend *backend = MEMORY_BACKEND(obj); if (backend->force_prealloc) { if (value) { error_setg(errp, "remove -mem-prealloc to use the prealloc property"); return; } } if (!memory_region_size(&backend->mr)) { backend->prealloc = value; return; } if (value && !backend->prealloc) { int fd = memory_region_get_fd(&backend->mr); void *ptr = memory_region_get_ram_ptr(&backend->mr); uint64_t sz = memory_region_size(&backend->mr); os_mem_prealloc(fd, ptr, sz, &local_err); if (local_err) { error_propagate(errp, local_err); return; } backend->prealloc = true; } }
1threat
GetOpt Long processing similar input names : <p>I'm running a perl script with a lot of input options, one of them being:</p> <pre><code> 'errorcode=s{1,}' =&gt; \@ecodes, </code></pre> <p>I have a die at the end of the GetOptions if anything entered doesn't match the input. However if I input '--ecode 500' the program runs. </p> <p>Why isn't the script dying? If I try something else like '--testing 123' it does die.</p>
0debug
How can I bring a node express app online? : <p>I've built a node express app and now I want to make it available on a website. What are the steps I need to take? This may be a very general newbie question, but I've never bought a domain before and I don't know how to get anything on it. Google didn't help much unfortunately.</p>
0debug
void *av_realloc(void *ptr, size_t size) { #if CONFIG_MEMALIGN_HACK int diff; #endif if (size > (MAX_MALLOC_SIZE-16)) return NULL; #if CONFIG_MEMALIGN_HACK if(!ptr) return av_malloc(size); diff= ((char*)ptr)[-1]; return (char*)realloc((char*)ptr - diff, size + diff) + diff; #else return realloc(ptr, size + !size); #endif }
1threat
Display an image from url in ReactJS : <p>I want to display an image from a URL in React. For example, I want this image </p> <pre><code>https://images.pexels.com/photos/20787/pexels-photo.jpg?auto=compress&amp;cs=tinysrgb&amp;h=350 </code></pre> <p>to be displayed in a Card body or reactJS. Is it possible to do it or do I have to download it to assets before I can display it? And how to do it?</p>
0debug
Aml *aml_buffer(void) { Aml *var = aml_bundle(0x11 , AML_BUFFER); return var; }
1threat
void do_store_dcr (void) { if (unlikely(env->dcr_env == NULL)) { if (loglevel != 0) { fprintf(logfile, "No DCR environment\n"); } do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_INVAL_INVAL); } else if (unlikely(ppc_dcr_write(env->dcr_env, T0, T1) != 0)) { if (loglevel != 0) { fprintf(logfile, "DCR write error %d %03x\n", (int)T0, (int)T0); } do_raise_exception_err(EXCP_PROGRAM, EXCP_INVAL | EXCP_PRIV_REG); } }
1threat
static av_always_inline int sbr_hf_apply_noise(int (*Y)[2], const SoftFloat *s_m, const SoftFloat *q_filt, int noise, int phi_sign0, int phi_sign1, int m_max) { int m; for (m = 0; m < m_max; m++) { int y0 = Y[m][0]; int y1 = Y[m][1]; noise = (noise + 1) & 0x1ff; if (s_m[m].mant) { int shift, round; shift = 22 - s_m[m].exp; if (shift < 1) { av_log(NULL, AV_LOG_ERROR, "Overflow in sbr_hf_apply_noise, shift=%d\n", shift); return AVERROR(ERANGE); } else if (shift < 30) { round = 1 << (shift-1); y0 += (s_m[m].mant * phi_sign0 + round) >> shift; y1 += (s_m[m].mant * phi_sign1 + round) >> shift; } } else { int shift, round, tmp; int64_t accu; shift = 22 - q_filt[m].exp; if (shift < 1) { av_log(NULL, AV_LOG_ERROR, "Overflow in sbr_hf_apply_noise, shift=%d\n", shift); return AVERROR(ERANGE); } else if (shift < 30) { round = 1 << (shift-1); accu = (int64_t)q_filt[m].mant * ff_sbr_noise_table_fixed[noise][0]; tmp = (int)((accu + 0x40000000) >> 31); y0 += (tmp + round) >> shift; accu = (int64_t)q_filt[m].mant * ff_sbr_noise_table_fixed[noise][1]; tmp = (int)((accu + 0x40000000) >> 31); y1 += (tmp + round) >> shift; } } Y[m][0] = y0; Y[m][1] = y1; phi_sign1 = -phi_sign1; } return 0; }
1threat
std::tie vs std::make_tuple : <p><a href="http://ideone.com/bGk17H" rel="noreferrer">This code compiles</a> but I'm wondering which version should be preferred:</p> <pre><code>#include &lt;iostream&gt; #include &lt;tuple&gt; using namespace std; tuple&lt;int, int, int&gt; return_tuple1() { int a = 33; int b = 22; int c = 31; return tie(a, b, c); } tuple&lt;int, int, int&gt; return_tuple2() { int a = 33; int b = 22; int c = 31; return make_tuple(a, b, c); } int main() { auto a = return_tuple1(); auto b = return_tuple2(); return 0; } </code></pre> <p>since the function is returning a tuple by value there shouldn't be any problem in using <code>std::tie</code> right? (i.e. no dangling references)</p>
0debug
static int update_prob(VP56RangeCoder *c, int p) { static const int inv_map_table[254] = { 7, 20, 33, 46, 59, 72, 85, 98, 111, 124, 137, 150, 163, 176, 189, 202, 215, 228, 241, 254, 1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, }; int d; if (!vp8_rac_get(c)) { d = vp8_rac_get_uint(c, 4) + 0; } else if (!vp8_rac_get(c)) { d = vp8_rac_get_uint(c, 4) + 16; } else if (!vp8_rac_get(c)) { d = vp8_rac_get_uint(c, 5) + 32; } else { d = vp8_rac_get_uint(c, 7); if (d >= 65) d = (d << 1) - 65 + vp8_rac_get(c); d += 64; } return p <= 128 ? 1 + inv_recenter_nonneg(inv_map_table[d], p - 1) : 255 - inv_recenter_nonneg(inv_map_table[d], 255 - p); }
1threat
Using a for loop to read 2 scores and average them. JAVA : 1) insert the number of students 2) insert 2 scores for each students 3) find and print the average of the 2 scores from 100 4) print if the student will pass or fail by for-loop
0debug
React create app hot reload is not always working on linux : <p>I created a react application using create-react-app boilerplate, which seems to be very popular, hot reload some times updates when any of the files changes and some times not, seems like there is a minimum duration or something like that, I'm using Ubuntu, node version 7.0, the script in package.json is <code>npm:'react-script start'</code> what I am missing ?</p>
0debug
static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVIContext *avi = s->priv_data; AVStream *st; int i, index; int64_t pos, pos_min; AVIStream *ast; if (avi->dv_demux) stream_index = 0; if (!avi->index_loaded) { avi_load_index(s); avi->index_loaded |= 1; } av_assert0(stream_index >= 0); st = s->streams[stream_index]; ast = st->priv_data; index = av_index_search_timestamp(st, timestamp * FFMAX(ast->sample_size, 1), flags); if (index < 0) { if (st->nb_index_entries > 0) av_log(s, AV_LOG_DEBUG, "Failed to find timestamp %"PRId64 " in index %"PRId64 " .. %"PRId64 "\n", timestamp * FFMAX(ast->sample_size, 1), st->index_entries[0].timestamp, st->index_entries[st->nb_index_entries - 1].timestamp); return AVERROR_INVALIDDATA; } pos = st->index_entries[index].pos; timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1); av_log(s, AV_LOG_TRACE, "XX %"PRId64" %d %"PRId64"\n", timestamp, index, st->index_entries[index].timestamp); if (CONFIG_DV_DEMUXER && avi->dv_demux) { if (avio_seek(s->pb, pos, SEEK_SET) < 0) return -1; ff_dv_offset_reset(avi->dv_demux, timestamp); avi->stream_index = -1; return 0; } pos_min = pos; for (i = 0; i < s->nb_streams; i++) { AVStream *st2 = s->streams[i]; AVIStream *ast2 = st2->priv_data; ast2->packet_size = ast2->remaining = 0; if (ast2->sub_ctx) { seek_subtitle(st, st2, timestamp); continue; } if (st2->nb_index_entries <= 0) continue; av_assert0(fabs(av_q2d(st2->time_base) - ast2->scale / (double)ast2->rate) < av_q2d(st2->time_base) * 0.00000001); index = av_index_search_timestamp(st2, av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), flags | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (index < 0) index = 0; ast2->seek_pos = st2->index_entries[index].pos; pos_min = FFMIN(pos_min,ast2->seek_pos); } for (i = 0; i < s->nb_streams; i++) { AVStream *st2 = s->streams[i]; AVIStream *ast2 = st2->priv_data; if (ast2->sub_ctx || st2->nb_index_entries <= 0) continue; index = av_index_search_timestamp( st2, av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), flags | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (index < 0) index = 0; while (!avi->non_interleaved && index>0 && st2->index_entries[index-1].pos >= pos_min) index--; ast2->frame_offset = st2->index_entries[index].timestamp; } if (avio_seek(s->pb, pos_min, SEEK_SET) < 0) { av_log(s, AV_LOG_ERROR, "Seek failed\n"); return -1; } avi->stream_index = -1; avi->dts_max = INT_MIN; return 0; }
1threat
Similar code. One works, one crashes. Why? : <p>I was working on a problem for Project Euler using C++ in Code::Blocks 10.05 and found my program to be crashing in a strange place: the initialization. Here is a code snippet that reproduces the problem.</p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;deque&gt; using namespace std; vector&lt;deque&lt;uint32_t&gt; &gt; f; int main() { deque&lt;uint32_t&gt; p; deque&lt;uint32_t&gt;::iterator dit1,dit2; p.push_back(0); p.push_back(1); f.push_back(p); cout &lt;&lt; f.back().size() &lt;&lt; endl; cout &lt;&lt; "f= "; for(dit1==f.back().begin();dit1!=f.back().end();dit1++) cout &lt;&lt; *dit1 &lt;&lt; " "; cout &lt;&lt; "Checkpoint" &lt;&lt; endl; return 0; } </code></pre> <p>Before posting here, I tried a test program to see if I could figure out the problem.</p> <pre><code>#include &lt;iostream&gt; #include &lt;deque&gt; #include &lt;vector&gt; using namespace std; int main(void) { uint64_t i; deque&lt;uint32_t&gt; d; vector&lt;deque&lt;uint32_t&gt; &gt; vd; deque&lt;uint32_t&gt;::iterator it; for(i=1;i&lt;=5;i++) d.push_back(i); vd.push_back(d); for(it=vd.back().begin();it!=vd.back().end();it++) cout &lt;&lt; *it &lt;&lt; " "; return 0; } </code></pre> <p>The first program crashes while the second correctly reproduces the deque. Besides variable names, the only major difference I see is the first program uses a global variable and the test program uses a local variable. So why does the first program crash in the for loop while the second does not?</p>
0debug
Moving people to voice channels (Discord.net) : I seam to have this weird error and I don't know how to fix it. await userName.ModifyAsync(x => { x.Channel = Program.client.GetChannel(588025239103995904) as IVoiceChannel; }); Error: Cannot implicitly convert type 'Discord.IVoiceChannel' to 'Discord.Optional<Discord.IVoiceChannel>'
0debug
How do I turn int into float in C? : <p>I have a simple question in C. How do i turn an int value into a float, so I can add nonintegers to it. </p> <p>Like say</p> <pre><code>int i = 1; </code></pre> <p>How can I add 0.5 to i to get a float number 1.5? I've tried:</p> <pre><code>float j = (float)i + 0.5; </code></pre> <p>Doesn't seem to work. </p> <p>Pleas help. </p>
0debug
Pluck with multiple columns? : <p>When i use pluck with multiple columns i get this:</p> <pre><code>{"Kreis 1 \/ Altstadt":"City","Kreis 2":"Enge","Kreis 3":"Sihifeld","Kreis 4":"Hard","Kreis 5 \/ Industriequartier":"Escher Wyss","Kreis 6":"Oberstrass","Kreis 7":"Witikon","Kreis 8 \/ Reisbach":"Weinegg","Kreis 9":"Altstetten","Kreis 10":"Wipkingen","Kreis 11":"Seebach","Kreis 12 \/ Schwamendingen":"Hirzenbach" </code></pre> <p>But i need this?</p> <pre><code>["Rathaus","Hochschulen","Lindenhof","City","Wollishofen","Leimbach","Enge","Alt-Wiedikon","Friesenberg","Sihifeld","Werd","Langstrasse","Hard","Gewerbechule","Escher Wyss","Unterstrass","Oberstrass","Fluntern","Hottingen","Hirslanden","Witikon","Seefeld","M\u00fchlebach","Weinegg","Albisrieden","Altstetten","H\u00f6ngg","Wipkingen","Affoltern","Oerlikon","Seebach","Saatlen","Schwamendingen-Mitte","Hirzenbach"] </code></pre> <p>Any suggestion how can i do that? This is my method:</p> <pre><code> public function autocomplete_districts(Request $request) { $district = $request-&gt;input('query'); // $ass = /DB::table('districts')-&gt;select(array('district', 'region'))-&gt;get(); // dd($ass); $data = Districts::whereRaw('LOWER(district) like ?', [strtolower('%'.$district . '%')])-&gt;orWhereRaw('LOWER(region) like ?', [strtolower('%'.$district . '%')])-&gt;pluck('region','district'); return response()-&gt;json($data); } </code></pre>
0debug
static int64_t ivshmem_recv_msg(IVShmemState *s, int *pfd, Error **errp) { int64_t msg; int n, ret; n = 0; do { ret = qemu_chr_fe_read_all(&s->server_chr, (uint8_t *)&msg + n, sizeof(msg) - n); if (ret < 0) { if (ret == -EINTR) { continue; } error_setg_errno(errp, -ret, "read from server failed"); return INT64_MIN; } n += ret; } while (n < sizeof(msg)); *pfd = qemu_chr_fe_get_msgfd(&s->server_chr); return msg; }
1threat
Cross-thread issue, invoking? : <p>i have been searching online and cant seem to find an appropriate fix for my error: <code>Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on.</code></p> <p>I looked onto but cant figure out how i invoke my size change?</p> <p>My code which works some times and the other throws the above code is:</p> <pre><code>'Handler to handle screen resizes! (Tablet being flipped etc...) Private Sub TouchRadio_Resize(sender As Object, e As EventArgs) Handles Me.Resize Dim thread As New Thread(AddressOf resizescreen) thread.Start() End Sub Public Sub resizescreen() System.Threading.Thread.Sleep(1) For index As Integer = 1 To 50000 If Screen.PrimaryScreen.Bounds.Width = (Screen.PrimaryScreen.Bounds.Width + 17) Then Exit For End If Dim screenWidth As Integer = Screen.PrimaryScreen.Bounds.Width screenWidth = (screenWidth + 17) Dim screenHeight As Integer = Screen.PrimaryScreen.Bounds.Height Me.Size = New System.Drawing.Size(screenWidth, screenHeight) 'Here it errors at GeckoWebBrowser1.Size = New System.Drawing.Size(screenWidth, screenHeight) Me.Location = New Point(0, 0) Next End Sub </code></pre>
0debug
A cookie header was received that contained an invalid cookie. : <p>I am <strong>migrating</strong> my Server from <strong>Tomcat-6</strong> to <strong>Tomcat-9</strong>. My website is designed for the protocol of HTTP/1.1 . The server.xml file contains the Connector Protocol of <strong>org.apache.coyote.http11.Http11NioProtocol</strong> . The server starts up normally without generating any errors. However, when I try to access my website using localhost, I get the following error :-</p> <p>INFO [https-nio-8445-exec-3] <strong>org.apache.tomcat.util.http.parser.Cookie.logInvalidHeader</strong> A cookie header was received [ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 21, 22, 23]; userId=53136] that contained an invalid cookie. That cookie will be ignored.Note: further occurrences of this error will be logged at DEBUG level. </p> <p>Can anyone please tell me the reason for this error? What causes an invalid cookie? Can this error be avoided if I use a different connector?</p>
0debug
static int parse_ifo_palette(DVDSubContext *ctx, char *p) { FILE *ifo; char ifostr[12]; uint32_t sp_pgci, pgci, off_pgc, pgc; uint8_t r, g, b, yuv[65], *buf; int i, y, cb, cr, r_add, g_add, b_add; int ret = 0; const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; ctx->has_palette = 0; if ((ifo = fopen(p, "r")) == NULL) { av_log(ctx, AV_LOG_WARNING, "Unable to open IFO file \"%s\": %s\n", p, strerror(errno)); return AVERROR_EOF; } if (fread(ifostr, 12, 1, ifo) != 1 || memcmp(ifostr, "DVDVIDEO-VTS", 12)) { av_log(ctx, AV_LOG_WARNING, "\"%s\" is not a proper IFO file\n", p); ret = AVERROR_INVALIDDATA; goto end; } fseek(ifo, 0xCC, SEEK_SET); if (fread(&sp_pgci, 4, 1, ifo) == 1) { pgci = av_be2ne32(sp_pgci) * 2048; fseek(ifo, pgci + 0x0C, SEEK_SET); if (fread(&off_pgc, 4, 1, ifo) == 1) { pgc = pgci + av_be2ne32(off_pgc); fseek(ifo, pgc + 0xA4, SEEK_SET); if (fread(yuv, 64, 1, ifo) == 1) { buf = yuv; for(i=0; i<16; i++) { y = *++buf; cr = *++buf; cb = *++buf; YUV_TO_RGB1_CCIR(cb, cr); YUV_TO_RGB2_CCIR(r, g, b, y); ctx->palette[i] = (r << 16) + (g << 8) + b; buf++; } ctx->has_palette = 1; } } } if (ctx->has_palette == 0) { av_log(ctx, AV_LOG_WARNING, "Failed to read palette from IFO file \"%s\"\n", p); ret = AVERROR_INVALIDDATA; } end: fclose(ifo); return ret; }
1threat
static int RENAME(dct_quantize)(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow) { int level=0, last_non_zero_p1, q; const uint16_t *qmat, *bias; static __align8 int16_t temp_block[64]; ff_fdct_mmx (block); if (s->mb_intra) { int dummy; if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; if (!s->h263_aic) { #if 1 asm volatile ( "imul %%ecx \n\t" : "=d" (level), "=a"(dummy) : "a" ((block[0]>>2) + q), "c" (inverse[q<<1]) ); #else asm volatile ( "xorl %%edx, %%edx \n\t" "divw %%cx \n\t" "movzwl %%ax, %%eax \n\t" : "=a" (level) : "a" ((block[0]>>2) + q), "c" (q<<1) : "%edx" ); #endif } else level = (block[0] + 4)>>3; block[0]=0; last_non_zero_p1 = 1; bias = s->q_intra_matrix16_bias[qscale]; qmat = s->q_intra_matrix16[qscale]; } else { last_non_zero_p1 = 0; bias = s->q_inter_matrix16_bias[qscale]; qmat = s->q_inter_matrix16[qscale]; } if(s->out_format == FMT_H263 && s->mpeg_quant==0){ asm volatile( "movd %%eax, %%mm3 \n\t" SPREADW(%%mm3) "pxor %%mm7, %%mm7 \n\t" "pxor %%mm4, %%mm4 \n\t" "movq (%1), %%mm5 \n\t" "pxor %%mm6, %%mm6 \n\t" "psubw (%2), %%mm6 \n\t" "movl $-128, %%eax \n\t" : "+a" (last_non_zero_p1) : "r" (qmat), "r" (bias) ); asm volatile( ".balign 16 \n\t" "1: \n\t" "pxor %%mm1, %%mm1 \n\t" "movq (%1, %%eax), %%mm0 \n\t" "pcmpgtw %%mm0, %%mm1 \n\t" <= 0 ? 0xFF : 0x00 "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "psubusw %%mm6, %%mm0 \n\t" + bias[0] "pmulhw %%mm5, %%mm0 \n\t" "por %%mm0, %%mm4 \n\t" "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "movq %%mm0, (%3, %%eax) \n\t" "pcmpeqw %%mm7, %%mm0 \n\t" "movq (%2, %%eax), %%mm1 \n\t" "movq %%mm7, (%1, %%eax) \n\t" "pandn %%mm1, %%mm0 \n\t" PMAXW(%%mm0, %%mm3) "addl $8, %%eax \n\t" " js 1b \n\t" : "+a" (last_non_zero_p1) : "r" (block+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) ); asm volatile( "movq %%mm3, %%mm0 \n\t" "psrlq $32, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movq %%mm3, %%mm0 \n\t" "psrlq $16, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movd %%mm3, %%eax \n\t" "movzbl %%al, %%eax \n\t" "movd %2, %%mm1 \n\t" SPREADW(%%mm1) "psubusw %%mm1, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t" "movd %%mm4, %1 \n\t" : "+a" (last_non_zero_p1), "=r" (*overflow) : "r" (s->max_qcoeff) ); }else{ asm volatile( "pushl %%ebp \n\t" "pushl %%ebx \n\t" "movl %0, %%ebp \n\t" "movl (%%ebp), %%ebx \n\t" "movd %%ebx, %%mm3 \n\t" SPREADW(%%mm3) "pxor %%mm7, %%mm7 \n\t" "pxor %%mm4, %%mm4 \n\t" "movl $-128, %%ebx \n\t" ".balign 16 \n\t" "1: \n\t" "pxor %%mm1, %%mm1 \n\t" "movq (%1, %%ebx), %%mm0 \n\t" "pcmpgtw %%mm0, %%mm1 \n\t" <= 0 ? 0xFF : 0x00 "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "movq (%3, %%ebx), %%mm6 \n\t" "paddusw %%mm6, %%mm0 \n\t" + bias[0] "movq (%2, %%ebx), %%mm5 \n\t" "pmulhw %%mm5, %%mm0 \n\t" "por %%mm0, %%mm4 \n\t" "pxor %%mm1, %%mm0 \n\t" "psubw %%mm1, %%mm0 \n\t" "movq %%mm0, (%5, %%ebx) \n\t" "pcmpeqw %%mm7, %%mm0 \n\t" "movq (%4, %%ebx), %%mm1 \n\t" "movq %%mm7, (%1, %%ebx) \n\t" "pandn %%mm1, %%mm0 \n\t" PMAXW(%%mm0, %%mm3) "addl $8, %%ebx \n\t" " js 1b \n\t" "movq %%mm3, %%mm0 \n\t" "psrlq $32, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movq %%mm3, %%mm0 \n\t" "psrlq $16, %%mm3 \n\t" PMAXW(%%mm0, %%mm3) "movd %%mm3, %%ebx \n\t" "movzbl %%bl, %%ebx \n\t" "movl %%ebx, (%%ebp) \n\t" "popl %%ebx \n\t" "popl %%ebp \n\t" : : "m" (last_non_zero_p1), "r" (block+64), "r" (qmat+64), "r" (bias+64), "r" (inv_zigzag_direct16+64), "r" (temp_block+64) ); asm volatile( "movd %1, %%mm1 \n\t" SPREADW(%%mm1) "psubusw %%mm1, %%mm4 \n\t" "packuswb %%mm4, %%mm4 \n\t" "movd %%mm4, %0 \n\t" : "=r" (*overflow) : "r" (s->max_qcoeff) ); } if(s->mb_intra) block[0]= level; else block[0]= temp_block[0]; if(s->dsp.idct_permutation_type == FF_SIMPLE_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x08] = temp_block[0x01]; block[0x10] = temp_block[0x08]; block[0x20] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x18] = temp_block[0x09]; block[0x04] = temp_block[0x02]; block[0x09] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x14] = temp_block[0x0A]; block[0x28] = temp_block[0x11]; block[0x12] = temp_block[0x18]; block[0x02] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1A] = temp_block[0x19]; block[0x24] = temp_block[0x12]; block[0x19] = temp_block[0x0B]; block[0x01] = temp_block[0x04]; block[0x0C] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x11] = temp_block[0x0C]; block[0x29] = temp_block[0x13]; block[0x16] = temp_block[0x1A]; block[0x0A] = temp_block[0x21]; block[0x30] = temp_block[0x28]; block[0x22] = temp_block[0x30]; block[0x38] = temp_block[0x29]; block[0x06] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x21] = temp_block[0x14]; block[0x1C] = temp_block[0x0D]; block[0x05] = temp_block[0x06]; block[0x0D] = temp_block[0x07]; block[0x15] = temp_block[0x0E]; block[0x2C] = temp_block[0x15]; block[0x13] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x0B] = temp_block[0x23]; block[0x34] = temp_block[0x2A]; block[0x2A] = temp_block[0x31]; block[0x32] = temp_block[0x38]; block[0x3A] = temp_block[0x39]; block[0x26] = temp_block[0x32]; block[0x39] = temp_block[0x2B]; block[0x03] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x25] = temp_block[0x16]; block[0x1D] = temp_block[0x0F]; block[0x2D] = temp_block[0x17]; block[0x17] = temp_block[0x1E]; block[0x0E] = temp_block[0x25]; block[0x31] = temp_block[0x2C]; block[0x2B] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x36] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x23] = temp_block[0x34]; block[0x3C] = temp_block[0x2D]; block[0x07] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x0F] = temp_block[0x27]; block[0x35] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x2E] = temp_block[0x35]; block[0x33] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x27] = temp_block[0x36]; block[0x3D] = temp_block[0x2F]; block[0x2F] = temp_block[0x37]; block[0x37] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else if(s->dsp.idct_permutation_type == FF_LIBMPEG2_IDCT_PERM){ if(last_non_zero_p1 <= 1) goto end; block[0x04] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x0C] = temp_block[0x09]; block[0x01] = temp_block[0x02]; block[0x05] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x09] = temp_block[0x0A]; block[0x14] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x1C] = temp_block[0x19]; block[0x11] = temp_block[0x12]; block[0x0D] = temp_block[0x0B]; block[0x02] = temp_block[0x04]; block[0x06] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0A] = temp_block[0x0C]; block[0x15] = temp_block[0x13]; block[0x19] = temp_block[0x1A]; block[0x24] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x2C] = temp_block[0x29]; block[0x21] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1D] = temp_block[0x1B]; block[0x12] = temp_block[0x14]; block[0x0E] = temp_block[0x0D]; block[0x03] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0B] = temp_block[0x0E]; block[0x16] = temp_block[0x15]; block[0x1A] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x25] = temp_block[0x23]; block[0x29] = temp_block[0x2A]; block[0x34] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x3C] = temp_block[0x39]; block[0x31] = temp_block[0x32]; block[0x2D] = temp_block[0x2B]; block[0x22] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1E] = temp_block[0x1D]; block[0x13] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1B] = temp_block[0x1E]; block[0x26] = temp_block[0x25]; block[0x2A] = temp_block[0x2C]; block[0x35] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x39] = temp_block[0x3A]; block[0x3D] = temp_block[0x3B]; block[0x32] = temp_block[0x34]; block[0x2E] = temp_block[0x2D]; block[0x23] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2B] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x36] = temp_block[0x35]; block[0x3A] = temp_block[0x3C]; block[0x3E] = temp_block[0x3D]; block[0x33] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3B] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; }else{ if(last_non_zero_p1 <= 1) goto end; block[0x01] = temp_block[0x01]; block[0x08] = temp_block[0x08]; block[0x10] = temp_block[0x10]; if(last_non_zero_p1 <= 4) goto end; block[0x09] = temp_block[0x09]; block[0x02] = temp_block[0x02]; block[0x03] = temp_block[0x03]; if(last_non_zero_p1 <= 7) goto end; block[0x0A] = temp_block[0x0A]; block[0x11] = temp_block[0x11]; block[0x18] = temp_block[0x18]; block[0x20] = temp_block[0x20]; if(last_non_zero_p1 <= 11) goto end; block[0x19] = temp_block[0x19]; block[0x12] = temp_block[0x12]; block[0x0B] = temp_block[0x0B]; block[0x04] = temp_block[0x04]; block[0x05] = temp_block[0x05]; if(last_non_zero_p1 <= 16) goto end; block[0x0C] = temp_block[0x0C]; block[0x13] = temp_block[0x13]; block[0x1A] = temp_block[0x1A]; block[0x21] = temp_block[0x21]; block[0x28] = temp_block[0x28]; block[0x30] = temp_block[0x30]; block[0x29] = temp_block[0x29]; block[0x22] = temp_block[0x22]; if(last_non_zero_p1 <= 24) goto end; block[0x1B] = temp_block[0x1B]; block[0x14] = temp_block[0x14]; block[0x0D] = temp_block[0x0D]; block[0x06] = temp_block[0x06]; block[0x07] = temp_block[0x07]; block[0x0E] = temp_block[0x0E]; block[0x15] = temp_block[0x15]; block[0x1C] = temp_block[0x1C]; if(last_non_zero_p1 <= 32) goto end; block[0x23] = temp_block[0x23]; block[0x2A] = temp_block[0x2A]; block[0x31] = temp_block[0x31]; block[0x38] = temp_block[0x38]; block[0x39] = temp_block[0x39]; block[0x32] = temp_block[0x32]; block[0x2B] = temp_block[0x2B]; block[0x24] = temp_block[0x24]; if(last_non_zero_p1 <= 40) goto end; block[0x1D] = temp_block[0x1D]; block[0x16] = temp_block[0x16]; block[0x0F] = temp_block[0x0F]; block[0x17] = temp_block[0x17]; block[0x1E] = temp_block[0x1E]; block[0x25] = temp_block[0x25]; block[0x2C] = temp_block[0x2C]; block[0x33] = temp_block[0x33]; if(last_non_zero_p1 <= 48) goto end; block[0x3A] = temp_block[0x3A]; block[0x3B] = temp_block[0x3B]; block[0x34] = temp_block[0x34]; block[0x2D] = temp_block[0x2D]; block[0x26] = temp_block[0x26]; block[0x1F] = temp_block[0x1F]; block[0x27] = temp_block[0x27]; block[0x2E] = temp_block[0x2E]; if(last_non_zero_p1 <= 56) goto end; block[0x35] = temp_block[0x35]; block[0x3C] = temp_block[0x3C]; block[0x3D] = temp_block[0x3D]; block[0x36] = temp_block[0x36]; block[0x2F] = temp_block[0x2F]; block[0x37] = temp_block[0x37]; block[0x3E] = temp_block[0x3E]; block[0x3F] = temp_block[0x3F]; } end: return last_non_zero_p1 - 1; }
1threat
int ff_rv34_decode_init_thread_copy(AVCodecContext *avctx) { int err; RV34DecContext *r = avctx->priv_data; r->s.avctx = avctx; if (avctx->internal->is_copy) { r->tmp_b_block_base = NULL; if ((err = ff_MPV_common_init(&r->s)) < 0) return err; if ((err = rv34_decoder_alloc(r)) < 0) return err; } return 0; }
1threat
Firebase (FCM): open activity and pass data on notification click. android : <p>There should be clear implementation of how to work with Firebase notification and data. I read many answers but can't seem to make it work. here are my steps:</p> <p>1.) I am passing notification and data to android in PHP and it seems to be fine:</p> <pre><code>$msg = array ( "body" =&gt; $body, "title" =&gt; $title, "sound" =&gt; "mySound" ); $data = array ( "user_id" =&gt; $res_id, "date" =&gt; $date, "hal_id" =&gt; $hal_id, "M_view" =&gt; $M_view ); $fields = array ( 'registration_ids' =&gt; $registrationIds, 'notification' =&gt; $msg, 'data' =&gt; $data ); $headers = array ( 'Authorization: key='.API_ACCESS_KEY, 'Content-Type: application/json' ); $ch = curl_init(); curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' ); curl_setopt( $ch,CURLOPT_POST, true ); curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers ); curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true ); curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false ); curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) ); $result = curl_exec($ch ); curl_close( $ch ); </code></pre> <p>2.) when notification and data is received in Android it shows notification. When I click on this notification it opens app. But I can not figure out the way to handle the data when the app is opened. There are couple differences when app is in foreground and backround. The code that I have now is the following: </p> <pre><code>public class MyFirebaseMessagingService extends FirebaseMessagingService { private static final String TAG = "MyFirebaseMsgService"; @Override public void onMessageReceived(RemoteMessage remoteMessage) { String user_id = "0"; String date = "0"; String cal_id = "0"; String M_view = "0"; if (remoteMessage.getData().size() &gt; 0) { Log.d(TAG, "Message data payload: " + remoteMessage.getData()); user_id = remoteMessage.getData().get("user_id"); date = remoteMessage.getData().get("date"); hal_id = remoteMessage.getData().get("hal_id"); M_view = remoteMessage.getData().get("M_view"); } //Calling method to generate notification sendNotification(remoteMessage.getNotification().getBody(), user_id, date, hal_id, M_view); } private void sendNotification(String messageBody, String user_id, String date, String hal_id, String M_view) { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("fcm_notification", "Y"); intent.putExtra("user_id", user_id); intent.putExtra("date", date); intent.putExtra("hal_id", hal_id); intent.putExtra("M_view", M_view); int uniqueInt = (int) (System.currentTimeMillis() &amp; 0xff); PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), uniqueInt, intent, PendingIntent.FLAG_UPDATE_CURRENT); Uri defaultSoundUri= RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this); notificationBuilder.setSmallIcon(R.drawable.ic_launcher) .setContentText(messageBody) .setAutoCancel(true) .setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0, notificationBuilder.build()); }} </code></pre> <p>3.) When I use the code above and when I click on notification all it does it opens the app if in background. If app in foreground then on notification click it simply dismisses notification. However, I want to receive data and open specific Activity in both scenarios (background and foreground). I have in MainActivity the following code, but I am not able to get data. fcm_notification, date, hal_id returns null.</p> <pre><code>public class MainActivity extends Activity { UserFunctions userFunctions; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); setIntent(intent); Intent intent_o = getIntent(); } @Override protected void onResume() { super.onResume(); userFunctions = new UserFunctions(); if(userFunctions.isUserLoggedIn(getApplicationContext())){ Intent intent_o = getIntent(); String fcm_notification = intent_o.getStringExtra("fcm_notification") ; String user_id = intent_o.getStringExtra("user_id"); String date = intent_o.getStringExtra("date"); String hal_id = intent_o.getStringExtra("hal_id"); String M_view = intent_o.getStringExtra("M_view"); Intent intent = new Intent(this, JobList.class); // THIS RETURNS NULL, user_id = null System.out.print("FCM" + user_id); startActivity(intent); finish(); }else{ // user is not logged in show login screen Intent login = new Intent(this, LoginActivity.class); startActivity(login); // Closing dashboard screen finish(); } }} </code></pre> <p>IF anyone can direct or advice how can I retrieve data in MainActivity.java from Firebase in either scenario (foreground or background) that would be fantastic. </p>
0debug
How to match on Some(Vec<T>)? : I'm working a network application where I want to iterate over all possible ip addresses for a network interface (IPv4 or IPv6) and only do something with the v4 addresses (in my case print them). For example, printing with debug I get Some([V6(fe80::6a5b:35ff:fec7:5eeb), V4(10.0.11.241)]) Which is a *Option<Vec<std::net::IpAdd>>* in which I want to iterate and if I encounter a V4 address will write the Display implementation for it. Note that the type of [std::net::IpAdd][1] is pub enum IpAddr { V4(Ipv4Addr), V6(Ipv6Addr), } But how do I match the enum on type (V4 only in my case)? [1]: https://doc.rust-lang.org/nightly/std/net/enum.IpAddr.html
0debug
not switching accounts in same project on button click : this is an app about layout first the screen will be in portrait layout on clciking button it will be changed to landscape layout.so here on clicking button it is not going to next activity though no compilation errors are found activity_main.xml ?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.vamshivikas.orientation.MainActivity"> <TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="28dp" android:text="@string/this_is_potrait_layout" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.48" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.15" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="47dp" android:layout_marginStart="8dp" android:layout_marginTop="80dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:text="@string/go_to_next_activity" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/textView" /> </android.support.constraint.ConstraintLayout> activity_second.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" android:text="@string/this_is_landscape_layout" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout> activityManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.vamshivikas.orientation"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name="com.example.vamshivikas.orientation.MainActivity" android:screenOrientation="portrait"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name=".SecondActivity" android:screenOrientation="landscape"> </activity> </application> </manifest> mainActivity.java package com.example.vamshivikas.orientation; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { Button button1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); button1=(Button)findViewById(R.id.button1); } public void onClcik(View v){ Intent intent=new Intent(MainActivity.this,SecondActivity.class); startActivity(intent); } secondActivity.java package com.example.vamshivikas.orientation; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class SecondActivity extends AppCompatActivity{ @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); } }
0debug
static int read_channel_params(MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp, unsigned int ch) { SubStream *s = &m->substream[substr]; ChannelParams *cp = &s->channel_params[ch]; FilterParams *fir = &cp->filter_params[FIR]; FilterParams *iir = &cp->filter_params[IIR]; int ret; if (s->param_presence_flags & PARAM_FIR) if (get_bits1(gbp)) if ((ret = read_filter_params(m, gbp, substr, ch, FIR)) < 0) return ret; if (s->param_presence_flags & PARAM_IIR) if (get_bits1(gbp)) if ((ret = read_filter_params(m, gbp, substr, ch, IIR)) < 0) return ret; if (fir->order + iir->order > 8) { av_log(m->avctx, AV_LOG_ERROR, "Total filter orders too high.\n"); return AVERROR_INVALIDDATA; } if (fir->order && iir->order && fir->shift != iir->shift) { av_log(m->avctx, AV_LOG_ERROR, "FIR and IIR filters must use the same precision.\n"); return AVERROR_INVALIDDATA; } if (!fir->order && iir->order) fir->shift = iir->shift; if (s->param_presence_flags & PARAM_HUFFOFFSET) if (get_bits1(gbp)) cp->huff_offset = get_sbits(gbp, 15); cp->codebook = get_bits(gbp, 2); cp->huff_lsbs = get_bits(gbp, 5); if (cp->huff_lsbs > 24) { av_log(m->avctx, AV_LOG_ERROR, "Invalid huff_lsbs.\n"); cp->huff_lsbs = 0; return AVERROR_INVALIDDATA; } cp->sign_huff_offset = calculate_sign_huff(m, substr, ch); return 0; }
1threat
Declarated a variable in WPF and i used it for another WPF wich C# : <p>I have a project with WPF when i introduce a UrlTxt in textbox with name txtCmdUrl This is my code XAML station.xaml</p> <pre><code>&lt;UserControl .....&gt; &lt;Grid x:Name="GridGlobal"&gt; &lt;DockPanel Background="White" Margin="5" &gt; &lt;StackPanel DockPanel.Dock="Left" HorizontalAlignment="Left" Orientation="Horizontal" Margin="10 0 10 0"&gt; &lt;StackPanel Orientation="Horizontal"&gt; **&lt;TextBox x:Name="txtCommandeUrl" Width="500" Height="24" VerticalAlignment="Center" /&gt;** &lt;mui:ModernButton x:Name="btnSave" Content="{x:Static p:Resources.Link_Save_Link}" Click="BtnSave_Click" VerticalAlignment="Center" Command="{Binding NextCommand, Mode=TwoWay}" IsEnabled="{Binding NextEnabled}"/&gt; &lt;/StackPanel&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>And in my code behind i used my click button with this code</p> <pre><code> private string txtUrlStation = ""; //BtnSave_Click private void BtnSave_Click(object sender, RoutedEventArgs e) { try { txtUrlStation = txtCommandeUrl.Text; MessageBox.Show(txtSave); } catch { } } </code></pre> <p>I want to use my variable <strong>txtCommandeUrl</strong> for another file.xaml exemple station2.xaml in the code behind also.</p> <p>Who can to help me in this small problem and Thanks </p>
0debug
Preserving state between tab view pages : <h3>issue</h3> <p>I have two <code>ListViews</code> rendering inside of a <code>TabBarView</code> using a <code>TabController</code>.</p> <p>How do I preserve state (for lack of a better word) between each <code>ListView</code> so that: 1.) the Widgets don't rebuild and 2.) the <code>ListView</code> position is remembered between tabs.</p> <h3>relevant code</h3> <pre><code>class AppState extends State&lt;App&gt; with SingleTickerProviderStateMixin { TabController _tabController; @override void initState() { super.initState(); _tabController = new TabController( vsync: this, length: _allPages.length, ); } @override void dispose() { _tabController.dispose(); super.dispose(); } Widget _buildScaffold(BuildContext context) { return new Scaffold( appBar: new AppBar( title: new Text('headlines'), bottom: new TabBar( controller: _tabController, isScrollable: true, tabs: _allPages .map((_Page page) =&gt; new Tab(text: page.country)) .toList()), ), body: new TabBarView( controller: _tabController, children: _allPages.map((_Page page) { return new SafeArea( top: false, bottom: false, child: new Container( key: new ObjectKey(page.country), child: new Newsfeed(country: page.country), ), ); }).toList()), ); } @override Widget build(BuildContext context) { return new MaterialApp( title: 'news app', home: _buildScaffold(context), ); } } </code></pre> <h3>illustrating gif</h3> <p><a href="https://media.giphy.com/media/2ysWhzqHVqL1xcBlBE/giphy.gif" rel="noreferrer">https://media.giphy.com/media/2ysWhzqHVqL1xcBlBE/giphy.gif</a></p>
0debug
set attribute value of input element with script tag : <p>I want to set the value on an input element like this:</p> <pre><code>&lt;input type="submit" name="submit" id="loginButton" value="&lt;script&gt;document.write(language['login'])&lt;/script&gt;"/&gt; </code></pre> <p>but i can't get it to work. Is it not possible?</p>
0debug
How can i format date and time in golang to use it in neo4j query? : i'm developing a website to learn how to use golang(github.com/gin-gonic/gin) and neo4j(github.com/johnnadratowski/golang-neo4j-bolt-driver). I have a User struct like that type User struct { Id int16 `json:"id" db:"id"` Username string `json:"username" db:"username"` Email string `json:"email" db:"email"` CreatedAt time.Time `json:"created_at" db:"created_at" } and i want to create a node in neo4j with all this information func test(u User) { m := structs.Map(u) app.Neo.ExecNeo("CREATE (n:NODE {Id: {Id}, Username: {Username}, " + "Email: {Email}, CreatedAt: {CreatedAt}})", m) } because of the format of the date "0001-01-01 00:00:00 +0000 UTC" neo4j does't accept the query (everything work if i remove the Created At). So i wanted to know how i can format it, is there any tips ? or do i have to make my own function ? Thanks.
0debug
Make a single property optional in TypeScript : <p>In TypeScript, 2.2...</p> <p>Let's say I have a Person type:</p> <pre><code>interface Person { name: string; hometown: string; nickname: string; } </code></pre> <p>And I'd like to create a function that returns a Person, but doesn't require a nickname:</p> <pre><code>function makePerson(input: ???): Person { return {...input, nickname: input.nickname || input.name}; } </code></pre> <p>What should be the type of <code>input</code>? I'm looking for a dynamic way to specify a type that is identical to <code>Person</code> except that <code>nickname</code> is optional (<code>nickname?: string | undefined</code>). The closest thing I've figured out so far is this:</p> <pre><code>type MakePersonInput = Partial&lt;Person&gt; &amp; { name: string; hometown: string; } </code></pre> <p>but that's not quite what I'm looking for, since I have to specify all the types that are <em>required</em> instead of the ones that are optional.</p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
Get values of variables inside of a php array : <p>I'm very new to this and I need help. I have been searching and searching for days on end. My question is how to get it so my code I have here, returns just the values of one variable from inside the different object(stdClass)'s. Like I said I am very new and inexperienced with any sort of programming but I have self taught myself quite a bit.</p> <p>Here is my current php code:</p> <pre><code>$rc = get_data('https://xboxapi.com/v2/2535433396471499/friends'); $rc2 = json_decode($rc); </code></pre> <p>Here is what I get when it is printed in the browser:</p> <pre><code>object(stdClass)#1 (13) { ["id"]=&gt; int(2535472804586102) ["hostId"]=&gt; NULL ["Gamertag"]=&gt; string(11) "Unikornz119" ["GameDisplayName"]=&gt; string(11) "Unikornz119" ["AppDisplayName"]=&gt; string(11) "Unikornz119" ["Gamerscore"]=&gt; int(3190) ["GameDisplayPicRaw"]=&gt; string(5) "a.png" ["AppDisplayPicRaw"]=&gt; string(180) "b.png" ["AccountTier"]=&gt; string(4) "Gold" ["XboxOneRep"]=&gt; string(10) "GoodPlayer" ["PreferredColor"]=&gt; string(0) "" ["TenureLevel"]=&gt; int(1) ["isSponsoredUser"]=&gt; bool(false) } </code></pre> <p>Thank you all, I hope to hear some positive responses! :)</p>
0debug
static void generate_bootsect(target_phys_addr_t option_rom, uint32_t gpr[8], uint16_t segs[6], uint16_t ip) { uint8_t rom[512], *p, *reloc; uint8_t sum; int i; memset(rom, 0, sizeof(rom)); p = rom; *p++ = 0x55; *p++ = 0xaa; *p++ = 1; *p++ = 0x50; *p++ = 0x1e; *p++ = 0x31; *p++ = 0xc0; *p++ = 0x8e; *p++ = 0xd8; *p++ = 0xc7; *p++ = 0x06; *p++ = 0x64; *p++ = 0x00; reloc = p; *p++ = 0x00; *p++ = 0x00; *p++ = 0x8c; *p++ = 0x0e; *p++ = 0x66; *p++ = 0x00; *p++ = 0x1f; *p++ = 0x58; *p++ = 0xcb; *reloc = (p - rom); *p++ = 0xfa; *p++ = 0xfc; for (i = 0; i < 6; i++) { if (i == 1) continue; *p++ = 0xb8; *p++ = segs[i]; *p++ = segs[i] >> 8; *p++ = 0x8e; *p++ = 0xc0 + (i << 3); } for (i = 0; i < 8; i++) { *p++ = 0x66; *p++ = 0xb8 + i; *p++ = gpr[i]; *p++ = gpr[i] >> 8; *p++ = gpr[i] >> 16; *p++ = gpr[i] >> 24; } *p++ = 0xea; *p++ = ip; *p++ = ip >> 8; *p++ = segs[1]; *p++ = segs[1] >> 8; sum = 0; for (i = 0; i < (sizeof(rom) - 1); i++) sum += rom[i]; rom[sizeof(rom) - 1] = -sum; cpu_physical_memory_write_rom(option_rom, rom, sizeof(rom)); option_rom_setup_reset(option_rom, sizeof (rom)); }
1threat
While regecting call i am getting an error : 06-05 08:56:37.866 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null 06-05 08:56:37.866 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw start 06-05 08:56:37.867 824-1126/it.bikemode.sharwin.com.bikemode D/webkit/webcore: webkitDraw::nativeRecordContent 06-05 08:56:37.867 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw NEW_PICTURE_MSG_ID 06-05 08:56:37.869 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null 06-05 08:56:37.869 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw start 06-05 08:56:37.881 824-1126/it.bikemode.sharwin.com.bikemode D/webkit/webcore: webkitDraw::nativeRecordContent 06-05 08:56:37.881 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw NEW_PICTURE_MSG_ID 06-05 08:56:37.965 824-824/it.bikemode.sharwin.com.bikemode E/INCOMING: +918500549640 06-05 08:56:37.970 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null 06-05 08:56:38.131 824-824/it.bikemode.sharwin.com.bikemode W/System.err: java.lang.SecurityException: Neither user 10110 nor current process has android.permission.MODIFY_PHONE_STATE. 06-05 08:56:38.214 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:38.214 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004A, flags=0x0, dataLen=0x9 06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004B, flags=0x0, dataLen=0x9 06-05 08:56:39.028 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 06-05 08:56:39.033 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.os.Parcel.readException(Parcel.java:1425) 06-05 08:56:39.034 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.os.Parcel.readException(Parcel.java:1379) 06-05 08:56:39.034 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at com.android.internal.telephony.ITelephony$Stub$Proxy.silenceRinger(ITelephony.java:1983) 06-05 08:56:39.034 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at it.bikemode.sharwin.com.bikemode.IngoingReceiver.onReceive(IngoingReceiver.java:44) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.app.ActivityThread.handleReceiver(ActivityThread.java:2550) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.app.ActivityThread.access$1500(ActivityThread.java:162) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.os.Handler.dispatchMessage(Handler.java:107) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.os.Looper.loop(Looper.java:194) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5371) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at java.lang.reflect.Method.invokeNative(Native Method) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at java.lang.reflect.Method.invoke(Method.java:525) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) 06-05 08:56:39.035 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode W/System.err: at dalvik.system.NativeStart.main(Native Method) 06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode V/webview: NEW_PICTURE_MSG_ID 06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::start 06-05 08:56:39.036 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::processing 111 06-05 08:56:39.039 824-824/it.bikemode.sharwin.com.bikemode V/webview: NEW_PICTURE_MSG_ID 06-05 08:56:39.039 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::start 06-05 08:56:39.052 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::processing 111 06-05 08:56:39.055 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: WEBKIT_DRAW arg1=0 arg2=0 obj=null 06-05 08:56:39.055 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw start 06-05 08:56:39.057 824-1126/it.bikemode.sharwin.com.bikemode D/webkit/webcore: webkitDraw::nativeRecordContent 06-05 08:56:39.057 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: webkitDraw NEW_PICTURE_MSG_ID 06-05 08:56:39.078 824-824/it.bikemode.sharwin.com.bikemode V/webview: NEW_PICTURE_MSG_ID 06-05 08:56:39.079 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: LOAD_URL arg1=0 arg2=0 obj=android.webkit.WebViewCore$GetUrlData@4169d870 06-05 08:56:39.079 824-1126/it.bikemode.sharwin.com.bikemode V/webcore: CORE loadUrl javascript:AFMA_updateActiveView({"units":[{"viewBox":{"bottom":533,"right":320,"left":0,"top":0},"isScreenOn":true,"isPaused":false,"adFormat":"320x50_mb","localVisibleBoxVisible":false,"activeViewJSON":{"click_string":"BjD8MvZtTV4-AK5e9oAP6sLHQBgCFkcCSrgIAABABOAGgBjk","active_experiment_ids":"","is_active_view_immediate_enabled":true,"activeview_cpm_urls":[]},"isNative":false,"hashCode":"abd2bfc2-8ada-4aca-b94a-74ff268ec3a4","afmaVersion":"afma-sdk-a-v9082034.8487000.1","windowVisibility":8,"screenDensity":1.5,"localVisibleBox":{"bottom":50,"right":320,"left":0,"top":0},"isAttachedToWindow":true,"timestamp":54853252,"globalVisibleBox":{"bottom":50,"right":320,"left":0,"top":0},"isVisible":true,"adBox":{"bottom":-146,"right":320,"left":0,"top":-196},"hitBox":{"bottom":50,"right":320,"left":0,"top":0},"isMraid":false,"globalVisibleBoxVisible":false,"isStopped":false}]}); 06-05 08:56:39.079 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::start 06-05 08:56:39.080 824-824/it.bikemode.sharwin.com.bikemode D/webkit/webview: setNewPicture::processing 111 06-05 08:56:39.202 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:39.202 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004C, flags=0x0, dataLen=0x9 06-05 08:56:39.202 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 06-05 08:56:39.702 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:39.702 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004D, flags=0x0, dataLen=0x9 06-05 08:56:39.702 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 06-05 08:56:40.203 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: processIncoming 06-05 08:56:40.203 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: handlePacket : cmd=0x1, cmdSet=0xC7, len=0x14, id=0x4000004E, flags=0x0, dataLen=0x9 06-05 08:56:40.203 824-830/it.bikemode.sharwin.com.bikemode D/jdwp: sendBufferedRequest : len=0x34 public class IngoingReceiver extends BroadcastReceiver { int previousState = 2; public void onReceive(final Context context, Intent intent) { ITelephony telephonyService; TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); try { Class c = Class.forName(tm.getClass().getName()); Method m = c.getDeclaredMethod("getITelephony"); m.setAccessible(true); telephonyService = (ITelephony) m.invoke(tm);`enter code here` Bundle bundle = intent.getExtras(); String phoneNumber = bundle.getString("incoming_number"); Log.e("INCOMING", phoneNumber); if ((phoneNumber != null)) { telephonyService.silenceRinger(); telephonyService.endCall(); Log.e("HANG UP", phoneNumber); } } catch (Exception e) { e.printStackTrace(); } } } package com.android.internal.telephony; public interface ITelephony { boolean endCall(); void answerRingingCall(); void silenceRinger(); }
0debug
static void t_gen_muls(TCGv d, TCGv d2, TCGv a, TCGv b) { TCGv t0, t1; t0 = tcg_temp_new(TCG_TYPE_I64); t1 = tcg_temp_new(TCG_TYPE_I64); tcg_gen_ext32s_i64(t0, a); tcg_gen_ext32s_i64(t1, b); tcg_gen_mul_i64(t0, t0, t1); tcg_gen_trunc_i64_i32(d, t0); tcg_gen_shri_i64(t0, t0, 32); tcg_gen_trunc_i64_i32(d2, t0); tcg_temp_free(t0); tcg_temp_free(t1); }
1threat
PHP validate if duplicate char "?" : <p>I have URL parameter like this: <code>http://localhost/project-mini-framework/public/Home/_list?page=2?page=3</code></p> <p>How to validate if i have duplicate char "?" in PHP code.</p> <p>terima kasih</p>
0debug
How to print part of output from an object in python : <p>I want to know that is there any way to print only part of content from an object in python? For example if I have stmt.addr = 185, how can I only print out 18 not 185?</p>
0debug
Javscript: Image height based on window height : In the code below I would like to only include "`height="246" width="188`" of the image if the `var h` in the javascript is < 600. <script> var h = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; </script> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel panel-default"> <div class="panel-body"> <center><img class="visible-xs hidden-sm hidden-md hidden-lg" src="{% static 'intro_small.png' %}" alt="str8RED" height="246" width="188"/></center> <a href="" class="btn btn-info btn-block .btn-lg" style="font-size: 20px">WHAT IS str8RED?</a><a href="https://str8red.com/selectteams/0/0/" style="font-size: 20px" class="btn btn-success btn-block .btn-lg">PLAY str8RED <span style="font-size: 20px" class="glyphicon glyphicon-play-circle" aria-hidden="true"></a> </div> </div> </div> </div>
0debug
How to ighore duplicates in mysql : I'm 'newbie' at MySQL, so i don't know how to correctly execute INSERT IGNORE in MySQL. I'm developing a website with referral system that is linked to MySQL. I want to allow using same referral code for unlimited times, but now i'm always receiving an error "Failed to run query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'ref0001' for key 'referral'" Also, please tell me where i have to put the INSERT IGNORE code. Thanks in advance, i will really appreciate your help <3
0debug
nvdimm_dsm_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { AcpiNVDIMMState *state = opaque; NvdimmDsmIn *in; hwaddr dsm_mem_addr = val; nvdimm_debug("dsm memory address %#" HWADDR_PRIx ".\n", dsm_mem_addr); in = g_new(NvdimmDsmIn, 1); cpu_physical_memory_read(dsm_mem_addr, in, sizeof(*in)); le32_to_cpus(&in->revision); le32_to_cpus(&in->function); le32_to_cpus(&in->handle); nvdimm_debug("Revision %#x Handler %#x Function %#x.\n", in->revision, in->handle, in->function); if (in->revision != 0x1 ) { nvdimm_debug("Revision %#x is not supported, expect %#x.\n", in->revision, 0x1); nvdimm_dsm_no_payload(1 , dsm_mem_addr); goto exit; } if (in->handle == NVDIMM_QEMU_RSVD_HANDLE_ROOT) { nvdimm_dsm_reserved_root(state, in, dsm_mem_addr); goto exit; } if (!in->handle) { nvdimm_dsm_root(in, dsm_mem_addr); goto exit; } nvdimm_dsm_device(in, dsm_mem_addr); exit: g_free(in); }
1threat
PHP Session won't start : <p>I'm having problem with starting a session in PHP. By looking around I wrote some code that should work but it doesnt. Can you please help me out because I don't know what's wrong here. This is my loging.php page</p> <pre><code> &lt;?php $host = "localhost"; $user = "usern"; $password = "gtest123"; $db = "test"; $errore = "Login info are wrong!`enter code here`"; mysql_connect($host,$user,$password); mysql_select_db($db); if(isset($_POST['username'])){ $username = $_POST['username']; $password = $_POST['password']; $sql = "select * from utenti where username = '".$username."' AND Password = '".$password."' limit 1"; $result = mysql_query($sql); if(mysql_num_rows($result)==1){ $_SESSION['username'] = $username; header("location:index.php"); } else{ echo "" .$errore; }`enter code here` } ?&gt; </code></pre> <p>I than have my db with users on phpmyamin and the login it's working. The problem is when I load the index.php page.</p> <pre><code>&lt;?php session_start(); echo "Welcome" .$_SESSION['']; ?&gt; &lt;html&gt; all the html code </code></pre> <p>I start this session because I want to be able to see which user do certian function in the website. However I get this error message: Notice: Undefined index: I know what the error means but I don't know how to fix it, any help?</p>
0debug
static void s390x_cpu_set_id(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { S390CPU *cpu = S390_CPU(obj); DeviceState *dev = DEVICE(obj); const int64_t min = 0; const int64_t max = UINT32_MAX; Error *err = NULL; int64_t value; if (dev->realized) { error_setg(errp, "Attempt to set property '%s' on '%s' after " "it was realized", name, object_get_typename(obj)); return; } visit_type_int(v, name, &value, &err); if (err) { error_propagate(errp, err); return; } if (value < min || value > max) { error_setg(errp, "Property %s.%s doesn't take value %" PRId64 " (minimum: %" PRId64 ", maximum: %" PRId64 ")" , object_get_typename(obj), name, value, min, max); return; } cpu->id = value; }
1threat
Convert a Windows Mobile 6.5 application to Android app with Xamarin : <p>I have a Windows Mobile 6.5 application that a customer are interested to have the same application for Android devices. I have thought with Xamarin to migrate the application to Android platform. Is it possible or exists some other way/tool to achieve that?</p> <p>I have read in this <a href="https://forums.xamarin.com/discussion/14475/windows-ce-and-windows-mobile-6-5-support" rel="nofollow">forum</a> that seems it isn't possible.</p>
0debug
Null pointer exception on list view : <p>I am creating dynamic views. I want to add views to list and remove them onActivityResult. </p> <p>But i am getting NullPointerException on list view when I am adding view to the list.</p> <p>Where should I add view in list view? </p> <p>Here is my code :</p> <pre><code>public class Mon extends Fragment { private FrameLayout fab; private EventTableHelper mDb; private Intent i; private ViewGroup dayplanView; private int minutesFrom,minutesTo; private List&lt;EventData&gt; events; private List&lt;View&gt; list; private EventData e; private LayoutInflater inflater; public boolean editMode; private RelativeLayout container; RelativeLayout parent; View eventView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_mon, container, false); fab = (FrameLayout) view.findViewById(R.id.main_fab); ImageButton imageButton = (ImageButton) view.findViewById(R.id.imgbtn_fab); imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { i = new Intent(getActivity(), AddEventActivity.class); editMode = false; i.putExtra("EditMode", editMode); startActivityForResult(i, 1); } }); dayplanView = (ViewGroup) view.findViewById(R.id.hoursRelativeLayout); showEvents(); return view; } private void createEvent(LayoutInflater inflater, ViewGroup dayplanView, int fromMinutes, int toMinutes, String title,String location,final int id) { eventView = inflater.inflate(R.layout.event_view, dayplanView, false); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) eventView.getLayoutParams(); container = (RelativeLayout) eventView.findViewById(R.id.container); TextView tvTitle = (TextView) eventView.findViewById(R.id.textViewTitle); if (tvTitle.getParent() != null) ((ViewGroup) tvTitle.getParent()).removeView(tvTitle); if(location.equals("")) { tvTitle.setText("Event : " + title); } else { tvTitle.setText("Event : " + title + " (At : " + location +")"); } int distance = (toMinutes - fromMinutes); layoutParams.topMargin = dpToPixels(fromMinutes + 9); layoutParams.height = dpToPixels(distance); eventView.setLayoutParams(layoutParams); dayplanView.addView(eventView); container.addView(tvTitle); eventView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { i = new Intent(getActivity(), AddEventActivity.class); editMode = true; i.putExtra("EditMode", editMode); i.putExtra("id", id); startActivityForResult(i, 1); } }); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); removeView(); showEvents(); } public void showEvents() { mDb = new EventTableHelper(getActivity()); events = mDb.getAllEvents("Mon"); for (EventData eventData : events) { int id = eventData.getId(); String datefrom = eventData.getFromDate(); if (datefrom != null) { String[] times = datefrom.substring(11, 16).split(":"); minutesFrom = Integer.parseInt(times[0]) * 60 + Integer.parseInt(times[1]); } String title = eventData.getTitle(); String location = eventData.getLocation(); String dateTo = eventData.getToDate(); if (dateTo != null) { //times = dateTo.substring(11,16).split(":"); String[] times1 = dateTo.substring(11, 16).split(":"); minutesTo = Integer.parseInt(times1[0]) * 60 + Integer.parseInt(times1[1]); } createEvent(inflater, dayplanView, minutesFrom, minutesTo, title, location, id); id++; list.add(eventView); } } public void removeView() { for(int i=0; i&lt;list.size(); i++) { dayplanView.removeView(eventView); } } private int dpToPixels(int dp) { return (int) (dp * getResources().getDisplayMetrics().density); } } </code></pre> <p>Getting exception at list.add(eventview); Please help..</p>
0debug
Length which is computed from two points pairs : How can I create an output polyline shapefile with each polyline being a two-point line? What I want to do is that I have a txt file and I want to create an output polyline shapefile with each polyline being a two-point line. Include fields (parcelID, Map, Lot, Length (computed from 2 point pairs).Then, I can read these points in ArcMap.
0debug
static void test_io(void) { #ifndef _WIN32 int sv[2]; int r; unsigned i, j, k, s, t; fd_set fds; unsigned niov; struct iovec *iov, *siov; unsigned char *buf; size_t sz; iov_random(&iov, &niov); sz = iov_size(iov, niov); buf = g_malloc(sz); for (i = 0; i < sz; ++i) { buf[i] = i & 255; } iov_from_buf(iov, niov, 0, buf, sz); siov = g_malloc(sizeof(*iov) * niov); memcpy(siov, iov, sizeof(*iov) * niov); if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) < 0) { perror("socketpair"); exit(1); } FD_ZERO(&fds); t = 0; if (fork() == 0) { close(sv[0]); FD_SET(sv[1], &fds); fcntl(sv[1], F_SETFL, O_RDWR|O_NONBLOCK); r = g_test_rand_int_range(sz / 2, sz); setsockopt(sv[1], SOL_SOCKET, SO_SNDBUF, &r, sizeof(r)); for (i = 0; i <= sz; ++i) { for (j = i; j <= sz; ++j) { k = i; do { s = g_test_rand_int_range(0, j - k + 1); r = iov_send(sv[1], iov, niov, k, s); g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0); if (r >= 0) { k += r; t += r; usleep(g_test_rand_int_range(0, 30)); } else if (errno == EAGAIN) { select(sv[1]+1, NULL, &fds, NULL, NULL); continue; } else { perror("send"); exit(1); } } while(k < j); } } exit(0); } else { close(sv[1]); FD_SET(sv[0], &fds); fcntl(sv[0], F_SETFL, O_RDWR|O_NONBLOCK); r = g_test_rand_int_range(sz / 2, sz); setsockopt(sv[0], SOL_SOCKET, SO_RCVBUF, &r, sizeof(r)); usleep(500000); for (i = 0; i <= sz; ++i) { for (j = i; j <= sz; ++j) { k = i; iov_memset(iov, niov, 0, 0xff, -1); do { s = g_test_rand_int_range(0, j - k + 1); r = iov_recv(sv[0], iov, niov, k, s); g_assert(memcmp(iov, siov, sizeof(*iov)*niov) == 0); if (r > 0) { k += r; t += r; } else if (!r) { if (s) { break; } } else if (errno == EAGAIN) { select(sv[0]+1, &fds, NULL, NULL, NULL); continue; } else { perror("recv"); exit(1); } } while(k < j); test_iov_bytes(iov, niov, i, j - i); } } } #endif }
1threat