problem
stringlengths
26
131k
labels
class label
2 classes
static void spapr_phb_remove_pci_device(sPAPRDRConnector *drc, sPAPRPHBState *phb, PCIDevice *pdev, Error **errp) { sPAPRDRConnectorClass *drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); drck->detach(drc, DEVICE(pdev), spapr_phb_remove_pci_device_cb, phb, errp); }
1threat
React app stuck on "Starting the development server" : <p>I have a react app created by create-react-app. After running npm start (the start script is present in package.json as "start": "react-scripts start") the console says Starting the development server as usual and fires up the browser. But after this both the console and the browser do absolutely nothing indefinitely. No error or output. It simply does nothing.</p>
0debug
vue is not defined on the instance but referenced during render : <p>I'm trying to build a simple app in vue and I'm getting an error. My onScroll function behaves as expected, but my sayHello function returns an error when I click my button component</p> <blockquote> <p>Property or method "sayHello" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. (found in component )</p> </blockquote> <pre><code>Vue.component('test-item', { template: '&lt;div&gt;&lt;button v-on:click="sayHello()"&gt;Hello&lt;/button&gt;&lt;/div&gt;' }); var app = new Vue({ el: '#app', data: { header: { brightness: 100 } }, methods: { sayHello: function() { console.log('Hello'); }, onScroll: function () { this.header.brightness = (100 - this.$el.scrollTop / 8); } } }); </code></pre> <p>I feel like the answer is really obvious but I've tried searching and haven't come up with anything. Any help would be appreciated.</p> <p>Thanks.</p>
0debug
static void term_print_cmdline (const char *cmdline) { term_show_prompt(); term_printf(cmdline); term_flush(); }
1threat
How can I create a maven plugin to test the source code of a project? : <p>We have a console program that checks all .java files in a project for some common mistakes. It Reads the source code as plain text. We'd like to transform it to a maven plugin that is run when pushed to gitlab in the CI pipeline </p>
0debug
Xcode Application Loader stuck at "Signing in to App Store Connect" : <p><em>Note: this is NOT the same as being stuck at "Authenticating with the iTunes store" while uploading an app, which is well-documented on SO and elsewhere.</em></p> <p>When I first launch Application Loader, I'm prompted for a username and password. I enter my credentials and click Sign In. A message pops up saying "Signing in to App Store Connect" with a little spinner to the left. Then a few seconds later, the spinner goes away, and I'm never brought to the page where I can upload an .ipa. And I'm left questioning my life choices.</p> <p><a href="https://i.stack.imgur.com/MYzQv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MYzQv.png" alt="Application Loader Sign In"></a></p> <p>I have a coworker who experienced the exact same issue. We each have email addresses associated to 2 Apple Developer accounts, we'll call them <code>nodice.com</code> and <code>allgood.com</code>. We can both sign in to our <code>allgood.com</code> accounts fine. But both of us experience this issue when signing in to our <code>nodice.com</code> accounts.</p> <p>However, we can both sign in to both accounts at <a href="https://developer.apple.com/" rel="noreferrer">https://developer.apple.com/</a> and <a href="https://appstoreconnect.apple.com/" rel="noreferrer">https://appstoreconnect.apple.com/</a>.</p> <p>The curious difference between the two, is that both of our <code>nodice.com</code> email addresses also belong to other organizations. The <code>allgood.com</code> accounts have only been invited to one organization. In other words, on the websites above, while logged in to the <code>nodice.com</code> account, I can switch between these organizations. On the <code>allgood.com</code> account, I have only one organization to choose from.</p> <p><a href="https://i.stack.imgur.com/TDoTw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/TDoTw.png" alt="App Store Connect menu"></a></p> <p>Even curiouser is this, which I found by accident: if I close the stuck login screen, I see the "Template Chooser" screen! But the selected team is the one I don't want, and when I click the button, the menu is borked.</p> <p><a href="https://i.stack.imgur.com/2Li6J.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2Li6J.png" alt="Template Chooser"></a> </p> <p>Recently Apple made a change -- we all got the email -- that "Teams and roles have been unified" between the Apple Developer website and App Store Connect. This could be related.</p> <p>We are using Xcode Version 10.1 (10B61) and Application Loader Version 3.7.2 (1138), which as far as I know are the most recent versions. </p> <p>I have tried modifying the <code>net.properties</code> file as documented <a href="https://stackoverflow.com/questions/18971710/application-loader-stuck-at-the-stage-of-authenticating-with-the-itunes-store">here</a>.</p> <p>I have also tried updating the <code>iTMSTransporter</code> using the instructions found <a href="https://forums.developer.apple.com/thread/76803" rel="noreferrer">here</a>.</p> <p>I may just have to file a bug report with Apple, but I'm curious if anyone else has had this issue and has maybe found a workaround.</p>
0debug
Random string generator from JavaScript for kids challenge : <p>I want to ask about the random string generator challenge. So, I got this quiz from JavaScript for kids book from no starch press publisher. I'm newbie and very confused about this challenge, can somebody help me?</p> <p>====================</p> <h1>Random string generator</h1> <p>"Make a random string generator. You’ll need to start with a string containing all the letters in the alphabet: var alphabet = "abcdefghijklmnopqrstuvwxyz"; To pick a random letter from this string, you can update the code we used for the random insult generator in Chapter 3: Math.floor(Math.random() * alphabet.length). This will create a random index into the string. You can then use square brackets to get the character at that index. To create the random string, start with an empty string (var randomString = ""). Then, create a while loop that will continually add new random letters to this string, as long as the string length is less than 6 (or any length you choose). You could use the += operator to add a new letter to the end of the string. After the loop has finished, log it to the console to see your creation!"</p>
0debug
Javascrip test to see if first 4 characters are correct : Here is my issue i am trying to run a script to see if i can verify the first 4 characters in a text box. The text box works to tell me that the characters are not there but when i put the first 4 number in correctly it still gives me the same error. Also the text box has a min of 15 characters and a max of 16 characters. Here is the script: var check_card_no = function (event){ check_digits = card_no.substring(0, 4); if(check_digits=="9999"){ return true; } else{ alert("please enter valid Credit Card Number"); patron_card_no.value=""; patron_card_no.focus(); return false; } }
0debug
size_t nbd_wr_sync(int fd, void *buffer, size_t size, bool do_read) { size_t offset = 0; if (qemu_in_coroutine()) { if (do_read) { return qemu_co_recv(fd, buffer, size); } else { return qemu_co_send(fd, buffer, size); } } while (offset < size) { ssize_t len; if (do_read) { len = qemu_recv(fd, buffer + offset, size - offset, 0); } else { len = send(fd, buffer + offset, size - offset, 0); } if (len == -1) errno = socket_error(); if (len == -1 && (errno == EAGAIN || errno == EINTR)) { continue; } if (len == 0) { break; } if (len == -1) { return 0; } offset += len; } return offset; }
1threat
backpropagation work. how? : I created my first simple Neural Net on the paper. It has 5 inputs(data - float number from 0.0 to 10.0) and one output. Without hidden layers. For example at start my weights = [0.2, 0.2, 0.15, 0.15, 0.3]. Result should be in range like input data(0.0 - 10.0). For example network returned 8 when right is 8.5. How backprop will change weights? I know how grad.descent works but I can't understand how i should choose parameters of partial derivative. Help, please. I can elaborate something if you need.
0debug
Recursively print all permutations of a string (Javascript) : <p>I've seen versions of this question for other languages, but not for JS.</p> <p>Is it possible to do this recursively in one function?</p> <p>I understand that I need to take the first element in the string, and then append it to each solution to the recursion on the remainder of the string. So logically, I understand how the recursion needs to go. I just don't understand how to append the first char onto each of the recursive solutions</p> <pre><code>var myString = "xyz"; function printPermut(inputString){ var outputString; if(inputString.length === 0){ return inputString; } if(inputString.length === 1){ return inputString; } else{ for(int i = 0; i&lt;inputString.length(); i++){ //something here like: //outputString = outputString.concat(printPermut(inputString.slice(1))?? //maybe store each unique permutation to an array or something? } } } </code></pre>
0debug
Why does rendering a pdf from rmarkdown require closing rstudio between renders? : <h2>Background</h2> <p>I am trying to make a rmarkdown document that is rendered using <code>render()</code>. The <code>render</code> call has two elements that are parameterized:</p> <ul> <li>I would like the user to be able to specify pdf or html. Straightforward using <code>output_format()</code>.</li> <li>I also would like to pass a parameter to the document to specify if the tables (using the <code>kableExtra</code> package) are latex or html. </li> </ul> <p>This is the rmarkdown file called test.Rmd</p> <pre><code>--- title: "Title" author: "Zzz Zzzzzz" params: table_format: value --- ```{r setup} knitr::opts_chunk$set(echo = FALSE) library(knitr) library(kableExtra) options(knitr.table.format = params$table_format) ``` ## Test table ```{r cars} if (params$table_format == "latex"){ kable(iris[1:100,], booktabs = T) %&gt;% kable_styling(latex_options = c("scale_down")) } if (params$table_format == "html"){ kable(iris[1:100,]) %&gt;% kable_styling(bootstrap_options = c("striped", "hover")) %&gt;% scroll_box(width = "500px", height = "600px") } params$table_format ``` </code></pre> <p>Now here are the two calls to render the file:</p> <pre><code>rmarkdown::render("test.Rmd", output_format = "pdf_document", params = list( table_format = "latex" )) rmarkdown::render("test.Rmd", output_format = "html_document", params = list( table_format = "html" )) </code></pre> <h2>Problem</h2> <p>Now if I open up a fresh rstudio session I can run both <code>render</code> calls no problem. Either .pdf or an .html file is created. However if I then try to run the .pdf render <em>again</em> i get the following error:</p> <blockquote> <p>"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template "C:\Users\salbers\R\win-library\3.4\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in" ! Undefined control sequence. \begin {tabular}{rrrrl} \toprule Sepal.Length &amp; Sepal.Width &amp; Pet... l.267 \end{tabular}}</p> <p>pandoc.exe: Error producing PDF Error: pandoc document conversion failed with error 43 In addition: Warning message: running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template "C:\Users\salbers\R\win-library\3.4\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in"' had status 43</p> </blockquote> <p>The html render works fine over and over again. If I close rstudio, then ropen the project, the render for pdf work fine as well.</p> <h2>Question</h2> <ul> <li>Can anyone tell me why my pdf rendered rmarkdown document can't be rendered twice in a single session of rstudio? </li> <li>Similarly, why does rstudio have to closed in between renderings?</li> </ul>
0debug
static void pmac_ide_atapi_transfer_cb(void *opaque, int ret) { DBDMA_io *io = opaque; MACIOIDEState *m = io->opaque; IDEState *s = idebus_active_if(&m->bus); int unaligned; if (ret < 0) { m->aiocb = NULL; qemu_sglist_destroy(&s->sg); ide_atapi_io_error(s, ret); io->remainder_len = 0; goto done; } if (!m->dma_active) { MACIO_DPRINTF("waiting for data (%#x - %#x - %x)\n", s->nsector, io->len, s->status); io->processing = false; return; } MACIO_DPRINTF("io_buffer_size = %#x\n", s->io_buffer_size); if (s->io_buffer_size > 0) { m->aiocb = NULL; qemu_sglist_destroy(&s->sg); s->packet_transfer_size -= s->io_buffer_size; s->io_buffer_index += s->io_buffer_size; s->lba += s->io_buffer_index >> 11; s->io_buffer_index &= 0x7ff; } s->io_buffer_size = MIN(io->len, s->packet_transfer_size); MACIO_DPRINTF("remainder: %d io->len: %d size: %d\n", io->remainder_len, io->len, s->packet_transfer_size); if (io->remainder_len && io->len) { int remainder_len = MIN(io->remainder_len, io->len); MACIO_DPRINTF("copying remainder %d bytes\n", remainder_len); cpu_physical_memory_write(io->addr, io->remainder + 0x200 - remainder_len, remainder_len); io->addr += remainder_len; io->len -= remainder_len; s->io_buffer_size = remainder_len; io->remainder_len -= remainder_len; qemu_sglist_init(&s->sg, DEVICE(m), io->len / MACIO_PAGE_SIZE + 1, &address_space_memory); pmac_ide_atapi_transfer_cb(opaque, 0); return; } if (!s->packet_transfer_size) { MACIO_DPRINTF("end of transfer\n"); ide_atapi_cmd_ok(s); m->dma_active = false; } if (io->len == 0) { MACIO_DPRINTF("end of DMA\n"); goto done; } unaligned = io->len & 0x1ff; if (unaligned) { int sector_num = (s->lba << 2) + (s->io_buffer_index >> 9); int nsector = io->len >> 9; MACIO_DPRINTF("precopying unaligned %d bytes to %#" HWADDR_PRIx "\n", unaligned, io->addr + io->len - unaligned); bdrv_read(s->bs, sector_num + nsector, io->remainder, 1); cpu_physical_memory_write(io->addr + io->len - unaligned, io->remainder, unaligned); io->len -= unaligned; } MACIO_DPRINTF("io->len = %#x\n", io->len); qemu_sglist_init(&s->sg, DEVICE(m), io->len / MACIO_PAGE_SIZE + 1, &address_space_memory); qemu_sglist_add(&s->sg, io->addr, io->len); io->addr += s->io_buffer_size; io->remainder_len = MIN(s->packet_transfer_size - s->io_buffer_size, (0x200 - unaligned) & 0x1ff); MACIO_DPRINTF("set remainder to: %d\n", io->remainder_len); if (!io->len) { pmac_ide_atapi_transfer_cb(opaque, 0); return; } io->len = 0; MACIO_DPRINTF("sector_num=%d size=%d, cmd_cmd=%d\n", (s->lba << 2) + (s->io_buffer_index >> 9), s->packet_transfer_size, s->dma_cmd); m->aiocb = dma_bdrv_read(s->bs, &s->sg, (int64_t)(s->lba << 2) + (s->io_buffer_index >> 9), pmac_ide_atapi_transfer_cb, io); return; done: MACIO_DPRINTF("done DMA\n"); block_acct_done(bdrv_get_stats(s->bs), &s->acct); io->dma_end(opaque); }
1threat
document.getElementById('input').innerHTML = user_input;
1threat
Debugging not showing the proper result : <p>I am trying to learn the javascript debugging and I am followint the article here[linke here][1]</p> <p>[1]: <a href="http://meeech.amihod.com/getting-started-with-javascript-debugging-in-chrome/" rel="nofollow">http://meeech.amihod.com/getting-started-with-javascript-debugging-in-chrome/</a> I was able to follow along the tutorial.My code is</p> <pre><code>&lt;script&gt; var value="hang"; function test(){ setInterval(function(){ switch(value){ case'hang': document.body.innerHtml="Hang in there"; break; case'up': document.body.innerHTML="Up"; break; default: document.body.innerHTML="No good!"; } },1000); }; &lt;/script&gt; </code></pre> <p>Ater inspecting in debugger,it shows that it reached to <code>document.body.innerHtml="Hang in there";</code>But my html page isnot showing the output <strong>Hang in there</strong> Though it may seem simple question, I am not getting into it. Please help. Also I cannot find <strong>Add to watch option</strong> on right click as stated in tutorial.</p>
0debug
yuv2422_1_c_template(SwsContext *c, const int16_t *buf0, const int16_t *ubuf[2], const int16_t *vbuf[2], const int16_t *abuf0, uint8_t *dest, int dstW, int uvalpha, int y, enum PixelFormat target) { const int16_t *ubuf0 = ubuf[0], *vbuf0 = vbuf[0]; int i; if (uvalpha < 2048) { for (i = 0; i < (dstW >> 1); i++) { int Y1 = buf0[i * 2] >> 7; int Y2 = buf0[i * 2 + 1] >> 7; int U = ubuf0[i] >> 7; int V = vbuf0[i] >> 7; output_pixels(i * 4, Y1, U, Y2, V); } } else { const int16_t *ubuf1 = ubuf[1], *vbuf1 = vbuf[1]; for (i = 0; i < (dstW >> 1); i++) { int Y1 = buf0[i * 2] >> 7; int Y2 = buf0[i * 2 + 1] >> 7; int U = (ubuf0[i] + ubuf1[i]) >> 8; int V = (vbuf0[i] + vbuf1[i]) >> 8; output_pixels(i * 4, Y1, U, Y2, V); } } }
1threat
Customize the djoser create user endpoint : <p>I am using djoser for auth purposes. I want to customize the create user end point of djoser. I have a User app. Here is my User model</p> <pre><code>from django.db import models class User(models.Model): email = models.CharField(max_length=100, blank=False) name = models.CharField(max_length=100, blank=False) last_name = models.CharField(max_length=100, blank=False) account_address = models.CharField(max_length=30, blank=False) password = models.CharField(max_length=100, blank=False) </code></pre> <p>and here is my serializer</p> <pre><code>from rest_framework import serializers from User.models import User class UserSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = User fields = ('url', 'id', 'email', 'name', 'last_name', 'account_address', 'password') </code></pre> <p>and my User.urls.py looks like following</p> <pre><code>from django.conf.urls import url, include from rest_framework.routers import DefaultRouter from .views import UserViewSet router = DefaultRouter() urlpatterns = [ url(r'^', include(router.urls)), url(r'^account/', include('djoser.urls')), ] </code></pre> <p>and project's url.py is follwing</p> <pre><code>from django.contrib import admin from django.urls import path from django.conf.urls import include, url urlpatterns = [ path('admin/', admin.site.urls), url(r'^users/', include('User.urls')), url(r'^advertisements', include('advertisements.urls')), url(r'^account', include('wallet.urls')), ] </code></pre> <p>but i am unable to create user with customized model instead when i go to user/account/create i see djoser's default create user view. Anybody please tell where I am doing wrong. Thanks :)</p>
0debug
static int init_image(TiffContext *s, AVFrame *frame) { int ret; switch (s->planar * 1000 + s->bpp * 10 + s->bppcount) { case 11: s->avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; break; case 81: s->avctx->pix_fmt = s->palette_is_set ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8; break; case 243: s->avctx->pix_fmt = AV_PIX_FMT_RGB24; break; case 161: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GRAY16LE : AV_PIX_FMT_GRAY16BE; break; case 162: s->avctx->pix_fmt = AV_PIX_FMT_YA8; break; case 322: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_YA16LE : AV_PIX_FMT_YA16BE; break; case 324: s->avctx->pix_fmt = AV_PIX_FMT_RGBA; break; case 483: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGB48LE : AV_PIX_FMT_RGB48BE; break; case 644: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGBA64LE : AV_PIX_FMT_RGBA64BE; break; case 1243: s->avctx->pix_fmt = AV_PIX_FMT_GBRP; break; case 1324: s->avctx->pix_fmt = AV_PIX_FMT_GBRAP; break; case 1483: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRP16LE : AV_PIX_FMT_GBRP16BE; break; case 1644: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRAP16LE : AV_PIX_FMT_GBRAP16BE; break; default: "This format is not supported (bpp=%d, bppcount=%d)\n", if (s->width != s->avctx->width || s->height != s->avctx->height) { ret = ff_set_dimensions(s->avctx, s->width, s->height); if (ret < 0) return ret; if ((ret = ff_get_buffer(s->avctx, frame, 0)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) { memcpy(frame->data[1], s->palette, sizeof(s->palette)); return 0;
1threat
SQL - create table : when I execute query I got this table [![enter image description here][1]][1] but i want to make new table to get this [![enter image description here][2]][2] in name of column to get value 1,2,3... Any idea? [1]: http://i.stack.imgur.com/2Rm5D.png [2]: http://i.stack.imgur.com/VFqxY.png
0debug
You get an 'aux ps' output where only 1 terminal was opened and a.out was executed 2 times, but you only called it once. Something in the trend of : <p><a href="https://i.stack.imgur.com/1gKxa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1gKxa.png" alt="enter image description here"></a></p> <p>The questions are as follows:</p> <ol> <li><p>How can we see from the above picture that only one terminal are open?</p></li> <li><p>Is it true that there is one parent process and two child processes? How can you say that? Can we determine the states of parent and the child?</p></li> </ol>
0debug
static int compare_doubles(const double *a, const double *b, int len, double max_diff) { int i; for (i = 0; i < len; i++) { if (fabs(a[i] - b[i]) > max_diff) { av_log(NULL, AV_LOG_ERROR, "%d: %- .12f - %- .12f = % .12g\n", i, a[i], b[i], a[i] - b[i]); return -1; } } return 0; }
1threat
prevent css and js inheritence in ascx : <br> I have an application with only one aspx page (Default.aspx).<br> This page loads .ascx controls as needed.<br> All These controls are using the Same Js and Css file.<br> Now I want to apply Bootstrap on some of theme. But I am sceared if bootStap will breake some css and Js.<br> So I am thinking about wrapping each control in Iframe (because what I know is: <br>Iframe bloks inheritence of css and Js).<br> Is my solution ok ?<br> Or Is there any way to know wich css and js is needed by each control<br> thanks
0debug
Reversing bitwise operations : I have a Java function written by another programmer, which uses bitwise manipulation. I need a function that will reverse the process (if possible). Perhaps some of you are more savvy than I with these operators. Here's what needs to be reversed: public void someFunc(int[] msg, int[] newMsg) { int i = SOME_LENGTH_CONSTANT; for (int j = 0; j < newMsg.length; j++) { // msg[i] Shift left by 8 bits bitwise or with next msg[i+1] // then bitwise not (~) and bitwise and with $FFF newMsg[j] = (~(((msg[i] & 0x0f) << 8) | (msg[i + 1]))) & 0xfff; i += 2; } }
0debug
iOS XMPP Framwork - libidn.a does not contain bitcode : <p>XMPP Framework Error</p> <p>ld: 'xmppFrameWork/Vendor/libidn/libidn.a(stringprep.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64</p> <p>Note: Error occurred, while running app in iPhone device only. (It's working in simulator).</p>
0debug
golang slice copy is not working as expected : In the following golang program, I am creating mySlice1 with 6 elements in it. mySlice2 is initialized with 3 elements. From mySlice1 I am taking 1st two elements into mySlice2. Also using copy function of slice, 3 elements of mySlice1 are overwritten to mySlice2. package main import "fmt" func main() { mySlice1 := []int{1, 3, 5, 7, 9, 11} mySlice2 := make([]int,3) mySlice2 = mySlice1[0:2] copy(mySlice2,mySlice1) fmt.Printf("%T\t%T\n", mySlice1,mySlice2) fmt.Println(mySlice1,mySlice2) } But while printing mySlice2 I am getting two elements only. $ go run main.go []int []int [1 3 5 7 9 11] [1 3] Why does mySlice2 is not getting overwritten while using copy function ? Thank you
0debug
Multipart body length limit exceeded exception : <p>Although having set the <code>MaxRequestLength</code> and <code>maxAllowedContentLength</code> to the maximum possible values in the <code>web.config</code> section, ASP.Net Core does not allow me to upload files larger than <code>134,217,728 Bytes</code>. The exact error coming from the web server is:</p> <blockquote> <p>An unhandled exception occurred while processing the request.</p> <p>InvalidDataException: Multipart body length limit 134217728 exceeded.</p> </blockquote> <p>Is there any way to work this around? (<strong>ASP.Net Core</strong>)</p>
0debug
i have been makign a code with javascript that run o. while i have made it run n : I have been making a java script code to show a traffic light that changes it image. it uses a set array but i am new to coding and have not been told how to do this. i have looked and made a code but it still not working. help. i can get it to run by clicking it but i need it to run without having to press a button lot of time. so it changes image that are in the same folder as the code but now i don't know why it will not work. i have been task to do it so a person only has to press the button one time.help... `<!DOCTYPE html> <html> <body> <h1>JavaScript Task 4</h1> <p> traffic light task for A452</p> <img id="light" src="traffitlr.jpeg"> <button type="button" onclick="changeLights()">changelights(and Start Lights)</button> <button type="button" onclick=setinterval(change,1000)>start auto cycle</button> <script> var list = [ "traffitlg.jpg", "traffitla.jpg", "traffitlr.jpg", "traffitly.jpg" ]; var index = 0; function changeLights() { index = index + 1; if (index == list.length) index = 0; var image = document.getElementById('light'); image.src=list[index]; } </script> </body> </html> `
0debug
build_tpm2(GArray *table_data, GArray *linker) { Acpi20TPM2 *tpm2_ptr; tpm2_ptr = acpi_data_push(table_data, sizeof *tpm2_ptr); tpm2_ptr->platform_class = cpu_to_le16(TPM2_ACPI_CLASS_CLIENT); tpm2_ptr->control_area_address = cpu_to_le64(0); tpm2_ptr->start_method = cpu_to_le32(TPM2_START_METHOD_MMIO); build_header(linker, table_data, (void *)tpm2_ptr, "TPM2", sizeof(*tpm2_ptr), 4, NULL); }
1threat
IS IT POSSIBLE TO RETRIEVE NUMBER OF DEPARTMENTS AND THE NUMBER OF EMPLOYEES WORKING IN THAT DEPARTMENT IF GIVEN THE LOCATION ID : IS IT POSSIBLE TO RETRIEVE NUMBER OF DEPARTMENTS AND THE NUMBER OF EMPLOYEES WORKING IN THAT DEPARTMENT IF GIVEN THE LOCATION ID CANNOT GET THE CORRECT RESULT WITH THIS QUERY: select count(E.employee_id),COUNT(D.DEPARTMENT_ID)from employees e join departments d on (e.department_id=d.department_id) WHERE D.LOCATION_ID =1700; ANY HELP WILL BE APPRECIATED, THANKS
0debug
Q : How to pick value based on condition in macros vba : I want to pick a value based on a condition. The example data that I haved is like -> [my excel data][1] [1]: https://i.stack.imgur.com/uy93l.jpg The condition is : I want to pick the value of PO NO. that always placed 2 column after text "PO NO." How do I get that value?
0debug
static void sysbus_device_class_init(ObjectClass *klass, void *data) { DeviceClass *k = DEVICE_CLASS(klass); k->init = sysbus_device_init; k->bus_type = TYPE_SYSTEM_BUS; }
1threat
Angular 5 adding html content dynamically : <p>I have following angular to add dynamically loaded content:</p> <p><strong>main.html</strong></p> <pre><code>&lt;div class="top"&gt; &lt;ng-template #main&gt;&lt;/ng-template&gt; &lt;/div&gt; </code></pre> <p><strong>main.ts</strong></p> <pre><code>import { Component, ViewChild, ComponentFactoryResolver, ViewContainerRef } from '@angular/core'; @Component({ selector: 'page-main_page', templateUrl: 'main_page.html' }) export class main_page { @ViewChild('main', { read: ViewContainerRef }) entry: ViewContainerRef; data: any; constructor(public resolver: ComponentFactoryResolver){ }; ngOnInit(){ this.getDynamicREST().then((res)=&gt;{ this.data = res; //Where it is a html markup from php server: &lt;div class="sample"&gt; Example &lt;/div&gt; const factory = this.resolver.resolveComponentFactory(this.data); this.entry.createComponent(factory); }) }; } </code></pre> <p>In the <code>getDynamicRest()</code>, I am getting a html markup from php server such as :</p> <pre><code> &lt;div class="sample"&gt; Example &lt;/div&gt; </code></pre> <p>However I am getting an error <code>"Error: No component factory found for &lt;div class="sample"&gt; Example &lt;/div&gt;"</code></p> <p>Any suggestions would be much appreciated.</p>
0debug
First Flutter App error: cannot resolve symbol "Properties" : <p>I followed the steps in the Flutter document and tried to build my first Flutter app in Intellij IDEA. And when I try to run it,there was an error about my JAVA_HOME variable. And an error about cannot resolve symbol "Properties" in the build.gradle file. I really don't know what to do.</p> <p>This is my error information displayed in the Console window.</p> <pre><code>Launching lib\main.dart on Android SDK built for x86 in debug mode... Initializing gradle... Finished with error: ProcessException: Process "F:\untitled\android\gradlew.bat" exited abnormally: ERROR: JAVA_HOME is set to an invalid directory: F:\Google download\jdk- 10.0.1_windows-x64_bin.exe Please set the JAVA_HOME variable in your environment to match the location of your Java installation. Command: F:\untitled\android\gradlew.bat -v </code></pre> <p>Actually there is nothing wrong with my JAVA_HOME variable, I set it to the proper directory: C:\Program Files (x86)\Java\jdk1.8.0_131.</p> <p>And I run the command it shows above "F:\untitled\android\gradlew.bat -v", it seemed to update the gradle version, but the error didn't resolved.</p> <p>And this is the code in build.gradle file.</p> <pre><code>def localProperties = new Properties() //there will be a highlight on Properties indicates that 'cannot resolve symbol "Properties" ' def localPropertiesFile = rootProject.file('local.properties') if (localPropertiesFile.exists()) { localPropertiesFile.withReader('UTF-8') { reader -&gt; localProperties.load(reader) } } def flutterRoot = localProperties.getProperty('flutter.sdk') if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") //the same as the Properties on GradleException } def flutterVersionCode = localProperties.getProperty('flutter.versionCode') if (flutterVersionCode == null) { flutterVersionCode = '1' } def flutterVersionName = localProperties.getProperty('flutter.versionName') if (flutterVersionName == null) { flutterVersionName = '1.0' } apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { compileSdkVersion 28 lintOptions { disable 'InvalidPackage' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.untitled" minSdkVersion 16 targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. signingConfig signingConfigs.debug } } } flutter { source '../..' } dependencies { testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' } </code></pre>
0debug
How to Add a Menu Without a Bar : <p>I've seen a lot of applications There is no actionbar But there is menu how? like this picture <a href="https://i.stack.imgur.com/X4DcD.png" rel="nofollow noreferrer">enter image description here</a> How can I create this</p>
0debug
Python: pass "not" as a lambda function : <p>I need to pass a function as a parameter that works as the boolean "not". I tried something like this but it didn't work because <code>not</code> isn't a function.</p> <pre><code>theFunction(callback=not) # Doesn't work :( </code></pre> <p>I need to do the following, but <strong>I wonder if there exists any predefined function that does this simple job</strong>, so that I don't have to redefine it like this:</p> <pre><code>theFunction(callback=lambda b: not b, anotherCallback=lambda b: not b) </code></pre> <hr> <p><strong><em>Note:</strong> I can't change the fact that I have to pass a function like this because it's an API call.</em></p>
0debug
How to call the functions present in one .py file from other .py file ? I have coded like this : one.py class One: def printNumber( self, a ): print (a) two.py << import one >> gives error no module named one << import One >> gives error no module named One class Two << Here I want to call printNumber method from one.py >>
0debug
adapter = new ListLeaderBoardAdapter(this, mLeaderboardlist); : <p><a href="https://i.stack.imgur.com/9NjUT.png" rel="nofollow noreferrer">what shall i do to this one?</a></p> <p><a href="https://i.stack.imgur.com/MiEhP.png" rel="nofollow noreferrer">This is my list adapter</a></p>
0debug
void qemu_bh_schedule_idle(QEMUBH *bh) { if (bh->scheduled) return; bh->idle = 1; smp_wmb(); bh->scheduled = 1; }
1threat
Get JQuery element By ID or Class : <p>How can I get the element number 5 <strong>innerHTML</strong> of this JQUERY Object?</p> <p><img src="https://i.imgur.com/TqMdUvI.png" alt="jquery obj"></p> <p>Thanks in advance</p>
0debug
Can we make submit the iPhone and iPad version of an app on iTunes store? : I have an iPad app,and converted my iPad app into an iPhone app. Now I want to submit my app for both iPhone and iPad version using same bundle id. Is it possible to do so? Please Help and Suggest Thanks
0debug
Error: unexpected '}' : <p>I'm trying to generate a random data. Basically, I copied this code from the book, however it doesn't work for me. It works until it reaches the line stated in the warning: </p> <pre><code>Error: unexpected '}' in: "+ this.seg[,j] &lt;- rnorm(segSize[i], mean=segMeans[i,j], sd=segSDs[i,j]) + }" </code></pre> <p>The code looks as following:</p> <pre><code>for (i in seq_along(segNames)) { + cat(i, segNames[i], "\n") + + # empty matrix to hold this particular segment’s data + this.seg &lt;- data.frame(matrix(NA, nrow=segSize[i], ncol=length(segVars))) + + # within segment, iterate over variables and draw appropriate random data + for (j in seq_along(segVars)) { # and iterate over each variable + if (segVarType[j] == "norm") { # draw random normals + this.seg[,j] &lt;- rnorm(segSize[i], mean=segMeans[i,j], sd=segSDs[i,j]) + } else if (segVarType[j] == "pois") { # draw counts + this.seg[, j] &lt;- rpois(segSize[i], lambda=segMeans[i, j]) + } else if (segVarType[j] == "binom") { # draw binomials + this.seg[, j] &lt;- rbinom(segSize[i], size=1, prob=segMeans[i, j]) + } else { + stop("Bad segment data type: ", segVarType[j]) + } + } + # add this segment to the total dataset + seg.df &lt;- rbind(seg.df, this.seg) + } </code></pre> <p>Can somebody explain why it stucks on that line and what has to be changed? Thanks! </p>
0debug
rails, how to get specific string from a sentences : i want to ask what is best method on rails to get specific string from a sentences? example i have "My working time is: 3 hours and the job is finished" "Bla2 time is: 6 hours and the job is still pending" "Bla bla bla time is: 7 hours and the job is finished" i want to take the number after words "time is: " so the output is only number like: 3, 6, 7 any idea how to do it? Thanks
0debug
static int token_is_operator(QObject *obj, char op) { const char *val; if (token_get_type(obj) != JSON_OPERATOR) { return 0; } val = token_get_value(obj); return (val[0] == op) && (val[1] == 0); }
1threat
Extract strings between brackets for each line : <p>Suppose I have a text like this:</p> <pre><code>a b [c] d [e] f [g] [h] i j k [l] </code></pre> <p>I'd like to ask how to extract the strings between brackets line by line using sed or awk command?</p> <p>The output should be:</p> <pre><code>c e g h l </code></pre>
0debug
Formatting proprty in C# : I am currently studying for an exam, while I was trying to write a class I saw this requirement for a property.I need to write this property in class called User. "Phone – must be in the format “+[country_code]/[phone]” where [country_code] is between 1 and 3 digits and the [phone] is between 8 and 10 digits. o Valid phones: +123/88888888, +1/1234579284 o Invalid phones: -123/88888888, +123/ 4 5 4444444, +123348585313, +123\34553363587" Do I use "[RegularExpression()]" from ComponentModel.DataAnnotations or something else
0debug
Jave - paintComponent random only once : <p>I'm just started to learn Java.</p> <p>I'm trying to build a program that draw in the JPanel random shapes once, and it doesn't change' even in resizing. If the user wants (by a Dialog box) the shapes will repaint all over again.</p> <p>How can I do that?</p> <p>The number of shapes or they color is not fixed and can be change.</p> <p>Thanks!</p>
0debug
void *av_tree_insert(AVTreeNode **tp, void *key, int (*cmp)(void *key, const void *b), AVTreeNode **next){ AVTreeNode *t= *tp; if(t){ unsigned int v= cmp(t->elem, key); void *ret; if(!v){ if(*next) return t->elem; else if(t->child[0]||t->child[1]){ int i= !t->child[0]; void *next_elem[2]; av_tree_find(t->child[i], key, cmp, next_elem); key= t->elem= next_elem[i]; v= -i; }else{ *next= t; *tp=NULL; return NULL; } } ret= av_tree_insert(&t->child[v>>31], key, cmp, next); if(!ret){ int i= (v>>31) ^ !!*next; AVTreeNode **child= &t->child[i]; t->state += 2*i - 1; if(!(t->state&1)){ if(t->state){ if((*child)->state*2 == -t->state){ *tp= (*child)->child[i^1]; (*child)->child[i^1]= (*tp)->child[i]; (*tp)->child[i]= *child; *child= (*tp)->child[i^1]; (*tp)->child[i^1]= t; (*tp)->child[0]->state= -((*tp)->state>0); (*tp)->child[1]->state= (*tp)->state<0 ; (*tp)->state=0; }else{ *tp= *child; *child= (*child)->child[i^1]; (*tp)->child[i^1]= t; if((*tp)->state) t->state = 0; else t->state>>= 1; (*tp)->state= -t->state; } } } if(!(*tp)->state ^ !!*next) return key; } return ret; }else{ *tp= *next; *next= NULL; (*tp)->elem= key; return NULL; } }
1threat
static QPCIDevice *get_ahci_device(uint32_t *fingerprint) { QPCIDevice *ahci; uint32_t ahci_fingerprint; QPCIBus *pcibus; pcibus = qpci_init_pc(); ahci = qpci_device_find(pcibus, QPCI_DEVFN(0x1F, 0x02)); g_assert(ahci != NULL); ahci_fingerprint = qpci_config_readl(ahci, PCI_VENDOR_ID); switch (ahci_fingerprint) { case AHCI_INTEL_ICH9: break; default: g_assert_not_reached(); } if (fingerprint) { *fingerprint = ahci_fingerprint; } return ahci; }
1threat
uint64_t helper_frsqrte (uint64_t arg) { CPU_DoubleU fone, farg; fone.ll = 0x3FF0000000000000ULL; farg.ll = arg; if (unlikely(float64_is_signaling_nan(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSNAN); } else if (unlikely(float64_is_neg(farg.d) && !float64_is_zero(farg.d))) { farg.ll = fload_invalid_op_excp(POWERPC_EXCP_FP_VXSQRT); } else if (likely(isnormal(farg.d))) { farg.d = float64_sqrt(farg.d, &env->fp_status); farg.d = float32_div(fone.d, farg.d, &env->fp_status); } else { if (farg.ll == 0x8000000000000000ULL) { farg.ll = 0xFFF0000000000000ULL; } else if (farg.ll == 0x0000000000000000ULL) { farg.ll = 0x7FF0000000000000ULL; } else if (float64_is_nan(farg.d)) { farg.ll |= 0x000FFFFFFFFFFFFFULL; } else if (float64_is_neg(farg.d)) { farg.ll = 0x7FF8000000000000ULL; } else { farg.ll = 0x0000000000000000ULL; } } return farg.ll; }
1threat
static inline void gen_op_eval_bleu(TCGv dst, TCGv_i32 src) { gen_mov_reg_Z(cpu_tmp0, src); gen_mov_reg_C(dst, src); tcg_gen_or_tl(dst, dst, cpu_tmp0); }
1threat
new Date().getFullYear() in React : <p>I'm trying to display a current year in footer and trying to figure out how to get the current year React way? Is there a way to use new Date().getFullYear()?</p>
0debug
static inline void RENAME(yuv2rgbX)(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstbpp, int16_t * lumMmxFilter, int16_t * chrMmxFilter) { if(fullUVIpol) { } else { #ifdef HAVE_MMX if(dstbpp == 32) untested { asm volatile( YSCALEYUV2RGBX WRITEBGR32 :: "m" (-lumFilterSize), "m" (-chrFilterSize), "m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4), "r" (dest), "m" (dstW), "m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize) : "%eax", "%ebx", "%ecx", "%edx", "%esi" ); } else if(dstbpp==24) untested { asm volatile( YSCALEYUV2RGBX "leal (%%eax, %%eax, 2), %%ebx \n\t" optimize "addl %4, %%ebx \n\t" WRITEBGR24 :: "m" (-lumFilterSize), "m" (-chrFilterSize), "m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4), "r" (dest), "m" (dstW), "m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize) : "%eax", "%ebx", "%ecx", "%edx", "%esi" ); } else if(dstbpp==15) { asm volatile( YSCALEYUV2RGBX #ifdef DITHER1XBPP "paddusb b5Dither, %%mm2 \n\t" "paddusb g5Dither, %%mm4 \n\t" "paddusb r5Dither, %%mm5 \n\t" #endif WRITEBGR15 :: "m" (-lumFilterSize), "m" (-chrFilterSize), "m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4), "r" (dest), "m" (dstW), "m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize) : "%eax", "%ebx", "%ecx", "%edx", "%esi" ); } else if(dstbpp==16) { asm volatile( YSCALEYUV2RGBX #ifdef DITHER1XBPP "paddusb b5Dither, %%mm2 \n\t" "paddusb g6Dither, %%mm4 \n\t" "paddusb r5Dither, %%mm5 \n\t" #endif WRITEBGR16 :: "m" (-lumFilterSize), "m" (-chrFilterSize), "m" (lumMmxFilter+lumFilterSize*4), "m" (chrMmxFilter+chrFilterSize*4), "r" (dest), "m" (dstW), "m" (lumSrc+lumFilterSize), "m" (chrSrc+chrFilterSize) : "%eax", "%ebx", "%ecx", "%edx", "%esi" ); } #else if(dstbpp==32) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; dest[8*i+0]=clip_table[((Y1 + Cb) >>13)]; dest[8*i+1]=clip_table[((Y1 + Cg) >>13)]; dest[8*i+2]=clip_table[((Y1 + Cr) >>13)]; dest[8*i+4]=clip_table[((Y2 + Cb) >>13)]; dest[8*i+5]=clip_table[((Y2 + Cg) >>13)]; dest[8*i+6]=clip_table[((Y2 + Cr) >>13)]; } } else if(dstbpp==24) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; dest[0]=clip_table[((Y1 + Cb) >>13)]; dest[1]=clip_table[((Y1 + Cg) >>13)]; dest[2]=clip_table[((Y1 + Cr) >>13)]; dest[3]=clip_table[((Y2 + Cb) >>13)]; dest[4]=clip_table[((Y2 + Cg) >>13)]; dest[5]=clip_table[((Y2 + Cr) >>13)]; dest+=6; } } else if(dstbpp==16) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; ((uint16_t*)dest)[2*i] = clip_table16b[(Y1 + Cb) >>13] | clip_table16g[(Y1 + Cg) >>13] | clip_table16r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[2*i+1] = clip_table16b[(Y2 + Cb) >>13] | clip_table16g[(Y2 + Cg) >>13] | clip_table16r[(Y2 + Cr) >>13]; } } else if(dstbpp==15) { int i; for(i=0; i<(dstW>>1); i++){ int j; int Y1=0; int Y2=0; int U=0; int V=0; int Cb, Cr, Cg; for(j=0; j<lumFilterSize; j++) { Y1 += lumSrc[j][2*i] * lumFilter[j]; Y2 += lumSrc[j][2*i+1] * lumFilter[j]; } for(j=0; j<chrFilterSize; j++) { U += chrSrc[j][i] * chrFilter[j]; V += chrSrc[j][i+2048] * chrFilter[j]; } Y1= clip_yuvtab_2568[ (Y1>>19) + 256 ]; Y2= clip_yuvtab_2568[ (Y2>>19) + 256 ]; U >>= 19; V >>= 19; Cb= clip_yuvtab_40cf[U+ 256]; Cg= clip_yuvtab_1a1e[V+ 256] + yuvtab_0c92[U+ 256]; Cr= clip_yuvtab_3343[V+ 256]; ((uint16_t*)dest)[2*i] = clip_table15b[(Y1 + Cb) >>13] | clip_table15g[(Y1 + Cg) >>13] | clip_table15r[(Y1 + Cr) >>13]; ((uint16_t*)dest)[2*i+1] = clip_table15b[(Y2 + Cb) >>13] | clip_table15g[(Y2 + Cg) >>13] | clip_table15r[(Y2 + Cr) >>13]; } } #endif } }
1threat
static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, const float *coefs, const FFPsyWindowInfo *wi) { AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data; AacPsyChannel *pch = &pctx->ch[channel]; int start = 0; int i, w, g; const int num_bands = ctx->num_bands[wi->num_windows == 8]; const uint8_t* band_sizes = ctx->bands[wi->num_windows == 8]; AacPsyCoeffs *coeffs = &pctx->psy_coef[wi->num_windows == 8]; for (w = 0; w < wi->num_windows*16; w += 16) { for (g = 0; g < num_bands; g++) { AacPsyBand *band = &pch->band[w+g]; band->energy = 0.0f; for (i = 0; i < band_sizes[g]; i++) band->energy += coefs[start+i] * coefs[start+i]; band->thr = band->energy * 0.001258925f; start += band_sizes[g]; ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].energy = band->energy; } } for (w = 0; w < wi->num_windows*16; w += 16) { AacPsyBand *band = &pch->band[w]; for (g = 1; g < num_bands; g++) band[g].thr = FFMAX(band[g].thr, band[g-1].thr * coeffs->spread_hi [g]); for (g = num_bands - 2; g >= 0; g--) band[g].thr = FFMAX(band[g].thr, band[g+1].thr * coeffs->spread_low[g]); for (g = 0; g < num_bands; g++) { band[g].thr_quiet = band[g].thr = FFMAX(band[g].thr, coeffs->ath[g]); if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w))) band[g].thr = FFMAX(PSY_3GPP_RPEMIN*band[g].thr, FFMIN(band[g].thr, PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet)); ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].threshold = band[g].thr; } } memcpy(pch->prev_band, pch->band, sizeof(pch->band)); }
1threat
What's the difference between .userInitiated and .userInteractive in GCD? : <p>I would like to know what's difference between them, I am trying to update something in the UI thus I must do it using the main thread but not sure which of them I should use to accomplish what I want.</p> <p>Thanks</p>
0debug
Syntax error when i try to insert into table : <h1>My Table</h1> <pre><code>CREATE TABLE IF NOT EXISTS `contas` ( `cod_conta` int(11) NOT NULL AUTO_INCREMENT, `cod_char` int(9) NOT NULL, `username` varchar(180) NOT NULL, `password` varchar(180) NOT NULL, `email` varchar(180) NOT NULL, `datacc` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `adm` int(1) NOT NULL DEFAULT '0', PRIMARY KEY (`cod_conta`) ) ENGINE=InnoDB DEFAULT CHARSET </code></pre> <h1>Insert SQL</h1> <pre><code>&gt; INSERT INTO 'contas'('cod_char','username','password','email') VALUES (2,'sdgsd','186672cc13','aaa') </code></pre> <h1>Error</h1> <blockquote> <p>1064 - Erreur de syntaxe près de ''contas'('cod_char','username','password','email') VALUES</p> </blockquote>
0debug
static int vtenc_create_encoder(AVCodecContext *avctx, CMVideoCodecType codec_type, CFStringRef profile_level, CFNumberRef gamma_level, CFDictionaryRef enc_info, CFDictionaryRef pixel_buffer_info, VTCompressionSessionRef *session) { VTEncContext *vtctx = avctx->priv_data; SInt32 bit_rate = avctx->bit_rate; CFNumberRef bit_rate_num; int status = VTCompressionSessionCreate(kCFAllocatorDefault, avctx->width, avctx->height, codec_type, enc_info, pixel_buffer_info, kCFAllocatorDefault, vtenc_output_callback, avctx, session); if (status || !vtctx->session) { av_log(avctx, AV_LOG_ERROR, "Error: cannot create compression session: %d\n", status); #if !TARGET_OS_IPHONE if (!vtctx->allow_sw) { av_log(avctx, AV_LOG_ERROR, "Try -allow_sw 1. The hardware encoder may be busy, or not supported.\n"); } #endif return AVERROR_EXTERNAL; } bit_rate_num = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &bit_rate); if (!bit_rate_num) return AVERROR(ENOMEM); status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_AverageBitRate, bit_rate_num); CFRelease(bit_rate_num); if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting bitrate property: %d\n", status); return AVERROR_EXTERNAL; } if (profile_level) { status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_ProfileLevel, profile_level); if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting profile/level property: %d\n", status); return AVERROR_EXTERNAL; } } if (avctx->gop_size > 0) { CFNumberRef interval = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &avctx->gop_size); if (!interval) { return AVERROR(ENOMEM); } status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_MaxKeyFrameInterval, interval); CFRelease(interval); if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting 'max key-frame interval' property: %d\n", status); return AVERROR_EXTERNAL; } } if (vtctx->frames_before) { status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_MoreFramesBeforeStart, kCFBooleanTrue); if (status == kVTPropertyNotSupportedErr) { av_log(avctx, AV_LOG_WARNING, "frames_before property is not supported on this device. Ignoring.\n"); } else if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting frames_before property: %d\n", status); } } if (vtctx->frames_after) { status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_MoreFramesAfterEnd, kCFBooleanTrue); if (status == kVTPropertyNotSupportedErr) { av_log(avctx, AV_LOG_WARNING, "frames_after property is not supported on this device. Ignoring.\n"); } else if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting frames_after property: %d\n", status); } } if (avctx->sample_aspect_ratio.num != 0) { CFNumberRef num; CFNumberRef den; CFMutableDictionaryRef par; AVRational *avpar = &avctx->sample_aspect_ratio; av_reduce(&avpar->num, &avpar->den, avpar->num, avpar->den, 0xFFFFFFFF); num = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &avpar->num); den = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &avpar->den); par = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); if (!par || !num || !den) { if (par) CFRelease(par); if (num) CFRelease(num); if (den) CFRelease(den); return AVERROR(ENOMEM); } CFDictionarySetValue( par, kCMFormatDescriptionKey_PixelAspectRatioHorizontalSpacing, num); CFDictionarySetValue( par, kCMFormatDescriptionKey_PixelAspectRatioVerticalSpacing, den); status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_PixelAspectRatio, par); CFRelease(par); CFRelease(num); CFRelease(den); if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting pixel aspect ratio to %d:%d: %d.\n", avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, status); return AVERROR_EXTERNAL; } } if (vtctx->transfer_function) { status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_TransferFunction, vtctx->transfer_function); if (status) { av_log(avctx, AV_LOG_WARNING, "Could not set transfer function: %d\n", status); } } if (vtctx->ycbcr_matrix) { status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_YCbCrMatrix, vtctx->ycbcr_matrix); if (status) { av_log(avctx, AV_LOG_WARNING, "Could not set ycbcr matrix: %d\n", status); } } if (vtctx->color_primaries) { status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_ColorPrimaries, vtctx->color_primaries); if (status) { av_log(avctx, AV_LOG_WARNING, "Could not set color primaries: %d\n", status); } } if (gamma_level) { status = VTSessionSetProperty(vtctx->session, kCVImageBufferGammaLevelKey, gamma_level); if (status) { av_log(avctx, AV_LOG_WARNING, "Could not set gamma level: %d\n", status); } } if (!vtctx->has_b_frames) { status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_AllowFrameReordering, kCFBooleanFalse); if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting 'allow frame reordering' property: %d\n", status); return AVERROR_EXTERNAL; } } if (vtctx->entropy != VT_ENTROPY_NOT_SET) { CFStringRef entropy = vtctx->entropy == VT_CABAC ? kVTH264EntropyMode_CABAC: kVTH264EntropyMode_CAVLC; status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_H264EntropyMode, entropy); if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting entropy property: %d\n", status); return AVERROR_EXTERNAL; } } if (vtctx->realtime) { status = VTSessionSetProperty(vtctx->session, kVTCompressionPropertyKey_RealTime, kCFBooleanTrue); if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting realtime property: %d\n", status); } } status = VTCompressionSessionPrepareToEncodeFrames(vtctx->session); if (status) { av_log(avctx, AV_LOG_ERROR, "Error: cannot prepare encoder: %d\n", status); return AVERROR_EXTERNAL; } return 0; }
1threat
static inline int check_ap(CPUARMState *env, ARMMMUIdx mmu_idx, int ap, int domain_prot, int access_type) { int prot_ro; bool is_user = regime_is_user(env, mmu_idx); if (domain_prot == 3) { return PAGE_READ | PAGE_WRITE; } if (access_type == 1) { prot_ro = 0; } else { prot_ro = PAGE_READ; } switch (ap) { case 0: if (arm_feature(env, ARM_FEATURE_V7)) { return 0; } if (access_type == 1) { return 0; } switch (regime_sctlr(env, mmu_idx) & (SCTLR_S | SCTLR_R)) { case SCTLR_S: return is_user ? 0 : PAGE_READ; case SCTLR_R: return PAGE_READ; default: return 0; } case 1: return is_user ? 0 : PAGE_READ | PAGE_WRITE; case 2: if (is_user) { return prot_ro; } else { return PAGE_READ | PAGE_WRITE; } case 3: return PAGE_READ | PAGE_WRITE; case 4: return 0; case 5: return is_user ? 0 : prot_ro; case 6: return prot_ro; case 7: if (!arm_feature(env, ARM_FEATURE_V6K)) { return 0; } return prot_ro; default: abort(); } }
1threat
static av_cold int g726_decode_init(AVCodecContext *avctx) { G726Context* c = avctx->priv_data; if (avctx->sample_rate <= 0) { av_log(avctx, AV_LOG_ERROR, "Samplerate is invalid\n"); return -1; } if(avctx->channels != 1){ av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n"); return -1; } c->code_size = avctx->bits_per_coded_sample; if (c->code_size < 2 || c->code_size > 5) { av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size); return AVERROR(EINVAL); } g726_reset(c, c->code_size - 2); avctx->sample_fmt = AV_SAMPLE_FMT_S16; return 0; }
1threat
e1000_mmio_read(void *opaque, hwaddr addr, unsigned size) { E1000State *s = opaque; unsigned int index = (addr & 0x1ffff) >> 2; if (index < NREADOPS && macreg_readops[index]) { return macreg_readops[index](s, index); } DBGOUT(UNKNOWN, "MMIO unknown read addr=0x%08x\n", index<<2); return 0; }
1threat
static char *read_splashfile(char *filename, int *file_sizep, int *file_typep) { GError *err = NULL; gboolean res; gchar *content; int file_type = -1; unsigned int filehead = 0; int bmp_bpp; res = g_file_get_contents(filename, &content, (gsize *)file_sizep, &err); if (res == FALSE) { error_report("failed to read splash file '%s'", filename); g_error_free(err); return NULL; } if (*file_sizep < 30) { goto error; } filehead = ((content[0] & 0xff) + (content[1] << 8)) & 0xffff; if (filehead == 0xd8ff) { file_type = JPG_FILE; } else if (filehead == 0x4d42) { file_type = BMP_FILE; } else { goto error; } if (file_type == BMP_FILE) { bmp_bpp = (content[28] + (content[29] << 8)) & 0xffff; if (bmp_bpp != 24) { goto error; } } *file_typep = file_type; return content; error: error_report("splash file '%s' format not recognized; must be JPEG " "or 24 bit BMP", filename); g_free(content); return NULL; }
1threat
Diff between the datatypes decimal(1, 1) and numeric (1, 1) in sql : <p>Can anyone please explain the difference between the datatypes decimal(1, 1) and numeric (1, 1) in SQL with an example?</p>
0debug
static int bfi_decode_frame(AVCodecContext * avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; BFIContext *bfi = avctx->priv_data; uint8_t *dst = bfi->dst; uint8_t *src, *dst_offset, colour1, colour2; uint8_t *frame_end = bfi->dst + avctx->width * avctx->height; uint32_t *pal; int i, j, height = avctx->height; if (bfi->frame.data[0]) avctx->release_buffer(avctx, &bfi->frame); bfi->frame.reference = 1; if (avctx->get_buffer(avctx, &bfi->frame) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } if (!avctx->frame_number) { bfi->frame.pict_type = FF_I_TYPE; bfi->frame.key_frame = 1; if(avctx->extradata_size>768) { av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n"); return -1; } pal = (uint32_t *) bfi->frame.data[1]; for (i = 0; i < avctx->extradata_size / 3; i++) { int shift = 16; *pal = 0; for (j = 0; j < 3; j++, shift -= 8) *pal += ((avctx->extradata[i * 3 + j] << 2) | (avctx->extradata[i * 3 + j] >> 4)) << shift; pal++; } bfi->frame.palette_has_changed = 1; } else { bfi->frame.pict_type = FF_P_TYPE; bfi->frame.key_frame = 0; } buf += 4; while (dst != frame_end) { static const uint8_t lentab[4]={0,2,0,1}; unsigned int byte = *buf++, av_uninit(offset); unsigned int code = byte >> 6; unsigned int length = byte & ~0xC0; if (length == 0) { if (code == 1) { length = bytestream_get_byte(&buf); offset = bytestream_get_le16(&buf); } else { length = bytestream_get_le16(&buf); if (code == 2 && length == 0) break; } } else { if (code == 1) offset = bytestream_get_byte(&buf); } if (dst + (length<<lentab[code]) > frame_end) break; switch (code) { case 0: bytestream_get_buffer(&buf, dst, length); dst += length; break; case 1: dst_offset = dst - offset; length *= 4; if (dst_offset < bfi->dst) break; while (length--) *dst++ = *dst_offset++; break; case 2: dst += length; break; case 3: colour1 = bytestream_get_byte(&buf); colour2 = bytestream_get_byte(&buf); while (length--) { *dst++ = colour1; *dst++ = colour2; } break; } } src = bfi->dst; dst = bfi->frame.data[0]; while (height--) { memcpy(dst, src, avctx->width); src += avctx->width; dst += bfi->frame.linesize[0]; } *data_size = sizeof(AVFrame); *(AVFrame *) data = bfi->frame; return buf_size; }
1threat
static av_cold int pulse_write_header(AVFormatContext *h) { PulseData *s = h->priv_data; AVStream *st = NULL; int ret; unsigned int i; pa_sample_spec ss; pa_buffer_attr attr = { -1, -1, -1, -1, -1 }; const char *stream_name = s->stream_name; for (i = 0; i < h->nb_streams; i++) { if (h->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { st = h->streams[i]; s->stream_index = i; break; } } if (!st) { av_log(s, AV_LOG_ERROR, "No audio stream found.\n"); return AVERROR(EINVAL); } if (!stream_name) { if (h->filename[0]) stream_name = h->filename; else stream_name = "Playback"; } ss.format = codec_id_to_pulse_format(st->codec->codec_id); ss.rate = st->codec->sample_rate; ss.channels = st->codec->channels; s->pa = pa_simple_new(s->server, s->name, PA_STREAM_PLAYBACK, s->device, stream_name, &ss, NULL, &attr, &ret); if (!s->pa) { av_log(s, AV_LOG_ERROR, "pa_simple_new failed: %s\n", pa_strerror(ret)); return AVERROR(EIO); } avpriv_set_pts_info(st, 64, 1, 1000000); return 0; }
1threat
static void virtio_scsi_fail_cmd_req(VirtIOSCSIReq *req) { req->resp.cmd->response = VIRTIO_SCSI_S_FAILURE; virtio_scsi_complete_cmd_req(req); }
1threat
Is there a mobile image recognition library? : <p>I want to make an application that opens up camera, point at an image and if the image is recognized in my database, give all the corresponding info, else, nothing happens. I dont know where to start, can you give me orientation and specify what cross-platform / ios / android language should I use? </p>
0debug
static int decode_micromips_opc (CPUMIPSState *env, DisasContext *ctx) { uint32_t op; if (ctx->pc & 0x1) { env->CP0_BadVAddr = ctx->pc; generate_exception(ctx, EXCP_AdEL); ctx->bstate = BS_STOP; return 2; } op = (ctx->opcode >> 10) & 0x3f; if (ctx->hflags & MIPS_HFLAG_BDS_STRICT) { switch (op & 0x7) { case 0: case 4: case 5: case 6: case 7: if (ctx->hflags & MIPS_HFLAG_BDS16) { generate_exception(ctx, EXCP_RI); ctx->bstate = BS_STOP; return 2; } break; case 1: case 2: case 3: if (ctx->hflags & MIPS_HFLAG_BDS32) { generate_exception(ctx, EXCP_RI); ctx->bstate = BS_STOP; return 2; } break; } } switch (op) { case POOL16A: { int rd = mmreg(uMIPS_RD(ctx->opcode)); int rs1 = mmreg(uMIPS_RS1(ctx->opcode)); int rs2 = mmreg(uMIPS_RS2(ctx->opcode)); uint32_t opc = 0; switch (ctx->opcode & 0x1) { case ADDU16: opc = OPC_ADDU; break; case SUBU16: opc = OPC_SUBU; break; } gen_arith(ctx, opc, rd, rs1, rs2); } break; case POOL16B: { int rd = mmreg(uMIPS_RD(ctx->opcode)); int rs = mmreg(uMIPS_RS(ctx->opcode)); int amount = (ctx->opcode >> 1) & 0x7; uint32_t opc = 0; amount = amount == 0 ? 8 : amount; switch (ctx->opcode & 0x1) { case SLL16: opc = OPC_SLL; break; case SRL16: opc = OPC_SRL; break; } gen_shift_imm(ctx, opc, rd, rs, amount); } break; case POOL16C: gen_pool16c_insn(ctx); break; case LWGP16: { int rd = mmreg(uMIPS_RD(ctx->opcode)); int rb = 28; int16_t offset = SIMM(ctx->opcode, 0, 7) << 2; gen_ld(ctx, OPC_LW, rd, rb, offset); } break; case POOL16F: check_insn_opc_removed(ctx, ISA_MIPS32R6); if (ctx->opcode & 1) { generate_exception(ctx, EXCP_RI); } else { int enc_dest = uMIPS_RD(ctx->opcode); int enc_rt = uMIPS_RS2(ctx->opcode); int enc_rs = uMIPS_RS1(ctx->opcode); int rd, rs, re, rt; static const int rd_enc[] = { 5, 5, 6, 4, 4, 4, 4, 4 }; static const int re_enc[] = { 6, 7, 7, 21, 22, 5, 6, 7 }; static const int rs_rt_enc[] = { 0, 17, 2, 3, 16, 18, 19, 20 }; rd = rd_enc[enc_dest]; re = re_enc[enc_dest]; rs = rs_rt_enc[enc_rs]; rt = rs_rt_enc[enc_rt]; gen_arith(ctx, OPC_ADDU, rd, rs, 0); gen_arith(ctx, OPC_ADDU, re, rt, 0); } break; case LBU16: { int rd = mmreg(uMIPS_RD(ctx->opcode)); int rb = mmreg(uMIPS_RS(ctx->opcode)); int16_t offset = ZIMM(ctx->opcode, 0, 4); offset = (offset == 0xf ? -1 : offset); gen_ld(ctx, OPC_LBU, rd, rb, offset); } break; case LHU16: { int rd = mmreg(uMIPS_RD(ctx->opcode)); int rb = mmreg(uMIPS_RS(ctx->opcode)); int16_t offset = ZIMM(ctx->opcode, 0, 4) << 1; gen_ld(ctx, OPC_LHU, rd, rb, offset); } break; case LWSP16: { int rd = (ctx->opcode >> 5) & 0x1f; int rb = 29; int16_t offset = ZIMM(ctx->opcode, 0, 5) << 2; gen_ld(ctx, OPC_LW, rd, rb, offset); } break; case LW16: { int rd = mmreg(uMIPS_RD(ctx->opcode)); int rb = mmreg(uMIPS_RS(ctx->opcode)); int16_t offset = ZIMM(ctx->opcode, 0, 4) << 2; gen_ld(ctx, OPC_LW, rd, rb, offset); } break; case SB16: { int rd = mmreg2(uMIPS_RD(ctx->opcode)); int rb = mmreg(uMIPS_RS(ctx->opcode)); int16_t offset = ZIMM(ctx->opcode, 0, 4); gen_st(ctx, OPC_SB, rd, rb, offset); } break; case SH16: { int rd = mmreg2(uMIPS_RD(ctx->opcode)); int rb = mmreg(uMIPS_RS(ctx->opcode)); int16_t offset = ZIMM(ctx->opcode, 0, 4) << 1; gen_st(ctx, OPC_SH, rd, rb, offset); } break; case SWSP16: { int rd = (ctx->opcode >> 5) & 0x1f; int rb = 29; int16_t offset = ZIMM(ctx->opcode, 0, 5) << 2; gen_st(ctx, OPC_SW, rd, rb, offset); } break; case SW16: { int rd = mmreg2(uMIPS_RD(ctx->opcode)); int rb = mmreg(uMIPS_RS(ctx->opcode)); int16_t offset = ZIMM(ctx->opcode, 0, 4) << 2; gen_st(ctx, OPC_SW, rd, rb, offset); } break; case MOVE16: { int rd = uMIPS_RD5(ctx->opcode); int rs = uMIPS_RS5(ctx->opcode); gen_arith(ctx, OPC_ADDU, rd, rs, 0); } break; case ANDI16: gen_andi16(ctx); break; case POOL16D: switch (ctx->opcode & 0x1) { case ADDIUS5: gen_addius5(ctx); break; case ADDIUSP: gen_addiusp(ctx); break; } break; case POOL16E: switch (ctx->opcode & 0x1) { case ADDIUR2: gen_addiur2(ctx); break; case ADDIUR1SP: gen_addiur1sp(ctx); break; } break; case B16: gen_compute_branch(ctx, OPC_BEQ, 2, 0, 0, SIMM(ctx->opcode, 0, 10) << 1, 4); break; case BNEZ16: case BEQZ16: gen_compute_branch(ctx, op == BNEZ16 ? OPC_BNE : OPC_BEQ, 2, mmreg(uMIPS_RD(ctx->opcode)), 0, SIMM(ctx->opcode, 0, 7) << 1, 4); break; case LI16: { int reg = mmreg(uMIPS_RD(ctx->opcode)); int imm = ZIMM(ctx->opcode, 0, 7); imm = (imm == 0x7f ? -1 : imm); tcg_gen_movi_tl(cpu_gpr[reg], imm); } break; case RES_20: case RES_28: case RES_29: case RES_30: case RES_31: case RES_38: case RES_39: generate_exception(ctx, EXCP_RI); break; default: decode_micromips32_opc(env, ctx); return 4; } return 2; }
1threat
Split Array By Values In Sequence : <p>Is there an easy (linq?) way to split an <code>int</code> array into new arrays based off unbroken numerical sequences? For example given this pseudo code:</p> <pre><code>[Fact] public void ArraySpike() { var source = new[] {1, 2, 3, 7, 8, 9, 12, 13, 24}; var results = SplitArray(source); Assert.True(results[0] == new[] {1, 2, 3}); Assert.True(results[1] == new[] {7, 8, 9}); Assert.True(results[2] == new[] {12, 13}); Assert.True(results[3] == new[] {24}); } public int[][] SplitArray(int[] source) { return source.??? } </code></pre>
0debug
Why I am seeing my headers like this "labels.frontend.auth.login_box_title" on my local host : <p><a href="https://i.stack.imgur.com/2hPNv.jpg" rel="nofollow noreferrer">enter image description here</a></p> <p>what to do I need to do with this issue?</p>
0debug
Laravel Eloquent, assert that collection contains item : <p>How to assert (in PHPUnit test) that Eloquent collection contains an item?</p> <p>Something like this:</p> <pre><code>$expected = factory::create(Item::class)-&gt;create(); $eloquentCollection = someData(); // Item::orderBy(...)-&gt;...-&gt;get(); $this-&gt;assertContains($expected, $eloquentCollection); </code></pre>
0debug
"no newline at end of file" C : <p>I'm using this command to compile:</p> <p><code>gcc –Werror –std=c99 client.c –o client</code> </p> <p>CODE:</p> <pre><code>#include &lt;string.h&gt; #include &lt;stdio.h&gt; #include &lt;strings.h&gt; #include &lt;stdlib.h&gt; #include &lt;unistd.h&gt; #include &lt;netdb.h&gt; #include &lt;sys/types.h&gt; #include &lt;sys/socket.h&gt; #include &lt;netinet/in.h&gt; #define BUFFER_SIZE 1000 #define PORT_NUM 8888 void error(char *msg) { perror(msg); exit(0); } int main(int argc, char *argv[]) { int sockfd, portno, n; struct sockaddr_in serv_addr; struct hostent *server; char buffer[BUFFER_SIZE]; if (argc &lt; 3) { fprintf(stderr,"usage %s hostname port\n", argv[0]); exit(0); } portno = atoi(argv[2]); sockfd = socket(AF_INET, SOCK_STREAM, 0); if (sockfd &lt; 0) error("ERROR opening socket"); server = gethostbyname(argv[1]); if (server == NULL) { fprintf(stderr,"ERROR, no such host\n"); exit(0); } bzero((char *) &amp;serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; bcopy((char *)server-&gt;h_addr, (char *)&amp;serv_addr.sin_addr.s_addr, server-&gt;h_length); serv_addr.sin_port = htons(portno); if (connect(sockfd,(struct sockaddr *)&amp;serv_addr,sizeof(serv_addr)) &lt; 0) error("ERROR connecting"); while (1) { bzero(buffer, BUFFER_SIZE); fgets(buffer, BUFFER_SIZE, stdin); if((strncmp(buffer,"close",5) == 0 )) break; printf("Please enter the message: "); bzero(buffer, BUFFER_SIZE); n = write(sockfd,buffer,strlen(buffer)); if (n &lt; 0) error("ERROR writing to socket"); bzero(buffer, BUFFER_SIZE); n = read(sockfd,buffer, BUFFER_SIZE-1); if (n &lt; 0) error("ERROR reading from socket"); printf("%s\n",buffer); } close(sockfd); return 0; } </code></pre> <p>Trying to compile it in a shell on VM whos OS is linux This error is driving me crazy, I don't understand what to do inorder to fix this. I thought the client.c file is damaged, so I copied and pasted into a new .c file. When that failed, I wrote it from 0 and still getting this error.</p> <p>Thanks in advance!</p>
0debug
Spring Boot 2.0.0.SNAPSHOT or 2.0.0.RC1 with jpa doenst start : A simple spring boot 2.0.0.RC1 application with jpa started included as dependency doesnt start at all with the following log: :: Spring Boot :: (v2.0.0.RC1) 2018-02-06 15:06:00.926 INFO 1208 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication on 4e4034c0b5d8 with PID 1208 (/home/developer/isolation/src/new_env/demo/target/classes started by developer in /home/developer/isolation/src/new_env/demo) 2018-02-06 15:06:00.930 INFO 1208 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default 2018-02-06 15:06:00.991 INFO 1208 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@37574691: startup date [Tue Feb 06 15:06:00 UTC 2018]; root of context hierarchy 2018-02-06 15:06:02.057 WARN 1208 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: At least one JPA metamodel must be present! 2018-02-06 15:06:02.057 INFO 1208 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2018-02-06 15:06:02.069 INFO 1208 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-02-06 15:06:02.077 ERROR 1208 --- [ main] o.s.boot.SpringApplication : Application run failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: At least one JPA metamodel must be present! at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1710) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:583) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:502) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:312) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:742) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868) ~[spring-context-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:388) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RC1.jar:2.0.0.RC1] at com.example.demo.DemoApplication.main(DemoApplication.java:10) [classes/:na] Caused by: java.lang.IllegalArgumentException: At least one JPA metamodel must be present! at org.springframework.util.Assert.notEmpty(Assert.java:450) ~[spring-core-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.data.jpa.mapping.JpaMetamodelMappingContext.<init>(JpaMetamodelMappingContext.java:54) ~[spring-data-jpa-2.0.3.RELEASE.jar:2.0.3.RELEASE] at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:88) ~[spring-data-jpa-2.0.3.RELEASE.jar:2.0.3.RELEASE] at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:43) ~[spring-data-jpa-2.0.3.RELEASE.jar:2.0.3.RELEASE] at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:141) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1769) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1706) ~[spring-beans-5.0.3.RELEASE.jar:5.0.3.RELEASE] ... 15 common frames omitted The application has the following pom got from start.spring.io: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.0.RC1</version> <relativePath/> </parent> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> <repositories> <repository> <id>spring-snapshots</id> <name>Spring Snapshots</name> <url>https://repo.spring.io/snapshot</url> <snapshots> <enabled>true</enabled> </snapshots> </repository> <repository> <id>spring-milestones</id> <name>Spring Milestones</name> <url>https://repo.spring.io/milestone</url> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-snapshots</id> <name>Spring Snapshots</name> <url>https://repo.spring.io/snapshot</url> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> <pluginRepository> <id>spring-milestones</id> <name>Spring Milestones</name> <url>https://repo.spring.io/milestone</url> <snapshots> <enabled>false</enabled> </snapshots> </pluginRepository> </pluginRepositories> </project> If I take off the jpa starter dependency it works. If I downgrade spring boot version to latest release it works but I need to use spring 5. Any ideas?
0debug
static void blizzard_reg_write(void *opaque, uint8_t reg, uint16_t value) { BlizzardState *s = (BlizzardState *) opaque; switch (reg) { case 0x04: s->pll = (value & 0x3f) + 1; break; case 0x06: s->pll_range = value & 3; break; case 0x08: s->pll_ctrl &= 0xf00; s->pll_ctrl |= (value << 0) & 0x0ff; break; case 0x0a: s->pll_ctrl &= 0x0ff; s->pll_ctrl |= (value << 8) & 0xf00; break; case 0x0c: s->pll_mode = value & 0x77; if ((value & 3) == 0 || (value & 3) == 3) fprintf(stderr, "%s: wrong PLL Control bits (%i)\n", __FUNCTION__, value & 3); break; case 0x0e: s->clksel = value & 0xff; break; case 0x10: s->memenable = value & 1; break; case 0x14: break; case 0x18: s->memrefresh &= 0xf00; s->memrefresh |= (value << 0) & 0x0ff; break; case 0x1a: s->memrefresh &= 0x0ff; s->memrefresh |= (value << 8) & 0xf00; break; case 0x1c: s->timing[0] = value & 0x7f; break; case 0x1e: s->timing[1] = value & 0x17; break; case 0x20: s->timing[2] = value & 0x35; break; case 0x24: s->priority = value & 1; break; case 0x28: s->lcd_config = value & 0xff; if (value & (1 << 7)) fprintf(stderr, "%s: data swap not supported!\n", __FUNCTION__); break; case 0x2a: s->x = value << 3; break; case 0x2c: s->hndp = value & 0xff; break; case 0x2e: s->y &= 0x300; s->y |= (value << 0) & 0x0ff; break; case 0x30: s->y &= 0x0ff; s->y |= (value << 8) & 0x300; break; case 0x32: s->vndp = value & 0xff; break; case 0x34: s->hsync = value & 0xff; break; case 0x36: s->skipx = value & 0xff; break; case 0x38: s->vsync = value & 0xbf; break; case 0x3a: s->skipy = value & 0xff; break; case 0x3c: s->pclk = value & 0x82; break; case 0x3e: s->hssi_config[0] = value; break; case 0x40: s->hssi_config[1] = value; if (((value >> 4) & 3) == 3) fprintf(stderr, "%s: Illegal active-data-links value\n", __FUNCTION__); break; case 0x42: s->hssi_config[2] = value & 0xbd; break; case 0x44: s->tv_config = value & 0xfe; break; case 0x46 ... 0x4c: s->tv_timing[(reg - 0x46) >> 1] = value; break; case 0x4e: s->vbi = value; break; case 0x50: s->tv_x = value; break; case 0x52: s->tv_y = value & 0x7f; break; case 0x54: s->tv_test = value; break; case 0x56: s->tv_filter_config = value & 0xbf; break; case 0x58: s->tv_filter_idx = value & 0x1f; break; case 0x5a: if (s->tv_filter_idx < 0x20) s->tv_filter_coeff[s->tv_filter_idx ++] = value; break; case 0x60: s->yrc[0] = value & 0xb0; break; case 0x62: s->yrc[1] = value & 0x30; break; case 0x64: s->u = value & 0xff; break; case 0x66: s->v = value & 0xff; break; case 0x68: if ((s->mode ^ value) & 3) s->invalidate = 1; s->mode = value & 0xb7; s->enable = value & 1; s->blank = (value >> 1) & 1; if (value & (1 << 4)) fprintf(stderr, "%s: Macrovision enable attempt!\n", __FUNCTION__); break; case 0x6a: s->effect = value & 0xfb; break; case 0x6c: s->ix[0] &= 0x300; s->ix[0] |= (value << 0) & 0x0ff; break; case 0x6e: s->ix[0] &= 0x0ff; s->ix[0] |= (value << 8) & 0x300; break; case 0x70: s->iy[0] &= 0x300; s->iy[0] |= (value << 0) & 0x0ff; break; case 0x72: s->iy[0] &= 0x0ff; s->iy[0] |= (value << 8) & 0x300; break; case 0x74: s->ix[1] &= 0x300; s->ix[1] |= (value << 0) & 0x0ff; break; case 0x76: s->ix[1] &= 0x0ff; s->ix[1] |= (value << 8) & 0x300; break; case 0x78: s->iy[1] &= 0x300; s->iy[1] |= (value << 0) & 0x0ff; break; case 0x7a: s->iy[1] &= 0x0ff; s->iy[1] |= (value << 8) & 0x300; break; case 0x7c: s->ox[0] &= 0x300; s->ox[0] |= (value << 0) & 0x0ff; break; case 0x7e: s->ox[0] &= 0x0ff; s->ox[0] |= (value << 8) & 0x300; break; case 0x80: s->oy[0] &= 0x300; s->oy[0] |= (value << 0) & 0x0ff; break; case 0x82: s->oy[0] &= 0x0ff; s->oy[0] |= (value << 8) & 0x300; break; case 0x84: s->ox[1] &= 0x300; s->ox[1] |= (value << 0) & 0x0ff; break; case 0x86: s->ox[1] &= 0x0ff; s->ox[1] |= (value << 8) & 0x300; break; case 0x88: s->oy[1] &= 0x300; s->oy[1] |= (value << 0) & 0x0ff; break; case 0x8a: s->oy[1] &= 0x0ff; s->oy[1] |= (value << 8) & 0x300; break; case 0x8c: s->iformat = value & 0xf; s->bpp = blizzard_iformat_bpp[s->iformat]; if (!s->bpp) fprintf(stderr, "%s: Illegal or unsupported input format %x\n", __FUNCTION__, s->iformat); break; case 0x8e: s->source = value & 7; if ((!(s->effect & (1 << 3)) && (s->ix[0] != s->ox[0] || s->iy[0] != s->oy[0] || s->ix[1] != s->ox[1] || s->iy[1] != s->oy[1])) || !((s->ix[1] - s->ix[0]) & (s->iy[1] - s->iy[0]) & (s->ox[1] - s->ox[0]) & (s->oy[1] - s->oy[0]) & 1)) fprintf(stderr, "%s: Illegal input/output window positions\n", __FUNCTION__); blizzard_transfer_setup(s); break; case 0x90: if (!s->data.len && !blizzard_transfer_setup(s)) break; *s->data.ptr ++ = value; if (-- s->data.len == 0) blizzard_window(s); break; case 0xa8: s->border_r = value; break; case 0xaa: s->border_g = value; break; case 0xac: s->border_b = value; break; case 0xb4: s->gamma_config = value & 0x87; break; case 0xb6: s->gamma_idx = value; break; case 0xb8: s->gamma_lut[s->gamma_idx ++] = value; break; case 0xba: s->matrix_ena = value & 1; break; case 0xbc ... 0xde: s->matrix_coeff[(reg - 0xbc) >> 1] = value & ((reg & 2) ? 0x80 : 0xff); break; case 0xe0: s->matrix_r = value; break; case 0xe2: s->matrix_g = value; break; case 0xe4: s->matrix_b = value; break; case 0xe6: s->pm = value & 0x83; if (value & s->mode & 1) fprintf(stderr, "%s: The display must be disabled before entering " "Standby Mode\n", __FUNCTION__); break; case 0xe8: s->status = value & 0x1b; break; case 0xea: s->rgbgpio_dir = value & 0x8f; break; case 0xec: s->rgbgpio = value & 0xcf; break; case 0xee: s->gpio_dir = value; break; case 0xf0: s->gpio = value; break; case 0xf2: s->gpio_edge[0] = value; break; case 0xf4: s->gpio_edge[1] = value; break; case 0xf6: s->gpio_irq &= value; break; case 0xf8: s->gpio_pdown = value; break; default: fprintf(stderr, "%s: unknown register %02x\n", __FUNCTION__, reg); break; } }
1threat
Delphi 7 Webbrowser - select without value : <p>I need help...My problem is:</p> <p><strong>Page source:</strong></p> <pre><code>&lt;select name="year" id="year" class="form-control select-inline"&gt; &lt;option&gt;1990&lt;/option&gt; &lt;option&gt;1991&lt;/option&gt; &lt;option&gt;1992&lt;/option&gt; &lt;option&gt;1193&lt;/option&gt; &lt;/select&gt; </code></pre> <p><strong>In delphi 7, use:</strong></p> <pre><code>WebBrowser1.OleObject.Document.All.Item('year', 0).value := '1990'; </code></pre> <p><strong>But form site continue in blank...Help me please</strong></p>
0debug
static int ircam_read_header(AVFormatContext *s) { uint32_t magic, sample_rate, channels, tag; const AVCodecTag *tags; int le = -1, i; AVStream *st; magic = avio_rl32(s->pb); for (i = 0; i < 7; i++) { if (magic == table[i].magic) { le = table[i].is_le; break; } } if (le == 1) { sample_rate = av_int2float(avio_rl32(s->pb)); channels = avio_rl32(s->pb); tag = avio_rl32(s->pb); tags = ff_codec_ircam_le_tags; } else if (le == 0) { sample_rate = av_int2float(avio_rb32(s->pb)); channels = avio_rb32(s->pb); tag = avio_rb32(s->pb); tags = ff_codec_ircam_be_tags; } else { return AVERROR_INVALIDDATA; } if (!channels || !sample_rate) return AVERROR_INVALIDDATA; st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = channels; st->codecpar->sample_rate = sample_rate; st->codecpar->codec_id = ff_codec_get_id(tags, tag); if (st->codecpar->codec_id == AV_CODEC_ID_NONE) { av_log(s, AV_LOG_ERROR, "unknown tag %X\n", tag); return AVERROR_INVALIDDATA; } st->codecpar->bits_per_coded_sample = av_get_bits_per_sample(st->codecpar->codec_id); st->codecpar->block_align = st->codecpar->bits_per_coded_sample * st->codecpar->channels / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); avio_skip(s->pb, 1008); return 0; }
1threat
int bdrv_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors) { Coroutine *co; DiscardCo rwco = { .bs = bs, .sector_num = sector_num, .nb_sectors = nb_sectors, .ret = NOT_DONE, }; if (qemu_in_coroutine()) { bdrv_discard_co_entry(&rwco); } else { co = qemu_coroutine_create(bdrv_discard_co_entry); qemu_coroutine_enter(co, &rwco); while (rwco.ret == NOT_DONE) { qemu_aio_wait(); } } return rwco.ret; }
1threat
Standart deviation for each column : [Example][1] I need to find sd of Norm for each column value in a row, e.g sd(c(4,2) for 1 May [1]: http://i.stack.imgur.com/0hK68.png
0debug
Error: onActivityResult overrides nothing : <p>I am programming a speech recognition app in Kotlin for Android. </p> <pre><code>class MainActivity : AppCompatActivity() { public override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val intent:Intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH) intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM) startActivityForResult(intent, REQUEST_CODE) } override fun onActivityResult(requestCode:Int, resultCode:Int, data:Intent) { if (requestCode == REQUEST_CODE &amp;&amp; resultCode == RESULT_OK) {/*do something*/ } super.onActivityResult(requestCode, resultCode, data) } } </code></pre> <p>Strangly the compiler always finds the Error: 'onActivityResult' overrides nothing. </p> <p>Documentation of Android states that result of startActivityForResult can be retrived with onActivityResult.</p> <p>Now the question: how can one get the result of speech recognition using Kotlin?</p>
0debug
int pci_device_load(PCIDevice *s, QEMUFile *f) { uint8_t config[PCI_CONFIG_SPACE_SIZE]; uint32_t version_id; int i; version_id = qemu_get_be32(f); if (version_id > 2) return -EINVAL; qemu_get_buffer(f, config, sizeof config); for (i = 0; i < sizeof config; ++i) if ((config[i] ^ s->config[i]) & s->cmask[i] & ~s->wmask[i]) return -EINVAL; memcpy(s->config, config, sizeof config); pci_update_mappings(s); if (version_id >= 2) for (i = 0; i < 4; i ++) s->irq_state[i] = qemu_get_be32(f); return 0; }
1threat
where should i place data base file to run example project : i m new in PHP programing. i copy some project form github https://github.com/puttyvikas/shopping this is screen shot project containing thi file [githum PHP project files][1] i extract project place in my wamp www folder. and access by using http://localhost /shopping-master/index.php its show me not connect error. help me how do i connect with database where should i place sample code database to run project easily ?? this is screen shot enter code here //connect.php file <?php $server_name = "localhost"; $user_name = "root"; $pass = ""; //$db = "easygaadi"; $db = "shopping"; $conn_error = "not connected"; if(@!mysql_connect($server_name,$user_name,$pass) || @!mysql_select_db($db)) { die($conn_error); } //else { //echo "<span style='background-color:yellow'>Connected to Database Successfully!!</span><br>"; //} //this is index.php file <!DOCTYPE html> <html> <?php require 'connect.php'; ob_start(); session_start(); ?> <head>
0debug
what is this error? solve for me : Error:Execution failed for task ':app:processXzsaleDebugManifest'. > Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:8:9-36 is also present at [com.pnikosis:materialish-progress:1.0] AndroidManifest.xml:13:9-45 value=(@drawable/ic_launcher). Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.
0debug
how to use *ngFor in angular 6 for Multiple values : how to use *ngFor for multiple values in angular 6. and i want to know the full description of *ngFor usage in angular 6 i tried this--> <div>*ngFor="let data of datas track by $index"</div>
0debug
Observable.combineLatest type inference in kotlin : <p>I'm using RxJava2, Kotlin-1.1 along with RxBindings in my project.</p> <p>I have simple login screen with 'login' button disabled by default, I want to enable the button only when username and password edittext fields are not empty.</p> <p><strong>LoginActivity.java</strong></p> <pre><code>Observable&lt;Boolean&gt; isFormEnabled = Observable.combineLatest(mUserNameObservable, mPasswordObservable, (userName, password) -&gt; userName.length() &gt; 0 &amp;&amp; password.length() &gt; 0) .distinctUntilChanged(); </code></pre> <p>I'm unable to translate the above code from Java to Kotlin:</p> <p><strong>LoginActivity.kt</strong></p> <pre><code>class LoginActivity : AppCompatActivity() { val disposable = CompositeDisposable() private var userNameObservable: Observable&lt;CharSequence&gt;? = null private var passwordObservable: Observable&lt;CharSequence&gt;? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_login) initialize() } fun initialize() { userNameObservable = RxTextView.textChanges(username).skip(1) .debounce(500, TimeUnit.MILLISECONDS) passwordObservable = RxTextView.textChanges(password).skip(1) .debounce(500, TimeUnit.MILLISECONDS) } private fun setSignInButtonEnableListener() { val isSignInEnabled: Observable&lt;Boolean&gt; = Observable.combineLatest(userNameObservable, passwordObservable, { u: CharSequence, p: CharSequence -&gt; u.isNotEmpty() &amp;&amp; p.isNotEmpty() }) } } </code></pre> <p>I assumed it's something related to type inference of the third argument in <code>combinelatest</code>, but I don't get the issue properly by reading the error message: <a href="https://i.stack.imgur.com/obrG5.png" rel="noreferrer"><img src="https://i.stack.imgur.com/obrG5.png" alt="Type Inference issue"></a></p>
0debug
do save instance in my FragmentActivity : *in my FragmentActivity i have a recycleView i want do save instance in my Activity because i have a tabLayout with View pager look in the picutre* This the image of my application [enter image description here][1] [1]: https://i.stack.imgur.com/XGsit.png this is my code: ------------------- public class Menu1Fragment extends Fragment { recycleAdapter imp_listArrayAdapter; public static ArrayList<String> arrayList = new ArrayList<String>(); public Menu1Fragment() { } @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.list_item, container, false); //if (savedInstanceState != null) { //Restore the fragment's state here // } // Boolean a = false; ArrayList<imp_list> impLists = new ArrayList<imp_list>(); impLists.add(new imp_list("Make a Banana", "3000", R.drawable.makabananasplit, a)); impLists.add(new imp_list("Abdeys Apple Sizzler", "2000", R.drawable.abbeys, a)); impLists.add(new imp_list("Cheese Cake", "1000", R.drawable.cheesecake, a)); impLists.add(new imp_list("Choise Of Ice_Cream", "1500", R.drawable.icecream, a)); impLists.add(new imp_list("Daeth By Chocolate", "3000", R.drawable.deathbychocolate, a)); impLists.add(new imp_list("Make a Banana", "3000", R.drawable.makabananasplit, a)); impLists.add(new imp_list("Abdeys Apple Sizzler", "2000", R.drawable.abbeys, a)); impLists.add(new imp_list("Cheese Cake", "1000", R.drawable.cheesecake, a)); impLists.add(new imp_list("Choise Of Ice_Cream", "1500", R.drawable.icecream, a)); impLists.add(new imp_list("Daeth By Chocolate", "3000", R.drawable.deathbychocolate, a)); impLists.add(new imp_list("Make a Banana", "3000", R.drawable.makabananasplit, a)); impLists.add(new imp_list("Abdeys Apple Sizzler", "2000", R.drawable.abbeys, a)); impLists.add(new imp_list("Cheese Cake", "1000", R.drawable.cheesecake, a)); impLists.add(new imp_list("Choise Of Ice_Cream", "1500", R.drawable.icecream, a)); impLists.add(new imp_list("Daeth By Chocolate", "3000", R.drawable.deathbychocolate, a)); imp_listArrayAdapter = new recycleAdapter(getActivity(), impLists); RecyclerView recyclerView = (RecyclerView) rootView.findViewById(R.id.res_id); recyclerView.setAdapter(imp_listArrayAdapter); recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); arrayList = imp_listArrayAdapter.stringArrayList; return rootView; }
0debug
EINVRES Request to https://bower.herokuapp.com/packages/ failed with 502 : <p>Bower install fails with 502 - Bad Gateway when downloading bower packages.</p> <p>For example bower install for ember library gives following response in command line.</p> <blockquote> <p>EINVRES Request to <a href="https://bower.herokuapp.com/packages/ember" rel="noreferrer">https://bower.herokuapp.com/packages/ember</a> failed with 502</p> </blockquote> <p>When <a href="http://bower.herokuapp.com/" rel="noreferrer">http://bower.herokuapp.com/</a> is accessed directly from URL it gives the following message.</p> <blockquote> <p>This Bower version is deprecated. Please update it: npm install -g bower. The new registry address is <a href="https://registry.bower.io" rel="noreferrer">https://registry.bower.io</a></p> </blockquote>
0debug
How can I serializeArray with a structure based on key value? : <p>I am creating an Array from a form via <code>serializeArray()</code> in jQuery:</p> <pre><code>var form = $(this).closest('form'); var formData = form.serializeArray(); </code></pre> <p>If I output this with <code>alert(formData.toSource());</code> I get the result:</p> <pre><code>[{name:"form[username]", value:"1"}, {name:"form[email]", value:"1@12.sw"}, {name:"form[is_active]", value:"1"}, {name:"form[plainPassword][first]", value:""}, {name:"form[plainPassword][second]", value:""}, {name:"form[id]", value:"9"}, {name:"form[_token]", value:"Mk"}] </code></pre> <p>If I capture the data via Ajax to php with <code>$data = $request-&gt;request-&gt;get('data');</code>I get the following Array as a result:</p> <pre><code>array(7) { [0]=&gt; array(2) { ["name"]=&gt; string(14) "form[username]" ["value"]=&gt; string(1) "1" } [1]=&gt; array(2) { ["name"]=&gt; string(11) "form[email]" ["value"]=&gt; string(7) "1@12.sw" } [2]=&gt; array(2) { ["name"]=&gt; string(15) "form[is_active]" ["value"]=&gt; string(1) "1" } [3]=&gt; array(2) { ["name"]=&gt; string(26) "form[plainPassword][first]" ["value"]=&gt; string(0) "" } [4]=&gt; array(2) { ["name"]=&gt; string(27) "form[plainPassword][second]" ["value"]=&gt; string(0) "" } [5]=&gt; array(2) { ["name"]=&gt; string(8) "form[id]" ["value"]=&gt; string(1) "9" } [6]=&gt; array(2) { ["name"]=&gt; string(12) "form[_token]" ["value"]=&gt; string(43) "Mk" } } </code></pre> <p>The array that I would actually need is something like this:</p> <pre><code> array(2) { ["form[username]"]=&gt; string(14) "1" ["form[email]"]=&gt; string(1) "1@12.sw" ["form[is_active]"]=&gt; string(1) "1" ["form[plainPassword][first]"]=&gt; string(0) "" ["form[plainPassword][second]"]=&gt; string(0) "" ["form[id]"]=&gt; string(1) "9" ["form[id]"]=&gt; string(2) "Mk" } </code></pre> <p>So is it possible to actually serialize the Array differently? What is the best way to achieve the array I would need?</p>
0debug
MATLAB - Finding Peaks and Valleys : <p>So I have 2 .wav files that was recorded frequency. One is the original audio and the other one is the filtered one. Both are stereo .wav files.</p> <p>Right now, I am supposed to find the peaks and valleys of these 2 .wav file. I was told to that I have to take 3 consecutive data and determine which of the 3 is the max or the min. If the middle one is the max or the min, then peak/valley have been found. Repeat this until there are no more data.</p> <p>How should I achieve the above?</p> <p>I was told to do a sliding window of size 3 and take 3 points by 3 points.</p> <p>I googled it but could not find how to start. Could anyone assist please. Thank You!</p>
0debug
def count_samepair(list1,list2,list3): result = sum(m == n == o for m, n, o in zip(list1,list2,list3)) return result
0debug
How to find difference in hours between dates in R : <p>I have the following dataframe (DF1):</p> <pre><code>Date Value 29/12/2014 8:00 24.940 29/12/2014 9:00 24.960 29/12/2014 11:00 25.020 </code></pre> <p>I would like to add a new column for DF1$DIFF, where it contains the difference in values between each line's Date (including hours) to its above Date. So that the required results will be:</p> <pre><code>Date Value Diff 29/12/2014 8:00 24.940 29/12/2014 9:00 24.960 1 29/12/2014 11:00 25.020 2 </code></pre> <p>I tried to use the as.date function, however, I get the difference in dates only: </p> <pre><code>&gt; as.Date("2009-10-01 10:00")- as.Date("2009-10-01 9:00") Time difference of 0 days </code></pre>
0debug
static void gen_mtmsrd(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } if (ctx->opcode & 0x00010000) { TCGv t0 = tcg_temp_new(); tcg_gen_andi_tl(t0, cpu_gpr[rS(ctx->opcode)], (1 << MSR_RI) | (1 << MSR_EE)); tcg_gen_andi_tl(cpu_msr, cpu_msr, ~(target_ulong)((1 << MSR_RI) | (1 << MSR_EE))); tcg_gen_or_tl(cpu_msr, cpu_msr, t0); tcg_temp_free(t0); } else { gen_update_nip(ctx, ctx->nip); gen_helper_store_msr(cpu_env, cpu_gpr[rS(ctx->opcode)]); gen_stop_exception(ctx); } #endif }
1threat
how to convert an array of hash into object : I am trying to convert following array of hash into an object. data = { k: [ {id: 'abc'}, {id: 'bcd'}, {id: 'cde'} ] # o: { [{id: 'acd'}, {id: 'opu'}], id: 'qiu' } } This is what i have done so far. class Test def initialize(sample) sample.each do |k,v| # self.instance_variable_set("@#{k}", v.is_a?(Hash) ? Test.new(v) : v) self.instance_variable_set("@#{k}", v.is_a?(Array) ? Test.new(v.map do |v| v[:id] end) : v) end end end test = Test.new(data) It returns `#<Test:0x00005628978c1e30 @k=#<Test:0x00005628978c1d90 @abc=nil, @bcd=nil, @cde=nil>>` but what i am trying to get is this `#<Test:0x00005628978c1e30 @k=['abc', 'bcd', 'cde']>>` Also trying to convert the hash (commented in data) into object. Does anyone know how can i achieve this? Any help is appreciated. Thanks.
0debug
Different output using print and return : can anyone explain me why we get different output using print and return. For this code: def string(txt): for char in txt: print(char) string('Stack') the output would be: S t a c k And for this code: def string1(txt): for char in txt: return char string1('Stack') the output would be: 'S'
0debug
What are the arguments for scipy.stats.uniform? : <p>I'm trying to create a uniform distribution between two numbers (lower bound and upper bound) in order to feed it to sklearn's <a href="http://scikit-learn.org/stable/modules/generated/sklearn.model_selection.ParameterSampler.html" rel="noreferrer">ParameterSampler</a>. I am using <a href="https://docs.scipy.org/doc/scipy-0.19.0/reference/generated/scipy.stats.uniform.html" rel="noreferrer">scipy.stats.uniform</a> in the following format:</p> <pre><code>from scipy.stats import uniform params = ParameterSampler({'bandwidth':uniform(5,50)}, 20) </code></pre> <p>But when I get the random selections of the 'bandwidth' parameter, they are not all between 5 and 50. Some of them are bigger than 50 by a bit. So my question is what do the arguments in scipy.stats.uniform represent? Are they not a lower bound and upper bound? The documentation shows no arguments so I can't figure it out from that.</p>
0debug
static void enable_interrupt(EEPRO100State * s) { if (!s->int_stat) { logout("interrupt enabled\n"); qemu_irq_raise(s->pci_dev->irq[0]); s->int_stat = 1; } }
1threat
Location of swagger.json when created with Swashbuckle : <p>When I build and run my Azure Web API I get a nice swaggerUI.</p> <p>I want to add the API to Azure API Management.</p> <p>For this I need either a URL or the swagger.json file.</p> <p>Where does Swashbuckle put the file?</p> <p>Or if it generates it on the fly, how can I get access to it?</p>
0debug
Howto rename bunch of filenames which are calculated : <p>I want rename bunch of filenames. The rename is based on the calculation of the filename. That means the actual filename + 3600 = new filename. Important is that the underscore in the pid files have to stay.</p> <p>Thanks in advance!</p> <p>My system is Debian Stretch.</p> <p>Actual Filename:</p> <pre><code>134235.error 134235_.pid 134235.tiff 13893.error 13893_.pid 13893.tiff 1.error 1_.pid 1.tiff </code></pre> <p>Rename to:</p> <pre><code>137835.error 137835_.pid 137835.tiff 17493.error 17493_.pid 17493.tiff 3601.error 3601_.pid 3601.tiff </code></pre>
0debug
php mysqli insert on dublicate : Greetings out there on the outerweb ;-) Trying to make my life a little more easy, I descided to do a function for updating my tables with data. I would like to have it done eg. like this: $table = "ticket_stati"; $fields = array(`ticket_stati_id`, `locked_record`, `ticket_stati_name`, `ticket_stati_description`, `ticket_stati_color`); $data = array(1, 1, 'Open', 'The ticket is marked as open and not assigned or acked.', '#130a5a'); // Call function func_update_table($table, $fields, $data); $data = array(2, 1, 'Assigned', 'The ticket has been assigned to a user or group', '#11a916'); func_update_table($table, $fields, $data); But I am having trouble figuring out how the _INSERT INTO_ should be created to make sure that on dublicate (ON DUBLICATE) only the fields with **updateable data** are updated. Any one.
0debug
MAX = 1000000 def breakSum(n): dp = [0]*(n+1) dp[0] = 0 dp[1] = 1 for i in range(2, n+1): dp[i] = max(dp[int(i/2)] + dp[int(i/3)] + dp[int(i/4)], i); return dp[n]
0debug
Python: Please why does this code print out only the first letter? : Word=input('please enter a word') def cap(word): for char in word: if char in 'aeiou': return letter.upper() else: return letter result=cap(word) print result
0debug
Regex for combination of at least one alphanumeric and special character : <p>I need to create a regex which contains at least 1 special character, and at least 1 number with alphabets.</p>
0debug
How to link to the attachments added from the description of a workitem? : <p>In VSTS attachment can be uploaded for workitems. Those attachments are displayed in a seperate tab.</p> <p><a href="https://i.stack.imgur.com/Asp51.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Asp51.png" alt="enter image description here"></a></p> <p>I found no way to reference those attachments from within the description of the workitems.</p> <p><a href="https://i.stack.imgur.com/RI1et.png" rel="noreferrer"><img src="https://i.stack.imgur.com/RI1et.png" alt="enter image description here"></a></p> <p>So how to do it?</p>
0debug