problem
stringlengths
26
131k
labels
class label
2 classes
How to bundle a library with webpack? : <p>I want to create a frontend library. Therefore I want to use webpack. I especially like the css and image loader. However I can only require non-JS files if I am using webpack. Because I am building a library, I cannot garanty that the user of my library will too.</p> <p>Is there I way to bundle everything into a UMD module to publish it? I tried using multiple entry points, however I cannot require the module then.</p> <p>Thanks in advance</p>
0debug
int qemu_aio_set_fd_handler(int fd, IOHandler *io_read, IOHandler *io_write, AioFlushHandler *io_flush, void *opaque) { AioHandler *node; node = find_aio_handler(fd); if (!io_read && !io_write) { if (node) { if (walking_handlers) node->deleted = 1; else { LIST_REMOVE(node, node); qemu_free(node); } } } else { if (node == NULL) { node = qemu_mallocz(sizeof(AioHandler)); node->fd = fd; LIST_INSERT_HEAD(&aio_handlers, node, node); } node->io_read = io_read; node->io_write = io_write; node->io_flush = io_flush; node->opaque = opaque; } qemu_set_fd_handler2(fd, NULL, io_read, io_write, opaque); return 0; }
1threat
Typescript does not copy d.ts files to build : <p>So maybe I'm confused, but I thought that if I added <code>declaration:true</code> to my tsconfig.json I could have it tsc copy my <code>*.d.ts</code> files, along side the transpiled code &amp; it's <code>d.ts</code> files?</p> <p>EG:</p> <pre><code>- src - lib - types.d.ts - foo.ts </code></pre> <p>I would expect the result of tsc to be something like:</p> <pre><code>- build - lib - types.d.ts - foo.js - foo.d.ts </code></pre> <p>However, I can't seem to get <code>types.d.ts</code> to be copied to my build directory. </p> <p>Does typescript not provide any mechanism to copy <code>.d.ts</code> files? Or do I just have a misconfiguration somewhere? (I've tried a lot of different configurations at this point; nothing seems to work)</p>
0debug
static int swScale(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]) { const int srcW= c->srcW; const int dstW= c->dstW; const int dstH= c->dstH; const int chrDstW= c->chrDstW; const int chrSrcW= c->chrSrcW; const int lumXInc= c->lumXInc; const int chrXInc= c->chrXInc; const enum PixelFormat dstFormat= c->dstFormat; const int flags= c->flags; int16_t *vLumFilterPos= c->vLumFilterPos; int16_t *vChrFilterPos= c->vChrFilterPos; int16_t *hLumFilterPos= c->hLumFilterPos; int16_t *hChrFilterPos= c->hChrFilterPos; int16_t *vLumFilter= c->vLumFilter; int16_t *vChrFilter= c->vChrFilter; int16_t *hLumFilter= c->hLumFilter; int16_t *hChrFilter= c->hChrFilter; int32_t *lumMmxFilter= c->lumMmxFilter; int32_t *chrMmxFilter= c->chrMmxFilter; int32_t av_unused *alpMmxFilter= c->alpMmxFilter; const int vLumFilterSize= c->vLumFilterSize; const int vChrFilterSize= c->vChrFilterSize; const int hLumFilterSize= c->hLumFilterSize; const int hChrFilterSize= c->hChrFilterSize; int16_t **lumPixBuf= c->lumPixBuf; int16_t **chrUPixBuf= c->chrUPixBuf; int16_t **chrVPixBuf= c->chrVPixBuf; int16_t **alpPixBuf= c->alpPixBuf; const int vLumBufSize= c->vLumBufSize; const int vChrBufSize= c->vChrBufSize; uint8_t *formatConvBuffer= c->formatConvBuffer; const int chrSrcSliceY= srcSliceY >> c->chrSrcVSubSample; const int chrSrcSliceH= -((-srcSliceH) >> c->chrSrcVSubSample); int lastDstY; uint32_t *pal=c->pal_yuv; yuv2planar1_fn yuv2yuv1 = c->yuv2yuv1; yuv2planarX_fn yuv2yuvX = c->yuv2yuvX; yuv2packed1_fn yuv2packed1 = c->yuv2packed1; yuv2packed2_fn yuv2packed2 = c->yuv2packed2; yuv2packedX_fn yuv2packedX = c->yuv2packedX; int dstY= c->dstY; int lumBufIndex= c->lumBufIndex; int chrBufIndex= c->chrBufIndex; int lastInLumBuf= c->lastInLumBuf; int lastInChrBuf= c->lastInChrBuf; if (isPacked(c->srcFormat)) { src[0]= src[1]= src[2]= src[3]= src[0]; srcStride[0]= srcStride[1]= srcStride[2]= srcStride[3]= srcStride[0]; } srcStride[1]<<= c->vChrDrop; srcStride[2]<<= c->vChrDrop; DEBUG_BUFFERS("swScale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n", src[0], srcStride[0], src[1], srcStride[1], src[2], srcStride[2], src[3], srcStride[3], dst[0], dstStride[0], dst[1], dstStride[1], dst[2], dstStride[2], dst[3], dstStride[3]); DEBUG_BUFFERS("srcSliceY: %d srcSliceH: %d dstY: %d dstH: %d\n", srcSliceY, srcSliceH, dstY, dstH); DEBUG_BUFFERS("vLumFilterSize: %d vLumBufSize: %d vChrFilterSize: %d vChrBufSize: %d\n", vLumFilterSize, vLumBufSize, vChrFilterSize, vChrBufSize); if (dstStride[0]%8 !=0 || dstStride[1]%8 !=0 || dstStride[2]%8 !=0 || dstStride[3]%8 != 0) { static int warnedAlready=0; if (flags & SWS_PRINT_INFO && !warnedAlready) { av_log(c, AV_LOG_WARNING, "Warning: dstStride is not aligned!\n" " ->cannot do aligned memory accesses anymore\n"); warnedAlready=1; } } if (srcSliceY ==0) { lumBufIndex=-1; chrBufIndex=-1; dstY=0; lastInLumBuf= -1; lastInChrBuf= -1; } lastDstY= dstY; for (;dstY < dstH; dstY++) { unsigned char *dest =dst[0]+dstStride[0]*dstY; const int chrDstY= dstY>>c->chrDstVSubSample; unsigned char *uDest=dst[1]+dstStride[1]*chrDstY; unsigned char *vDest=dst[2]+dstStride[2]*chrDstY; unsigned char *aDest=(CONFIG_SWSCALE_ALPHA && alpPixBuf) ? dst[3]+dstStride[3]*dstY : NULL; const int firstLumSrcY= vLumFilterPos[dstY]; const int firstLumSrcY2= vLumFilterPos[FFMIN(dstY | ((1<<c->chrDstVSubSample) - 1), dstH-1)]; const int firstChrSrcY= vChrFilterPos[chrDstY]; int lastLumSrcY= firstLumSrcY + vLumFilterSize -1; int lastLumSrcY2=firstLumSrcY2+ vLumFilterSize -1; int lastChrSrcY= firstChrSrcY + vChrFilterSize -1; int enough_lines; if (firstLumSrcY > lastInLumBuf) lastInLumBuf= firstLumSrcY-1; if (firstChrSrcY > lastInChrBuf) lastInChrBuf= firstChrSrcY-1; assert(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1); assert(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1); DEBUG_BUFFERS("dstY: %d\n", dstY); DEBUG_BUFFERS("\tfirstLumSrcY: %d lastLumSrcY: %d lastInLumBuf: %d\n", firstLumSrcY, lastLumSrcY, lastInLumBuf); DEBUG_BUFFERS("\tfirstChrSrcY: %d lastChrSrcY: %d lastInChrBuf: %d\n", firstChrSrcY, lastChrSrcY, lastInChrBuf); enough_lines = lastLumSrcY2 < srcSliceY + srcSliceH && lastChrSrcY < -((-srcSliceY - srcSliceH)>>c->chrSrcVSubSample); if (!enough_lines) { lastLumSrcY = srcSliceY + srcSliceH - 1; lastChrSrcY = chrSrcSliceY + chrSrcSliceH - 1; DEBUG_BUFFERS("buffering slice: lastLumSrcY %d lastChrSrcY %d\n", lastLumSrcY, lastChrSrcY); } while(lastInLumBuf < lastLumSrcY) { const uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; const uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3]; lumBufIndex++; assert(lumBufIndex < 2*vLumBufSize); assert(lastInLumBuf + 1 - srcSliceY < srcSliceH); assert(lastInLumBuf + 1 - srcSliceY >= 0); hyscale(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc, hLumFilter, hLumFilterPos, hLumFilterSize, formatConvBuffer, pal, 0); if (CONFIG_SWSCALE_ALPHA && alpPixBuf) hyscale(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, lumXInc, hLumFilter, hLumFilterPos, hLumFilterSize, formatConvBuffer, pal, 1); lastInLumBuf++; DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n", lumBufIndex, lastInLumBuf); } while(lastInChrBuf < lastChrSrcY) { const uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; const uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; chrBufIndex++; assert(chrBufIndex < 2*vChrBufSize); assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH)); assert(lastInChrBuf + 1 - chrSrcSliceY >= 0); if (c->needs_hcscale) hcscale(c, chrUPixBuf[chrBufIndex], chrVPixBuf[chrBufIndex], chrDstW, src1, src2, chrSrcW, chrXInc, hChrFilter, hChrFilterPos, hChrFilterSize, formatConvBuffer, pal); lastInChrBuf++; DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n", chrBufIndex, lastInChrBuf); } if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize; if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize; if (!enough_lines) break; #if HAVE_MMX updateMMXDitherTables(c, dstY, lumBufIndex, chrBufIndex, lastInLumBuf, lastInChrBuf); #endif if (dstY >= dstH-2) { find_c_packed_planar_out_funcs(c, &yuv2yuv1, &yuv2yuvX, &yuv2packed1, &yuv2packed2, &yuv2packedX); } { const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; const int16_t **chrUSrcPtr= (const int16_t **) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; const int16_t **chrVSrcPtr= (const int16_t **) chrVPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { const int chrSkipMask= (1<<c->chrDstVSubSample)-1; if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; if (c->yuv2yuv1 && vLumFilterSize == 1 && vChrFilterSize == 1) { const int16_t *lumBuf = lumSrcPtr[0]; const int16_t *chrUBuf= chrUSrcPtr[0]; const int16_t *chrVBuf= chrVSrcPtr[0]; const int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL; yuv2yuv1(c, lumBuf, chrUBuf, chrVBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW); } else { yuv2yuvX(c, vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, vChrFilter+chrDstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW); } } else { assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); assert(chrUSrcPtr + vChrFilterSize - 1 < chrUPixBuf + vChrBufSize*2); if (c->yuv2packed1 && vLumFilterSize == 1 && vChrFilterSize == 2) { int chrAlpha= vChrFilter[2*dstY+1]; yuv2packed1(c, *lumSrcPtr, *chrUSrcPtr, *(chrUSrcPtr+1), *chrVSrcPtr, *(chrVSrcPtr+1), alpPixBuf ? *alpSrcPtr : NULL, dest, dstW, chrAlpha, dstFormat, flags, dstY); } else if (c->yuv2packed2 && vLumFilterSize == 2 && vChrFilterSize == 2) { int lumAlpha= vLumFilter[2*dstY+1]; int chrAlpha= vChrFilter[2*dstY+1]; lumMmxFilter[2]= lumMmxFilter[3]= vLumFilter[2*dstY ]*0x10001; chrMmxFilter[2]= chrMmxFilter[3]= vChrFilter[2*chrDstY]*0x10001; yuv2packed2(c, *lumSrcPtr, *(lumSrcPtr+1), *chrUSrcPtr, *(chrUSrcPtr+1), *chrVSrcPtr, *(chrVSrcPtr+1), alpPixBuf ? *alpSrcPtr : NULL, alpPixBuf ? *(alpSrcPtr+1) : NULL, dest, dstW, lumAlpha, chrAlpha, dstY); } else { yuv2packedX(c, vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, alpSrcPtr, dest, dstW, dstY); } } } } if ((dstFormat == PIX_FMT_YUVA420P) && !alpPixBuf) fillPlane(dst[3], dstStride[3], dstW, dstY-lastDstY, lastDstY, 255); #if HAVE_MMX2 if (av_get_cpu_flags() & AV_CPU_FLAG_MMX2) __asm__ volatile("sfence":::"memory"); #endif emms_c(); c->dstY= dstY; c->lumBufIndex= lumBufIndex; c->chrBufIndex= chrBufIndex; c->lastInLumBuf= lastInLumBuf; c->lastInChrBuf= lastInChrBuf; return dstY - lastDstY; }
1threat
How to Shrink a VirtualBox Virtual Machine and Free Up Disk Space in nixos guest system? : <p>I was following this <a href="https://www.howtogeek.com/312883/how-to-shrink-a-virtualbox-virtual-machine-and-free-up-disk-space/" rel="nofollow noreferrer">instruction</a> to try to shrink my virtual nixos. It says,</p> <blockquote> <p>You can’t actually use zerofree on your / partition while you’re booted into the standard Linux environment. Instead, you’ll want to boot into a special recovery mode where your normal root partition isn’t mounted.</p> </blockquote> <p>But I can't find a place to boot into recovery mode in nixos. Question: How to boot into some mode where my root partiion isn't mounted in nixos? Or how do I do zerofree in nixos?</p>
0debug
Android studio : InvalidVirtualFileAccessException: Accessing invalid virtual file: : <blockquote> <p>Just updated the SDK and got the following error, and my android version is </p> </blockquote> <h2>InvalidVirtualFileAccessException: Worker exited due to exception: Accessing invalid virtual file: jar:///Users/Android/android-sdk/platforms/android-25/android.jar!/; original:239; found:159070</h2> <p>My Android studio version is Android studio 2.3 RC 1</p>
0debug
Use a lightweight executor for a declarative pipeline stage (agent none) : <p>I'm using Jenkins Pipeline with the declarative syntax, currently with the following stages:</p> <ol> <li>Prepare</li> <li>Build (two parallel sets of steps)</li> <li>Test (also two parallel sets of steps)</li> <li>Ask if/where to deploy</li> <li>Deploy</li> </ol> <p>For steps 1, 2, 3, and 5 I need and agent (an executor) because they do actual work on the workspace. For step 4, I don't need one, and I would like to not block my available executors while waiting for user input. This seem to be referred to as either a "flyweight" or "lightweight" executor for the classic, scripted syntax, but I cannot find any information on how to achieve this with the declarative syntax.</p> <p>So far I've tried:</p> <ol> <li>Setting an agent directly in the pipeline options, and then setting <code>agent none</code> on the stage. This has no effect, and the pipeline runs as normalt, blocking the executor while waiting for input. It is also mentioned in the documentation that it will have no effect, but I thought I'd give it a shot anyway.</li> <li>Setting <code>agent none</code> in the pipeline options, and then setting an agent for each stage except #4. Unfortunately, but expectedly, this allocates a new workspace for every stage, which in turn requires me to stash and unstash. This is both messy and gives me further problems in the parallel stages (2 and 3) because I cannot have code outside the <code>parallel</code> construct. I assume the parallel steps run in the same workspace, so stashing/unstashing in both would have unfortunate results.</li> </ol> <p>Here is an outline of my Jenkinsfile:</p> <pre><code>pipeline { agent { label 'build-slave' } stages { stage("Prepare build") { steps { // ... } } stage("Build") { steps { parallel( frontend: { // ... }, backend: { // ... } ) } } stage("Test") { steps { parallel( jslint: { // ... }, phpcs: { // ... }, ) } post { // ... } } stage("Select deploy target") { steps { script { // ... code that determines choiceParameterDefinition based on branch name ... try { timeout(time: 5, unit: 'MINUTES') { deployEnvironment = input message: 'Deploy target', parameters: [choiceParameterDefinition] } } catch(ex) { deployEnvironment = null } } } } stage("Deploy") { when { expression { return binding.variables.get("deployEnvironment") } } steps { // ... } } } post { // ... } } </code></pre> <p>Am I missing something here, or is it just not possible in the current version?</p>
0debug
Laravel 5 - Many to Many - Attach versus Save : <p>I have a many to many relationship between two models, users and roles. Is there a difference between saving a relationship using the save() method and using the attach() method?</p> <pre><code>$user-&gt;roles()-&gt;save($role, ['expires' =&gt; $expires]); //using save $user-&gt;roles()-&gt;attach($roleId, ['expires' =&gt; $expires]);// using attach </code></pre> <p>Are the two equivalent? I personally dont see the difference. Thoughts?</p>
0debug
int nbd_init(int fd, QIOChannelSocket *sioc, uint32_t flags, off_t size) { TRACE("Setting NBD socket"); if (ioctl(fd, NBD_SET_SOCK, sioc->fd) < 0) { int serrno = errno; LOG("Failed to set NBD socket"); return -serrno; } TRACE("Setting block size to %lu", (unsigned long)BDRV_SECTOR_SIZE); if (ioctl(fd, NBD_SET_BLKSIZE, (size_t)BDRV_SECTOR_SIZE) < 0) { int serrno = errno; LOG("Failed setting NBD block size"); return -serrno; } TRACE("Setting size to %zd block(s)", (size_t)(size / BDRV_SECTOR_SIZE)); if (ioctl(fd, NBD_SET_SIZE_BLOCKS, (size_t)(size / BDRV_SECTOR_SIZE)) < 0) { int serrno = errno; LOG("Failed setting size (in blocks)"); return -serrno; } if (ioctl(fd, NBD_SET_FLAGS, flags) < 0) { if (errno == ENOTTY) { int read_only = (flags & NBD_FLAG_READ_ONLY) != 0; TRACE("Setting readonly attribute"); if (ioctl(fd, BLKROSET, (unsigned long) &read_only) < 0) { int serrno = errno; LOG("Failed setting read-only attribute"); return -serrno; } } else { int serrno = errno; LOG("Failed setting flags"); return -serrno; } } TRACE("Negotiation ended"); return 0; }
1threat
Difference between Ajax return Response function and only return : <p>What is the difference between having the following in an ajax request / call (is it request or call?)</p> <pre><code>return $output; </code></pre> <p>and</p> <pre><code>return Response($output); </code></pre> <p>both work, but Response does not give me information about the returned element while return only does give me information.</p>
0debug
C# Prevent process from turning inactive : I want to improve my c# skills a bit and made a little programm with some heavy calculation. <br><br> The Problem that occours is, that the whole process turns inactive after a few seconds in cause of the calculation (up to 531.441.000.000 char arrays are created by calculation). <br> My CPU usage is somewhere around 20% and the memory usage around 100MB while the process is being executed. The whole code is written in c# with c# froms. <br><br> **My Question**: Is there a general way to prevent it from turning inactive? I can imagine, that I could use more of my hardware capacities, but I don't know where to start.
0debug
PHP & JAVASCRIPT - How to take values from multiple input fields after clicking on the buttons which are connected to each input field? : <p>I want to create a subpage for changing the username, password, mail etc. I have 4 inputs and 4 buttons next to each input in my php file. I am wondering, how can I take the value from one of the input field after clicking on the button next to it? I want to take that values without reloading the page. What's more first click on the button changes the input field from "disabled" (in PHP) to "prop('disabled', false)" (in JAVASCRIPT). Then, you can enter something into the input field. The second click on the same button changes similarly (from "abled" to "disabled"). So I want to take the input value after SECOND CLICK on the button.</p> <p>HELP ME! :&lt;</p> <p>My code: [HTML] <a href="https://i.stack.imgur.com/JE9K9.png" rel="nofollow">https://i.stack.imgur.com/JE9K9.png</a> [JAVASCRIPT] <a href="https://i.stack.imgur.com/syoKa.png" rel="nofollow">https://i.stack.imgur.com/syoKa.png</a></p>
0debug
struct omap_mcspi_s *omap_mcspi_init(struct omap_target_agent_s *ta, int chnum, qemu_irq irq, qemu_irq *drq, omap_clk fclk, omap_clk iclk) { struct omap_mcspi_s *s = (struct omap_mcspi_s *) g_malloc0(sizeof(struct omap_mcspi_s)); struct omap_mcspi_ch_s *ch = s->ch; s->irq = irq; s->chnum = chnum; while (chnum --) { ch->txdrq = *drq ++; ch->rxdrq = *drq ++; ch ++; } omap_mcspi_reset(s); memory_region_init_io(&s->iomem, NULL, &omap_mcspi_ops, s, "omap.mcspi", omap_l4_region_size(ta, 0)); omap_l4_attach(ta, 0, &s->iomem); return s; }
1threat
How do i make it so that a drop-down menu only shows at half or quarter window size : Like on <a href="https://uk.ign.com/">IGN</a> i would like to make it so that within my E-Magazine i can change the top tabs from the line layout, to a drop down menu, like IGN does when the website window is made too small. Any help you can give would make me extremely helpful as i am new to web development and coding.
0debug
tokens and delims help extracting different colomns of data from text : Just a quick tip please, if I may. I'm doing some testing with tokens and delims (batch) and have some great code some kind folks whipped up for me. This code .. for /F "usebackq delims=" %%a in ("hosts.txt") do ( for %%b in (%%a) do ( set "hostname=!version!" set "version=!last!" set "last=%%b" ) echo !hostname! !version!>>"hosts2.txt" ) expertly extracts from a text file with content... 2 Dec 2016 14:37 GMT 194.176.105.139 United Kingdom ID006972.CENTRAL 3.10.6.0 Remove 2 Dec 2016 14:34 GMT 194.176.105.132 United Kingdom ID007574.CENTRAL 3.10.6.0 Remove this data (below)...(for me to then do stuff with)..However, I am interested in knowing how it's doing it? And also how can I alter it to add the IP address colomn aswell. Whats the formula? Is it in hidden metavariables? ID006972.CENTRAL 3.10.6.0 ID007574.CENTRAL 3.10.6.0 e.g how could it be altered to extract it to look like this 194.176.105.132 ID007574.CENTRAL 3.10.6.0 194.176.105.139 ID006972.CENTRAL 3.10.6.0 or even for learning purposes, like this, with the date colomn instead of IP... 2 Dec 2016 14:37 GMT ID007574.CENTRAL 3.10.6.0 2 Dec 2016 14:34 GMT ID006972.CENTRAL 3.10.6.0 Thanks
0debug
GCC compiles leading zero count poorly unless Haswell specified : <p>GCC supports the <a href="https://gcc.gnu.org/onlinedocs/gcc-6.2.0/gcc/Other-Builtins.html#index-g_t_005f_005fbuiltin_005fclz-4249" rel="noreferrer"><code>__builtin_clz(int x)</code></a> builtin, which counts the number of number of <em>leading zeros</em> (consecutive most-significant zeros) in the argument.</p> <p>Among other things<sup>0</sup>, this is great for efficiently implementing the <code>lg(unsigned int x)</code> function, which takes the base-2 logarithm of <code>x</code>, rounding down<sup>1</sup>:</p> <pre><code>/** return the base-2 log of x, where x &gt; 0 */ unsigned lg(unsigned x) { return 31U - (unsigned)__builtin_clz(x); } </code></pre> <p>This works in the straightforward way - in particular consider the case <code>x == 1</code> and <code>clz(x) == 31</code> - then <code>x == 2^0</code> so <code>lg(x) == 0</code> and <code>31 - 31 == 0</code> and we get the correct result. Higher values of <code>x</code> work similarly.</p> <p>Assuming the builtin is efficiently implemented, this ends much better than the alternate <a href="https://graphics.stanford.edu/~seander/bithacks.html#IntegerLogObvious" rel="noreferrer">pure C solutions</a>.</p> <p>Now as it happens, the <em>count leading zeros</em> operation is essentially the dual of the <a href="http://www.felixcloutier.com/x86/BSR.html" rel="noreferrer"><code>bsr</code></a> instruction in x86. That returns the index of the most-significant 1-bit<sup>2</sup> in the argument. So if there are 10 leading zeros, the first 1-bit is in bit 21 of the argument. In general we have <code>31 - clz(x) == bsr(x)</code> and in so <code>bsr</code> in fact <em>directly</em> implements our desired <code>lg()</code> function, without the superfluous <code>31U - ...</code> part. </p> <p>In fact, you can read between the line and see that the <code>__builtin_clz</code> function was implemented with <code>bsr</code> in mind: it is defined as <em>undefined behavior</em> if the argument is zero, when of course the "leading zeros" operation is perfectly well-defined as 32 (or whatever the bit-size of <code>int</code> is) with a zero argument. So <code>__builtin_clz</code> was certainly implemented with the idea of being efficiently mapped to a <code>bsr</code> instruction on x86. </p> <p>However, looking at what GCC actually does, at <code>-O3</code> with otherwise default options: it <a href="https://godbolt.org/g/gvYBrH" rel="noreferrer">adds a ton of extra junk</a>:</p> <pre><code>lg(unsigned int): bsr edi, edi mov eax, 31 xor edi, 31 sub eax, edi ret </code></pre> <p>The <code>xor edi,31</code> line is effectively a <code>not edi</code> for the bottom 4 bits that actually matter, that's off-by-one<sup>3</sup> from <code>neg edi</code> which turns the result of <code>bsr</code> into <code>clz</code>. Then the <code>31 - clz(x)</code> is carried out.</p> <p>However with <code>-mtune=haswell</code>, the <a href="https://godbolt.org/g/gvYBrH" rel="noreferrer">code simplifies</a> into exactly the expected single <code>bsr</code> instruction:</p> <pre><code>lg(unsigned int): bsr eax, edi ret </code></pre> <p>Why that is the case is very unclear to me. The <code>bsr</code> instruction has been around for a couple decades before Haswell, and the behavior is, AFAIK, unchanged. It's not just an issue of <em>tuning</em> for a particular arch, since <code>bsr</code> + a bunch of extra instructions isn't going to be faster than a plain <code>bsr</code> and furthermore using <code>-mtune=haswell</code> <a href="https://godbolt.org/g/5bDhWQ" rel="noreferrer">still results</a> in the slower code. </p> <p>The situation for <strong>64-bit</strong> inputs and outputs is <a href="https://godbolt.org/g/5t7867" rel="noreferrer">even slightly worse</a>: there is an extra <code>movsx</code> in the critical path which seems to do nothing since the result from <code>clz</code> will never be negative. Again, the <code>-march=haswell</code> variant is optimal with a single <code>bsr</code> instruction.</p> <p>Finally, let's check the big players in the non-Windows compiler space, <a href="https://godbolt.org/g/WIROzq" rel="noreferrer"><code>icc</code> and <code>clang</code></a>. <code>icc</code> just does a bad job and adds redundant stuff like <code>neg eax; add eax, 31; neg eax; add eax, 31;</code> - wtf? <code>clang</code> does a good job regardless of <code>-march</code>.</p> <hr> <p><sup>0</sup> Such as scanning a <em>bitmap</em> for the first set bit.</p> <p><sup>1</sup> The logarithm of 0 is undefinited, and so calling our function with a 0 argument is <em>undefined behavior</em>.</p> <p><sup>2</sup> Here, the LSB is the 0th bit and the MSB is the 31st. </p> <p><sup>3</sup> Recall that <code>-x == ~x + 1</code> in twos-complement.</p>
0debug
Is there a difference between read_table and read_csv in pandas? : <p>I've tested it and also checked the documentation with no visible differences.Either way i wanted to ask just in case.</p> <p>Do you think that read_csv should be used only for csv's even though it works for other types? while read_table works for anything? and if they're the same while they exist?</p>
0debug
iscsi_readcapacity10_cb(struct iscsi_context *iscsi, int status, void *command_data, void *opaque) { struct IscsiTask *itask = opaque; struct scsi_readcapacity10 *rc10; struct scsi_task *task = command_data; if (status != 0) { error_report("iSCSI: Failed to read capacity of iSCSI lun. %s", iscsi_get_error(iscsi)); itask->status = 1; itask->complete = 1; scsi_free_scsi_task(task); return; } rc10 = scsi_datain_unmarshall(task); if (rc10 == NULL) { error_report("iSCSI: Failed to unmarshall readcapacity10 data."); itask->status = 1; itask->complete = 1; scsi_free_scsi_task(task); return; } itask->iscsilun->block_size = rc10->block_size; if (rc10->lba == 0) { itask->iscsilun->num_blocks = 0; } else { itask->iscsilun->num_blocks = rc10->lba + 1; } itask->bs->total_sectors = itask->iscsilun->num_blocks * itask->iscsilun->block_size / BDRV_SECTOR_SIZE ; itask->status = 0; itask->complete = 1; scsi_free_scsi_task(task); }
1threat
How do i filter the output of a scrapper? (PHP) : <p>I am scrapping a page and i am getting this result:</p> <pre><code>string(1) " " string(15) " +0,25 pist.wit" string(14) " +0,25 pist.br" // and so on... </code></pre> <p>But i want a result like this:</p> <pre><code>0,25 0,25 //and so on... </code></pre> <p>So technically i want to filter the prices (without + signs) and the bread names (pist.wit etc.) Does someone know how to do this? Here is my code:</p> <pre><code> public function onRun() { $client = new Client(); $crawler = $client-&gt;request('GET', 'http://www.sandwich-express.nl/online-bestellen/'); $crawler-&gt;filter('tr')-&gt;each(function ($node) { if(sizeof($node-&gt;filter('.table-spacing')) &gt; 0) var_dump('nieuwe headers next TR'); $node-&gt;filter('tr.colomn_text td')-&gt;each(function ($node) { var_dump($node-&gt;text()); }); }); } </code></pre>
0debug
Q: How do I parse relevant IP addresses from netstat and redirect it to NSlookup in a batch script? : How do you parse the ip addresses in the foreign address column and redirect it to nslookup whilst ignoring everything else? ` Proto Local Address Foreign Address State PID TCP 127.0.0.1:5354 0.0.0.0:0 LISTENING 2076 TCP 127.0.0.1:5354 127.0.0.1:49671 ESTABLISHED 2076 TCP 127.0.0.1:5354 127.0.0.1:49672 ESTABLISHED 2076 TCP 127.0.0.1:27015 0.0.0.0:0 LISTENING 1360 TCP 127.0.0.1:27015 127.0.0.1:51666 ESTABLISHED 1360 TCP 127.0.0.1:49671 127.0.0.1:5354 ESTABLISHED 1360 TCP 127.0.0.1:49672 127.0.0.1:5354 ESTABLISHED 1360 TCP 127.0.0.1:49769 127.0.0.1:49770 ESTABLISHED 7916 TCP 127.0.0.1:49770 127.0.0.1:49769 ESTABLISHED 7916 TCP 127.0.0.1:49773 127.0.0.1:49774 ESTABLISHED 6952 TCP 127.0.0.1:49774 127.0.0.1:49773 ESTABLISHED 6952 TCP 127.0.0.1:51666 127.0.0.1:27015 ESTABLISHED 7944 TCP 192.168.1.4:139 0.0.0.0:0 LISTENING 4 TCP 192.168.1.4:50031 40.77.229.23:443 ESTABLISHED 3268 TCP 192.168.1.4:50047 17.252.60.32:5223 ESTABLISHED 8684 TCP 192.168.1.4:50197 104.82.252.232:443 CLOSE_WAIT 12640 TCP 192.168.1.4:50198 104.82.252.232:443 CLOSE_WAIT 12640`
0debug
Incorrect syntax near 'ID'. : Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click cn = New SqlConnection cn.ConnectionString = "Data Source=LAPTOP-VLPOS8UG;Initial Catalog=FAMS;Integrated Security=True" Try cn.Open() Dim query As String query = "INSERT INTO Master (Asset ID, Asset Category, Department, Brand/Make, Product Serial No, Purchase Date, Purchase Order Date, Installation Date, Purchase Cost, Depriciation Rate, Vendor Code, Warranty Details, Processor, RAM, HDD, Operating System, Application/Software, Note, Asset Name, Status)" + "VALUES ('" & Asset_IDTextBox.Text & "','" & Asset_CategoryComboBox.Text & "','" & DepartmentComboBox.Text & "','" & Brand_MakeTextBox.Text & "','" & Product_Serial_NoTextBox.Text & "','" & Purchase_DateDateTimePicker.Text & "','" & Purchase_Order_DateDateTimePicker.Text & "','" & Installation_DateDateTimePicker.Text & "','" & Purchase_CostTextBox.Text & "','" & Depriciation_RateTextBox.Text & "','" & Vendor_CodeComboBox.Text & "','" & Warranty_DetailsComboBox.Text & "','" & ProcessorComboBox.Text & "','" & RAMComboBox.Text & "','" & HDDComboBox.Text & "','" & Operating_SystemComboBox.Text & "','" & Application_SodtwareTextBox.Text & "','" & NoteTextBox.Text & "','" & Asset_NameTextBox.Text & "','" & StatusComboBox.Text & "')" cmd = New SqlCommand(query, cn) dr = cmd.ExecuteReader MessageBox.Show("Data Saved") cn.Close() Catch ex As SqlException MessageBox.Show(ex.Message) Finally cn.Dispose() End Try End Sub
0debug
How To Properly Update A Widget In Android 8.0 - Oreo - API 26 : <p>Let's say I have a widget for an app that has targetSDKVersion set to 26. This widget takes between 100ms and 10s to update. Most of the time under 1s. Before Android O, if onUpdate() was called on my AppWidgetProvider, I could launch a background service to update this widget. However, Android O returns an IllegalStateException if you attempt that behavior. The obvious solution of starting a foreground service seems like an extreme measure for something that will be done in under 10s 99% of the time.</p> <p>Possible solutions</p> <ul> <li>Start a foreground service to update the widget. Annoy the user with a notification that will be gone in 10s.</li> <li>Use JobScheduler to schedule a job as quickly as possible. Your widget may or may not get updated for a while.</li> <li>Attempt to do the work in a broadcast receiver. Lock up the UI thread for any other apps. Yuck.</li> <li>Attempt to do work in the widget receiver. Lock up the UI thread for any other apps. Yuck.</li> <li>Abuse GCM to get a background service running. A lot of work and feels hacky.</li> </ul> <p>I don't personally like any of the above solutions. Hopefully I'm missing something. </p> <p>(Even more frustrating is that my app is already loaded into memory by the system calling onUpdate(). I don't see how loading my app into memory to call onUpdate(), but then not giving my app 1s to update the widget off the UI thread is saving anyone any battery life.)</p>
0debug
static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src, ptrdiff_t stride, SAOParams *sao, int *borders, int width, int height, int c_idx, int class) { pixel *dst = (pixel *)_dst; pixel *src = (pixel *)_src; int offset_table[32] = { 0 }; int k, y, x; int chroma = !!c_idx; int shift = BIT_DEPTH - 5; int *sao_offset_val = sao->offset_val[c_idx]; int sao_left_class = sao->band_position[c_idx]; int init_y = 0, init_x = 0; stride /= sizeof(pixel); switch (class) { case 0: if (!borders[2]) width -= (8 >> chroma) + 2; if (!borders[3]) height -= (4 >> chroma) + 2; break; case 1: init_y = -(4 >> chroma) - 2; if (!borders[2]) width -= (8 >> chroma) + 2; height = (4 >> chroma) + 2; break; case 2: init_x = -(8 >> chroma) - 2; width = (8 >> chroma) + 2; if (!borders[3]) height -= (4 >> chroma) + 2; break; case 3: init_y = -(4 >> chroma) - 2; init_x = -(8 >> chroma) - 2; width = (8 >> chroma) + 2; height = (4 >> chroma) + 2; break; } dst = dst + (init_y * stride + init_x); src = src + (init_y * stride + init_x); for (k = 0; k < 4; k++) offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1]; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) dst[x] = av_clip_pixel(src[x] + offset_table[av_clip_pixel(src[x] >> shift)]); dst += stride; src += stride; } }
1threat
static void piix4_pm_realize(PCIDevice *dev, Error **errp) { PIIX4PMState *s = PIIX4_PM(dev); uint8_t *pci_conf; pci_conf = dev->config; pci_conf[0x06] = 0x80; pci_conf[0x07] = 0x02; pci_conf[0x09] = 0x00; pci_conf[0x3d] = 0x01; apm_init(dev, &s->apm, apm_ctrl_changed, s); if (!s->smm_enabled) { pci_conf[0x5B] = 0x02; } pci_conf[0x90] = s->smb_io_base | 1; pci_conf[0x91] = s->smb_io_base >> 8; pci_conf[0xd2] = 0x09; pm_smbus_init(DEVICE(dev), &s->smb); memory_region_set_enabled(&s->smb.io, pci_conf[0xd2] & 1); memory_region_add_subregion(pci_address_space_io(dev), s->smb_io_base, &s->smb.io); memory_region_init(&s->io, OBJECT(s), "piix4-pm", 64); memory_region_set_enabled(&s->io, false); memory_region_add_subregion(pci_address_space_io(dev), 0, &s->io); acpi_pm_tmr_init(&s->ar, pm_tmr_timer, &s->io); acpi_pm1_evt_init(&s->ar, pm_tmr_timer, &s->io); acpi_pm1_cnt_init(&s->ar, &s->io, s->disable_s3, s->disable_s4, s->s4_val); acpi_gpe_init(&s->ar, GPE_LEN); s->powerdown_notifier.notify = piix4_pm_powerdown_req; qemu_register_powerdown_notifier(&s->powerdown_notifier); s->machine_ready.notify = piix4_pm_machine_ready; qemu_add_machine_init_done_notifier(&s->machine_ready); qemu_register_reset(piix4_reset, s); piix4_acpi_system_hot_add_init(pci_address_space_io(dev), dev->bus, s); piix4_pm_add_propeties(s); }
1threat
Please help me, How can I arrange data using R following these conditions? : I am a new user in the programming. When download my data into the R I found … >str(g) data.frame': 253227 obs. of 2 variables: $ ID : int 7896741 7896743 7896745 7896747 7896749 7896751 7896753 7896755 7896757 7896758 ... $ gene_assignment: Factor w/ 85855 levels "","---","AB001736 // IGLJ3 /// AB001733 // IGLJ3 /// ENST00000390609 // IGHV3-23 /// X14584 // IGHV3-23 /// BC072419 // "| __truncated__,..: 16002 81923 16018 2 2 2335 2 2392 5497 5497 ... 1.How can I remove two factors ("","---") from gene_assignment variable? What type of code should I use? 2. “ AB001736 // IGLJ3 /// AB001733 // IGLJ3 /// ENST00000390609 // IGHV3-23 /// X14584 // IGHV3-23 /// BC072419 // "| This factors contains many parameters but some are common like ENST00000390609, AB001733 (ENST fixed and rest of them different number). How can I remove these parameters? With thanks, Gene
0debug
How to get user_id of a phone number in telegram : <p>Im creating a bot to send message to multiple contact in Telegram. user can share contact with bot. then i use getUpdates and obtain the phone number. For using the sendMessage Method i need the chat_id. now how to get chat_id of a user with his phone number? Is there any way better than this method to do this?</p>
0debug
Getting multiple values out of a key in hashtable : <p>I have an output from an API which gives multiple value want them to prettify as an indivual output in javascript</p> <pre><code>[ { "key": "Time", "value": "\nTuesday, July 30, 2019 5:34:16 PM\nMonday, July 29, 2019 3:23:20 PM\nMonday, July 29, 2019 1:54:05 PM" } ] </code></pre>
0debug
void pc_dimm_memory_unplug(DeviceState *dev, MemoryHotplugState *hpms, MemoryRegion *mr) { PCDIMMDevice *dimm = PC_DIMM(dev); numa_unset_mem_node_id(dimm->addr, memory_region_size(mr), dimm->node); memory_region_del_subregion(&hpms->mr, mr); vmstate_unregister_ram(mr, dev); }
1threat
Create a temporary directory in PowerShell? : <p><a href="http://blogs.technet.com/b/heyscriptingguy/archive/2015/08/05/create-temporary-files-with-powershell-5-0.aspx" rel="noreferrer">PowerShell 5 introduces the <code>New-TemporaryFile</code> cmdlet</a>, which is handy. How can I do the same thing but instead of a file create a directory? Is there a <code>New-TemporaryDirectory</code> cmdlet?</p>
0debug
ffmpeg: overlay a png image on a video with custom transparency? : <p>Suppose I have a video <code>foo.mkv</code> and an image <code>bar.png</code> (which happens to contains an alpha channel). I can blend this image over the video like this:</p> <pre><code>ffmpeg -i foo.mkv -i bar.png -filter_complex "[0:v][1:v]overlay" -vcodec libx264 myresult.mkv </code></pre> <p>(using multiple lines here for readability, normally this is one command line).</p> <p>Now, besides the png image having an alpha channel of its own, I would also apply a custom <em>overall transparency</em> when blending this image over the video.</p> <p>In the above example, the image would be visible 100% on top of the video — or at least the parts where its alpha channel is fully opaque.</p> <p>Is there a way to add a custom overall opacity or transparency blend factor, something like <code>opacity=0.5</code> or whatever, which would make the image only 50% visible?</p>
0debug
static void bdrv_move_feature_fields(BlockDriverState *bs_dest, BlockDriverState *bs_src) { bs_dest->open_flags = bs_src->open_flags; bs_dest->dev_ops = bs_src->dev_ops; bs_dest->dev_opaque = bs_src->dev_opaque; bs_dest->dev = bs_src->dev; bs_dest->guest_block_size = bs_src->guest_block_size; bs_dest->copy_on_read = bs_src->copy_on_read; bs_dest->enable_write_cache = bs_src->enable_write_cache; memcpy(&bs_dest->throttle_state, &bs_src->throttle_state, sizeof(ThrottleState)); bs_dest->throttled_reqs[0] = bs_src->throttled_reqs[0]; bs_dest->throttled_reqs[1] = bs_src->throttled_reqs[1]; bs_dest->io_limits_enabled = bs_src->io_limits_enabled; bs_dest->on_read_error = bs_src->on_read_error; bs_dest->on_write_error = bs_src->on_write_error; bs_dest->iostatus_enabled = bs_src->iostatus_enabled; bs_dest->iostatus = bs_src->iostatus; bs_dest->dirty_bitmaps = bs_src->dirty_bitmaps; bs_dest->refcnt = bs_src->refcnt; bs_dest->in_use = bs_src->in_use; bs_dest->job = bs_src->job; pstrcpy(bs_dest->device_name, sizeof(bs_dest->device_name), bs_src->device_name); bs_dest->device_list = bs_src->device_list; bs_dest->node_list = bs_src->node_list; }
1threat
static av_always_inline void paint_raw(uint8_t *dst, int w, int h, const uint8_t *src, int bpp, int be, int stride) { int i, j, p; for (j = 0; j < h; j++) { for (i = 0; i < w; i++) { p = vmnc_get_pixel(src, bpp, be); src += bpp; switch (bpp) { case 1: dst[i] = p; break; case 2: ((uint16_t*)dst)[i] = p; break; case 4: ((uint32_t*)dst)[i] = p; break; } } dst += stride; } }
1threat
Need convert txt to csv using Power shell with headers : Can we convert below txt file to csv format added at the end ?? file1 : IP Address: 192.168.1.1 Hostname: 01-any1TEST Event Message: Ping Alert Status: Down at least 3 min Event Time: 17:25:14 Alert Type: :Windows 2012 Server ------------------------------------------------------------------------------------- IP Address: 192.168.1.2 Hostname: 02-any2TEST Event Message: Ping Alert Status: Down at least 4 min Event Time: 17:25:40 Alert Type: :Unix Server ------------------------------------------------------------------------------------- IP Address: 192.168.1.3 Hostname: 03-any3TEST Event Message: Ping Alert Status: Down at least 3 min Event Time: 17:26:21 Alert Type: :windows host ------------------------------------------------------------------------------------- Csv file output required as below : 'IP Address','Hostname','Event Message','Alert Status','Event Time','Alert Type' '192.168.1.1','01-any1TEST','Ping','Down at least 3 min','17:26:21','Windows 2012 Server ' '192.168.1.2','02-any2TEST','Ping','Down at least 3 min','17:26:21','unix host ' '192.168.1.3','03-any3TEST','Ping','Down at least 3 min','17:26:21','windows host '
0debug
How to fix problem with iterating through list if times using iterator? : <p>Debugger sais there is an incompatible iterator. How i can solve this. What can cause the problem. Here is my main code</p> <pre><code>for (std::list&lt;std::chrono::duration&lt;double, std::milli&gt;&gt; ::iterator it = road.get_times().begin() ;it!= road.get_times().end();it++,z++) //error incompatible iterator { *road::file &lt;&lt; "Samochod z drogi " &lt;&lt; road.get_lane_number() &lt;&lt; " pojechal "; switch (road.get_direction()) { case'S': *road::file &lt;&lt; "prosto" &lt;&lt; std::endl; break; case'L': *road::file &lt;&lt; "w lewo" &lt;&lt; std::endl; break; case'R': *road::file &lt;&lt; "w prawo" &lt;&lt; std::endl; break; } *road::file &lt;&lt; "Jego czas stania w kolejce wyniosl "; avarage_time += it-&gt;count() / 1000; *road::file &lt;&lt; round(it-&gt;count() / 1000) &lt;&lt; std::endl; } </code></pre> <p>function road.get_times ()</p> <pre><code> std::list&lt; std::chrono::duration&lt;double, std::milli&gt;&gt; get_times() { return times; } </code></pre>
0debug
Why when i set height are double.infinity ,it shows a bug in the display? : my code look like this ``` get _pdfViewer{ if(pathPDF != null) return Container( child: PdfViewer( filePath: pathPDF, ), color: Colors.red, ); else return Container(height: 30,color: Colors.blueAccent,); } Column( children: <Widget>[ Flex( direction: Axis.horizontal, children: <Widget>[ Expanded( flex: 7, child: Container( height: 500, color: Colors.blueAccent, child: _pdfViewer, ), ), Expanded( flex: 1, child:Container( height:500, color: Colors.green, ) ), ], ) ], ); ``` in the code has twice heights, when i make the height to **double.infinity** its worry(error) look like this: [image][1] i want to max of the screen in the application.what should i do? [1]: https://i.stack.imgur.com/1lu62.png
0debug
How do I center a form in a navbar? : <p>I have this Bootstrap4 Navigation bar. There is a brand and a couple links (nav-item). Below I have a search form that appears on the right. How would I center it inside the nav. It shouldn't be centered to take up the remaining space, rather be centered completely inside the entire navbar. Any classes or styles I should add to make this work? Also, I would like to add links on the right side, where the form is currently standing.</p> <p>I've tried messing around with the margin classes, adding "mx-auto" to the form, placing the form inside the ul list and using "display: inline-block"</p> <pre><code>&lt;nav class="navbar navbar-expand-lg navbar-light bg-light"&gt; &lt;a class="navbar-brand" href="#"&gt;Brand&lt;/a&gt; &lt;button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"&gt; &lt;span class="navbar-toggler-icon"&gt;&lt;/span&gt; &lt;/button&gt; &lt;div class="collapse navbar-collapse" id="navbarSupportedContent"&gt; &lt;ul class="navbar-nav mr-auto"&gt; &lt;li class="nav-item active"&gt; &lt;a class="nav-link" href="#"&gt;Home &lt;span class="sr-only"&gt;(current)&lt;/span&gt;&lt;/a&gt; &lt;/li&gt; &lt;li class="nav-item"&gt; &lt;a class="nav-link" href="#"&gt;About&lt;/a&gt; &lt;/li&gt; &lt;li class="nav-item"&gt; &lt;a class="nav-link" href="#"&gt;Contact&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;form class="form-inline my-2 my-lg-0"&gt; &lt;input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search"&gt; &lt;button class="btn btn-outline-success my-2 my-sm-0" type="submit"&gt;Search&lt;/button&gt; &lt;/form&gt; &lt;/div&gt; &lt;/nav&gt; </code></pre> <p>As stated earlier, the inline form is centered on the right side, but it should be fully centered, in the middle. Here are some photos for context. (also, I am using Bootstrap Material Design, that's why it looks a bit different)</p> <p>Current: <a href="https://ibb.co/ZY7FMXg" rel="nofollow noreferrer">Current result</a> What I want: <a href="https://ibb.co/ZY7FMXg" rel="nofollow noreferrer">What I want/Expected</a></p>
0debug
Parsing a huge text file gives me a segmentation : I am trying to parse a relatively big text file in C. I cannot use malloc or realloc. Words should be tokenized based on "/" as you can see. However the code below gives me a segmenation error even if i change the size of the array. char buf[1000]; char *token; char tags[500][1000]; FILE *fp = fopen("file.txt", "r"); for (i = 0; fgets(buf, sizeof(buf), fp);) { token = strtok(buf, " /"); while (token != NULL) { strcpy(tags[i], token); i++; token = strtok(NULL, " /"); } }
0debug
static int alloc_refcount_block(BlockDriverState *bs, int64_t cluster_index, void **refcount_block) { BDRVQcow2State *s = bs->opaque; unsigned int refcount_table_index; int ret; BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC); refcount_table_index = cluster_index >> s->refcount_block_bits; if (refcount_table_index < s->refcount_table_size) { uint64_t refcount_block_offset = s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; if (refcount_block_offset) { if (offset_into_cluster(s, refcount_block_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "Refblock offset %#" PRIx64 " unaligned (reftable index: " "%#x)", refcount_block_offset, refcount_table_index); return -EIO; } return load_refcount_block(bs, refcount_block_offset, refcount_block); } } *refcount_block = NULL; ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { return ret; } int64_t new_block = alloc_clusters_noref(bs, s->cluster_size); if (new_block < 0) { return new_block; } #ifdef DEBUG_ALLOC2 fprintf(stderr, "qcow2: Allocate refcount block %d for %" PRIx64 " at %" PRIx64 "\n", refcount_table_index, cluster_index << s->cluster_bits, new_block); #endif if (in_same_refcount_block(s, new_block, cluster_index << s->cluster_bits)) { ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block, refcount_block); if (ret < 0) { goto fail_block; } memset(*refcount_block, 0, s->cluster_size); int block_index = (new_block >> s->cluster_bits) & (s->refcount_block_size - 1); s->set_refcount(*refcount_block, block_index, 1); } else { ret = update_refcount(bs, new_block, s->cluster_size, 1, false, QCOW2_DISCARD_NEVER); if (ret < 0) { goto fail_block; } ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail_block; } ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block, refcount_block); if (ret < 0) { goto fail_block; } memset(*refcount_block, 0, s->cluster_size); } BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE); qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache, *refcount_block); ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail_block; } if (refcount_table_index < s->refcount_table_size) { uint64_t data64 = cpu_to_be64(new_block); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_HOOKUP); ret = bdrv_pwrite_sync(bs->file->bs, s->refcount_table_offset + refcount_table_index * sizeof(uint64_t), &data64, sizeof(data64)); if (ret < 0) { goto fail_block; } s->refcount_table[refcount_table_index] = new_block; return -EAGAIN; } qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_GROW); uint64_t blocks_used = DIV_ROUND_UP(MAX(cluster_index + 1, (new_block >> s->cluster_bits) + 1), s->refcount_block_size); if (blocks_used > QCOW_MAX_REFTABLE_SIZE / sizeof(uint64_t)) { return -EFBIG; } uint64_t table_size = next_refcount_table_size(s, blocks_used + 1); uint64_t last_table_size; uint64_t blocks_clusters; do { uint64_t table_clusters = size_to_clusters(s, table_size * sizeof(uint64_t)); blocks_clusters = 1 + ((table_clusters + s->refcount_block_size - 1) / s->refcount_block_size); uint64_t meta_clusters = table_clusters + blocks_clusters; last_table_size = table_size; table_size = next_refcount_table_size(s, blocks_used + ((meta_clusters + s->refcount_block_size - 1) / s->refcount_block_size)); } while (last_table_size != table_size); #ifdef DEBUG_ALLOC2 fprintf(stderr, "qcow2: Grow refcount table %" PRId32 " => %" PRId64 "\n", s->refcount_table_size, table_size); #endif uint64_t meta_offset = (blocks_used * s->refcount_block_size) * s->cluster_size; uint64_t table_offset = meta_offset + blocks_clusters * s->cluster_size; uint64_t *new_table = g_try_new0(uint64_t, table_size); void *new_blocks = g_try_malloc0(blocks_clusters * s->cluster_size); assert(table_size > 0 && blocks_clusters > 0); if (new_table == NULL || new_blocks == NULL) { ret = -ENOMEM; goto fail_table; } memcpy(new_table, s->refcount_table, s->refcount_table_size * sizeof(uint64_t)); new_table[refcount_table_index] = new_block; int i; for (i = 0; i < blocks_clusters; i++) { new_table[blocks_used + i] = meta_offset + (i * s->cluster_size); } uint64_t table_clusters = size_to_clusters(s, table_size * sizeof(uint64_t)); int block = 0; for (i = 0; i < table_clusters + blocks_clusters; i++) { s->set_refcount(new_blocks, block++, 1); } BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE_BLOCKS); ret = bdrv_pwrite_sync(bs->file->bs, meta_offset, new_blocks, blocks_clusters * s->cluster_size); g_free(new_blocks); new_blocks = NULL; if (ret < 0) { goto fail_table; } for(i = 0; i < table_size; i++) { cpu_to_be64s(&new_table[i]); } BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE_TABLE); ret = bdrv_pwrite_sync(bs->file->bs, table_offset, new_table, table_size * sizeof(uint64_t)); if (ret < 0) { goto fail_table; } for(i = 0; i < table_size; i++) { be64_to_cpus(&new_table[i]); } uint8_t data[12]; cpu_to_be64w((uint64_t*)data, table_offset); cpu_to_be32w((uint32_t*)(data + 8), table_clusters); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_SWITCH_TABLE); ret = bdrv_pwrite_sync(bs->file->bs, offsetof(QCowHeader, refcount_table_offset), data, sizeof(data)); if (ret < 0) { goto fail_table; } uint64_t old_table_offset = s->refcount_table_offset; uint64_t old_table_size = s->refcount_table_size; g_free(s->refcount_table); s->refcount_table = new_table; s->refcount_table_size = table_size; s->refcount_table_offset = table_offset; qcow2_free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t), QCOW2_DISCARD_OTHER); ret = load_refcount_block(bs, new_block, refcount_block); if (ret < 0) { return ret; } return -EAGAIN; fail_table: g_free(new_blocks); g_free(new_table); fail_block: if (*refcount_block != NULL) { qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); } return ret; }
1threat
Idiomatic elixir to execute if params is not nil? : <p>How to go about filtering out invalid params like nil or empty list before proceed to process the params?</p> <p>The <code>case</code> use below seems to be common but it's not clear code -- I am pretty sure there is a simpler and idiomatic way to do this.</p> <pre><code> def load(token) do case token do nil -&gt; nil [] -&gt; nil token -&gt; process(token) end end </code></pre>
0debug
ng-click function wont work : <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> var myApp = angular.module('myApp', ['ngRoute']); myApp.config(function($routeProvider) { $routeProvider.when('/', { template: '', controller: 'DefaultController as dc' }).when('/rent', { templateUrl: 'views/partials/rent.html', controller: 'rentController as rc' }).when('/buy', { templateUrl: 'views/partials/buy.html', controller: 'buyController as bc' }); }); //end config myApp.controller('DefaultController', DefaultController); myApp.controller("rentController", rentController); myApp.controller("buyController", buyController); function DefaultController() { console.log('inside of DefaultController'); var vm = this; vm.checkPost = function() { console.log('checkpost clicked'); }; } //end controller function rentController(RealStateService) { console.log('inside of rent controller'); var vm = this; vm.rentArray = []; vm.info = false; vm.getProperties = function() { console.log('port'); RealStateService.serverPractice().then(function(res) { RealStateService.data.forEach(function(data) { if (data.rent) { vm.rentArray.push(data); } }); //end for each }); //end then }; //end getProperties vm.showInfo = function(index) { vm.info = true; console.log('in get Info'); vm.info = vm.rentArray[index]; console.log(vm.info); }; //end get info } function buyController(RealStateService) { console.log('inside of buy controller'); var vm = this; vm.rentArray = []; vm.info = false; vm.getProperties = function() { RealStateService.serverPractice().then(function(res) { RealStateService.data.forEach(function(data) { if (data.cost) { vm.rentArray.push(data); } }); //end for each }); //end then }; //end getProperties vm.showInfo = function(index) { vm.info = true; console.log('in get Info'); vm.info = vm.rentArray[index]; console.log(vm.info); }; //end get info } <!-- language: lang-html --> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> Weekend Challenge #5</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" href="styles/style.css"> <script src="vendors/angular.min.js" charset="utf-8"></script> <script src="vendors/angular-route.min.js" charset="utf-8"></script> <script src="scripts/client.js" charset="utf-8"></script> <script src="scripts/services/realState.js" charset="utf-8"></script> </head> <body ng-app='myApp'> <div class="container-fluid"> <div class="navBar"> <h1>Weekend Challenge #5</h1> <button type="button" name="button"><a href="http://localhost:3000/#!/rent">See for rent</a></button> <button type="button" name="button"><a href="http://localhost:3000/#!/buy">See for sale</a></button> <button type="button" name="button"><a href="http://localhost:3000/#!/">post rent/sale</a></button> </div> <ng-view></ng-view> <h1>Post</h1> <div class="post"> <label for="type">Type: </label> <select name='type' ng-model='dc.type'> <option value="">Rent</option> <option value="">Sell</option> </select> <button type="button" name="button" ng-click='dc.checkPost()'>Begin</button> </div> </div> </body> </html> <!-- end snippet --> the app is not running here on SO, but basically i am not getting the log at the default controller when i click the begin button. I am not sure what the problem is. I should see in the console 'checkpost cliked'
0debug
TS cannot find modules : <p>I have used <a href="https://github.com/FountainJS/generator-fountain-webapp" rel="noreferrer">https://github.com/FountainJS/generator-fountain-webapp</a> to set up a new project using React &amp; Typescript. I'm pretty comfortable with JS having used node for an ongoing project, but not familiar with TS where the problem seems to lie.</p> <p>I have ran the generator with the following environment: typescript, react, webpack w/ NPM, gulp.</p> <p>When I run <code>gulp serve</code> I get the output below. I'm quite confused why it can't find the files - they are all there on my file system. I've looked at other questions and haven't found anything that resolves my issue</p> <pre><code>[23:04:52] Loading /Users/omelvin/github_projects/kaizen/gulp_tasks/browsersync.js [23:04:53] Loading /Users/omelvin/github_projects/kaizen/gulp_tasks/karma.js [23:04:54] Loading /Users/omelvin/github_projects/kaizen/gulp_tasks/misc.js [23:04:54] Loading /Users/omelvin/github_projects/kaizen/gulp_tasks/webpack.js [23:04:54] Using gulpfile ~/github_projects/kaizen/gulpfile.js [23:04:54] Starting 'serve'... [23:04:54] Starting 'webpack:watch'... ts-loader: Using typescript@2.0.8 and /Users/omelvin/github_projects/kaizen/tsconfig.json [23:05:01] Time: 6436ms Asset Size Chunks Chunk Names index.js 1.11 MB 0 main index.js.map 1.32 MB 0 main ERROR in ./src/index.tsx (5,24): error TS2307: Cannot find module 'react'. ERROR in ./src/index.tsx (6,27): error TS2307: Cannot find module 'react-dom'. ERROR in ./src/index.tsx (7,45): error TS2307: Cannot find module 'react-router'. ERROR in ./src/index.tsx (1,1): error TS6053: File '/Users/omelvin/github_projects/kaizen/typings/index.d.ts' not found. ERROR in ./src/app/title.tsx (3,24): error TS2307: Cannot find module 'react'. ERROR in ./src/app/title.tsx (1,1): error TS6053: File '/Users/omelvin/github_projects/kaizen/typings/index.d.ts' not found. ERROR in ./src/app/techs/techs.tsx (3,24): error TS2307: Cannot find module 'react'. ERROR in ./src/app/techs/techs.tsx (4,24): error TS2307: Cannot find module 'axios'. ERROR in ./src/app/techs/techs.tsx (33,10): error TS2339: Property 'state' does not exist on type 'Techs'. ERROR in ./src/app/techs/techs.tsx (39,24): error TS2503: Cannot find namespace 'Axios'. ERROR in ./src/app/techs/techs.tsx (40,14): error TS2339: Property 'setState' does not exist on type 'Techs'. ERROR in ./src/app/techs/techs.tsx (51,17): error TS2339: Property 'state' does not exist on type 'Techs'. ERROR in ./src/app/techs/techs.tsx (1,1): error TS6053: File '/Users/omelvin/github_projects/kaizen/typings/index.d.ts' not found. ERROR in ./src/app/techs/tech.tsx (3,24): error TS2307: Cannot find module 'react'. ERROR in ./src/app/techs/tech.tsx (50,44): error TS2339: Property 'props' does not exist on type 'TechComponent'. ERROR in ./src/app/techs/tech.tsx (52,17): error TS2339: Property 'props' does not exist on type 'TechComponent'. ERROR in ./src/app/techs/tech.tsx (54,18): error TS2339: Property 'props' does not exist on type 'TechComponent'. ERROR in ./src/app/techs/tech.tsx (55,18): error TS2339: Property 'props' does not exist on type 'TechComponent'. ERROR in ./src/app/techs/tech.tsx (1,1): error TS6053: File '/Users/omelvin/github_projects/kaizen/typings/index.d.ts' not found. ERROR in ./src/app/main.tsx (3,24): error TS2307: Cannot find module 'react'. ERROR in ./src/app/main.tsx (1,1): error TS6053: File '/Users/omelvin/github_projects/kaizen/typings/index.d.ts' not found. ERROR in ./src/app/header.tsx (3,24): error TS2307: Cannot find module 'react'. ERROR in ./src/app/header.tsx (1,1): error TS6053: File '/Users/omelvin/github_projects/kaizen/typings/index.d.ts' not found. ERROR in ./src/app/footer.tsx (3,24): error TS2307: Cannot find module 'react'. ERROR in ./src/app/footer.tsx (1,1): error TS6053: File '/Users/omelvin/github_projects/kaizen/typings/index.d.ts' not found. ERROR in /Users/omelvin/github_projects/kaizen/src/app/footer.spec.tsx (4,24): error TS2307: Cannot find module 'react'. ERROR in /Users/omelvin/github_projects/kaizen/src/app/footer.spec.tsx (5,27): error TS2307: Cannot find module 'react-dom'. ERROR in /Users/omelvin/github_projects/kaizen/src/app/footer.spec.tsx (6,28): error TS2307: Cannot find module 'react-addons-test-utils'. ERROR in /Users/omelvin/github_projects/kaizen/src/app/footer.spec.tsx (10,1): error TS2304: Cannot find name 'describe'. ERROR in /Users/omelvin/github_projects/kaizen/src/app/footer.spec.tsx (11,3): error TS2304: Cannot find name 'it'. ERROR in /Users/omelvin/github_projects/kaizen/src/app/footer.spec.tsx (14,5): error TS2304: Cannot find name 'expect'. ERROR in /Users/omelvin/github_projects/kaizen/src/app/footer.spec.tsx (1,1): error TS6053: File '/Users/omelvin/github_projects/kaizen/typings/index.d.ts' not found. Child html-webpack-plugin for "index.html": Asset Size Chunks Chunk Names index.html 564 kB 0 [23:05:01] Finished 'webpack:watch' after 6.45 s [23:05:01] Starting 'watch'... [23:05:01] Finished 'watch' after 54 ms [23:05:01] Starting 'browsersync'... [23:05:01] Finished 'browsersync' after 78 ms [23:05:01] Finished 'serve' after 6.58 s [BS] [BrowserSync SPA] Running... [BS] Access URLs: -------------------------------------- Local: http://localhost:3000 External: http://10.193.122.24:3000 -------------------------------------- UI: http://localhost:3001 UI External: http://10.193.122.24:3001 -------------------------------------- [BS] Serving files from: .tmp [BS] Serving files from: src ts-loader: Using typescript@2.0.8 and /Users/omelvin/github_projects/kaizen/tsconfig.json webpack built 5ccca2fe23cfa5a1a610 in 5073ms </code></pre>
0debug
Refresh indicator without scrollview : <p>I know with a <code>ListView</code> or <code>SingleChildScrollView</code> <code>RefreshIndicator</code> just works natively but I want to use a <code>RefreshIndicator</code> on a page that doesn't scroll. Is this even possible and if so, how?</p>
0debug
android font change(default fonts) does not work : <TextView ... android:typeface="monospace" /> - this dose not show any change to the preview screen and my phone. I cannot use all the default fonts; it does not work. All the other attributes are working except typeface. I reinstalled android studio but it didn't solve the problem. please let me what should I do.
0debug
void blk_dev_change_media_cb(BlockBackend *blk, bool load) { if (blk->dev_ops && blk->dev_ops->change_media_cb) { bool tray_was_closed = !blk_dev_is_tray_open(blk); blk->dev_ops->change_media_cb(blk->dev_opaque, load); if (tray_was_closed) { qapi_event_send_device_tray_moved(blk_name(blk), true, &error_abort); } if (load) { qapi_event_send_device_tray_moved(blk_name(blk), false, &error_abort); } } }
1threat
how to show popup of spinner when click on button? : There is button and spinner on form and spinner is clicked then its popup is displayed and when I want to display the popup even when button is clicked , how can it be done?
0debug
Changing hostname and port with Vapor 3 : <p>The Config/server.json file doesn't seem to be read by Vapor 3, and as such I can't configure the hostname and port that a Vapor 3 app binds to.</p> <p>Does Vapor 3 have a different method for this?</p>
0debug
How can i make a php script which will automatically generate links of my folder's file : <p>I want to make a script for my website which will automatically generate links, i will put all my files in a folder and i want those files will show in a web page and can be downloadable. please help...</p>
0debug
PHP multi select array : <p>I am having issues getting the following to work and really hope somebody can help out a little:</p> <p>I have the following select dropdown box and I am trying to send 2 values each time. 1st is my JobID, 2nd is my ProfileID.</p> <pre><code>echo ' &lt;select class="ui dropdown multiple special AddProfileToCastings" name="AddProfileToCastings[]" &gt;'; echo ' &lt;option value="" &gt;Casting Jobs&lt;/option&gt;'; foreach($GetCastings_result as $data){ $Job_ID = $data-&gt;Job_ID; echo ' &lt;option value="'.$Job_ID.','.$ProfileID.'" &gt;'.$data-&gt;Job_Title.'&lt;/option&gt;'; } echo " &lt;/select&gt;"; if(isset($_POST['Submit_AddProfileToCastings'])){ $AddProfileToCastings = $_POST['AddProfileToCastings']; print_r($AddProfileToCastings); } </code></pre> <p>The resulting Array looks like this:</p> <p>Array ( [0] => 66,1108 [1] => 69,1108 [2] => 73,1108 )</p> <p>I would now like to split up my JobID and ProfileID(the comma separated values) so that I am able to insert the data in to my database.</p>
0debug
static void breakpoint_invalidate(CPUState *env, target_ulong pc) { target_ulong phys_addr; phys_addr = cpu_get_phys_page_debug(env, pc); tb_invalidate_phys_page_range(phys_addr, phys_addr + 1, 0); }
1threat
How to disable the disabling of an android application (which can be done through settings)? : <p>All android apps in settings can be disabled. But I want to make an application which cant be disabled from settings. What can be done for that?</p>
0debug
How to get the total social shares number of a post : I googled a lot but didn't find the answer correctly. I am looking for the specific code snippet that I can use to show the total social shares number of a post like FB, Google, Twitter, Pinterest etc. Something like that [Here is the Example][1] [1]: https://i.stack.imgur.com/IRI4j.png I want to show this number as a text. Pls, help me with the code snippet. Thanks in advance.
0debug
def harmonic_sum(n): if n < 2: return 1 else: return 1 / n + (harmonic_sum(n - 1))
0debug
Why are my calculations are off? 1 work day is supposed to equal 8 hours. : <p>I think my math isn't done right in the setter function(s). I've been staring at it too long. Thanks in advance programmers! </p> <pre><code>#include &lt;iostream&gt; using namespace std; class numDays { int hours; int days; public: numDays(int hrs); //constructor prototype void setHours(int); void setDays(int); int getHours(); int getDays(); double operator+ (const numDays Object1) //overloading the + operator to return the sum of two objects' hours members { return hours + Object1.hours; } double operator-(const numDays Object1) //overloading the + operator to return the difference of two objects' hours members { return hours - Object1.hours; } numDays operator++() //prefix increment operator to increment # of hours stored in object. Days are recalculated. { ++hours; days = hours/8; return *this; } numDays operator++(int) //postfix increment operator to increment # of hours stored in object. Days are recalculated. { numDays temp(hours); hours++; days = hours/8; return temp; } numDays operator--() //prefix decrement operator to decrement # of hours stored in object. Days are recalculated. { --hours; days = hours/8; return *this; } numDays operator-- (int) //prefix decrement operator to decrement # of hours stored in object. Days are recalculated. { numDays temp(hours); hours--; days = hours/8; return temp; } }; numDays::numDays(int hrs) //constructor that accepts a number of hours {hours = hrs;} </code></pre> <p>I expect the problem is here in either the setHours function or the setDays function.</p> <pre><code>void numDays::setHours(int hrs) //mutator function to store the amount of hours { hours = hrs; days = hrs/8; } void numDays::setDays(int d) //mutator function to store the amount of days { hours = d; days = hours % 8; } int numDays::getHours() //accessor function to get the amount of hours { return hours; } int numDays::getDays() //accessor function to get the amount of days { return days; } int main() { int workHours; numDays object2(0); cout &lt;&lt; "Please type in a certain amount of hours to see how much work in days it is: "; cin &gt;&gt; workHours; object2.setHours(workHours); object2.setDays(workHours); cout &lt;&lt; "The number of hours you put in is " &lt;&lt; object2.getHours() &lt;&lt; endl; cout &lt;&lt; "That means you worked " &lt;&lt;object2.getDays() &lt;&lt; " days " &lt;&lt; endl; return 0; } </code></pre>
0debug
static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf, int buf_size) { int i; uint32_t state; ParseContext *pc = &p->pc; state = pc->state; if (state > 13) state = 7; for (i = 0; i < buf_size; i++) { if (state == 7) { i += p->h264dsp.startcode_find_candidate(buf + i, buf_size - i); if (i < buf_size) state = 2; } else if (state <= 2) { if (buf[i] == 1) state ^= 5; else if (buf[i]) state = 7; else state >>= 1; } else if (state <= 5) { int nalu_type = buf[i] & 0x1F; if (nalu_type == NAL_SEI || nalu_type == NAL_SPS || nalu_type == NAL_PPS || nalu_type == NAL_AUD) { if (pc->frame_start_found) { i++; goto found; } } else if (nalu_type == NAL_SLICE || nalu_type == NAL_DPA || nalu_type == NAL_IDR_SLICE) { if (pc->frame_start_found) { state += 8; continue; } else pc->frame_start_found = 1; } state = 7; } else { if (buf[i] & 0x80) goto found; state = 7; } } pc->state = state; return END_NOT_FOUND; found: pc->state = 7; pc->frame_start_found = 0; return i - (state & 5); }
1threat
How to create a list in C# : [![System.Collections.List Error On Creating List In C#][1]][1] [1]: https://i.stack.imgur.com/u2VGg.png Can anyone assist in debugging this code, please ? Thank you.
0debug
Import Error @pyrebase : I have a problem with importing pyrebase on my raspberrypi. In the picture you see the ErrorCode. Before I installed pyrebase with the command: "sudo pip install pyrebase" [ErrorCode][1] [1]: https://i.stack.imgur.com/snSvH.png
0debug
Jenkins pipeline: return value of build step : <p>In this integration pipeline in Jenkins, I am triggering different builds in parallel using <a href="https://jenkins.io/doc/pipeline/steps/pipeline-build-step/" rel="noreferrer">the build step</a>, as follows:</p> <pre><code>stage('trigger all builds') { parallel { stage('componentA') { steps { script { def myjob=build job: 'componentA', propagate: true, wait: true } } } stage('componentB') { steps { script { def myjob=build job: 'componentB', propagate: true, wait: true } } } } } </code></pre> <p>I would like to access the return value of the <code>build</code> step, so that I can know in my Groovy scripts what job name, number was triggered.</p> <p>I have found in the examples that the object returned has getters like <code>getProjectName()</code> or <code>getNumber()</code> that I can use for this.</p> <p>But how do I know the exact class of the returned object and the list of methods I can call on it? This seems to be missing from the <a href="https://jenkins.io/doc/pipeline/steps/pipeline-build-step/" rel="noreferrer">Pipeline documentation</a>. I am asking for this case in particular, but generally speaking, how can I know the class of the returned object and its documentation?</p>
0debug
How to get Year and Month of a DATE using Toad : How can I get the year and month of a date in the where clause using TOAD, I used to be working with SQL server and it was as simple as YEAR(FIELDNAME) and MONTH(FIELDNAME). Your help is really appreciated.
0debug
static int net_socket_mcast_create(struct sockaddr_in *mcastaddr) { struct ip_mreq imr; int fd; int val, ret; if (!IN_MULTICAST(ntohl(mcastaddr->sin_addr.s_addr))) { fprintf(stderr, "qemu: error: specified mcastaddr \"%s\" (0x%08x) does not contain a multicast address\n", inet_ntoa(mcastaddr->sin_addr), (int)ntohl(mcastaddr->sin_addr.s_addr)); return -1; } fd = socket(PF_INET, SOCK_DGRAM, 0); if (fd < 0) { perror("socket(PF_INET, SOCK_DGRAM)"); return -1; } val = 1; ret=setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (const char *)&val, sizeof(val)); if (ret < 0) { perror("setsockopt(SOL_SOCKET, SO_REUSEADDR)"); goto fail; } ret = bind(fd, (struct sockaddr *)mcastaddr, sizeof(*mcastaddr)); if (ret < 0) { perror("bind"); goto fail; } imr.imr_multiaddr = mcastaddr->sin_addr; imr.imr_interface.s_addr = htonl(INADDR_ANY); ret = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char *)&imr, sizeof(struct ip_mreq)); if (ret < 0) { perror("setsockopt(IP_ADD_MEMBERSHIP)"); goto fail; } val = 1; ret=setsockopt(fd, IPPROTO_IP, IP_MULTICAST_LOOP, (const char *)&val, sizeof(val)); if (ret < 0) { perror("setsockopt(SOL_IP, IP_MULTICAST_LOOP)"); goto fail; } socket_set_nonblock(fd); return fd; fail: if (fd >= 0) closesocket(fd); return -1; }
1threat
Javascript open link in new tab not same tab : <p>I have some code to make a table row clickable which works as it should.</p> <p>The only problem is it opens the URL in the same tab. Is there a way I can change this to open the URL in a new tab?</p> <pre><code>&lt;tr class='clickable-row' data-href='http://www.google.com'&gt; &lt;script&gt; jQuery(document).ready(function($) { $(".clickable-row").click(function() { window.location = $(this).data("href")); }); }); &lt;/script&gt; </code></pre>
0debug
How to write into a cvs? : I want to write all the file names into a comma separated csv file. I have tried this, but it separate all the characters, not only the whole file names. for filename in filenames: with open('C:\Users\igyulavics\Desktop\estfile.csv', 'w') as csvFile: a = (os.path.join(dirname, filename)) print a writer = csv.writer(csvFile) writer.writerows(a) csvFile.close() So it gives back: c,Users,1, etc but I want this: c:\Users\1,c:\Users\2
0debug
Incorrect overriding of "equals"? : <p>got stuck on the test tusk:</p> <pre><code> class MyKeys { Integer key; MyKeys(Integer k) { key = k; } public boolean equals(Object o) { return ((MyKeys) o).key == this.key; } } </code></pre> <p>And this code snippet:</p> <pre><code>Map m = new HashMap(); MyKeys m1 = new MyKeys(1); MyKeys m2 = new MyKeys(2); MyKeys m3 = new MyKeys(1); MyKeys m4 = new MyKeys(new Integer(2)); m.put(m1, "car"); m.put(m2, "boat"); m.put(m3, "plane"); m.put(m4, "bus"); System.out.print(m.size()); </code></pre> <p>So, my expected output would be "2", while it's actually 4. I guess there is some problem with correctness of overriding equals method. Any help is useful. </p>
0debug
static void gen_store_exclusive(DisasContext *s, int rd, int rt, int rt2, TCGv_i32 addr, int size) { TCGv_i32 tmp; TCGv_i64 val64, extaddr; int done_label; int fail_label; fail_label = gen_new_label(); done_label = gen_new_label(); extaddr = tcg_temp_new_i64(); tcg_gen_extu_i32_i64(extaddr, addr); tcg_gen_brcond_i64(TCG_COND_NE, extaddr, cpu_exclusive_addr, fail_label); tcg_temp_free_i64(extaddr); tmp = tcg_temp_new_i32(); switch (size) { case 0: gen_aa32_ld8u(tmp, addr, get_mem_index(s)); break; case 1: gen_aa32_ld16u(tmp, addr, get_mem_index(s)); break; case 2: case 3: gen_aa32_ld32u(tmp, addr, get_mem_index(s)); break; default: abort(); } val64 = tcg_temp_new_i64(); if (size == 3) { TCGv_i32 tmp2 = tcg_temp_new_i32(); TCGv_i32 tmp3 = tcg_temp_new_i32(); tcg_gen_addi_i32(tmp2, addr, 4); gen_aa32_ld32u(tmp3, tmp2, get_mem_index(s)); tcg_temp_free_i32(tmp2); tcg_gen_concat_i32_i64(val64, tmp, tmp3); tcg_temp_free_i32(tmp3); } else { tcg_gen_extu_i32_i64(val64, tmp); } tcg_temp_free_i32(tmp); tcg_gen_brcond_i64(TCG_COND_NE, val64, cpu_exclusive_val, fail_label); tcg_temp_free_i64(val64); tmp = load_reg(s, rt); switch (size) { case 0: gen_aa32_st8(tmp, addr, get_mem_index(s)); break; case 1: gen_aa32_st16(tmp, addr, get_mem_index(s)); break; case 2: case 3: gen_aa32_st32(tmp, addr, get_mem_index(s)); break; default: abort(); } tcg_temp_free_i32(tmp); if (size == 3) { tcg_gen_addi_i32(addr, addr, 4); tmp = load_reg(s, rt2); gen_aa32_st32(tmp, addr, get_mem_index(s)); tcg_temp_free_i32(tmp); } tcg_gen_movi_i32(cpu_R[rd], 0); tcg_gen_br(done_label); gen_set_label(fail_label); tcg_gen_movi_i32(cpu_R[rd], 1); gen_set_label(done_label); tcg_gen_movi_i64(cpu_exclusive_addr, -1); }
1threat
static int avi_probe(AVProbeData *p) { if (p->buf_size <= 32) return 0; if (p->buf[0] == 'R' && p->buf[1] == 'I' && p->buf[2] == 'F' && p->buf[3] == 'F' && p->buf[8] == 'A' && p->buf[9] == 'V' && p->buf[10] == 'I' && (p->buf[11] == ' ' || p->buf[11] == 0x19)) return AVPROBE_SCORE_MAX; else return 0; }
1threat
static void s390_init(ram_addr_t my_ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { CPUState *env = NULL; MemoryRegion *sysmem = get_system_memory(); MemoryRegion *ram = g_new(MemoryRegion, 1); ram_addr_t kernel_size = 0; ram_addr_t initrd_offset; ram_addr_t initrd_size = 0; int shift = 0; uint8_t *storage_keys; void *virtio_region; target_phys_addr_t virtio_region_len; target_phys_addr_t virtio_region_start; int i; while ((my_ram_size >> (20 + shift)) > 65535) { shift++; } my_ram_size = my_ram_size >> (20 + shift) << (20 + shift); ram_size = my_ram_size; s390_bus = s390_virtio_bus_init(&my_ram_size); memory_region_init_ram(ram, NULL, "s390.ram", my_ram_size); memory_region_add_subregion(sysmem, 0, ram); storage_keys = g_malloc0(my_ram_size / TARGET_PAGE_SIZE); if (cpu_model == NULL) { cpu_model = "host"; } ipi_states = g_malloc(sizeof(CPUState *) * smp_cpus); for (i = 0; i < smp_cpus; i++) { CPUState *tmp_env; tmp_env = cpu_init(cpu_model); if (!env) { env = tmp_env; } ipi_states[i] = tmp_env; tmp_env->halted = 1; tmp_env->exception_index = EXCP_HLT; tmp_env->storage_keys = storage_keys; } s390_add_running_cpu(env); if (kernel_filename) { kernel_size = load_image(kernel_filename, qemu_get_ram_ptr(0)); if (lduw_be_phys(KERN_IMAGE_START) != 0x0dd0) { fprintf(stderr, "Specified image is not an s390 boot image\n"); exit(1); } env->psw.addr = KERN_IMAGE_START; env->psw.mask = 0x0000000180000000ULL; } else { ram_addr_t bios_size = 0; char *bios_filename; if (bios_name == NULL) { bios_name = ZIPL_FILENAME; } bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); bios_size = load_image(bios_filename, qemu_get_ram_ptr(ZIPL_LOAD_ADDR)); g_free(bios_filename); if ((long)bios_size < 0) { hw_error("could not load bootloader '%s'\n", bios_name); } if (bios_size > 4096) { hw_error("stage1 bootloader is > 4k\n"); } env->psw.addr = ZIPL_START; env->psw.mask = 0x0000000180000000ULL; } if (initrd_filename) { initrd_offset = INITRD_START; while (kernel_size + 0x100000 > initrd_offset) { initrd_offset += 0x100000; } initrd_size = load_image(initrd_filename, qemu_get_ram_ptr(initrd_offset)); stq_be_phys(INITRD_PARM_START, initrd_offset); stq_be_phys(INITRD_PARM_SIZE, initrd_size); } if (kernel_cmdline) { cpu_physical_memory_write(KERN_PARM_AREA, kernel_cmdline, strlen(kernel_cmdline) + 1); } for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; DeviceState *dev; if (!nd->model) { nd->model = g_strdup("virtio"); } if (strcmp(nd->model, "virtio")) { fprintf(stderr, "S390 only supports VirtIO nics\n"); exit(1); } dev = qdev_create((BusState *)s390_bus, "virtio-net-s390"); qdev_set_nic_properties(dev, nd); qdev_init_nofail(dev); } for(i = 0; i < MAX_BLK_DEVS; i++) { DriveInfo *dinfo; DeviceState *dev; dinfo = drive_get(IF_IDE, 0, i); if (!dinfo) { continue; } dev = qdev_create((BusState *)s390_bus, "virtio-blk-s390"); qdev_prop_set_drive_nofail(dev, "drive", dinfo->bdrv); qdev_init_nofail(dev); } }
1threat
static void mcf_fec_receive(void *opaque, const uint8_t *buf, size_t size) { mcf_fec_state *s = (mcf_fec_state *)opaque; mcf_fec_bd bd; uint32_t flags = 0; uint32_t addr; uint32_t crc; uint32_t buf_addr; uint8_t *crc_ptr; unsigned int buf_len; DPRINTF("do_rx len %d\n", size); if (!s->rx_enabled) { fprintf(stderr, "mcf_fec_receive: Unexpected packet\n"); } size += 4; crc = cpu_to_be32(crc32(~0, buf, size)); crc_ptr = (uint8_t *)&crc; if (size > FEC_MAX_FRAME_SIZE) { size = FEC_MAX_FRAME_SIZE; flags |= FEC_BD_TR | FEC_BD_LG; } if (size > (s->rcr >> 16)) { flags |= FEC_BD_LG; } addr = s->rx_descriptor; while (size > 0) { mcf_fec_read_bd(&bd, addr); if ((bd.flags & FEC_BD_E) == 0) { fprintf(stderr, "mcf_fec: Lost end of frame\n"); break; } buf_len = (size <= s->emrbr) ? size: s->emrbr; bd.length = buf_len; size -= buf_len; DPRINTF("rx_bd %x length %d\n", addr, bd.length); if (size < 4) buf_len += size - 4; buf_addr = bd.data; cpu_physical_memory_write(buf_addr, buf, buf_len); buf += buf_len; if (size < 4) { cpu_physical_memory_write(buf_addr + buf_len, crc_ptr, 4 - size); crc_ptr += 4 - size; } bd.flags &= ~FEC_BD_E; if (size == 0) { bd.flags |= flags | FEC_BD_L; DPRINTF("rx frame flags %04x\n", bd.flags); s->eir |= FEC_INT_RXF; } else { s->eir |= FEC_INT_RXB; } mcf_fec_write_bd(&bd, addr); if ((bd.flags & FEC_BD_W) != 0) { addr = s->erdsr; } else { addr += 8; } } s->rx_descriptor = addr; mcf_fec_enable_rx(s); mcf_fec_update(s); }
1threat
Reading TextBox List in C# : <p>I have been making this program for about 1 hour now. And I've run into a small problem... I can't find an answer anywhere nor have no clue and how to do it. I basically want to read a textbox of accounts listed like this USERNAME:PASSWORD now how would I separate the : from each other and use them as strings or even use the data separate thanks,</p>
0debug
How to get application icon? - Android studio : I'm trying to do an app with all installed app's name, permissions and icon. I have done successfully the first and the second, but I don't know what to do for the third. Here it is AppsAdapter class: class AppsAdapter extends BaseAdapter { private final Context mContext; private List<Pair<String, List<String>>> mAppsWithPermission; public AppsAdapter(Context context, List<Pair<String, List<String>>> appsWithPermission) { mContext = context; mAppsWithPermission = appsWithPermission; } static class ViewHolder { public TextView appName; public TextView appPermissions; public ImageView appIcon; } @Override public int getCount() { return mAppsWithPermission.size(); } @Override public Object getItem(int position) { return mAppsWithPermission.get(position); } @Override public long getItemId(int position) { return mAppsWithPermission.get(position).hashCode(); } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { convertView = LayoutInflater.from(mContext).inflate(R.layout.list_item, parent, false); holder = new ViewHolder(); holder.appName = convertView.findViewById(R.id.list_item_appname); holder.appPermissions = convertView.findViewById(R.id.list_item_apppermissions); holder.appIcon = convertView.findViewById(R.id.list_item_appicon); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Pair<String, List<String>> item = mAppsWithPermission.get(position); holder.appName.setText(item.first); holder.appPermissions.setText(item.second.toString()); return convertView; } } I'm trying to get AppIcon. What should I do? Thanks in advance Faby
0debug
How to underline text in flutter : <p>How to underline text in flutter inside <code>Text</code> widget?</p> <p>I cannot seem to find underline inside <code>fontStyle</code> property of <code>TextStyle</code></p>
0debug
Angular2 router: how to correctly load children modules with their own routing rules : <p>here is my Angular2 app structure:</p> <p><a href="https://i.stack.imgur.com/qj7wv.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qj7wv.png" alt="enter image description here"></a></p> <p>Here is part of my code. The following is the main <code>module</code> of the Angular2 app, that imports its routing rules and a child module (<code>EdgeModule</code>) and uses some components related to some pages.</p> <p><strong>app.module.ts</strong></p> <pre><code>@NgModule({ declarations: [ AppComponent, PageNotFoundComponent, LoginComponent ], imports: [ ... appRouting, EdgeModule ], providers: [ appRoutingProviders, LoginService ], bootstrap: [AppComponent] }) export class AppModule { } </code></pre> <p>Here is the routing rules for the main module. It have paths to login page and page not found.</p> <p><strong>app.routing.ts</strong></p> <pre><code>const appRoutes: Routes = [ { path: 'login', component: LoginComponent }, { path: '**', component: PageNotFoundComponent } ]; export const appRoutingProviders: any[] = []; export const appRouting = RouterModule.forRoot(appRoutes, { useHash: true }); </code></pre> <p>Here is <code>EdgeModule</code> that declares the component that it uses and import its own routing rules and 2 child modules (<code>FirstSectionModule</code> and <code>SecondSectionModule</code>).</p> <p><strong>edge.module.ts</strong></p> <pre><code>@NgModule({ declarations: [ EdgeComponent, SidebarComponent, TopbarComponent ], imports: [ ... edgeRouting, FirstSectionModule, SecondSectionModule ], providers: [ AuthGuard ] }) export class EdgeModule { } </code></pre> <p>Here is the routing rules for the module that loads, as you can see, topbar and sidebar components.</p> <p><strong>edge.routing.ts</strong></p> <pre><code>Paths['edgePaths'] = { firstSection: 'firstSection', secondSection: 'secondSection' }; const appRoutes: Routes = [ { path: '', component: EdgeComponent, canActivate: [AuthGuard], children: [ { path: Paths.edgePaths.firstSection, loadChildren: '../somepath/first-section.module#FirstModule' }, { path: Paths.edgePaths.secondSection, loadChildren: '../someotherpath/second-section.module#SecondModule' }, { path: '', redirectTo: edgePaths.dashboard, pathMatch: 'full' } ] } ]; export const edgeRouting = RouterModule.forChild(appRoutes); </code></pre> <p>Finally, this is one of the two child module, that have its components and imports its routing rules.</p> <p><strong>first-section.module.ts</strong></p> <pre><code>@NgModule({ declarations: [ FirstSectionComponent, SomeComponent ], imports: [ ... firstSectionRouting ], providers: [ AuthGuard, ] }) export class FirstSectionModule { } </code></pre> <p>These are the routing rules for the pages (components) of <code>FirstSectionModule</code></p> <p><strong>first-section.routing.ts</strong></p> <pre><code>Paths['firstSectionPaths'] = { someSubPage: 'some-sub-page', someOtherSubPage: 'some-other-sub-page' }; const appRoutes: Routes = [ { path: '', children: [ { path: Paths.firstSectionPaths.someSubPage, component: someSubPageComponent}, { path: Paths.firstSectionPaths.someOtherSubPage, component: someOtherSubPageComponent}, { path: '', component: AnagraficheComponent } ] } ]; export const firstSectionRouting = RouterModule.forChild(appRoutes); </code></pre> <p>Almost the same happens for <code>second-section.module.ts</code> and <code>second-section.routing.ts</code> files.</p> <p>When i run the app the first things that load is the page related to <code>FirstSectionComponent</code>, with no sidebar nor topbar.</p> <p>Can you tell me what's wrong with my code? There are not errors in the console.</p>
0debug
Reg Ex is getting more digits then expected : I want to identify credit card numbers in a document by identifying 12 to 19 digit numbers. My regex is > [1-9](\d[ ]?[ ]*?[-]?[-]*?[:]*?[:]?){11,18}\b And I am using regex101.com to test it. You can see actual **[result here][1]** **1st Goal** is it should be able to get the 12-19 digit number even the number is followed by string. For ex: 4554-4545-4545-4545Visa ---> 4545-4545-4545-4545 **2nd Goal** is it should get the 12-19 digit numbers from the beginning For ex: 999999999999994190000000000000 --> 9999999999999941900 PLEASE CHECK THE CURRENT RESULT [HERE][2] [1]: https://regex101.com/r/J2DgIq/4 [2]: https://regex101.com/r/J2DgIq/4/
0debug
static int cpu_pre_load(void *opaque) { CPUState *env = opaque; cpu_synchronize_state(env); return 0; }
1threat
How to refer to a range of items on a list on python? : <p>Let's say I have a program that generates lists </p> <pre><code>list1 = [a, b, c, d, e, f, g] list2 = [a, b, c, d, e, f, g, h, i, j, k, l, m] list3 = [a, b, c, d, e, f, g, h, i, j, k, l, m, o, p] </code></pre> <p>how can i write a piece of code that extracts all the items from a given index all the way to the end and assigns them to a new variable?</p> <p>For example, if I want to get all the items from index 3 to the end of the list of list3 and assign them to list4</p> <pre><code>list4 = [d, e, f, g, h, i, j, k, l, m, o, p] </code></pre> <p>I am repeating myself when I say 'to the end' beacuse I need something that works for all the lists that variy in ranges. </p>
0debug
static int get_cookies(HTTPContext *s, char **cookies, const char *path, const char *domain) { int ret = 0; char *next, *cookie, *set_cookies = av_strdup(s->cookies), *cset_cookies = set_cookies; if (!set_cookies) return AVERROR(EINVAL); *cookies = NULL; while ((cookie = av_strtok(set_cookies, "\n", &next))) { int domain_offset = 0; char *param, *next_param, *cdomain = NULL, *cpath = NULL, *cvalue = NULL; set_cookies = NULL; while ((param = av_strtok(cookie, "; ", &next_param))) { cookie = NULL; if (!av_strncasecmp("path=", param, 5)) { cpath = av_strdup(&param[5]); } else if (!av_strncasecmp("domain=", param, 7)) { cdomain = av_strdup(&param[7]); } else if (!av_strncasecmp("secure", param, 6) || !av_strncasecmp("comment", param, 7) || !av_strncasecmp("max-age", param, 7) || !av_strncasecmp("version", param, 7)) { } else { av_free(cvalue); cvalue = av_strdup(param); } } if (!cdomain || !cpath || !cvalue) { av_log(s, AV_LOG_WARNING, "Invalid cookie found, no value, path or domain specified\n"); goto done_cookie; } if (av_strncasecmp(path, cpath, strlen(cpath))) goto done_cookie; domain_offset = strlen(domain) - strlen(cdomain); if (domain_offset < 0) goto done_cookie; if (av_strcasecmp(&domain[domain_offset], cdomain)) goto done_cookie; if (!*cookies) { if (!(*cookies = av_strdup(cvalue))) { ret = AVERROR(ENOMEM); goto done_cookie; } } else { char *tmp = *cookies; size_t str_size = strlen(cvalue) + strlen(*cookies) + 3; if (!(*cookies = av_malloc(str_size))) { ret = AVERROR(ENOMEM); goto done_cookie; } snprintf(*cookies, str_size, "%s; %s", tmp, cvalue); av_free(tmp); } done_cookie: av_free(cvalue); if (ret < 0) { if (*cookies) av_freep(cookies); av_free(cset_cookies); return ret; } } av_free(cset_cookies); return 0; }
1threat
First step in java.nio : <p>I'm moving the first steps in java and I met this kind of package.</p> <p>Why was the package java.nio introduced and what does'nio' stand for?</p>
0debug
Filtering and replacing from multiple coloumn : I have a file where i have to replace pvalue greater than 0.05 (pval > 0.05) with NA , in other words retain the pval < 0.05 and replace pval > 0.05 with NA . For example : Rv_FC Rv_Pval Gc_FC Gc_Pval ...... 2 0.001 3 0.99 3 0.99 1 0.0002 3 0.0001 2 0.89 Output : Rv_FC Rv_Pval Gc_FC Gc_Pval ...... 2 0.001 3 NA 3 NA 1 0.0002 3 0.0001 2 NA Only pval coloumns should be considered and if the value of them > 0.05 , it should be replced with NA. Advantage : pval coloumns are in 3rd, 5th , 7th ... coloumns..
0debug
Order costumers by the amount of invoices and sum of items : I'm trying to order my costumers by the amount of invoices and the sum of the values of invoices. To get the value of a invoice, I need to sum the items, that can (or not) be in 2 tables: products and support. The structure is something like this: [![][1]][1] I tried this query, but doesn't works: SELECT c.id, c.name, COUNT(i.id) as total_amount, SUM(ip.value * ip.quantity) as total_products, SUM(is.value) as total_support FROM Invoice i INNER JOIN Costumer c ON i.id_costumer = c.id LEFT JOIN InVoice_Product ip ON ip.id_invoice = i.id LEFT JOIN InVoice_Support sp ON sp.id_invoice = i.id GROUP BY c.id, c.name ORDER BY total_amount, total_products DESC If I exec the query without the LEFT JOINS, only looking for the amount of invoices, works great.. But when I try to add the JOINS, the results doesn't match with reality.. Anyone can help? I'm stucked on this.. [1]: https://i.stack.imgur.com/mInwX.png
0debug
static CharDriverState *qemu_chr_open_msmouse(const char *id, ChardevBackend *backend, ChardevReturn *ret, Error **errp) { ChardevCommon *common = backend->u.msmouse.data; MouseState *mouse; CharDriverState *chr; chr = qemu_chr_alloc(common, errp); chr->chr_write = msmouse_chr_write; chr->chr_close = msmouse_chr_close; chr->chr_accept_input = msmouse_chr_accept_input; chr->explicit_be_open = true; mouse = g_new0(MouseState, 1); mouse->hs = qemu_input_handler_register((DeviceState *)mouse, &msmouse_handler); mouse->chr = chr; chr->opaque = mouse; return chr;
1threat
void kvm_arm_reset_vcpu(ARMCPU *cpu) { kvm_arm_vcpu_init(CPU(cpu)); write_kvmstate_to_list(cpu); }
1threat
void timer_del(QEMUTimer *ts) { QEMUTimer **pt, *t; pt = &ts->timer_list->active_timers; for(;;) { t = *pt; if (!t) break; if (t == ts) { *pt = t->next; break; } pt = &t->next; } }
1threat
Use VS2017 to publish WebAPI , get stuck in `preparing profile` : <p>Right click project -> publish -> select publish to folder -> publish</p> <p>then got stucked in “preparing profile” . (I'vs waited for 10 mins)</p> <p><a href="https://i.stack.imgur.com/e9LAS.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/e9LAS.gif" alt="enter image description here"></a></p>
0debug
static void gen_mtspr(DisasContext *ctx) { void (*write_cb)(DisasContext *ctx, int sprn, int gprn); uint32_t sprn = SPR(ctx->opcode); #if defined(CONFIG_USER_ONLY) write_cb = ctx->spr_cb[sprn].uea_write; #else if (ctx->pr) { write_cb = ctx->spr_cb[sprn].uea_write; } else if (ctx->hv) { write_cb = ctx->spr_cb[sprn].hea_write; } else { write_cb = ctx->spr_cb[sprn].oea_write; } #endif if (likely(write_cb != NULL)) { if (likely(write_cb != SPR_NOACCESS)) { (*write_cb)(ctx, sprn, rS(ctx->opcode)); } else { fprintf(stderr, "Trying to write privileged spr %d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); if (qemu_log_separate()) { qemu_log("Trying to write privileged spr %d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); } gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); } } else { if (qemu_log_separate()) { qemu_log("Trying to write invalid spr %d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); } fprintf(stderr, "Trying to write invalid spr %d (0x%03x) at " TARGET_FMT_lx "\n", sprn, sprn, ctx->nip - 4); gen_inval_exception(ctx, POWERPC_EXCP_INVAL_SPR); } }
1threat
Change NSMutableArray with Buttons : for my iOS app I want to initiate an NSMutableArray and change the Object the array holds during runtime with buttons. So far I was able to initiate an array in viewDidLoad {} in the ViewController.m but now i can't access it in my buttonPressed method. How can I make the array accessible for the hold file?[Picture of the File][1] [1]: https://i.stack.imgur.com/aWNEY.jpg
0debug
static always_inline void powerpc_excp (CPUState *env, int excp_model, int excp) { target_ulong msr, vector; int srr0, srr1, asrr0, asrr1; if (loglevel & CPU_LOG_INT) { fprintf(logfile, "Raise exception at 0x" ADDRX " => 0x%08x (%02x)\n", env->nip, excp, env->error_code); } msr = do_load_msr(env); srr0 = SPR_SRR0; srr1 = SPR_SRR1; asrr0 = -1; asrr1 = -1; msr &= ~((target_ulong)0x783F0000); switch (excp) { case POWERPC_EXCP_NONE: return; case POWERPC_EXCP_CRITICAL: msr_ri = 0; switch (excp_model) { case POWERPC_EXCP_40x: srr0 = SPR_40x_SRR2; srr1 = SPR_40x_SRR3; break; case POWERPC_EXCP_BOOKE: srr0 = SPR_BOOKE_CSRR0; srr1 = SPR_BOOKE_CSRR1; break; case POWERPC_EXCP_G2: break; default: goto excp_invalid; } goto store_next; case POWERPC_EXCP_MCHECK: if (msr_me == 0) { excp = POWERPC_EXCP_RESET; goto excp_reset; } msr_ri = 0; msr_me = 0; #if defined(TARGET_PPC64H) msr_hv = 1; #endif switch (excp_model) { case POWERPC_EXCP_40x: srr0 = SPR_40x_SRR2; srr1 = SPR_40x_SRR3; break; case POWERPC_EXCP_BOOKE: srr0 = SPR_BOOKE_MCSRR0; srr1 = SPR_BOOKE_MCSRR1; asrr0 = SPR_BOOKE_CSRR0; asrr1 = SPR_BOOKE_CSRR1; break; default: break; } goto store_next; case POWERPC_EXCP_DSI: #if defined (DEBUG_EXCEPTIONS) if (loglevel != 0) { fprintf(logfile, "DSI exception: DSISR=0x" ADDRX" DAR=0x" ADDRX "\n", env->spr[SPR_DSISR], env->spr[SPR_DAR]); } #endif msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif goto store_next; case POWERPC_EXCP_ISI: #if defined (DEBUG_EXCEPTIONS) if (loglevel != 0) { fprintf(logfile, "ISI exception: msr=0x" ADDRX ", nip=0x" ADDRX "\n", msr, env->nip); } #endif msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif msr |= env->error_code; goto store_next; case POWERPC_EXCP_EXTERNAL: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes0 == 1) msr_hv = 1; #endif goto store_next; case POWERPC_EXCP_ALIGN: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif env->spr[SPR_DSISR] |= (ldl_code((env->nip - 4)) & 0x03FF0000) >> 16; goto store_current; case POWERPC_EXCP_PROGRAM: switch (env->error_code & ~0xF) { case POWERPC_EXCP_FP: if ((msr_fe0 == 0 && msr_fe1 == 0) || msr_fp == 0) { #if defined (DEBUG_EXCEPTIONS) if (loglevel != 0) { fprintf(logfile, "Ignore floating point exception\n"); } #endif return; } msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif msr |= 0x00100000; env->fpscr[7] |= 0x8; if ((((env->fpscr[7] & 0x3) << 3) | (env->fpscr[6] >> 1)) & ((env->fpscr[1] << 1) | (env->fpscr[0] >> 3))) env->fpscr[7] |= 0x4; if (msr_fe0 != msr_fe1) { msr |= 0x00010000; goto store_current; } break; case POWERPC_EXCP_INVAL: #if defined (DEBUG_EXCEPTIONS) if (loglevel != 0) { fprintf(logfile, "Invalid instruction at 0x" ADDRX "\n", env->nip); } #endif msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif msr |= 0x00080000; break; case POWERPC_EXCP_PRIV: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif msr |= 0x00040000; break; case POWERPC_EXCP_TRAP: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif msr |= 0x00020000; break; default: cpu_abort(env, "Invalid program exception %d. Aborting\n", env->error_code); break; } goto store_next; case POWERPC_EXCP_FPU: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif goto store_current; case POWERPC_EXCP_SYSCALL: if (env->gpr[3] == 0x113724fa && env->gpr[4] == 0x77810f9b && env->osi_call) { if (env->osi_call(env) != 0) return; } if (loglevel & CPU_LOG_INT) { dump_syscall(env); } msr_ri = 0; #if defined(TARGET_PPC64H) if (lev == 1 || (lpes0 == 0 && lpes1 == 0)) msr_hv = 1; #endif goto store_next; case POWERPC_EXCP_APU: msr_ri = 0; goto store_current; case POWERPC_EXCP_DECR: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif goto store_next; case POWERPC_EXCP_FIT: #if defined (DEBUG_EXCEPTIONS) if (loglevel != 0) fprintf(logfile, "FIT exception\n"); #endif msr_ri = 0; goto store_next; case POWERPC_EXCP_WDT: #if defined (DEBUG_EXCEPTIONS) if (loglevel != 0) fprintf(logfile, "WDT exception\n"); #endif switch (excp_model) { case POWERPC_EXCP_BOOKE: srr0 = SPR_BOOKE_CSRR0; srr1 = SPR_BOOKE_CSRR1; break; default: break; } msr_ri = 0; goto store_next; case POWERPC_EXCP_DTLB: msr_ri = 0; goto store_next; case POWERPC_EXCP_ITLB: msr_ri = 0; goto store_next; case POWERPC_EXCP_DEBUG: switch (excp_model) { case POWERPC_EXCP_BOOKE: srr0 = SPR_BOOKE_DSRR0; srr1 = SPR_BOOKE_DSRR1; asrr0 = SPR_BOOKE_CSRR0; asrr1 = SPR_BOOKE_CSRR1; break; default: break; } cpu_abort(env, "Debug exception is not implemented yet !\n"); goto store_next; #if defined(TARGET_PPCEMB) case POWERPC_EXCP_SPEU: msr_ri = 0; goto store_current; case POWERPC_EXCP_EFPDI: cpu_abort(env, "Embedded floating point data exception " "is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_EFPRI: cpu_abort(env, "Embedded floating point round exception " "is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_EPERFM: msr_ri = 0; cpu_abort(env, "Performance counter exception is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_DOORI: cpu_abort(env, "Embedded doorbell interrupt is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_DOORCI: switch (excp_model) { case POWERPC_EXCP_BOOKE: srr0 = SPR_BOOKE_CSRR0; srr1 = SPR_BOOKE_CSRR1; break; default: break; } cpu_abort(env, "Embedded doorbell critical interrupt " "is not implemented yet !\n"); goto store_next; #endif case POWERPC_EXCP_RESET: msr_ri = 0; #if defined(TARGET_PPC64H) msr_hv = 1; #endif excp_reset: goto store_next; #if defined(TARGET_PPC64) case POWERPC_EXCP_DSEG: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif goto store_next; case POWERPC_EXCP_ISEG: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif goto store_next; #endif #if defined(TARGET_PPC64H) case POWERPC_EXCP_HDECR: srr0 = SPR_HSRR0; srr1 = SPR_HSSR1; msr_hv = 1; goto store_next; #endif case POWERPC_EXCP_TRACE: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif goto store_next; #if defined(TARGET_PPC64H) case POWERPC_EXCP_HDSI: srr0 = SPR_HSRR0; srr1 = SPR_HSSR1; msr_hv = 1; goto store_next; case POWERPC_EXCP_HISI: srr0 = SPR_HSRR0; srr1 = SPR_HSSR1; msr_hv = 1; cpu_abort(env, "Hypervisor instruction storage exception " "is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_HDSEG: srr0 = SPR_HSRR0; srr1 = SPR_HSSR1; msr_hv = 1; goto store_next; case POWERPC_EXCP_HISEG: srr0 = SPR_HSRR0; srr1 = SPR_HSSR1; msr_hv = 1; goto store_next; #endif case POWERPC_EXCP_VPU: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif goto store_current; case POWERPC_EXCP_PIT: #if defined (DEBUG_EXCEPTIONS) if (loglevel != 0) fprintf(logfile, "PIT exception\n"); #endif msr_ri = 0; goto store_next; case POWERPC_EXCP_IO: cpu_abort(env, "601 IO error exception is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_RUNM: cpu_abort(env, "601 run mode exception is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_EMUL: cpu_abort(env, "602 emulation trap exception " "is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_IFTLB: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif switch (excp_model) { case POWERPC_EXCP_602: case POWERPC_EXCP_603: case POWERPC_EXCP_603E: case POWERPC_EXCP_G2: goto tlb_miss_tgpr; case POWERPC_EXCP_7x5: goto tlb_miss; case POWERPC_EXCP_74xx: goto tlb_miss_74xx; default: cpu_abort(env, "Invalid instruction TLB miss exception\n"); break; } break; case POWERPC_EXCP_DLTLB: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif switch (excp_model) { case POWERPC_EXCP_602: case POWERPC_EXCP_603: case POWERPC_EXCP_603E: case POWERPC_EXCP_G2: goto tlb_miss_tgpr; case POWERPC_EXCP_7x5: goto tlb_miss; case POWERPC_EXCP_74xx: goto tlb_miss_74xx; default: cpu_abort(env, "Invalid data load TLB miss exception\n"); break; } break; case POWERPC_EXCP_DSTLB: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif switch (excp_model) { case POWERPC_EXCP_602: case POWERPC_EXCP_603: case POWERPC_EXCP_603E: case POWERPC_EXCP_G2: tlb_miss_tgpr: swap_gpr_tgpr(env); msr_tgpr = 1; goto tlb_miss; case POWERPC_EXCP_7x5: tlb_miss: #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { const unsigned char *es; target_ulong *miss, *cmp; int en; if (excp == POWERPC_EXCP_IFTLB) { es = "I"; en = 'I'; miss = &env->spr[SPR_IMISS]; cmp = &env->spr[SPR_ICMP]; } else { if (excp == POWERPC_EXCP_DLTLB) es = "DL"; else es = "DS"; en = 'D'; miss = &env->spr[SPR_DMISS]; cmp = &env->spr[SPR_DCMP]; } fprintf(logfile, "6xx %sTLB miss: %cM " ADDRX " %cC " ADDRX " H1 " ADDRX " H2 " ADDRX " %08x\n", es, en, *miss, en, *cmp, env->spr[SPR_HASH1], env->spr[SPR_HASH2], env->error_code); } #endif msr |= env->crf[0] << 28; msr |= env->error_code; msr |= ((env->last_way + 1) & (env->nb_ways - 1)) << 17; break; case POWERPC_EXCP_74xx: tlb_miss_74xx: #if defined (DEBUG_SOFTWARE_TLB) if (loglevel != 0) { const unsigned char *es; target_ulong *miss, *cmp; int en; if (excp == POWERPC_EXCP_IFTLB) { es = "I"; en = 'I'; miss = &env->spr[SPR_IMISS]; cmp = &env->spr[SPR_ICMP]; } else { if (excp == POWERPC_EXCP_DLTLB) es = "DL"; else es = "DS"; en = 'D'; miss = &env->spr[SPR_TLBMISS]; cmp = &env->spr[SPR_PTEHI]; } fprintf(logfile, "74xx %sTLB miss: %cM " ADDRX " %cC " ADDRX " %08x\n", es, en, *miss, en, *cmp, env->error_code); } #endif msr |= env->error_code; break; default: cpu_abort(env, "Invalid data store TLB miss exception\n"); break; } goto store_next; case POWERPC_EXCP_FPA: cpu_abort(env, "Floating point assist exception " "is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_IABR: cpu_abort(env, "IABR exception is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_SMI: cpu_abort(env, "SMI exception is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_THERM: cpu_abort(env, "Thermal management exception " "is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_PERFM: msr_ri = 0; #if defined(TARGET_PPC64H) if (lpes1 == 0) msr_hv = 1; #endif cpu_abort(env, "Performance counter exception is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_VPUA: cpu_abort(env, "VPU assist exception is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_SOFTP: cpu_abort(env, "970 soft-patch exception is not implemented yet !\n"); goto store_next; case POWERPC_EXCP_MAINT: cpu_abort(env, "970 maintenance exception is not implemented yet !\n"); goto store_next; default: excp_invalid: cpu_abort(env, "Invalid PowerPC exception %d. Aborting\n", excp); break; store_current: env->spr[srr0] = env->nip - 4; break; store_next: env->spr[srr0] = env->nip; break; } env->spr[srr1] = msr; if (asrr0 != -1) env->spr[asrr0] = env->spr[srr0]; if (asrr1 != -1) env->spr[asrr1] = env->spr[srr1]; if (msr_ir || msr_dr) tlb_flush(env, 1); msr_ee = 0; msr_pr = 0; msr_fp = 0; msr_fe0 = 0; msr_se = 0; msr_be = 0; msr_fe1 = 0; msr_ir = 0; msr_dr = 0; #if 0 msr_pmm = 0; #endif msr_le = msr_ile; do_compute_hflags(env); vector = env->excp_vectors[excp]; if (vector == (target_ulong)-1) { cpu_abort(env, "Raised an exception without defined vector %d\n", excp); } vector |= env->excp_prefix; #if defined(TARGET_PPC64) if (excp_model == POWERPC_EXCP_BOOKE) { msr_cm = msr_icm; if (!msr_cm) vector = (uint32_t)vector; } else { msr_sf = msr_isf; if (!msr_sf) vector = (uint32_t)vector; } #endif env->nip = vector; env->exception_index = POWERPC_EXCP_NONE; env->error_code = 0; }
1threat
Angular 2: Callback when ngFor has finished : <p>In Angular 1 I have written a custom directive ("repeater-ready") to use with <code>ng-repeat</code> to invoke a callback method when the iteration has been completed:</p> <pre><code>if ($scope.$last === true) { $timeout(() =&gt; { $scope.$parent.$parent.$eval(someCallbackMethod); }); } </code></pre> <p>Usage in markup:</p> <pre><code>&lt;li ng-repeat="item in vm.Items track by item.Identifier" repeater-ready="vm.CallThisWhenNgRepeatHasFinished()"&gt; </code></pre> <p>How can I achieve a similar functionality with <code>ngFor</code> in Angular 2?</p>
0debug
Array or Json to String : <p>change the string to array is</p> <pre class="lang-php prettyprint-override"><code>$string = '[{"name":"jack","address":"who knows"},{"name":"jill","address":"who knows too"}]'; $array = json_decode($array,true); </code></pre> <p>but what if it's reversed change array to string</p> <pre class="lang-php prettyprint-override"><code>$array = [{"name":"jack","address":"who knows"},{"name":"jill","address":"who knows too"}]; $string = $array; // $string is $string like on first example </code></pre>
0debug
Facebook Account Kit Deprecated : <p>I <a href="https://developers.facebook.com/blog/post/2019/09/09/account-kit-services-no-longer-available-starting-march" rel="noreferrer">just saw</a> that <a href="https://developers.facebook.com/docs/accountkit/" rel="noreferrer">facebook account</a> kit is being <strong>deprecated</strong>. There isn't much information about what's the reason behind its depreciation or what could be the next steps/alternatives.</p> <ul> <li>Does anyone know why they deprecated it? Any technical insights/learnings?</li> <li>What are the alternatives now? or are they planing any successor of it?</li> </ul>
0debug
How to fix problem close drpdown when i click outside it : I am developping an angular 5 project. My home page is composed by many components. In navbarComponent i have a dropdown list. I want when the dropdown list is open if i click outside it,it will close automatically. This is my code: ngOnInit() { this.showMenu = false;} toggle() { this.showMenu = !this.showMenu; } <div *ngIf="isConnect" class=" userStyle dropdown-toggle " (click)="toggle()"> <ul class="dropdown-menu subMenu" role="menu" *ngIf="showMenu"> <li (click)="profile()" class="subMenuItem"> PROFILE</li> <li (click)="administration()" class="subMenuItem subMenuItem-last">ADMINISTRATION</li> <li class="subMenuItem subMenuItem-last"><button class="btn blue-btn" (click)="logout()" ><mat-icon mat-list-icon fontIcon="icon-logout"></mat-icon>LOGOUT</button></li> </ul> </div>
0debug
How much are 3-edge cycles in strongly connected graph with n nodes and n*n/2 edges? : How to calculate how much 3-edge cycles are in strongly connected graph with n nodes and n*n/2 directed edges?
0debug
Selenium WebDriber not working fine on Amazon site : I am trying to write a Selenium test against Amazon site. I want to get "Sign in" element so that I can click on it. url: www.amazon.es Here is my Selenium Code: System.setProperty("webdriver.gecko.driver","C:\\geckodriver-v0.18.0-win64\\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); driver.get("https://www.amazon.es"); try{ driver.findElement(By.id("nav-link-yourAccount")).click(); }catch (Exception e){ System.out.println("Not Found"); } Sometimes the code works correctly but sometimes it does not find the ID "nav-link-yourAccount". What is the problem? and how can I solve it? Thank you
0debug
void do_commit(Monitor *mon, const QDict *qdict) { const char *device = qdict_get_str(qdict, "device"); BlockDriverState *bs; if (!strcmp(device, "all")) { bdrv_commit_all(); } else { int ret; bs = bdrv_find(device); if (!bs) { qerror_report(QERR_DEVICE_NOT_FOUND, device); return; } ret = bdrv_commit(bs); if (ret == -EBUSY) { qerror_report(QERR_DEVICE_IN_USE, device); return; } } }
1threat
static ssize_t socket_writev_buffer(void *opaque, struct iovec *iov, int iovcnt, int64_t pos) { QEMUFileSocket *s = opaque; ssize_t len; ssize_t size = iov_size(iov, iovcnt); len = iov_send(s->fd, iov, iovcnt, 0, size); if (len < size) { len = -socket_error(); } return len; }
1threat
hello guys i need help in this fragment..i need to move to another activity instead of when i click button i get a toast...here is my code..thanks you : public class HomeFragment extends Fragment implements View.OnClickListener { Button btn,btn2; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_home, container, false); btn = (Button) view.findViewById(R.id.btn); btn2 = (Button) view.findViewById(R.id.btn2); btn.setOnClickListener(this); btn2.setOnClickListener(this); return view; } @Override public void onClick(View v) { switch (v.getId()){ case R.id.btn: Toast.makeText(this.getActivity(),"Button 1!", Toast.LENGTH_LONG).show(); break; case R.id.btn2: Toast.makeText(this.getActivity(),"Button 2 !", Toast.LENGTH_LONG).show(); break; } } }
0debug
static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu, int smt_threads) { int i, ret = 0; uint32_t servers_prop[smt_threads]; uint32_t gservers_prop[smt_threads * 2]; int index = ppc_get_vcpu_dt_id(cpu); if (cpu->cpu_version) { ret = fdt_setprop(fdt, offset, "cpu-version", &cpu->cpu_version, sizeof(cpu->cpu_version)); if (ret < 0) { return ret; } } for (i = 0; i < smt_threads; i++) { servers_prop[i] = cpu_to_be32(index + i); gservers_prop[i*2] = cpu_to_be32(index + i); gservers_prop[i*2 + 1] = 0; } ret = fdt_setprop(fdt, offset, "ibm,ppc-interrupt-server#s", servers_prop, sizeof(servers_prop)); if (ret < 0) { return ret; } ret = fdt_setprop(fdt, offset, "ibm,ppc-interrupt-gserver#s", gservers_prop, sizeof(gservers_prop)); return ret; }
1threat
How can I find current month name and current month number in swift : <p>I want to know current month number as int and name as string in swift.Can anybody help me with simple codes?</p>
0debug
Convert structs in C++ to class in Java : <p>I have a code written in C++ which use struct and i want that code to be converted in java.</p> <pre><code>void main(){ struct phone{ char name[100]; char num[10]; }; phone book[100]; for(int i = 0; i&lt;100; i++){ cin&gt;&gt;book[i].name; cin&gt;&gt;book[i].num; } } </code></pre> <p>Please help me to convert this code to java</p>
0debug
Image processing- how to check which Star is closer and which Star is farther in a space image : <p>Let's say we pick an image of space. Let's assume there is big star at 40 light years away and a smaller star 20 light years away. But when we look at the image both would look same size. How can we identify which is bigger and which is smaller by size and how far is it from us.</p> <p>I want to do image processing on these images.</p> <p>Keywords: Astronomy, space telescope, stars machine learning, opencv, python.</p>
0debug
Install package from lerna-managed monorepo via git URL : <p>I am using yarn for my project. My project has a dependency which happened to be a subpackage of larger monorepo maintained by lerna. The subpackage was updated but not published yet and I need that unpublished code. Is there any way to install lerna's subpackage via git url?</p> <p>Thanks.</p>
0debug
Submenu size in navigation bar HTML CSS : I am trying to create a website, but i'm having a strange problem wiht my submenu in nav bar as you can see in this picture: [submenu problem][1] [1]: https://i.stack.imgur.com/LkMki.png What i want is that my submenus elements have the same size, so i mean the same height. This is my html part: <header> <div class="menu_bar"> <a href="#" class="bt-menu"><span class="icon-menu"></span>Menu</a> </div> <div class="logo"> <img src="logo.png"> </div> <div class="box"> <form> <input type="text" name="" placeholder="Type..."> <input type="submit" name="" value="Search"> </form> </div> <nav> <ul> <li><a href="#"><span class="icon-home"></span>Acceuil</a></li> <li><a href="#"><span class="icon-briefcase"></span>Cities</a></li> <li class="tete"> <a href="#"><span class="icon-rocket"></span>Activites<span class="flash icon-circle-down"</a> <ul class="sousmenu"> <li><a href="#">Venice</a></li> <li><a href="#">Rome</a></li> <li><a href="#">Pisa</a></li> </ul> </li> <li><a href="#"><span class="icon-earth"></span>Services</a></li> <li><a href="#"><span class="icon-envelop"></span>Contacter</a></li> </ul> </nav> </header> And this is CSS part for the submenu: header nav ul li:hover .sousmenu { display:block;} header nav ul li .sousmenu { display: none; background:rgba(255, 0, 0, 0.2); margin-left: 0px; margin-top: 0px; position: absolute; width: 150%; z-index:1000;} header nav ul li .sousmenu li { display:block; overflow: hidden; border-bottom: 1px solid rgba(255,255,255,.5); } header nav ul li .sousmenu li a { display: block;} Can anyone help me plz? It's really urgent! Thanks!
0debug
Remove line breaks in csv using java : <p>I need to check for line breaks in csv for every entry using java. I have no idea how to do it. Can anybody help? thanks!</p>
0debug