problem
stringlengths
26
131k
labels
class label
2 classes
How can I put these words in the same line on CSS? (Display function not working) : I want to put [these words][1] on the same line. I Tried all of the Display functions, also tried with text-align. Nothing worked. [1]: https://i.stack.imgur.com/LW8vw.jpg code: <h3 id="trying">If you have time, you should read more about this incredible human being on his <a href="https://en.wikipedia.org/wiki/Norman_Borlaug" target="_blank">Wikipedia Entry</a>.</h3>
0debug
JSON without sorting swift : <p>i am trying load data from JSON file. While loading it changes order when it is converted to NSDictionary. Is there any way to get the data in the same order as in JSON file. Please guide me.</p>
0debug
Comparison between Big Data and Data Lakes , difference and similarities : <p>Can someone tell me the similarities and differences between Big data and Data Lakes.</p> <p>Can't find a satisfactory answer anywhere.</p>
0debug
PDO not working - simply displaying some of the code as if it wasn't PHP : <p>I'm new to PDO, so I apologise if this is a silly question. I have two files: writel.html contains a simple form, with formaction="submitArticle.php" and method="post". submitArticle.php contains the following:</p> <pre><code>&lt;?php $con = new PDO('mysql:host=localhost;dbname=mysql','root','root'); $submission = $con-&gt;prepare(" INSERT INTO sfWritings(title, summary, content) VALUES(:title, :summary, :content) "); $submission_execution = $submission-&gt;execute([ 'title' =&gt; $_POST['title'], 'summary' =&gt; $_POST['summary'], 'content' =&gt; $_POST['content'] ]); if($submission_execution) { echo "article submitted"; } ?&gt; </code></pre> <p>However, instead of getting either the echo message, or some sort of error, I simply get the whole code, as if it doesn't realise it's PHP or something: <a href="https://i.stack.imgur.com/UYVBR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UYVBR.png" alt="Screenshot"></a></p> <p>If I add some html tags (<code>&lt;html&gt;</code>, <code>&lt;body&gt;</code> etc.) then it starts giving me this: <a href="https://i.stack.imgur.com/tLH8F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tLH8F.png" alt="Screenshot when using html tags"></a></p> <p>The database is ok (I've been able to fetch some test data from it). And the way I'm doing the insert closely follows a (working) example for a tutorial. So I''m a bit stuck for what I'm doing wrong!</p>
0debug
static void mpegts_insert_pcr_only(AVFormatContext *s, AVStream *st) { MpegTSWrite *ts = s->priv_data; MpegTSWriteStream *ts_st = st->priv_data; uint8_t *q; uint8_t buf[TS_PACKET_SIZE]; q = buf; *q++ = 0x47; *q++ = ts_st->pid >> 8; *q++ = ts_st->pid; *q++ = 0x20 | ts_st->cc; *q++ = TS_PACKET_SIZE - 5; *q++ = 0x10; q += write_pcr_bits(q, get_pcr(ts, s->pb)); memset(q, 0xFF, TS_PACKET_SIZE - (q - buf)); mpegts_prefix_m2ts_header(s); avio_write(s->pb, buf, TS_PACKET_SIZE);
1threat
Python Datetime : use strftime() with a timezone-aware date : <p>Suppose I have date <code>d</code> like this : </p> <pre><code>&gt;&gt;&gt; d datetime(2009, 4, 19, 21, 12, tzinfo=tzoffset(None, -7200)) </code></pre> <p>As you can see, it is "timezone aware", there is an offset of 2 Hour, utctime is </p> <pre><code>&gt;&gt;&gt; d.utctimetuple() time.struct_time(tm_year=2009, tm_mon=4, tm_mday=19, tm_hour=23, tm_min=12, tm_sec=0, tm_wday=6, tm_yday=109, tm_isdst=0) </code></pre> <p>So, real UTC date is 19th March 2009 <strong>23</strong>:12:00, right ? </p> <p>Now I need to format my date in string, I use </p> <pre><code>&gt;&gt;&gt; d.strftime('%Y-%m-%d %H:%M:%S.%f') '2009-04-19 21:12:00.000000' </code></pre> <p>Which doesn't seems to take this offset into account. How to fix that ? </p>
0debug
int ff_rv34_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src) { RV34DecContext *r = dst->priv_data, *r1 = src->priv_data; MpegEncContext * const s = &r->s, * const s1 = &r1->s; int err; if (dst == src || !s1->context_initialized) return 0; if (s->height != s1->height || s->width != s1->width) { ff_MPV_common_end(s); s->height = s1->height; s->width = s1->width; if ((err = ff_MPV_common_init(s)) < 0) return err; if ((err = rv34_decoder_realloc(r)) < 0) return err; } if ((err = ff_mpeg_update_thread_context(dst, src))) return err; r->cur_pts = r1->cur_pts; r->last_pts = r1->last_pts; r->next_pts = r1->next_pts; memset(&r->si, 0, sizeof(r->si)); s->current_picture_ptr = NULL; return 0; }
1threat
void OPPROTO op_fdivr_ST0_FT0(void) { ST0 = FT0 / ST0; }
1threat
How to remove background from button : <p>I have got a basic button where you click it and it shows a modal, but I am unable to get the button transparent so that it does not have a background but just the text is visible.</p> <p>I have search on here and google, including w3 school for a solution but I have been unsuccessful </p> <p>HTML:</p> <pre><code>&lt;!-- Trigger/Open The Modal --&gt; &lt;button class="subscribe" id="subscribe"&gt;Button&lt;/button&gt; &lt;!-- The Modal --&gt; &lt;div id="myModal" class="modal"&gt; &lt;!-- Modal content --&gt; &lt;div class="modal-content"&gt; &lt;div class="modal-header"&gt; &lt;span class="close"&gt;&lt;/span&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;p&gt;Subscribe to the Galaxy Mailing List&lt;/p&gt; &lt;p&gt;Welcome to the Galaxy Games Subscription Management page. Galaxy mailing lists are the best way to get the early word on all our game announcements, official launches, contests, special events, and more. Make sure you're enlisted to receive all the updates.&lt;/p&gt; &lt;a href="https://socialclub.galaxy-games.co.uk/settings/email" class="manage" target="_blank" click="closeSection()" data-gtm-category="Footer" data-gtm-action="Social Club" data-gtm-label="Manage Subscription Account"&gt;Manage Your Account&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS</p> <pre><code>button.subscribe{ background:none; } /* The Modal (background) */ .modal { display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 1; /* Sit on top */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0,0,0); /* Fallback color */ background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ -webkit-animation-name: fadeIn; /* Fade in the background */ -webkit-animation-duration: 0.4s; animation-name: fadeIn; animation-duration: 0.4s } /* Modal Content */ .modal-content { position: fixed; bottom: 0; background-color: #fefefe; width: 100%; -webkit-animation-name: slideIn; -webkit-animation-duration: 0.4s; animation-name: slideIn; animation-duration: 0.4s } /* The Close Button */ .close { color: white; float: right; font-size: 28px; font-weight: bold; } .close:hover, .close:focus { color: #000; text-decoration: none; cursor: pointer; } .modal-header { padding: 2px 16px; background-color: #000; color: white; } .modal-body { padding: 2px 16px;} .modal-footer { padding: 2px 16px; background-color: #5cb85c; color: white; } /* Add Animation */ @-webkit-keyframes slideIn { from {bottom: -300px; opacity: 0} to {bottom: 0; opacity: 1} } @keyframes slideIn { from {bottom: -300px; opacity: 0} to {bottom: 0; opacity: 1} } @-webkit-keyframes fadeIn { from {opacity: 0} to {opacity: 1} } @keyframes fadeIn { from {opacity: 0} to {opacity: 1} } </code></pre> <p>Screenshot: <a href="https://imgur.com/6MMxjLy" rel="nofollow noreferrer">https://imgur.com/6MMxjLy</a></p> <p>Any help greatly appreciated and thanks in advance.</p>
0debug
NumPy save some arrays at once : <p>I working on different shapes of arrays and I want to save them all with <code>numpy.save</code>, so, consider I have </p> <pre><code>mat1 = numpy.arange(8).reshape(4, 2) mat2 = numpy.arange(9).reshape(2, 3) numpy.save('mat.npy', numpy.array([mat1, mat2])) </code></pre> <p>It works. But when I have two matrices with one dimension of same size it's not working. </p> <pre><code>mat1 = numpy.arange(8).reshape(2, 4) mat2 = numpy.arange(10).reshape(2, 5) numpy.save('mat.npy', numpy.array([mat1, mat2])) </code></pre> <p>It causes<br> <code>Traceback (most recent call last): File "&lt;input&gt;", line 1, in &lt;module&gt; ValueError: could not broadcast input array from shape (2,4) into shape (2)</code></p> <p>And note that the problem caused by <code>numpy.array([mat1, mat2])</code> and not by <code>numpy.save</code></p> <p>I know that such array is possible:</p> <p><code>&gt;&gt; numpy.array([[[1, 2]], [[1, 2], [3, 4]]]) array([[[1, 2]], [[1, 2], [3, 4]]], dtype=object)</code></p> <p>So, all of what I want is to save two arrays as <code>mat1</code> and <code>mat2</code> at once.</p>
0debug
void hmp_drive_add_node(Monitor *mon, const char *optstr) { QemuOpts *opts; QDict *qdict; Error *local_err = NULL; opts = qemu_opts_parse_noisily(&qemu_drive_opts, optstr, false); if (!opts) { return; } qdict = qemu_opts_to_qdict(opts, NULL); if (!qdict_get_try_str(qdict, "node-name")) { error_report("'node-name' needs to be specified"); goto out; } BlockDriverState *bs = bds_tree_init(qdict, &local_err); if (!bs) { error_report_err(local_err); goto out; } QTAILQ_INSERT_TAIL(&monitor_bdrv_states, bs, monitor_list); out: qemu_opts_del(opts); }
1threat
static int vpc_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVVPCState *s = bs->opaque; int i; VHDFooter *footer; VHDDynDiskHeader *dyndisk_header; uint8_t buf[HEADER_SIZE]; uint32_t checksum; int disk_type = VHD_DYNAMIC; int ret; ret = bdrv_pread(bs->file, 0, s->footer_buf, HEADER_SIZE); if (ret < 0) { goto fail; } footer = (VHDFooter *) s->footer_buf; if (strncmp(footer->creator, "conectix", 8)) { int64_t offset = bdrv_getlength(bs->file); if (offset < 0) { ret = offset; goto fail; } else if (offset < HEADER_SIZE) { ret = -EINVAL; goto fail; } ret = bdrv_pread(bs->file, offset-HEADER_SIZE, s->footer_buf, HEADER_SIZE); if (ret < 0) { goto fail; } if (strncmp(footer->creator, "conectix", 8)) { ret = -EMEDIUMTYPE; goto fail; } disk_type = VHD_FIXED; } checksum = be32_to_cpu(footer->checksum); footer->checksum = 0; if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum) fprintf(stderr, "block-vpc: The header checksum of '%s' is " "incorrect.\n", bs->filename); footer->checksum = be32_to_cpu(checksum); bs->total_sectors = (int64_t) be16_to_cpu(footer->cyls) * footer->heads * footer->secs_per_cyl; if (!strncmp(footer->creator_app, "d2v", 4)) { bs->total_sectors = be64_to_cpu(footer->size) / BDRV_SECTOR_SIZE; } if (bs->total_sectors >= 65535LL * 255 * 255) { ret = -EFBIG; goto fail; } if (disk_type == VHD_DYNAMIC) { ret = bdrv_pread(bs->file, be64_to_cpu(footer->data_offset), buf, HEADER_SIZE); if (ret < 0) { goto fail; } dyndisk_header = (VHDDynDiskHeader *) buf; if (strncmp(dyndisk_header->magic, "cxsparse", 8)) { ret = -EINVAL; goto fail; } s->block_size = be32_to_cpu(dyndisk_header->block_size); s->bitmap_size = ((s->block_size / (8 * 512)) + 511) & ~511; s->max_table_entries = be32_to_cpu(dyndisk_header->max_table_entries); s->pagetable = g_malloc(s->max_table_entries * 4); s->bat_offset = be64_to_cpu(dyndisk_header->table_offset); ret = bdrv_pread(bs->file, s->bat_offset, s->pagetable, s->max_table_entries * 4); if (ret < 0) { goto fail; } s->free_data_block_offset = (s->bat_offset + (s->max_table_entries * 4) + 511) & ~511; for (i = 0; i < s->max_table_entries; i++) { be32_to_cpus(&s->pagetable[i]); if (s->pagetable[i] != 0xFFFFFFFF) { int64_t next = (512 * (int64_t) s->pagetable[i]) + s->bitmap_size + s->block_size; if (next > s->free_data_block_offset) { s->free_data_block_offset = next; } } } if (s->free_data_block_offset > bdrv_getlength(bs->file)) { error_setg(errp, "block-vpc: free_data_block_offset points after " "the end of file. The image has been truncated."); ret = -EINVAL; goto fail; } s->last_bitmap_offset = (int64_t) -1; #ifdef CACHE s->pageentry_u8 = g_malloc(512); s->pageentry_u32 = s->pageentry_u8; s->pageentry_u16 = s->pageentry_u8; s->last_pagetable = -1; #endif } qemu_co_mutex_init(&s->lock); error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "vpc", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; fail: g_free(s->pagetable); #ifdef CACHE g_free(s->pageentry_u8); #endif return ret; }
1threat
how can I asynchronously map/filter an asynchronous iterable? : <p>Let's say I have an asynchronous iterable that I can pass over using <code>async for</code>, how then can I then map and filter it to a new asynchronous iterator? The following code which is an adaptation of how I'd do the same thing with a synchronous iterable doesn't work, since <code>yield</code> isn't allowed inside <code>async def</code>s.</p> <pre><code>async def mapfilter(aiterable, p, func): async for payload in aiterable: if p(payload): # This part isn't allowed, but hopefully it should be clear # what I'm trying to accomplish. yield func(payload) </code></pre>
0debug
C programming when printf a string we are not using * why : In c programming when we print a string. We are not using * . But when print a number using printf we are using *. So how it is understanding, i am printing a string or int. Is understanding using %s operator? Attaching an example code #include<stdio.h> int main(int argc,char* argv){ char data[]="This is an example of pointer"; char *pointerstringdata =data; printf("print the string data is >> %s\n",pointerstringdata); /* Here we are not using * why? case -1*/ int numberdata =100; int *pointerintdata=&numberdata; printf("print the int data is >> %d\n",*pointerintdata); /* Here we are using * why? case -2*/ return 0; }
0debug
Checking if user input matches a predefined pattern of words : <p>I want to make a grammar checker with Python. But this is not going to be a standard grammar checker. This is intended for learners of the English language who are at the beginner level. I wrote the following code to check if the user uses the correct form of the verb:</p> <pre><code>preList = ['came', 'waited', 'sat', 'stood', 'went', 'left'] sentence = input("Type a sentence using the past simple tense: ") sentence = sentence.split() if sentence[1] or sentence[2] or sentence[3] in preList: print("Looks good!") else: print("Maybe you're missing something!") </code></pre> <p>The problem I have is that even if the user input does not contain any of the words in preList, it prints "Looks good". What is the problem with my code?</p>
0debug
Pinterest embed image does not show : <p>I'm trying to embed a Pinterest link, like explained <a href="https://developers.pinterest.com/tools/widget-builder/?type=pin&amp;url=https%3A%2F%2Fwww.pinterest.com%2Fpin%2F379006124862874372%2F" rel="noreferrer">here</a>.</p> <p>I've added this Pinterest link to a blog:</p> <pre><code>&lt;a href="https://www.pinterest.com/pin/139330182194785581/" data-pin-do="embedPin"&gt;&lt;/a&gt; </code></pre> <p>I've also added script <code>&lt;script type="text/javascript" async src="//assets.pinterest.com/js/pinit.js"&gt;&lt;/script&gt;</code> before my <code>&lt;/body&gt;</code> tag.</p> <p>But the Pinterest image does not show. See a live example <a href="https://www.toptrouwen.nl/artikelen/121/the-unplugged-wedding" rel="noreferrer">here</a>.</p> <p>From the errors in the Chrome console I don't learn why.</p> <p>What can I do?</p>
0debug
Why does this change to the makefile make the performance go up? : <p>I recently completed a performance lab in class, but there was one thing that my buddy showed me that I can't figure out why. In the original makefile we had:</p> <pre><code>## ## CXX =g++ CXXFLAGS= -m32 -static </code></pre> <p>But I changed the CXXFLAGS to:</p> <pre><code>## ## CXX =g++ CXXFLAGS= -m32 -static -funroll-loops -O3 </code></pre> <p>What exactly does the -funroll-loops -O3 do that the original doesn't?</p>
0debug
How do apps like Pizza Hut generate all nearby Pizza Hut locations using Google Maps? : <p>I am fairly new to programming and am currently working on my first full app by myself. The app has a few different parts, and one of those parts helps narrow a user's food selection down by restaurant. For instance, if the user decided they wanted to eat at Pizza Hut, my idea is that my app would generate a Google Map and using Google API, show the user all nearby pizza huts. I would also like the user to be able to click on the pizza hut icons and then it would direct them to Google Maps for directions.</p> <p>Currently I am able to populate Google Maps, ask the user for permission to find their location, as well as I implemented Google Place Picker. The Google Place Picker works a bit differently than I first imagined though.</p> <p>What I'm stuck on is how do I actually get just the Pizza Hut locations to populate as opposed to everything else as well?</p> <p>Thank you!</p>
0debug
pci_ebus_init1(PCIDevice *s) { isa_bus_new(&s->qdev); pci_config_set_vendor_id(s->config, PCI_VENDOR_ID_SUN); pci_config_set_device_id(s->config, PCI_DEVICE_ID_SUN_EBUS); s->config[0x04] = 0x06; s->config[0x05] = 0x00; s->config[0x06] = 0xa0; s->config[0x07] = 0x03; s->config[0x08] = 0x01; s->config[0x09] = 0x00; pci_config_set_class(s->config, PCI_CLASS_BRIDGE_OTHER); s->config[0x0D] = 0x0a; pci_register_bar(s, 0, 0x1000000, PCI_BASE_ADDRESS_SPACE_MEMORY, ebus_mmio_mapfunc); pci_register_bar(s, 1, 0x800000, PCI_BASE_ADDRESS_SPACE_MEMORY, ebus_mmio_mapfunc); return 0; }
1threat
Android How To Send Notifications When App Is Closed : <p>I'm developing small app that sends a notification from an update from a website, but I want it to update the notification when app is closed - similar to when we receive emails. </p>
0debug
iOS 10 UNUserNotificationCenterDelegate not called. push notifications not working : <p>Tearing my hair out tying to get push notifications to work in iOS10. Current setup:</p> <p>in <code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool</code>:</p> <pre><code>if #available(iOS 10.0, *) { let center = UNUserNotificationCenter.current() center.delegate = self center.requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in if error == nil { print("DID REQUEST THE NOTIFICATION") UIApplication.shared.registerForRemoteNotifications() } } print("DID SET DELEGATE") } </code></pre> <p>In <code>func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)</code>:</p> <pre><code>print("DID REGISTER FOR A REMOTE NOTIFICATION AND THE TOKEN IS \(deviceToken.base64EncodedString())" let request = UpdatePushNotificationSubscription_Request(deviceToken: deviceToken) updatePushNotificationSubscriptionWorker.updateSubscription(request) </code></pre> <p>I have checked the token is uploaded to the backend correctly and it does indeed match.</p> <p>I have also implemented:</p> <pre><code> @available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -&gt; Void) { print("GOT A NOTIFICATION") } @available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -&gt; Void) { //This is for the user tapping on the notification print("GOT A NOTIFICATION") } </code></pre> <p>I have set the entitlements for all targets and enabled push:</p> <p><a href="https://i.stack.imgur.com/slJXQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/slJXQ.png" alt="enter image description here"></a></p> <p>Now when I try to send a message from the backend the device just receives nothing. Delegates are not being called. Have no idea what I'm doing wrong here. Push is working for iOS9 and android devices. Any pointers to what I might be doing wrong?</p>
0debug
why I could use hbass without start hadoop/hdfs? : I am new to hbase, recently I installed hbase and tried to start it in my Mac. Everything is fine and I could play with hbase. In some articles, it said I should start hadoop first when using hbase, I am wondering if this prerequisite changed?
0debug
How to delete files inside hidden folder with python? : <p>I want do delete a file, for ex. 'myfile.txt' that is stored under a hidden folder. Is it possible to do this in python?</p> <p>thank you</p>
0debug
static uint32_t bonito_spciconf_readl(void *opaque, target_phys_addr_t addr) { PCIBonitoState *s = opaque; PCIDevice *d = PCI_DEVICE(s); PCIHostState *phb = PCI_HOST_BRIDGE(s->pcihost); uint32_t pciaddr; uint16_t status; DPRINTF("bonito_spciconf_readl "TARGET_FMT_plx"\n", addr); assert((addr & 0x3) == 0); pciaddr = bonito_sbridge_pciaddr(s, addr); if (pciaddr == 0xffffffff) { return 0xffffffff; } phb->config_reg = (pciaddr) | (1u << 31); status = pci_get_word(d->config + PCI_STATUS); status &= ~(PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT); pci_set_word(d->config + PCI_STATUS, status); return pci_data_read(phb->bus, phb->config_reg, 4); }
1threat
Javascript - Merge multiple different array values of same length with a delimeter in a final single array? : I have 3 different array with same length var title = ['title 1','title 2','title 3']; var description = ['description 1','description 2','description 3']; var link = ['link 1','link 2','link 3']; How can i get or merge all array values in single array with PIPE delimeter "**|**" ? Result: final_arr = ['title 1|description 1|link 1','title 2|description 2|link 2','title 3|description 3|link ']
0debug
Generically derive Arbitrary for massive algebraic data types? : <p>I've got a protocol that I've typed like so:</p> <pre><code>data ProtocolPacket = Packet1 Word8 Text Int8 | Packet2 Text | Packet3 Int Text Text Text Text | Packet4 Int Double Double Double Int16 Int16 Int16 ... deriving (Show,Eq) </code></pre> <p>In addition, I've implemented serialization/deserialization code for each packet. Naturally, I would like to test this protocol in Quickcheck and make sure that serializing and deserializing any packet for any combination of inputs will give me back exactly what I put in. So I go ahead and implement these packets for the <code>Arbitrary</code> type class like so:</p> <pre><code>instance Arbitrary ProtocolPacket where arbitrary = do packetID &lt;- choose (0x00,...) :: Gen Word8 case packetID of 0x00 -&gt; do a &lt;- arbitrary b &lt;- arbitrary c &lt;- arbitrary return $ Packet1 a b c 0x01 -&gt; do a &lt;- arbitrary return $ Packet2 a 0x02 -&gt; do a &lt;- arbitrary b &lt;- arbitrary c &lt;- arbitrary d &lt;- arbitrary e &lt;- arbitrary return $ Packet3 a b c d e 0x03 -&gt; do a &lt;- arbitrary b &lt;- arbitrary c &lt;- arbitrary d &lt;- arbitrary e &lt;- arbitrary f &lt;- arbitrary g &lt;- arbitrary return $ Packet4 a b c d e f g ... </code></pre> <p>Assume that I've gone ahead and defined <code>Arbitrary</code> for all relevant data constructor arguments that don't have <code>Arbitrary</code> defined out of the box, such code needs to be hand-written by me in order for the packet fields to be populated with meaningful data. But that's it.</p> <p>But as you can see, I'm repeating myself <em>a lot</em> for something that is just grunt work. And this is a small sample of what I'm actually dealing with. Ideally, I would like to be able to just do this:</p> <pre><code>{-# LANGUAGE DeriveGeneric #-} import GHC.Generics data ProtocolPacket = Packet1 Word8 Text Int8 | Packet2 Text | Packet3 Int Text Text Text Text | Packet4 Int Double Double Double Int16 Int16 Int16 ... deriving (Show,Eq,Generic) instance Arbitrary ProtocolPacket </code></pre> <p>like I can do with <code>FromJSON</code> and <code>ToJSON</code>, but this doesn't work. Is there there a method that does?</p>
0debug
def count_element_in_list(list1, x): ctr = 0 for i in range(len(list1)): if x in list1[i]: ctr+= 1 return ctr
0debug
static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ MpegEncContext * const s = &h->s; AVCodecContext * const avctx= s->avctx; int buf_index=0; H264Context *hx; int context_count = 0; int next_avc= h->is_avc ? 0 : buf_size; h->max_contexts = (HAVE_THREADS && (s->avctx->active_thread_type&FF_THREAD_SLICE)) ? avctx->thread_count : 1; #if 0 int i; for(i=0; i<50; i++){ av_log(NULL, AV_LOG_ERROR,"%02X ", buf[i]); } #endif if(!(s->flags2 & CODEC_FLAG2_CHUNKS)){ h->current_slice = 0; if (!s->first_field) s->current_picture_ptr= NULL; ff_h264_reset_sei(h); } for(;;){ int consumed; int dst_length; int bit_length; const uint8_t *ptr; int i, nalsize = 0; int err; if(buf_index >= next_avc) { if(buf_index >= buf_size) break; nalsize = 0; for(i = 0; i < h->nal_length_size; i++) nalsize = (nalsize << 8) | buf[buf_index++]; if(nalsize <= 0 || nalsize > buf_size - buf_index){ av_log(h->s.avctx, AV_LOG_ERROR, "AVC: nal size %d\n", nalsize); break; } next_avc= buf_index + nalsize; } else { for(; buf_index + 3 < next_avc; buf_index++){ if(buf[buf_index] == 0 && buf[buf_index+1] == 0 && buf[buf_index+2] == 1) break; } if(buf_index+3 >= buf_size) break; buf_index+=3; if(buf_index >= next_avc) continue; } hx = h->thread_context[context_count]; ptr= ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, next_avc - buf_index); if (ptr==NULL || dst_length < 0){ return -1; } i= buf_index + consumed; if((s->workaround_bugs & FF_BUG_AUTODETECT) && i+3<next_avc && buf[i]==0x00 && buf[i+1]==0x00 && buf[i+2]==0x01 && buf[i+3]==0xE0) s->workaround_bugs |= FF_BUG_TRUNCATED; if(!(s->workaround_bugs & FF_BUG_TRUNCATED)){ while(ptr[dst_length - 1] == 0 && dst_length > 0) dst_length--; } bit_length= !dst_length ? 0 : (8*dst_length - ff_h264_decode_rbsp_trailing(h, ptr + dst_length - 1)); if(s->avctx->debug&FF_DEBUG_STARTCODE){ av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d/%d at %d/%d length %d\n", hx->nal_unit_type, hx->nal_ref_idc, buf_index, buf_size, dst_length); } if (h->is_avc && (nalsize != consumed) && nalsize){ av_log(h->s.avctx, AV_LOG_DEBUG, "AVC: Consumed only %d bytes instead of %d\n", consumed, nalsize); } buf_index += consumed; if(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0) continue; again: err = 0; switch(hx->nal_unit_type){ case NAL_IDR_SLICE: if (h->nal_unit_type != NAL_IDR_SLICE) { av_log(h->s.avctx, AV_LOG_ERROR, "Invalid mix of idr and non-idr slices"); return -1; } idr(h); case NAL_SLICE: init_get_bits(&hx->s.gb, ptr, bit_length); hx->intra_gb_ptr= hx->inter_gb_ptr= &hx->s.gb; hx->s.data_partitioning = 0; if((err = decode_slice_header(hx, h))) break; s->current_picture_ptr->key_frame |= (hx->nal_unit_type == NAL_IDR_SLICE) || (h->sei_recovery_frame_cnt >= 0); if (h->current_slice == 1) { if(!(s->flags2 & CODEC_FLAG2_CHUNKS)) { decode_postinit(h); } if (s->avctx->hwaccel && s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0) return -1; if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ff_vdpau_h264_picture_start(s); } if(hx->redundant_pic_count==0 && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B) && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I) && avctx->skip_frame < AVDISCARD_ALL){ if(avctx->hwaccel) { if (avctx->hwaccel->decode_slice(avctx, &buf[buf_index - consumed], consumed) < 0) return -1; }else if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU){ static const uint8_t start_code[] = {0x00, 0x00, 0x01}; ff_vdpau_add_data_chunk(s, start_code, sizeof(start_code)); ff_vdpau_add_data_chunk(s, &buf[buf_index - consumed], consumed ); }else context_count++; } break; case NAL_DPA: init_get_bits(&hx->s.gb, ptr, bit_length); hx->intra_gb_ptr= hx->inter_gb_ptr= NULL; if ((err = decode_slice_header(hx, h)) < 0) break; hx->s.data_partitioning = 1; break; case NAL_DPB: init_get_bits(&hx->intra_gb, ptr, bit_length); hx->intra_gb_ptr= &hx->intra_gb; break; case NAL_DPC: init_get_bits(&hx->inter_gb, ptr, bit_length); hx->inter_gb_ptr= &hx->inter_gb; if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning && s->context_initialized && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=AV_PICTURE_TYPE_B) && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==AV_PICTURE_TYPE_I) && avctx->skip_frame < AVDISCARD_ALL) context_count++; break; case NAL_SEI: init_get_bits(&s->gb, ptr, bit_length); ff_h264_decode_sei(h); break; case NAL_SPS: init_get_bits(&s->gb, ptr, bit_length); ff_h264_decode_seq_parameter_set(h); if(s->flags& CODEC_FLAG_LOW_DELAY || (h->sps.bitstream_restriction_flag && !h->sps.num_reorder_frames)) s->low_delay=1; if(avctx->has_b_frames < 2) avctx->has_b_frames= !s->low_delay; if (avctx->bits_per_raw_sample != h->sps.bit_depth_luma) { if (h->sps.bit_depth_luma >= 8 && h->sps.bit_depth_luma <= 10) { avctx->bits_per_raw_sample = h->sps.bit_depth_luma; h->pixel_shift = h->sps.bit_depth_luma > 8; ff_h264dsp_init(&h->h264dsp, h->sps.bit_depth_luma); ff_h264_pred_init(&h->hpc, s->codec_id, h->sps.bit_depth_luma); dsputil_init(&s->dsp, s->avctx); } else { av_log(avctx, AV_LOG_DEBUG, "Unsupported bit depth: %d\n", h->sps.bit_depth_luma); return -1; } } break; case NAL_PPS: init_get_bits(&s->gb, ptr, bit_length); ff_h264_decode_picture_parameter_set(h, bit_length); break; case NAL_AUD: case NAL_END_SEQUENCE: case NAL_END_STREAM: case NAL_FILLER_DATA: case NAL_SPS_EXT: case NAL_AUXILIARY_SLICE: break; default: av_log(avctx, AV_LOG_DEBUG, "Unknown NAL code: %d (%d bits)\n", hx->nal_unit_type, bit_length); } if(context_count == h->max_contexts) { execute_decode_slices(h, context_count); context_count = 0; } if (err < 0) av_log(h->s.avctx, AV_LOG_ERROR, "decode_slice_header error\n"); else if(err == 1) { h->nal_unit_type = hx->nal_unit_type; h->nal_ref_idc = hx->nal_ref_idc; hx = h; goto again; } } if(context_count) execute_decode_slices(h, context_count); return buf_index; }
1threat
How to retrieve all record from every table where id = 1 in MS SQL 2008 : How to retrieve all record from every table (Ex: table1, table2, table3, ... tableN ) where id = 1 from single database (EX: database1) in MS SQL 2008 Is this possible?
0debug
when to go for new string instead of string literal in java : <p>I know when we use <code>String s = new String("abc");</code> JVM will create the object in heap and when we use <code>String s = "abc";</code> the object gets created in String constant pool.</p> <p>IMO, using <code>String s = "abc";</code> serves our purpose. In which case we have to go for <code>new String("abc");</code></p>
0debug
Date and Time formatting on python : I'm trying to get make a comments section for a website with the backend written in python. As of now, everything works fine except I cannot figure out how to format the date and time the way I want. What I am trying to have at the time of posting is either of these: 1) Posted on Tue, 06/12/18 at - 11:20 or 2) Posted on 06/12/18 at - 11:21 Currently, what I have when the method is called is this: import time from datetime import * time = "Posted on " + str(datetime.now().day) + "/" + str(datetime.now().month) + " at: " + str(datetime.now().hour) + ":" + str(datetime.now().minute)
0debug
static av_cold int init_decoder(AVCodecContext *avctx) { avctx->pix_fmt = PIX_FMT_PAL8; return 0; }
1threat
clang-format closing bracket on a new line : <p>I have code that looks like this:</p> <pre><code>EXPECT_EQ( subsystem-&gt;previousTouchscreenState, expectedTouchscreenState ); </code></pre> <p>When I run <code>clang-format</code>, it reformats the snippet to look like this:</p> <pre><code>EXPECT_EQ( subsystem-&gt;previousTouchscreenState, expectedTouchscreenState ); </code></pre> <p>This is quite counterintuitive; I'd like my multi-line function invocations (although <code>EXPECT_EQ</code> is a macro in this case) to have the closing round bracket on its own line, indented to the level of the name of the function, as it is in the first snippet.</p> <p>How do I accomplish this with <code>clang-format</code>?</p> <p>Many thanks.</p>
0debug
c program to find the duplicate element in an ascending array using logn time complexity : <p>Array is in ascending order need to find the duplicated number Need a program with logn time complexity </p> <pre><code> int n[] = {1, 2, 3, 4, 5, 5, 6}; int size = sizeof[n]; int mid; mid = size/ 2 ; if (a[mid] == a[mid + 1]) printf("%d",a[mid]); return a[mid]; else if (a[mid] != a[mid + 1]) for(int i=0;i&lt;mid;i++){ if(a[i]==a[mid+1]) return a[i]; } else for(int i=mid ;mid&lt;size;i++){ if(a[mid]==a[mid+1]) return a[mid]; } </code></pre>
0debug
config.php are not work in live website but it's work localhost : - This is config.php file working properly in localhost but it's not work live website <?php $connect = @mysql_connect('localhost','root',''); mysql_select_db('bridgetechnosfot'); ?>
0debug
which plugin will use for bootstrap or html and css like this http://www.gwadarrealestate.pk/map/lahore/dha-lahore-rahbar-map.html : <p>which plugin will use for bootstrap or html and CSS like this for zoom </p> <p><a href="http://www.gwadarrealestate.pk/map/lahore/dha-lahore-rahbar-map.html" rel="nofollow noreferrer">http://www.gwadarrealestate.pk/map/lahore/dha-lahore-rahbar-map.html</a></p>
0debug
How to cut date from date? : $uname -a SunOS 5.10 Generic_150400-33 sun4v sparc sun4v $date Friday, 6 May 2016 7:43:41 PM AEST $ date | cut -d"," -f1 Friday Now I need to cut the date alone where the output is 6 May 2016 ???
0debug
const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){ int i, si, di; uint8_t *dst; int bufidx; h->nal_ref_idc= src[0]>>5; h->nal_unit_type= src[0]&0x1F; src++; length--; #if HAVE_FAST_UNALIGNED # if HAVE_FAST_64BIT # define RS 7 for(i=0; i+1<length; i+=9){ if(!((~AV_RN64A(src+i) & (AV_RN64A(src+i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL)) # else # define RS 3 for(i=0; i+1<length; i+=5){ if(!((~AV_RN32A(src+i) & (AV_RN32A(src+i) - 0x01000101U)) & 0x80008080U)) # endif continue; if(i>0 && !src[i]) i--; while(src[i]) i++; #else # define RS 0 for(i=0; i+1<length; i+=2){ if(src[i]) continue; if(i>0 && src[i-1]==0) i--; #endif if(i+2<length && src[i+1]==0 && src[i+2]<=3){ if(src[i+2]!=3){ length=i; } break; } i-= RS; } if(i>=length-1){ *dst_length= length; *consumed= length+1; return src; } bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; av_fast_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+FF_INPUT_BUFFER_PADDING_SIZE); dst= h->rbsp_buffer[bufidx]; if (dst == NULL){ return NULL; } memcpy(dst, src, i); si=di=i; while(si+2<length){ if(src[si+2]>3){ dst[di++]= src[si++]; dst[di++]= src[si++]; }else if(src[si]==0 && src[si+1]==0){ if(src[si+2]==3){ dst[di++]= 0; dst[di++]= 0; si+=3; continue; }else goto nsc; } dst[di++]= src[si++]; } while(si<length) dst[di++]= src[si++]; nsc: memset(dst+di, 0, FF_INPUT_BUFFER_PADDING_SIZE); *dst_length= di; *consumed= si + 1; return dst; }
1threat
document.location = 'http://evil.com?username=' + user_input;
1threat
static int local_create_mapped_attr_dir(FsContext *ctx, const char *path) { int err; char attr_dir[PATH_MAX]; char *tmp_path = strdup(path); snprintf(attr_dir, PATH_MAX, "%s/%s/%s", ctx->fs_root, dirname(tmp_path), VIRTFS_META_DIR); err = mkdir(attr_dir, 0700); if (err < 0 && errno == EEXIST) { err = 0; } free(tmp_path); return err; }
1threat
How to set the browser resolution to 2610*1610 using Selenium web driver in IE11 : I want to set the IE11 browser resolution to 2610*1610 using Selenium IE driver automatically through scripts
0debug
Which would be more correct on C++11: switch-case or if( .. || .. || .. )? : I'm trying to build simple lexical analyzer - lexer. The part I'm working on now is tokenizer. I'm writing function which determines whitespaces (whitespaces, tabs, newlines(CR, LF)) in the input sequence. So the question is which code is more correct: The code with switch-case statement: bool isWhitespace(wchar_t &symbol) { switch (symbol) { case L' ': case L'\t': case L'\r': case L'\n': return true; default: return false; } } Or the code with if(.. || .. || ..) statement: bool isWhitespace(wchar_t &symbol) { if (symbol == L' ' || symbol == L'\t' || symbol == L'\r' || symbol == L'\n') { return true; } return false; } And which one would be faster?
0debug
C# Static Methods Calls : <p>I'm trying to create a static method that can be used in chaining, but the available options depend of the previous method within the chain</p> <p>For example MethodXX will only be an option if MethodA() was called.</p> <p>something.MethodA().MethodXX();</p> <p>If MethodB was called, then the available option will be MethodYY</p> <p>something.MethodB().MethodYY();</p> <p>Thank you</p>
0debug
Reading a multiple line .txt file into an array Python : <p>I have a text file formatted as follows</p> <pre><code>a,b,c,d,e,f, g,h,i,j,k,l, </code></pre> <p>How would I read this and store it as an array that looks like <code>[[a,b,c,d,e,f],[g,h,i,j,k,l]]</code>?</p>
0debug
void av_opencl_uninit(void) { cl_int status; int i; LOCK_OPENCL gpu_env.init_count--; if (gpu_env.is_user_created) goto end; if ((gpu_env.init_count > 0) || (gpu_env.kernel_count > 0)) goto end; for (i = 0; i < gpu_env.program_count; i++) { if (gpu_env.programs[i]) { status = clReleaseProgram(gpu_env.programs[i]); if (status != CL_SUCCESS) { av_log(&openclutils, AV_LOG_ERROR, "Could not release OpenCL program: %s\n", opencl_errstr(status)); } gpu_env.programs[i] = NULL; } } if (gpu_env.command_queue) { status = clReleaseCommandQueue(gpu_env.command_queue); if (status != CL_SUCCESS) { av_log(&openclutils, AV_LOG_ERROR, "Could not release OpenCL command queue: %s\n", opencl_errstr(status)); } gpu_env.command_queue = NULL; } if (gpu_env.context) { status = clReleaseContext(gpu_env.context); if (status != CL_SUCCESS) { av_log(&openclutils, AV_LOG_ERROR, "Could not release OpenCL context: %s\n", opencl_errstr(status)); } gpu_env.context = NULL; } av_freep(&(gpu_env.device_ids)); end: UNLOCK_OPENCL }
1threat
What is the advantage of internal only elbs over secured public elbs? : <p>I'm a little unclear on the advantage of internal only ELBs. I could restrict access to my public ELBs with security groups and I have the advantage of allowing public traffic by merely adjusting the security group.</p> <p>Is the advantage just being absolutely sure no public traffic can hit the ELB? Is it purely for that fail safe kind of thing or is there something here I am missing that I can do with internal ELB but not external ELB?</p>
0debug
Assembly code fsqrt and fmul function : Im trying to compute 1.34 *sqrt(lght) in this function using assembly code, but Im getting errors like '_asm' undeclared (first use in this function) each undeclared identifier is reported only once for each func tion it appears in expected ';' before '{' token ****************************************************************************** I have been researching how to solve this problem but cant find much to continue can you guys help me fix it please ?? double hullSpeed(double lgth) { _asm{ global _start fld lght; //load lght fld st(0); //duplicate lght on Top of stack fsqrt ; square root of lght fld st(0);//load square result on top of stack fld 1.34;//load 1.34 on top of stack fld st(i); duplicate 1.34 on TOS fmulp st(0), st(i);//multiply them fst z; save result in z } return z;// return result of [ 1.34 *sqrt(lght) ] }
0debug
How to perform multiplication for integers larger than 64 bits in C? : I want to multiply 57bit integer with 11bit integer. The result can be up to 68bits so I'm planning to split my result in to 2 different integers. I cannot use any library and It should be as simple as possible because the code will be translated to VHDL. There is some ways to that online but all of them are not meet my criteria. I want to split the result as 60bits lower part and 8 bits higher part. C-Code --- int main(){ unsigned long long int log2 = 0b101100010111001000010111111101111101000111001111011110011; unsigned short int absE; unsigned in result_M; unsigned long long int result_L; result_L = absE * log2; result_M = 0; } VHDL --- signal absE : std_logic_vector(10 downto 0); signal log2 : std_logic_vector(57 downto 0) := "101100010111001000010111111101111101000111001111011110011"; signal result: std_logic_vector(67 downto 0); result <= absE * log2;
0debug
How to get List from Page in Spring Data REST : <p>I am using <code>JPARespository</code> for all my CRUD operation. Recently I wanted to implement sorting, so I went ahead with <code>Pagable</code>.</p> <p>The problem is, I want the repository methods to return <code>List</code> objects, I use them in my service layer.</p> <p>How can I achieve this, is there a way to convert these <code>Page</code> objects to <code>List</code>?</p>
0debug
getJSON each how to traverse to children objects : <p>I have the json below and I'm trying to traverse to the "results" and <b>get the question value or the incorrect answers values</b></p> <pre><code>{ "response_code": 0, "results": [ { "category": "Science &amp; Nature", "type": "multiple", "difficulty": "medium", "question": "Which part of the body does glaucoma affect?", "correct_answer": "Eyes", "incorrect_answers": [ "Throat", "Stomach", "Blood" ] } ] } </code></pre> <p>I can get the "response_code", "results" with the code that I wrote below</p> <pre><code>$(function() { $.getJSON('https://opentdb.com/api.php?amount=10', function(data){ $.each(data, function(key, val) { console.log(key +" or " + val); }); }); }); </code></pre>
0debug
void hmp_info_cpus(Monitor *mon, const QDict *qdict) { CpuInfoList *cpu_list, *cpu; cpu_list = qmp_query_cpus(NULL); for (cpu = cpu_list; cpu; cpu = cpu->next) { int active = ' '; if (cpu->value->CPU == monitor_get_cpu_index()) { active = '*'; } monitor_printf(mon, "%c CPU #%" PRId64 ":", active, cpu->value->CPU); switch (cpu->value->arch) { case CPU_INFO_ARCH_X86: monitor_printf(mon, " pc=0x%016" PRIx64, cpu->value->u.x86->pc); break; case CPU_INFO_ARCH_PPC: monitor_printf(mon, " nip=0x%016" PRIx64, cpu->value->u.ppc->nip); break; case CPU_INFO_ARCH_SPARC: monitor_printf(mon, " pc=0x%016" PRIx64, cpu->value->u.q_sparc->pc); monitor_printf(mon, " npc=0x%016" PRIx64, cpu->value->u.q_sparc->npc); break; case CPU_INFO_ARCH_MIPS: monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.q_mips->PC); break; case CPU_INFO_ARCH_TRICORE: monitor_printf(mon, " PC=0x%016" PRIx64, cpu->value->u.tricore->PC); break; default: break; } if (cpu->value->halted) { monitor_printf(mon, " (halted)"); } monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id); } qapi_free_CpuInfoList(cpu_list); }
1threat
NFS client under WSL - mount.nfs: No such device : <p>I am getting the following error trying to mount a nfs export.</p> <pre><code>sudo mount 192.168.1.175:/mnt/nas /mnt/c/nas mount.nfs: No such device </code></pre> <p>Any ideas on how to fix this?</p>
0debug
Speeding up package load in Julia : <p>I wrote a program to solve a linear program in Julia using GLPKMathProgInterface and JuMP. The Julia code is being called by python program which runs multiple instances of the Juila code through multiple command line calls. While I'm extremely happy with the performance of the actual solver the initialization is extremely slow. I was wondering if there were approaches to speed this up. </p> <p>For example if I just save the following to a file </p> <pre><code>@time using DataFrames, CSV, GLPKMathProgInterface, JuMP, ArgParse </code></pre> <p>and run it</p> <pre><code>mylabtop:~ me$ julia test.jl 12.270137 seconds (6.54 M allocations: 364.537 MiB, 3.05% gc time) </code></pre> <p>This seems extremely slow, is there some good way to speed up using modules like a precompile step I could do once? </p>
0debug
how to solve these nin javascript : Locate the displayBirthdate function you initially defined, which took no parameter. Modify it to use object de-structuring to get just the 'dob' property of the parameter object it will receive here's the code const displayBirthdate = () => { }; const displayExtraUserInfo = (extra) => { document.getElementById("btn-birthdate").addEventListener("click", ()=> { displayBirthdate(extra) }) "dob": { "date": "1986-02-19T23:25:07Z", "age": 33 } const getUser = () => ({ date: 156-888, age: 20, });
0debug
window.location.href = 'http://attack.com?user=' + user_input;
1threat
static int ogg_write_header(AVFormatContext *s) { OGGStreamContext *oggstream; int i, j; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; unsigned serial_num = i; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { if (st->codec->codec_id == AV_CODEC_ID_OPUS) avpriv_set_pts_info(st, 64, 1, 48000); else avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); } else if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) avpriv_set_pts_info(st, 64, st->codec->time_base.num, st->codec->time_base.den); if (st->codec->codec_id != AV_CODEC_ID_VORBIS && st->codec->codec_id != AV_CODEC_ID_THEORA && st->codec->codec_id != AV_CODEC_ID_SPEEX && st->codec->codec_id != AV_CODEC_ID_FLAC && st->codec->codec_id != AV_CODEC_ID_OPUS) { av_log(s, AV_LOG_ERROR, "Unsupported codec id in stream %d\n", i); return -1; } if (!st->codec->extradata || !st->codec->extradata_size) { av_log(s, AV_LOG_ERROR, "No extradata present\n"); return -1; } oggstream = av_mallocz(sizeof(*oggstream)); oggstream->page.stream_index = i; if (!(st->codec->flags & CODEC_FLAG_BITEXACT)) do { serial_num = av_get_random_seed(); for (j = 0; j < i; j++) { OGGStreamContext *sc = s->streams[j]->priv_data; if (serial_num == sc->serial_num) break; } } while (j < i); oggstream->serial_num = serial_num; st->priv_data = oggstream; if (st->codec->codec_id == AV_CODEC_ID_FLAC) { int err = ogg_build_flac_headers(st->codec, oggstream, st->codec->flags & CODEC_FLAG_BITEXACT, &s->metadata); if (err) { av_log(s, AV_LOG_ERROR, "Error writing FLAC headers\n"); av_freep(&st->priv_data); return err; } } else if (st->codec->codec_id == AV_CODEC_ID_SPEEX) { int err = ogg_build_speex_headers(st->codec, oggstream, st->codec->flags & CODEC_FLAG_BITEXACT, &s->metadata); if (err) { av_log(s, AV_LOG_ERROR, "Error writing Speex headers\n"); av_freep(&st->priv_data); return err; } } else if (st->codec->codec_id == AV_CODEC_ID_OPUS) { int err = ogg_build_opus_headers(st->codec, oggstream, st->codec->flags & CODEC_FLAG_BITEXACT, &s->metadata); if (err) { av_log(s, AV_LOG_ERROR, "Error writing Opus headers\n"); av_freep(&st->priv_data); return err; } } else { uint8_t *p; const char *cstr = st->codec->codec_id == AV_CODEC_ID_VORBIS ? "vorbis" : "theora"; int header_type = st->codec->codec_id == AV_CODEC_ID_VORBIS ? 3 : 0x81; int framing_bit = st->codec->codec_id == AV_CODEC_ID_VORBIS ? 1 : 0; if (avpriv_split_xiph_headers(st->codec->extradata, st->codec->extradata_size, st->codec->codec_id == AV_CODEC_ID_VORBIS ? 30 : 42, oggstream->header, oggstream->header_len) < 0) { av_log(s, AV_LOG_ERROR, "Extradata corrupted\n"); av_freep(&st->priv_data); return -1; } p = ogg_write_vorbiscomment(7, st->codec->flags & CODEC_FLAG_BITEXACT, &oggstream->header_len[1], &s->metadata, framing_bit); oggstream->header[1] = p; if (!p) return AVERROR(ENOMEM); bytestream_put_byte(&p, header_type); bytestream_put_buffer(&p, cstr, 6); if (st->codec->codec_id == AV_CODEC_ID_THEORA) { oggstream->kfgshift = ((oggstream->header[0][40]&3)<<3)|(oggstream->header[0][41]>>5); oggstream->vrev = oggstream->header[0][9]; av_log(s, AV_LOG_DEBUG, "theora kfgshift %d, vrev %d\n", oggstream->kfgshift, oggstream->vrev); } } } for (j = 0; j < s->nb_streams; j++) { OGGStreamContext *oggstream = s->streams[j]->priv_data; ogg_buffer_data(s, s->streams[j], oggstream->header[0], oggstream->header_len[0], 0, 1); oggstream->page.flags |= 2; ogg_buffer_page(s, oggstream); } for (j = 0; j < s->nb_streams; j++) { AVStream *st = s->streams[j]; OGGStreamContext *oggstream = st->priv_data; for (i = 1; i < 3; i++) { if (oggstream && oggstream->header_len[i]) ogg_buffer_data(s, st, oggstream->header[i], oggstream->header_len[i], 0, 1); } ogg_buffer_page(s, oggstream); } return 0; }
1threat
How to sumit 3 forms of 3 diffrent pages at once : I have 3 forms in 3 different pages, and submit button is on the 3rd page, how can I submit all 3 forms simultaneously by clicking on submit button. Is there any solution in javascript or jquery. page-1 <form id="firstForm"> <input type="checkbox" name="answ1" value="answ1" autocomplete="off"/> </form> page-2 <form id="secondForm"> <input type="checkbox" name="answ2" value="answ2" autocomplete="off"/> <input type="checkbox" name="answ3" value="answ3" autocomplete="off"/> <input type="checkbox" name="answ4" value="answ4" autocomplete="off"/> </form> page-3 <form id="ThirdForm"> <input type="checkbox" name="answ5" value="answ5" autocomplete="off"/> <input type="checkbox" name="answ6" value="answ6" autocomplete="off"/> <input type="checkbox" name="answ7" value="answ7" autocomplete="off"/> <button type="submit">submit</button> </form>
0debug
Scala : => parameters : <p>What does the (code: => Unit) parameter do in this scala function from the scala documentation:</p> <pre><code>def unless(exp: Boolean)(code: =&gt; Unit): Unit = if (!exp) code unless(x &lt; 5) { println("x was not less than five") } </code></pre> <p><a href="http://docs.scala-lang.org/style/declarations.html" rel="nofollow noreferrer">Link</a></p>
0debug
Does std::vector::reserve guarantee that the implementation will not invalidate iterators in this case? : <p>Here is a function which intends to:</p> <p>a) accept a vector of int</p> <p>b) for each int in the input vector, append the inverse of this int</p> <p>preconditions: none</p> <p>postconditions: returned vector's size() is exacly 2 * the input vector's size.</p> <p>Note that the vector is modified in-place.</p> <h2>Question:</h2> <p>Is this function strictly defined behaviour vis-a-vis iterator invalidation during the transform?</p> <h2>Bonus:</h2> <p>Is there a better/more succinct/robust way to write it?</p> <h2>Code:</h2> <pre><code>std::vector&lt;int&gt; append_negatives(std::vector&lt;int&gt; v) { v.reserve(v.size() * 2); std::transform(begin(v), end(v), back_inserter(v), [](auto&amp;&amp; x) { return -x; }); return v; } </code></pre>
0debug
static void blockdev_backup_prepare(BlkActionState *common, Error **errp) { BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, common, common); BlockdevBackup *backup; BlockDriverState *bs, *target; Error *local_err = NULL; assert(common->action->type == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP); backup = common->action->u.blockdev_backup.data; bs = qmp_get_root_bs(backup->device, errp); if (!bs) { return; } target = bdrv_lookup_bs(backup->target, backup->target, errp); if (!target) { return; } state->aio_context = bdrv_get_aio_context(bs); if (state->aio_context != bdrv_get_aio_context(target)) { state->aio_context = NULL; error_setg(errp, "Backup between two IO threads is not implemented"); return; } aio_context_acquire(state->aio_context); state->bs = bs; bdrv_drained_begin(state->bs); do_blockdev_backup(backup, common->block_job_txn, &local_err); if (local_err) { error_propagate(errp, local_err); return; } state->job = state->bs->job; }
1threat
static void set_signalled(sPAPRDRConnector *drc) { drc->signalled = true; }
1threat
The manually added controller can not be opened using url in mvc 5 : I'm new on asp.net mvc. I created a basic controller and I tried to open it using url. But rendering is not finished and my controller didn't display in several minutes. I did not change anything from default asp.net 5 mvc project also my controller's index method return only hello world string. I don't is there any problem on iis or VS. Any idea about that problem? Thanks for help.
0debug
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
1threat
How to preserve base data frame rownames upon filtering in dplyr chain : <p>I have the following data frame:</p> <p> <br/></p> <pre class="lang-r prettyprint-override"><code>df &lt;- structure(list(BoneMarrow = c(30, 0, 0, 31138, 2703), Pulmonary = c(3380, 21223.3333333333, 0, 0, 27)), row.names = c("ATP1B1", "CYCS", "DDX5", "GNB2L1", "PRR11"), class = "data.frame", .Names = c("BoneMarrow", "Pulmonary")) df #&gt; BoneMarrow Pulmonary #&gt; ATP1B1 30 3380.00 #&gt; CYCS 0 21223.33 #&gt; DDX5 0 0.00 #&gt; GNB2L1 31138 0.00 #&gt; PRR11 2703 27.00 </code></pre> <p>What I want to do is to get rid of rows with values &lt; 8 in any of the columns. I tried this but the row names (e.g. ATP1B1, CYCS etc) are gone:</p> <pre class="lang-r prettyprint-override"><code>&gt; df %&gt;% filter(!apply(., 1, function(row) any(row &lt;= 8 ))) BoneMarrow Pulmonary 1 30 3380 2 2703 27 </code></pre> <p>How can I preserve that in dplyr chain?</p>
0debug
Scope error:(TypeError: computeTotal() missing 1 required positional argument: 'drinks') : I know its a scope error but im not sure how to fix it since the variable is a global variable. [Code][1] [1]: https://i.stack.imgur.com/qjR4Q.png
0debug
When should you use npm install vs npm i : <p>Looking at npm's <a href="https://docs.npmjs.com/cli/install" rel="noreferrer">documentation</a>, 'i' is an alias of 'install', would there be any circumstances where it is preferable to use the full 'npm install'?</p>
0debug
Video played with AVPlayer has grey line to top and sides on iPhone 6S Plus : <p>This seems to be a device specific bug on only <strong>iPhone 6S Plus</strong>.</p> <p>Steps:</p> <ol> <li>Download <a href="https://developer.apple.com/library/ios/samplecode/AVPlayerDemo/Introduction/Intro.html" rel="noreferrer">AVPlayer demo sample code</a></li> <li>Adjust <code>AVPlayerDemoPlaybackView.xib</code> so that <code>MPlayback View</code> has margins around it</li> <li>Make content view color white</li> </ol> <p>1px grey lines will appear at the top and sides.</p> <p>Anyone knows how to workaround this?</p> <p>I have tried to put an opaque view that obscure the top, yet the line will still appear ABOVE the opaque view!</p>
0debug
int ppc_radix64_handle_mmu_fault(PowerPCCPU *cpu, vaddr eaddr, int rwx, int mmu_idx) { CPUState *cs = CPU(cpu); CPUPPCState *env = &cpu->env; PPCVirtualHypervisorClass *vhc = PPC_VIRTUAL_HYPERVISOR_GET_CLASS(cpu->vhyp); hwaddr raddr, pte_addr; uint64_t lpid = 0, pid = 0, offset, size, patbe, prtbe0, pte; int page_size, prot, fault_cause = 0; assert((rwx == 0) || (rwx == 1) || (rwx == 2)); assert(!msr_hv); assert(cpu->vhyp); assert(ppc64_use_proc_tbl(cpu)); if (((rwx == 2) && (msr_ir == 0)) || ((rwx != 2) && (msr_dr == 0))) { raddr = eaddr & 0x0FFFFFFFFFFFFFFFULL; tlb_set_page(cs, eaddr & TARGET_PAGE_MASK, raddr & TARGET_PAGE_MASK, PAGE_READ | PAGE_WRITE | PAGE_EXEC, mmu_idx, TARGET_PAGE_SIZE); return 0; } if (!ppc_radix64_get_fully_qualified_addr(env, eaddr, &lpid, &pid)) { ppc_radix64_raise_segi(cpu, rwx, eaddr); return 1; } patbe = vhc->get_patbe(cpu->vhyp); offset = pid * sizeof(struct prtb_entry); size = 1ULL << ((patbe & PATBE1_R_PRTS) + 12); if (offset >= size) { ppc_radix64_raise_si(cpu, rwx, eaddr, DSISR_NOPTE); return 1; } prtbe0 = ldq_phys(cs->as, (patbe & PATBE1_R_PRTB) + offset); page_size = PRTBE_R_GET_RTS(prtbe0); pte = ppc_radix64_walk_tree(cpu, rwx, eaddr & R_EADDR_MASK, prtbe0 & PRTBE_R_RPDB, prtbe0 & PRTBE_R_RPDS, &raddr, &page_size, &fault_cause, &prot, &pte_addr); if (!pte) { ppc_radix64_raise_si(cpu, rwx, eaddr, fault_cause); return 1; } ppc_radix64_set_rc(cpu, rwx, pte, pte_addr, &prot); tlb_set_page(cs, eaddr & TARGET_PAGE_MASK, raddr & TARGET_PAGE_MASK, prot, mmu_idx, 1UL << page_size); return 0; }
1threat
How to change the size of item-avatar in ionic? : <p>I am developing an app using ionic framework. I need to display an image in the side menu header. I have used <strong>item-avatar</strong> to display the image. Here is the code.</p> <pre><code>&lt;ion-side-menus&gt; &lt;ion-side-menu side="left"&gt; &lt;ion-header-bar class="bar-calm style="height:200px" &gt; &lt;div class="list" &gt; &lt;a class="item item-avatar"&gt; &lt;img src="some image source"&gt; &lt;p&gt;This is an image&lt;/p&gt; &lt;/a&gt; &lt;/div&gt; &lt;/ion-header-bar&gt; &lt;/ion-side-menu&gt; &lt;ion-side-menu-content&gt; &lt;ion-list &gt; &lt;!-- Links to the pages that must contain the side menu. --&gt; &lt;ion-item href="#/side-menu24/page1"&gt;Page1&lt;/ion-item&gt; &lt;ion-item href="#/side-menu24/page2"&gt; Page2&lt;/ion-item&gt; &lt;/ion-list&gt; &lt;/ion-side-menu-content&gt; </code></pre> <p></p> <p>How do I change(increase) the size of the image displayed in the item-avatar? I was suggested the following CSS:</p> <pre><code>.list .item-avatar{ width: 20px !important; height : 60px !important;} </code></pre> <p>This increases the content size(size allocated to the div tag) of the item-avatar as a whole but the image size remains the same. Is there any way to increase the size of the image displayed inside the item-avatar?</p>
0debug
How to compare two Images using nodeJs? : <p>Need to compare below image urls:</p> <p><a href="https://cdn-image.foodandwine.com/sites/default/files/original-201404-HD-buckwheat-crepes.jpg" rel="nofollow noreferrer">https://cdn-image.foodandwine.com/sites/default/files/original-201404-HD-buckwheat-crepes.jpg</a> <a href="https://test-static.onecms.io/wp-content/uploads/sites/9/2014/04/original-201404-HD-buckwheat-crepes.jpg" rel="nofollow noreferrer">https://test-static.onecms.io/wp-content/uploads/sites/9/2014/04/original-201404-HD-buckwheat-crepes.jpg</a></p> <p>Please provide solution.</p>
0debug
Connect PHP cripts remotely : I'm trying to use some PHP scripts but when i try o use them it gives me an error ("this page isn't working"). I can see the PHP files in the navigator this way http://public-ip/folder/ but then when i tape http://public-ip/folder/script.php it appears the error. If it helps the same error appears if i access it with local ip (192.168.1.24). It is an Ubuntu Server, XAMPP installed with PHP 7.0, Apache2, phpMyAdmin, MySQL (i have permission),... Thanks a lot
0debug
int ppc_hash32_handle_mmu_fault(CPUPPCState *env, target_ulong address, int rw, int mmu_idx) { struct mmu_ctx_hash32 ctx; int access_type; int ret = 0; if (rw == 2) { rw = 0; access_type = ACCESS_CODE; } else { access_type = env->access_type; } ret = ppc_hash32_get_physical_address(env, &ctx, address, rw, access_type); if (ret == 0) { tlb_set_page(env, address & TARGET_PAGE_MASK, ctx.raddr & TARGET_PAGE_MASK, ctx.prot, mmu_idx, TARGET_PAGE_SIZE); ret = 0; } else if (ret < 0) { LOG_MMU_STATE(env); if (access_type == ACCESS_CODE) { switch (ret) { case -1: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x40000000; break; case -2: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x08000000; break; case -3: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; case -4: env->exception_index = POWERPC_EXCP_ISI; env->error_code = 0x10000000; break; } } else { switch (ret) { case -1: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x42000000; } else { env->spr[SPR_DSISR] = 0x40000000; } break; case -2: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x0A000000; } else { env->spr[SPR_DSISR] = 0x08000000; } break; case -4: switch (access_type) { case ACCESS_FLOAT: env->exception_index = POWERPC_EXCP_ALIGN; env->error_code = POWERPC_EXCP_ALIGN_FP; env->spr[SPR_DAR] = address; break; case ACCESS_RES: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x06000000; } else { env->spr[SPR_DSISR] = 0x04000000; } break; case ACCESS_EXT: env->exception_index = POWERPC_EXCP_DSI; env->error_code = 0; env->spr[SPR_DAR] = address; if (rw == 1) { env->spr[SPR_DSISR] = 0x06100000; } else { env->spr[SPR_DSISR] = 0x04100000; } break; default: printf("DSI: invalid exception (%d)\n", ret); env->exception_index = POWERPC_EXCP_PROGRAM; env->error_code = POWERPC_EXCP_INVAL | POWERPC_EXCP_INVAL_INVAL; env->spr[SPR_DAR] = address; break; } break; } } #if 0 printf("%s: set exception to %d %02x\n", __func__, env->exception, env->error_code); #endif ret = 1; } return ret; }
1threat
static const unsigned char *seq_decode_op2(SeqVideoContext *seq, const unsigned char *src, unsigned char *dst) { int i; for (i = 0; i < 8; i++) { memcpy(dst, src, 8); src += 8; dst += seq->frame.linesize[0]; } return src; }
1threat
static void vector_fmul_window_mips(float *dst, const float *src0, const float *src1, const float *win, int len) { int i, j; float * dst_i, * dst_j, * dst_i2, * dst_j2; float temp, temp1, temp2, temp3, temp4, temp5, temp6, temp7; dst += len; win += len; src0 += len; for (i = -len, j = len - 1; i < 0; i += 8, j -= 8) { dst_i = dst + i; dst_j = dst + j; dst_i2 = dst + i + 4; dst_j2 = dst + j - 4; __asm__ volatile ( "mul.s %[temp], %[s1], %[wi] \n\t" "mul.s %[temp1], %[s1], %[wj] \n\t" "mul.s %[temp2], %[s11], %[wi1] \n\t" "mul.s %[temp3], %[s11], %[wj1] \n\t" "msub.s %[temp], %[temp], %[s0], %[wj] \n\t" "madd.s %[temp1], %[temp1], %[s0], %[wi] \n\t" "msub.s %[temp2], %[temp2], %[s01], %[wj1] \n\t" "madd.s %[temp3], %[temp3], %[s01], %[wi1] \n\t" "swc1 %[temp], 0(%[dst_i]) \n\t" "swc1 %[temp1], 0(%[dst_j]) \n\t" "swc1 %[temp2], 4(%[dst_i]) \n\t" "swc1 %[temp3], -4(%[dst_j]) \n\t" "mul.s %[temp4], %[s12], %[wi2] \n\t" "mul.s %[temp5], %[s12], %[wj2] \n\t" "mul.s %[temp6], %[s13], %[wi3] \n\t" "mul.s %[temp7], %[s13], %[wj3] \n\t" "msub.s %[temp4], %[temp4], %[s02], %[wj2] \n\t" "madd.s %[temp5], %[temp5], %[s02], %[wi2] \n\t" "msub.s %[temp6], %[temp6], %[s03], %[wj3] \n\t" "madd.s %[temp7], %[temp7], %[s03], %[wi3] \n\t" "swc1 %[temp4], 8(%[dst_i]) \n\t" "swc1 %[temp5], -8(%[dst_j]) \n\t" "swc1 %[temp6], 12(%[dst_i]) \n\t" "swc1 %[temp7], -12(%[dst_j]) \n\t" : [temp]"=&f"(temp), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5), [temp6]"=&f"(temp6), [temp7]"=&f"(temp7) : [dst_j]"r"(dst_j), [dst_i]"r" (dst_i), [s0] "f"(src0[i]), [wj] "f"(win[j]), [s1] "f"(src1[j]), [wi] "f"(win[i]), [s01]"f"(src0[i + 1]),[wj1]"f"(win[j - 1]), [s11]"f"(src1[j - 1]), [wi1]"f"(win[i + 1]), [s02]"f"(src0[i + 2]), [wj2]"f"(win[j - 2]), [s12]"f"(src1[j - 2]),[wi2]"f"(win[i + 2]), [s03]"f"(src0[i + 3]), [wj3]"f"(win[j - 3]), [s13]"f"(src1[j - 3]), [wi3]"f"(win[i + 3]) : "memory" ); __asm__ volatile ( "mul.s %[temp], %[s1], %[wi] \n\t" "mul.s %[temp1], %[s1], %[wj] \n\t" "mul.s %[temp2], %[s11], %[wi1] \n\t" "mul.s %[temp3], %[s11], %[wj1] \n\t" "msub.s %[temp], %[temp], %[s0], %[wj] \n\t" "madd.s %[temp1], %[temp1], %[s0], %[wi] \n\t" "msub.s %[temp2], %[temp2], %[s01], %[wj1] \n\t" "madd.s %[temp3], %[temp3], %[s01], %[wi1] \n\t" "swc1 %[temp], 0(%[dst_i2]) \n\t" "swc1 %[temp1], 0(%[dst_j2]) \n\t" "swc1 %[temp2], 4(%[dst_i2]) \n\t" "swc1 %[temp3], -4(%[dst_j2]) \n\t" "mul.s %[temp4], %[s12], %[wi2] \n\t" "mul.s %[temp5], %[s12], %[wj2] \n\t" "mul.s %[temp6], %[s13], %[wi3] \n\t" "mul.s %[temp7], %[s13], %[wj3] \n\t" "msub.s %[temp4], %[temp4], %[s02], %[wj2] \n\t" "madd.s %[temp5], %[temp5], %[s02], %[wi2] \n\t" "msub.s %[temp6], %[temp6], %[s03], %[wj3] \n\t" "madd.s %[temp7], %[temp7], %[s03], %[wi3] \n\t" "swc1 %[temp4], 8(%[dst_i2]) \n\t" "swc1 %[temp5], -8(%[dst_j2]) \n\t" "swc1 %[temp6], 12(%[dst_i2]) \n\t" "swc1 %[temp7], -12(%[dst_j2]) \n\t" : [temp]"=&f"(temp), [temp1]"=&f"(temp1), [temp2]"=&f"(temp2), [temp3]"=&f"(temp3), [temp4]"=&f"(temp4), [temp5]"=&f"(temp5), [temp6]"=&f"(temp6), [temp7] "=&f" (temp7) : [dst_j2]"r"(dst_j2), [dst_i2]"r"(dst_i2), [s0] "f"(src0[i + 4]), [wj] "f"(win[j - 4]), [s1] "f"(src1[j - 4]), [wi] "f"(win[i + 4]), [s01]"f"(src0[i + 5]),[wj1]"f"(win[j - 5]), [s11]"f"(src1[j - 5]), [wi1]"f"(win[i + 5]), [s02]"f"(src0[i + 6]), [wj2]"f"(win[j - 6]), [s12]"f"(src1[j - 6]),[wi2]"f"(win[i + 6]), [s03]"f"(src0[i + 7]), [wj3]"f"(win[j - 7]), [s13]"f"(src1[j - 7]), [wi3]"f"(win[i + 7]) : "memory" ); } }
1threat
Horizontal Scroll using buttons on angular2 : <p>So I have this app in angular2 where I need to scroll a component horizontally but with buttons right and left. So I need a function for each button that scroll to right or left the content. I need something like this: <a href="https://i.stack.imgur.com/eJaau.png" rel="noreferrer"><img src="https://i.stack.imgur.com/eJaau.png" alt="enter image description here"></a></p> <p>I tried using <code>document.getElementById('myscrolldiv').animate({ scrollLeft: "-=" + 250 + "px"; }</code> but Angular does not recognize the <code>animate</code> line.</p> <p>So I am looking for a diferent way of scroll horizontally using buttons but NOT using jquery. Is there any way to do this in angular?</p> <p>Here is my html</p> <pre><code>&lt;div class="container"&gt; &lt;div class="side"&gt; &lt;mat-icon (click)="scrollLeft()"&gt;keyboard_arrow_left&lt;/mat-icon&gt; &lt;/div&gt; &lt;div id="widgetsContent" class="middle"&gt; &lt;div class="scrolls"&gt; &lt;div class="info-widget"&gt; WIDGET &lt;/div&gt; &lt;div class="info-widget"&gt; WIDGET &lt;/div&gt; &lt;div class="info-widget"&gt; WIDGET &lt;/div&gt; &lt;div class="info-widget"&gt; WIDGET &lt;/div&gt; &lt;div class="info-widget"&gt; WIDGET &lt;/div&gt; &lt;div class="info-widget"&gt; WIDGET &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="side"&gt; &lt;mat-icon (click)="scrollRight()"&gt;keyboard_arrow_right&lt;/mat-icon&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And here is my css</p> <pre><code>.container { display: flex; height: 22.5vh !important; } .side { width: 50px; height: 22.5vh !important; } .middle { flex-grow: 1; height: 22.5vh !important; overflow-x: scroll; overflow-y: hidden; white-space: nowrap; } </code></pre> <p>So, how do I scroll right and left pushing the buttons? please help.</p>
0debug
MATLAB no longer unloading MEX-files after upgrade to macOS Mojave : <p>In MATLAB, <code>clear mex</code> unloads all MEX-files from memory (unless they're locked). Under previous versions of macOS, I was able to re-compile a MEX-file and run the modified version without restarting MATLAB, simply by issuing a <code>clear mex</code> command. This is no longer possible under Mojave.</p> <p>For example, take this trivial MEX-file (<code>get_data_pointer.c</code>):</p> <pre class="lang-c prettyprint-override"><code>#include "mex.h" void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { plhs[0] = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL); *(uint64_t*)mxGetData(plhs[0]) = (uint64_t)mxGetData(prhs[0]); } </code></pre> <p>We can create the MEX-file and load it in memory with</p> <pre class="lang-matlab prettyprint-override"><code>mex get_data_pointer.c get_data_pointer(0) </code></pre> <p>To clear it,</p> <pre class="lang-matlab prettyprint-override"><code>clear mex [~,mexfiles] = inmem version -modules </code></pre> <p><code>inmem</code> indeed returns an empty cell array indicating no MEX-files are loaded in memory, But <code>version -modules</code> (undocumented, from <a href="https://stackoverflow.com/a/20407568/7328782">this answer</a>) still shows <code>/Users/cris/matlab/get_data_pointer.mexmaci64</code> in its output. And changing the MEX-file source code and re-compiling demonstrates that, indeed, the MEX-file is never reloaded, the old version is still being run until one exits MATLAB.</p> <p>I am seeing this on MATLAB R2017a on macOS Mojave. This was never a problem with the same MATLAB version under High Sierra.</p> <p>How can I force MATLAB to unload the MEX-file without restarting?</p>
0debug
Vue instance inside Vue instance : <p>Sup people!</p> <p>I got this HTML code here:</p> <pre><code>// index.html &lt;div data-init="component-one"&gt; &lt;...&gt; &lt;div data-init="component-two"&gt; &lt;button @click="doSomething($event)"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>This basically references a Vue instance inside another Vue instance if I understood everything correctly. The respective JS code is split up in two files and looks like this:</p> <pre><code>// componentOne.js new Vue( el: '[data-init="component-one"]', data: {...}, methods: {...} ); // componentTwo.js new Vue( el: '[data-init="component-two"]' data: {...} methods: { doSomething: function(event) {...} } ); </code></pre> <p>Now, the problem with this is, that <code>doSomething</code> from <code>componentTwo</code> never gets called.</p> <p>But when I do some inline stuff, like <code>{{ 3 + 3 }}</code>, it gets computed like it should. So Vue knows there is something. And it also removes the <code>@click</code> element on page load.</p> <p>I tried fiddling around with <code>inline-template</code> as well, but it doesn't really work as I'd expect it to in this situation. And I figured it isn't meant for this case anyway, so I dropped it again.</p> <p>What would the correct approach be here? And how can I make this work the easiest way possible with how it's set up right now?</p> <p>The Vue version we use is <code>2.1.8</code>.</p> <p>Cheers!</p>
0debug
static void virtqueue_map_desc(unsigned int *p_num_sg, hwaddr *addr, struct iovec *iov, unsigned int max_num_sg, bool is_write, hwaddr pa, size_t sz) { unsigned num_sg = *p_num_sg; assert(num_sg <= max_num_sg); if (!sz) { error_report("virtio: zero sized buffers are not allowed"); while (sz) { hwaddr len = sz; if (num_sg == max_num_sg) { error_report("virtio: too many write descriptors in indirect table"); iov[num_sg].iov_base = cpu_physical_memory_map(pa, &len, is_write); iov[num_sg].iov_len = len; addr[num_sg] = pa; sz -= len; pa += len; num_sg++; *p_num_sg = num_sg;
1threat
clk_setup_cb cpu_ppc_tb_init (CPUPPCState *env, uint32_t freq) { PowerPCCPU *cpu = ppc_env_get_cpu(env); ppc_tb_t *tb_env; tb_env = g_malloc0(sizeof(ppc_tb_t)); env->tb_env = tb_env; tb_env->flags = PPC_DECR_UNDERFLOW_TRIGGERED; if (env->insns_flags & PPC_SEGMENT_64B) { tb_env->flags |= PPC_DECR_UNDERFLOW_LEVEL; } tb_env->decr_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &cpu_ppc_decr_cb, cpu); if (0) { tb_env->hdecr_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, &cpu_ppc_hdecr_cb, cpu); } else { tb_env->hdecr_timer = NULL; } cpu_ppc_set_tb_clk(env, freq); return &cpu_ppc_set_tb_clk; }
1threat
static void qemu_chr_parse_spice_vmc(QemuOpts *opts, ChardevBackend *backend, Error **errp) { const char *name = qemu_opt_get(opts, "name"); if (name == NULL) { error_setg(errp, "chardev: spice channel: no name given"); return; } backend->u.spicevmc = g_new0(ChardevSpiceChannel, 1); backend->u.spicevmc->type = g_strdup(name); }
1threat
Why is Python 3 http.client so much faster than python-requests? : <p>I was testing different Python HTTP libraries today and I realized that <a href="https://docs.python.org/3/library/http.client.html" rel="noreferrer"><code>http.client</code></a> library seems to perform much much faster than <a href="http://docs.python-requests.org/en/master/" rel="noreferrer"><code>requests</code></a>. </p> <p>To test it you can run following two code samples.</p> <pre><code>import http.client conn = http.client.HTTPConnection("localhost", port=8000) for i in range(1000): conn.request("GET", "/") r1 = conn.getresponse() body = r1.read() print(r1.status) conn.close() </code></pre> <p>and here is code doing same thing with python-requests:</p> <pre><code>import requests with requests.Session() as session: for i in range(1000): r = session.get("http://localhost:8000") print(r.status_code) </code></pre> <p>If I start SimpleHTTPServer:</p> <pre><code>&gt; python -m http.server </code></pre> <p>and run above code samples (I'm using Python 3.5.2). I get following results:</p> <p>http.client:</p> <pre><code>0.35user 0.10system 0:00.71elapsed 64%CPU </code></pre> <p>python-requests:</p> <pre><code>1.76user 0.10system 0:02.17elapsed 85%CPU </code></pre> <p>Are my measurements and tests correct? Can you reproduce them too? If yes does anyone know what's going on inside <code>http.client</code> that make it so much faster? Why is there such big difference in processing time?</p>
0debug
Open source Test Data Tool for Oracle : <p>Is there any open source test data generator tool to populate oracle database? I did some searches and came across devart, datanamic but these are paid ones.</p>
0debug
Why is this program not polymorphic? : <p>In the follwoing program I am trying to overload a method by passing paramaters, but the out put for both methods is the same </p> <pre><code> public class A { int a = 11; int b = 20; static int c = 0; public void A1(){ c = a+b; } public void A1(int a,int b){ c = this.a+this.b; } public static void main(String[] args){ A a = new A(); a.A1();// this should give 31 System.out.print(c); a.A1(3,46);// this should give 49 System.out.print(c); } } </code></pre> <p>OUTPUT : The output for both is 31.</p> <p>Even though I am trying to overload , the out put for both is same.</p>
0debug
Could not find "fill parent" in Android Studio : <p>Hi I am following an android tutorial and i need to do fill parent.</p> <p>However, I didn't find it in the layout list. The only two options are "wrap content" and "match parent".</p> <p>I am using Android Studio 2.3.3 on MacBook Pro 2016.</p> <p>Hope someone could help how to set it to fill parent.</p> <p>Thanks!</p>
0debug
static int bonito_initfn(PCIDevice *dev) { PCIBonitoState *s = DO_UPCAST(PCIBonitoState, dev, dev); pci_config_set_vendor_id(dev->config, 0xdf53); pci_config_set_device_id(dev->config, 0x00d5); pci_config_set_class(dev->config, PCI_CLASS_BRIDGE_HOST); pci_config_set_prog_interface(dev->config, 0x00); pci_config_set_revision(dev->config, 0x01); s->bonito_reg_handle = cpu_register_io_memory(bonito_read, bonito_write, s, DEVICE_NATIVE_ENDIAN); s->bonito_reg_start = BONITO_INTERNAL_REG_BASE; s->bonito_reg_length = BONITO_INTERNAL_REG_SIZE; cpu_register_physical_memory(s->bonito_reg_start, s->bonito_reg_length, s->bonito_reg_handle); s->bonito_pciconf_handle = cpu_register_io_memory(bonito_pciconf_read, bonito_pciconf_write, s, DEVICE_NATIVE_ENDIAN); s->bonito_pciconf_start = BONITO_PCICONFIG_BASE; s->bonito_pciconf_length = BONITO_PCICONFIG_SIZE; cpu_register_physical_memory(s->bonito_pciconf_start, s->bonito_pciconf_length, s->bonito_pciconf_handle); s->bonito_spciconf_handle = cpu_register_io_memory(bonito_spciconf_read, bonito_spciconf_write, s, DEVICE_NATIVE_ENDIAN); s->bonito_spciconf_start = BONITO_SPCICONFIG_BASE; s->bonito_spciconf_length = BONITO_SPCICONFIG_SIZE; cpu_register_physical_memory(s->bonito_spciconf_start, s->bonito_spciconf_length, s->bonito_spciconf_handle); s->bonito_ldma_handle = cpu_register_io_memory(bonito_ldma_read, bonito_ldma_write, s, DEVICE_NATIVE_ENDIAN); s->bonito_ldma_start = 0xbfe00200; s->bonito_ldma_length = 0x100; cpu_register_physical_memory(s->bonito_ldma_start, s->bonito_ldma_length, s->bonito_ldma_handle); s->bonito_cop_handle = cpu_register_io_memory(bonito_cop_read, bonito_cop_write, s, DEVICE_NATIVE_ENDIAN); s->bonito_cop_start = 0xbfe00300; s->bonito_cop_length = 0x100; cpu_register_physical_memory(s->bonito_cop_start, s->bonito_cop_length, s->bonito_cop_handle); s->bonito_pciio_start = BONITO_PCIIO_BASE; s->bonito_pciio_length = BONITO_PCIIO_SIZE; isa_mem_base = s->bonito_pciio_start; isa_mmio_init(s->bonito_pciio_start, s->bonito_pciio_length); s->bonito_localio_start = BONITO_DEV_BASE; s->bonito_localio_length = BONITO_DEV_SIZE; isa_mmio_init(s->bonito_localio_start, s->bonito_localio_length); pci_set_word(dev->config + PCI_COMMAND, 0x0000); pci_set_word(dev->config + PCI_STATUS, 0x0000); pci_set_word(dev->config + PCI_SUBSYSTEM_VENDOR_ID, 0x0000); pci_set_word(dev->config + PCI_SUBSYSTEM_ID, 0x0000); pci_set_byte(dev->config + PCI_INTERRUPT_LINE, 0x00); pci_set_byte(dev->config + PCI_INTERRUPT_PIN, 0x01); pci_set_byte(dev->config + PCI_MIN_GNT, 0x3c); pci_set_byte(dev->config + PCI_MAX_LAT, 0x00); qemu_register_reset(bonito_reset, s); return 0; }
1threat
How can I fix double scroll bar in Windows 10 Firefox? : #Environment - Laravel Version : **5.1.45 (LTS)** - PHP Version : **5.6.1** _______________ #Description I have using a tlk chat integration, and I kept seeing 2 scrollbar on Windows Firefox + IE. Mac is fine, Chrome is fine. [![enter image description here][1]][1] _______________ #Attempt I did some research and I've tried all of these, but none of them seem to work. // html, body {height:100%;} // html { overflow-y: scroll;} // * html .clearfix { height: 1%; } // html {overflow-y: hidden } I've tried applied them as in file css. _______________ #Question **How would one go about and debug this ?** _______________ I'm opening to any suggestions at this moment. Any hints / suggestions / helps on this be will be much appreciated ! [1]: https://i.stack.imgur.com/VfxcE.png
0debug
How to get terminal window inside Visual Studio 2017 / 2019? : <p>I was just reading this article - <a href="https://devblogs.microsoft.com/dotnet/visual-studio-2019-net-productivity-2/" rel="noreferrer">https://devblogs.microsoft.com/dotnet/visual-studio-2019-net-productivity-2/</a> and noticed in one of the GIF image, she is showing a terminal window inside VS editor itself. It looks like a fully fledged powershell window. How can we get that? Here is a screenshot.</p> <p><a href="https://i.stack.imgur.com/vKfjO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/vKfjO.png" alt="enter image description here"></a></p>
0debug
void msi_notify(PCIDevice *dev, unsigned int vector) { uint16_t flags = pci_get_word(dev->config + msi_flags_off(dev)); bool msi64bit = flags & PCI_MSI_FLAGS_64BIT; unsigned int nr_vectors = msi_nr_vectors(flags); MSIMessage msg; assert(vector < nr_vectors); if (msi_is_masked(dev, vector)) { assert(flags & PCI_MSI_FLAGS_MASKBIT); pci_long_test_and_set_mask( dev->config + msi_pending_off(dev, msi64bit), 1U << vector); MSI_DEV_PRINTF(dev, "pending vector 0x%x\n", vector); return; } msg = msi_get_message(dev, vector); MSI_DEV_PRINTF(dev, "notify vector 0x%x" " address: 0x%"PRIx64" data: 0x%"PRIx32"\n", vector, msg.address, msg.data); stl_le_phys(&address_space_memory, msg.address, msg.data); }
1threat
R: find date closest to row specific date : I have the following dataframe in R https://i.stack.imgur.com/buNOS.png 1st column contains identification numbers (respnr) 2nd column contains reference date per identification number (cdatalg) 3rd through 16th column contains dates (datesc1:datesc14) I wish to enter a 17th column in which the date in column 3:16 is printed which is closest to the reference date in column 2. I have tried combinations of apply and which.min and neardate, though can't figure it out. A push in the right direction would be very much appreciated.
0debug
document.write('<script src="evil.js"></script>');
1threat
How can i remove duplicate from a string in python?. My approaches have all been rejected. Below is a code i have : These are codes i've been stuck on, really don't know what to do from here: def remove_duplicates(string): s = string.split() return string.replace(s[0],"") def RemoveDupliChar(Word): NewWord = " " index = 0 for char in Word: if char != NewWord[index]: NewWord += char index += 1 print(NewWord.strip())
0debug
alert('Hello ' + user_input);
1threat
static void pci_device_reset(PCIDevice *dev) { int r; memset(dev->irq_state, 0, sizeof dev->irq_state); dev->config[PCI_COMMAND] &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); dev->config[PCI_CACHE_LINE_SIZE] = 0x0; dev->config[PCI_INTERRUPT_LINE] = 0x0; for (r = 0; r < PCI_NUM_REGIONS; ++r) { if (!dev->io_regions[r].size) { continue; } pci_set_long(dev->config + pci_bar(dev, r), dev->io_regions[r].type); } pci_update_mappings(dev); }
1threat
How should I go about querying SQL database based on html <a> click? : <p>What I want to do is when a user clicks an HTML a PHP file querys MySQL database and display the data in a popup tab. How should I go about doing this? Should I use javascript to handle the button events? Or can this be done with only PHP? Maybe a combination? You dont have show any code, maybe just a little guidance of how I should handle it. I am new to coding, only a week or so, thanks!</p>
0debug
compare 2 string arraylist and get same value in console : I have 2 below string array list. ArrayList<String> sourceArray = [bg, zh_cn, cs, da, en_us]; ArrayList<String> targetArray = [bg, pt, ru, sg, da, en_us]; I want to write the code in java, where I will compare this two arraylist get the same value in output, like below. If sourceArray equalis to targetArray then it should print below System.out.println("bg is similar in both array"); Can anybody tell me how can I proceed with this.. My output should be as below: **bg is similar in both array da is similar in both array en_us is similar in both array**
0debug
static void pci_qdev_realize(DeviceState *qdev, Error **errp) { PCIDevice *pci_dev = (PCIDevice *)qdev; PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev); Error *local_err = NULL; PCIBus *bus; bool is_default_rom; if (pc->is_express) { pci_dev->cap_present |= QEMU_PCI_CAP_EXPRESS; } bus = PCI_BUS(qdev_get_parent_bus(qdev)); pci_dev = do_pci_register_device(pci_dev, bus, object_get_typename(OBJECT(qdev)), pci_dev->devfn, errp); if (pci_dev == NULL) return; if (pc->realize) { pc->realize(pci_dev, &local_err); if (local_err) { error_propagate(errp, local_err); do_pci_unregister_device(pci_dev); return; } } is_default_rom = false; if (pci_dev->romfile == NULL && pc->romfile != NULL) { pci_dev->romfile = g_strdup(pc->romfile); is_default_rom = true; } pci_add_option_rom(pci_dev, is_default_rom, &local_err); if (local_err) { error_propagate(errp, local_err); pci_qdev_unrealize(DEVICE(pci_dev), NULL); return; } }
1threat
Backtracing variable UIBezlerPath : What to do? I'm getting this Error when i setted the Backtracing Variable... This Code is causing the Error for sure: UIBezierPath* ovalPath = [UIBezierPath bezierPath]; [ovalPath addArcWithCenter: CGPointMake(CGRectGetMidX(ovalRect), CGRectGetMidY(ovalRect)) radius: CGRectGetWidth(ovalRect) / 2 startAngle: 180 * M_PI/180 endAngle: 0 * M_PI/180 clockwise: YES]; [ovalPath addLineToPoint: CGPointMake(CGRectGetMidX(ovalRect), CGRectGetMidY(ovalRect))]; [ovalPath closePath]; [UIColor.grayColor setFill]; [ovalPath fill]; CGContextSetFlatness: invalid context 0x0. Backtrace: <<redacted>+48> <-[ViewController viewDidLoad]+2868> <<redacted>+996> <<redacted>+28> <<redacted>+76> <<redacted>+252> <<redacted>+48> <<redacted>+3456> <<redacted>+1684> <<redacted>+168> <<redacted>+36> <<redacted>+168> <<redacted>+56> <<redacted>+24> <<redacted>+540> <<redacted>+724> <CFRunLoopRunSpecific+384> <<redacted>+460> <UIApplicationMain+204> <main+124> Sep 5 21:55:56 Motion Tracking Radar - Aliem[2934] <Error>:
0debug
How to open keyboard automatically in React Native? : <p>I have a screen in my React Native application in which I have few text fields.</p> <p>I was wondering if there is any way in which on screen load my keyword opens automatically and focuses on my first text input field?</p> <p>I was searching for something like <code>stateAlwaysVisible</code> in android.</p>
0debug
Python 3 - how to knock off that last comma : So I am wondering what the best way to knock off that last comma printed. for i in range(1, 21): print(i, end=",")
0debug
After Task.IsCompleted what is better: await or Result : <p>I'm working in a simple timeout code for my http requests. I got this</p> <pre><code>private async Task&lt;HttpResponseMessage&gt; ExecuteIOTask(Task&lt;HttpResponseMessage&gt; ioTask, int timeout) { var timeoutTask = await Task.WhenAny(Task.Delay(timeout), ioTask); if (ioTask.IsCompleted) return ioTask.Result; throw new TimeoutException(); } </code></pre> <p>After IsCompleted, is there any difference using <code>Result</code> vs <code>await</code> ? The task is already completed at that instance, so I think the performance should be the same. But i'm a little concern about the exception handling. I think <code>Result</code> is not going to propagate the exceptions but <code>await</code> will.</p> <p>Is this correct?</p>
0debug